changeset 85114:5039706521c9

Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-875
author Miles Bader <miles@gnu.org>
date Tue, 09 Oct 2007 08:52:57 +0000
parents 82b4a12fd080 (current diff) 65ad63ddd4f6 (diff)
children 60728f83db60
files ChangeLog configure configure.in doc/emacs/ChangeLog doc/emacs/building.texi doc/emacs/display.texi doc/emacs/emacs.texi doc/emacs/rmail.texi doc/lispref/ChangeLog doc/lispref/commands.texi doc/lispref/display.texi doc/lispref/frames.texi doc/lispref/processes.texi doc/lispref/windows.texi doc/misc/ChangeLog doc/misc/flymake.texi doc/misc/gnus.texi doc/misc/info.texi etc/ChangeLog etc/NEWS.22 etc/PROBLEMS lib-src/ChangeLog lib-src/emacsclient.c lib-src/makefile.w32-in lisp/ChangeLog lisp/allout.el lisp/cus-start.el lisp/diff-mode.el lisp/dired.el lisp/ediff-init.el lisp/emacs-lisp/easy-mmode.el lisp/emacs-lisp/lisp-mode.el lisp/files.el lisp/follow.el lisp/frame.el lisp/gnus/ChangeLog lisp/log-view.el lisp/menu-bar.el lisp/outline.el lisp/pcvs.el lisp/progmodes/compile.el lisp/progmodes/cperl-mode.el lisp/progmodes/gdb-ui.el lisp/progmodes/gud.el lisp/progmodes/python.el lisp/term/x-win.el lisp/textmodes/css-mode.el lisp/textmodes/flyspell.el lisp/vc-bzr.el lisp/vc-git.el lisp/vc-hooks.el lisp/vc-svn.el lisp/vc.el lisp/wid-edit.el lisp/window.el nt/ChangeLog src/ChangeLog src/ChangeLog.10 src/buffer.c src/eval.c src/fns.c src/frame.c src/frame.h src/keyboard.c src/keyboard.h src/macterm.c src/makefile.w32-in src/msdos.c src/s/hpux.h src/termhooks.h src/w32.c src/w32fns.c src/w32term.c src/xdisp.c src/xfaces.c src/xterm.c
diffstat 91 files changed, 2398 insertions(+), 784 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Oct 09 08:44:02 2007 +0000
+++ b/ChangeLog	Tue Oct 09 08:52:57 2007 +0000
@@ -3,6 +3,10 @@
 	* config.bat: Fix configuring `doc' due to changes in the
 	directory structure.
 
+2007-09-16  Peter O'Gorman <bug-gnu-emacs@mlists.thewrittenword.com> (tiny change)
+
+	* configure.in: Don't use -lpthread on HP-UX.
+
 2007-09-16  Glenn Morris  <rgm@gnu.org>
 
 	* make-dist: File gfdl.1 has been removed.
--- a/admin/nt/README-ftp-server	Tue Oct 09 08:44:02 2007 +0000
+++ b/admin/nt/README-ftp-server	Tue Oct 09 08:52:57 2007 +0000
@@ -60,9 +60,12 @@
     file, plus temacs.exe and dump.bat, which are required if you want to
     redump emacs without recompiling it.
 
-  + libxpm-src.zip
-    Source code for libXpm-X11R7.2-3.5.6 modified to compile on Windows.
-    This corresponds to the libXpm.dll in emacs-22.2-bin-i386.zip
+  + libxpm-3.5.7-w32-src.zip
+    Source code required to compile libXpm-3.5.7 on Windows. Contains
+    a basic Makefile for compiling with mingw32 and a .def file for
+    generating a DLL with the appropriate exports in addition to the
+    source code to provide the subset of functionality Emacs uses from
+    libXpm. This corresponds to the libXpm.dll in emacs-22.2-bin-i386.zip
     and emacs-22.2-barebin-i386.zip.
 
 
@@ -93,7 +96,7 @@
       the black and white versions of the toolbar icons.
 
       XPM: a Windows port of the XPM library corresponding to the x.org
-      release of X11R7.2 is included with the binary distribution, but
+      release of X11R7.3 is included with the binary distribution, but
       can be replaced by other versions with the name xpm4.dll,
       libxpm-nox4.dll or libxpm.dll.
 
--- a/configure	Tue Oct 09 08:44:02 2007 +0000
+++ b/configure	Tue Oct 09 08:52:57 2007 +0000
@@ -412,10 +412,10 @@
 fi
 
 test \$exitcode = 0") || {
-  echo Please tell bug-autoconf@gnu.org about your system,
-  echo including any error possibly output before this message.
-  echo This can help us improve future autoconf versions.
-  echo Configuration will now proceed without shell functions.
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
 }
 
 
@@ -12036,7 +12036,10 @@
 
     fi
     if test "$HAVE_GTK_AND_PTHREAD" = yes; then
-      GTK_LIBS="$GTK_LIBS -lpthread"
+      case "${canonical}" in
+        *-hpux*) ;;
+        *) GTK_LIBS="$GTK_LIBS -lpthread" ;;
+      esac
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_GTK_AND_PTHREAD 1
--- a/configure.in	Tue Oct 09 08:44:02 2007 +0000
+++ b/configure.in	Tue Oct 09 08:52:57 2007 +0000
@@ -2253,7 +2253,10 @@
       AC_CHECK_LIB(pthread, pthread_self, HAVE_GTK_AND_PTHREAD=yes)
     fi
     if test "$HAVE_GTK_AND_PTHREAD" = yes; then
-      GTK_LIBS="$GTK_LIBS -lpthread"
+      case "${canonical}" in
+        *-hpux*) ;;
+        *) GTK_LIBS="$GTK_LIBS -lpthread" ;;
+      esac
       AC_DEFINE(HAVE_GTK_AND_PTHREAD, 1,
                [Define to 1 if you have GTK and pthread (-lpthread).])
     fi
--- a/doc/emacs/ChangeLog	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/emacs/ChangeLog	Tue Oct 09 08:52:57 2007 +0000
@@ -1,3 +1,12 @@
+2007-10-04  Nick Roberts  <nickrob@snap.net.nz>
+
+	* building.texi (GDB Graphical Interface): Remove references to gdba
+	and mention gud-gdb.
+
+2007-08-31  Eli Zaretskii  <eliz@gnu.org>
+
+	* rmail.texi (Rmail Sorting): Improve indexing.
+
 2007-10-06  Juri Linkov  <juri@jurta.org>
 
 	* text.texi (Fill Commands): Document fill-paragraph-or-region.
@@ -56,6 +65,13 @@
 
 	* emacs.texi (EMACSVER): Increase to 23.0.50.
 
+2007-08-27  Richard Stallman  <rms@gnu.org>
+
+	* emacs.texi (Top): Clarify menu item for Glossary.
+
+	* display.texi (Faces): Change secn title.
+	Clarify not all fonts come from Font Lock.
+
 2007-08-17  Eli Zaretskii  <eliz@gnu.org>
 
 	* basic.texi (Position Info): Add index entry for face at point.
--- a/doc/emacs/building.texi	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/emacs/building.texi	Tue Oct 09 08:52:57 2007 +0000
@@ -824,17 +824,14 @@
 operation you must not change these values during the GDB session.
 
 @vindex gud-gdb-command-name
-@findex gdba
-  You can also run GDB in text command mode, like other debuggers.  To
-do this, replace the GDB @code{"--annotate=3"} option with
-@code{"--fullname"} either in the minibuffer for the current Emacs
-session, or the custom variable @code{gud-gdb-command-name} for all
-future sessions.  You need to use text command mode to debug multiple
-programs within one Emacs session.  If you have customized
-@code{gud-gdb-command-name} in this way, you can use @kbd{M-x gdba} to
-invoke GDB in graphical mode.  Moreover, this command succeeds where
-@kbd{M-x gdb} fails, such as when your @file{.gdbinit} file contains
-executable GDB commands.
+  You can also run GDB in text command mode, like the other debuggers
+in Emacs.  To do this, replace the GDB @code{"--annotate=3"} option
+with @code{"--fullname"} either in the minibuffer for the current
+Emacs session, or the custom variable @code{gud-gdb-command-name} for
+all future sessions.  You need to use text command mode to debug
+multiple programs within one Emacs session.  You can also use
+@kbd{M-x gud-gdb} to invoke GDB in text command mode if you have
+problems before execution has started.
 
 @menu
 * GDB-UI Layout::               Control the number of displayed buffers.
--- a/doc/emacs/display.texi	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/emacs/display.texi	Tue Oct 09 08:52:57 2007 +0000
@@ -282,7 +282,7 @@
   To turn off Follow mode, type @kbd{M-x follow-mode} a second time.
 
 @node Faces
-@section Using Multiple Typefaces
+@section Faces: Controlling Text Display Style
 @cindex faces
 
   You can specify various styles for displaying text using
@@ -298,11 +298,11 @@
 support colors.  Text-only terminals generally do not support changing
 the height and width or the font family.
 
-  Emacs uses faces automatically for highlighting, through the work of
-Font Lock mode.  @xref{Font Lock}, for more information about Font
-Lock mode and syntactic highlighting.  You can print out the buffer
-with the highlighting that appears on your screen using the command
-@code{ps-print-buffer-with-faces}.  @xref{PostScript}.
+  Most major modes assign faces to the text automatically through the
+work of Font Lock mode.  @xref{Font Lock}, for more information about
+Font Lock mode and syntactic highlighting.  You can print the current
+buffer with the highlighting that appears on your screen using the
+command @code{ps-print-buffer-with-faces}.  @xref{PostScript}.
 
   You control the appearance of a part of the text in the buffer by
 specifying the face or faces to use for it.  The style of display used
--- a/doc/emacs/emacs.texi	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/emacs/emacs.texi	Tue Oct 09 08:52:57 2007 +0000
@@ -139,7 +139,7 @@
 			  it also explains that there is no warranty.
 * GNU Free Documentation License:: The license for this documentation.
 * Intro::	        An introduction to Emacs concepts.
-* Glossary::	        The glossary.
+* Glossary::	        Terms used in this manual.
 * Antinews::	        Information about Emacs version 21.
 * Mac OS::              Using Emacs in the Mac.
 * Microsoft Windows::   Using Emacs on Microsoft Windows and MS-DOS.
--- a/doc/emacs/rmail.texi	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/emacs/rmail.texi	Tue Oct 09 08:52:57 2007 +0000
@@ -955,27 +955,36 @@
 
 @node Rmail Sorting
 @section Sorting the Rmail File
+@cindex sorting Rmail file
+@cindex Rmail file sorting
 
 @table @kbd
+@findex rmail-sort-by-date
 @item M-x rmail-sort-by-date
 Sort messages of current Rmail file by date.
 
+@findex rmail-sort-by-subject
 @item M-x rmail-sort-by-subject
 Sort messages of current Rmail file by subject.
 
+@findex rmail-sort-by-author
 @item M-x rmail-sort-by-author
 Sort messages of current Rmail file by author's name.
 
+@findex rmail-sort-by-recipient
 @item M-x rmail-sort-by-recipient
 Sort messages of current Rmail file by recipient's names.
 
+@findex rmail-sort-by-correspondent
 @item M-x rmail-sort-by-correspondent
 Sort messages of current Rmail file by the name of the other
 correspondent.
 
+@findex rmail-sort-by-lines
 @item M-x rmail-sort-by-lines
 Sort messages of current Rmail file by size (number of lines).
 
+@findex rmail-sort-by-keywords
 @item M-x rmail-sort-by-keywords @key{RET} @var{labels} @key{RET}
 Sort messages of current Rmail file by labels.  The argument
 @var{labels} should be a comma-separated list of labels.  The order of
--- a/doc/lispref/ChangeLog	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/lispref/ChangeLog	Tue Oct 09 08:52:57 2007 +0000
@@ -6,6 +6,22 @@
 
 	* display.texi (Auto Faces): Fix typo.
 
+2007-10-02  Richard Stallman  <rms@gnu.org>
+
+	* display.texi (Display Property): Explain some display specs
+	don't let you move point in.
+
+	* frames.texi (Cursor Parameters): Describe
+	cursor-in-non-selected-windows here.  Explain more values.
+
+	* windows.texi (Basic Windows): Don't describe
+	cursor-in-non-selected-windows here.
+
+2007-10-01  Eli Zaretskii  <eliz@gnu.org>
+
+	* processes.texi (Misc Network): Note that these functions are
+	supported only on some systems.
+
 2007-10-01  Richard Stallman  <rms@gnu.org>
 
 	* display.texi (Overlay Properties): Explain nil as priority.
@@ -16,6 +32,12 @@
 
 	* macros.texi (Backquote): Minor clarification.
 
+2007-09-19  Richard Stallman  <rms@gnu.org>
+
+	* display.texi (Display Property): Explain multiple display specs.
+	Clarify when they work in parallel and when one overrides.
+	Fix error in example.
+
 2007-09-06  Glenn Morris  <rgm@gnu.org>
 
 	* Move from lispref/ to doc/lispref/.  Change all setfilename
@@ -27,6 +49,12 @@
 	* makefile.w32-in (infodir, texinputdir): Go up one more level.
 	(usermanualdir): Change from ../man to ../emacs.
 
+2007-08-30  Martin Rudalics  <rudalics@gmx.at>
+
+	* commands.texi (Command Loop Info): Advise against changing
+	most variables described here.  Explain new variable
+	last-repeatable-command.
+
 2007-08-29  Glenn Morris  <rgm@gnu.org>
 
 	* elisp.texi (EMACSVER): Increase to 23.0.50.
@@ -46,6 +74,11 @@
 	"Image Formats".
 	(Image Formats): New node.
 
+2007-08-27  Richard Stallman  <rms@gnu.org>
+
+	* windows.texi (Window Configurations): Clarify what
+	a window configuration saves.
+
 2007-08-25  Richard Stallman  <rms@gnu.org>
 
 	* display.texi (Images): Delete redundant @findex.
--- a/doc/lispref/commands.texi	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/lispref/commands.texi	Tue Oct 09 08:52:57 2007 +0000
@@ -716,7 +716,9 @@
 @section Information from the Command Loop
 
 The editor command loop sets several Lisp variables to keep status
-records for itself and for commands that are run.
+records for itself and for commands that are run.  With the exception of
+@code{this-command} and @code{last-command} it's generally a bad idea to
+change any of these variables in a Lisp program.
 
 @defvar last-command
 This variable records the name of the previous command executed by the
@@ -736,6 +738,12 @@
 but never altered by Lisp programs.
 @end defvar
 
+@defvar last-repeatable-command
+This variable stores the most recently executed command that was not
+part of an input event.  This is the command @code{repeat} will try to
+repeat, @xref{Repeating,,, emacs, The GNU Emacs Manual}.
+@end defvar
+
 @defvar this-command
 @cindex current command
 This variable records the name of the command now being executed by
--- a/doc/lispref/display.texi	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/lispref/display.texi	Tue Oct 09 08:52:57 2007 +0000
@@ -3245,15 +3245,21 @@
 insert images into text, and also control other aspects of how text
 displays.  The value of the @code{display} property should be a
 display specification, or a list or vector containing several display
-specifications.
-
-  Some kinds of @code{display} properties specify something to display
-instead of the text that has the property.  In this case, ``the text''
-means all the consecutive characters that have the same Lisp object as
-their @code{display} property; these characters are replaced as a
-single unit.  By contrast, characters that have similar but distinct
-Lisp objects as their @code{display} properties are handled
-separately.  Here's a function that illustrates this point:
+specifications.  Display specifications generally apply in parallel to
+the text they cover.
+
+  Some kinds of @code{display} specifications specify something to
+display instead of the text that has the property.  If a list of
+display specifications includes more than one of this kind, the first
+is effective and the rest are ignored.  You cannot interactively move
+point into the middle of the text that is thus replaced.
+
+  For these specifications, ``the text that has the property'' means
+all the consecutive characters that have the same Lisp object as their
+@code{display} property; these characters are replaced as a single
+unit.  By contrast, characters that have similar but distinct Lisp
+objects as their @code{display} properties are handled separately.
+Here's a function that illustrates this point:
 
 @smallexample
 (defun foo ()
@@ -3281,7 +3287,7 @@
   (goto-char (point-min))
   (dotimes (i 5)
     (let ((string (concat "A")))
-      (put-text-property (point) (2+ (point)) 'display string)
+      (put-text-property (point) (+ 2 (point)) 'display string)
       (put-text-property (point) (1+ (point)) 'display string)
       (forward-char 2))))
 @end smallexample
--- a/doc/lispref/frames.texi	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/lispref/frames.texi	Tue Oct 09 08:52:57 2007 +0000
@@ -663,8 +663,17 @@
 
 There are various defaults for how to blink each type of cursor, if
 the type is not mentioned as an @var{on-state} here.  Changes in this
-variable do not take effect immediately, because the variable is
-examined only when you specify the @code{cursor-type} parameter.
+variable do not take effect immediately, only when you specify the
+@code{cursor-type} frame parameter.
+@end defvar
+
+@defvar cursor-in-non-selected-windows
+This variable controls how the cursor looks in a window that is not
+selected.  It supports the same values as the @code{cursor-type} frame
+parameter; also, @code{nil} means don't display a cursor in
+nonselected windows, and @code{t} (the default) means use a standard
+modificatoin of the usual cursor type (solid box becomes hollow box,
+and bar becomes a narrower bar).
 @end defvar
 
 @node Color Parameters
--- a/doc/lispref/processes.texi	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/lispref/processes.texi	Tue Oct 09 08:52:57 2007 +0000
@@ -2062,7 +2062,8 @@
 @section Misc Network Facilities
 
   These additional functions are useful for creating and operating
-on network connections.
+on network connections.  Note that they are supported only on some
+systems.
 
 @defun network-interface-list
 This function returns a list describing the network interfaces
--- a/doc/lispref/windows.texi	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/lispref/windows.texi	Tue Oct 09 08:52:57 2007 +0000
@@ -55,15 +55,11 @@
   In each frame, at any time, one and only one window is designated as
 @dfn{selected within the frame}.  The frame's cursor appears in that
 window, but the other windows have ``non-selected'' cursors, normally
-less visible.  At any time, one frame is the selected frame; and the
-window selected within that frame is @dfn{the selected window}.  The
-selected window's buffer is usually the current buffer (except when
-@code{set-buffer} has been used).  @xref{Current Buffer}.
-
-@defvar cursor-in-non-selected-windows
-If this variable is @code{nil}, Emacs displays only one cursor,
-in the selected window.  Other windows have no cursor at all.
-@end defvar
+less visible.  (@pxref{Cursor Parameters}, for customization of this.)
+At any time, one frame is the selected frame; and the window selected
+within that frame is @dfn{the selected window}.  The selected window's
+buffer is usually the current buffer (except when @code{set-buffer}
+has been used).  @xref{Current Buffer}.
 
   For practical purposes, a window exists only while it is displayed in
 a frame.  Once removed from the frame, the window is effectively deleted
@@ -2246,13 +2242,13 @@
 @cindex saving window information
 
   A @dfn{window configuration} records the entire layout of one
-frame---all windows, their sizes, which buffers they contain, what
-part of each buffer is displayed, and the values of point and the
-mark; also their fringes, margins, and scroll bar settings.  It also
+frame---all windows, their sizes, which buffers they contain, how
+those buffers are scrolled, and their values of point and the mark;
+also their fringes, margins, and scroll bar settings.  It also
 includes the values of @code{window-min-height},
-@code{window-min-width} and @code{minibuffer-scroll-window}.  An
-exception is made for point in the selected window for the current
-buffer; its value is not saved in the window configuration.
+@code{window-min-width} and @code{minibuffer-scroll-window}.  As a
+special exception, the window configuration does not record the value
+of point in the selected window for the current buffer.
 
   You can bring back an entire previous layout by restoring a window
 configuration previously saved.  If you want to record all frames
--- a/doc/misc/ChangeLog	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/misc/ChangeLog	Tue Oct 09 08:52:57 2007 +0000
@@ -2,6 +2,10 @@
 
 	* tramp.texi (External packages): New section.
 
+2007-09-29  Juri Linkov  <juri@jurta.org>
+
+	* info.texi (Help-Int): Document `L' (`Info-history').
+
 2007-09-26  Carsten Dominik  <dominik@science.uva.nl>
 
 	* org.texi: Change links to webpage and maintained email.
@@ -16,6 +20,13 @@
 	* mh-e.texi (HTML): Mention binding of S-mouse-2 to
 	browse-url-at-mouse.
 
+2007-09-20  Eduard Wiebe  <usenet@pusto.de>  (tiny change)
+
+	* flymake.texi (Customizable variables): Face names don't end in -face.
+	Fix flymake-err-line-patterns template.
+	(Example -- Configuring a tool called directly): Fix init-function.
+	(Highlighting erroneous lines): Face names don't end in -face.
+
 2007-09-18  Exal de Jesus Garcia Carrillo  <exal@gmx.de>  (tiny change)
 
 	* erc.texi (Special-Features): Fix small typo.
--- a/doc/misc/flymake.texi	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/misc/flymake.texi	Tue Oct 09 08:52:57 2007 +0000
@@ -313,7 +313,7 @@
 
 @item flymake-err-line-patterns
 Patterns for error/warning messages in the form @code{(regexp file-idx
-line-idx err-text-idx)}. @xref{Parsing the output}.
+line-idx col-idx err-text-idx)}. @xref{Parsing the output}.
 
 @item flymake-compilation-prevents-syntax-check
 A flag indicating whether compilation and syntax check of the same
@@ -333,11 +333,11 @@
 A boolean flag indicating whether to start syntax check after a
 newline character is added to the buffer.
 
-@item flymake-errline-face
+@item flymake-errline
 A custom face for highlighting lines for which at least one error has
 been reported.
 
-@item flymake-warnline-face
+@item flymake-warnline
 A custom face for highlighting lines for which at least one warning
 and no errors have been reported.
 
@@ -410,9 +410,9 @@
 First, we write the @code{init-function}:
 
 @lisp
-(defun flymake-perl-init (buffer)
+(defun flymake-perl-init ()
   (let* ((temp-file (flymake-init-create-temp-buffer-copy
-                     buffer 'flymake-create-temp-inplace))
+                     'flymake-create-temp-inplace))
          (local-file  (concat (flymake-build-relative-filename
                                (file-name-directory
                                 (buffer-file-name
@@ -713,8 +713,8 @@
 
 Highlighting is implemented with overlays and happens in the process
 sentinel, after calling the cleanup function. Two customizable faces
-are used: @code{flymake-errline-face} and
-@code{flymake-warnline-face}.  Errors belonging outside the current
+are used: @code{flymake-errline} and
+@code{flymake-warnline}.  Errors belonging outside the current
 buffer are considered to belong to line 1 of the current buffer.
 
 @node Interaction with other modes
--- a/doc/misc/gnus.texi	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/misc/gnus.texi	Tue Oct 09 08:52:57 2007 +0000
@@ -2153,7 +2153,7 @@
 @code{gnus-large-newsgroup}, but is only used for ephemeral
 newsgroups.
 
-@vindex gnus-maximum-newsgroup
+@vindex gnus-newsgroup-maximum-articles
 In groups in some news servers, there might be a big gap between a few
 very old articles that will never be expired and the recent ones.  In
 such a case, the server will return the data like @code{(1 . 30000000)}
@@ -2162,14 +2162,14 @@
 know it at first and prepares for getting 30000000 articles.  However,
 it will consume hundreds megabytes of memories and might make Emacs get
 stuck as the case may be.  If you use such news servers, set the
-variable @code{gnus-maximum-newsgroup} to a positive number.  The value
-means that Gnus ignores articles other than this number of the latest
-ones in every group.  For instance, the value 10000 makes Gnus get only
-the articles 29990001-30000000 (if the latest article number is 30000000
-in a group).  Note that setting this variable to a number might prevent
-you from reading very old articles.  The default value of the variable
-@code{gnus-maximum-newsgroup} is @code{nil}, which means Gnus never
-ignores old articles.
+variable @code{gnus-newsgroup-maximum-articles} to a positive number.
+The value means that Gnus ignores articles other than this number of the
+latest ones in every group.  For instance, the value 10000 makes Gnus
+get only the articles 29990001-30000000 (if the latest article number is
+30000000 in a group).  Note that setting this variable to a number might
+prevent you from reading very old articles.  The default value of the
+variable @code{gnus-newsgroup-maximum-articles} is @code{nil}, which
+means Gnus never ignores old articles.
 
 @vindex gnus-select-group-hook
 @vindex gnus-auto-select-first
@@ -10676,10 +10676,9 @@
 your news admin until she includes the @code{Xref} header in the
 overview files.
 
-@vindex gnus-nov-is-evil
 If you want Gnus to get the @code{Xref}s right all the time, you have to
-set @code{gnus-nov-is-evil} to @code{t}, which slows things down
-considerably.
+set @code{nntp-nov-is-evil} to @code{t}, which slows things down
+considerably.  Also @pxref{Slow/Expensive Connection}.
 
 C'est la vie.
 
@@ -22768,7 +22767,7 @@
 @c @anchor{X-Face}
 
 Viewing an @code{X-Face} header either requires an Emacs that has
-@samp{compface} support (which most XEmacs versions has), or that you
+@samp{compface} support (which most XEmacs versions have), or that you
 have suitable conversion or display programs installed.  If your Emacs
 has image support the default action is to display the face before the
 @code{From} header.  If there's no native @code{X-Face} support, Gnus
@@ -27398,8 +27397,8 @@
 implementing something, I write the manual entry for that something
 straight away.  I then see that it's difficult to explain the
 functionality, so I write how it's supposed to be, and then I change the
-implementation.  Writing the documentation and writing the code goes
-hand in hand.
+implementation.  Writing the documentation and writing the code go hand
+in hand.
 
 This, of course, means that this manual has no, or little, flow.  It
 documents absolutely everything in Gnus, but often not where you're
@@ -27407,7 +27406,7 @@
 started with Gnus.
 
 That would be a totally different book, that should be written using the
-reference manual as source material.  It would look quite differently.
+reference manual as source material.  It would look quite different.
 
 
 @page
@@ -27519,11 +27518,32 @@
 
 @item @acronym{NOV}
 @cindex @acronym{NOV}
+@acronym{NOV} stands for News OverView, which is a type of news server
+header which provide datas containing the condensed header information
+of articles.  They are produced by the server itself; in the @code{nntp}
+back end Gnus uses the ones that the @acronym{NNTP} server makes, but
+Gnus makes them by itself for some backends (in particular, @code{nnml}).
+
 When Gnus enters a group, it asks the back end for the headers of all
 unread articles in the group.  Most servers support the News OverView
 format, which is more compact and much faster to read and parse than the
 normal @sc{head} format.
 
+The @acronym{NOV} data consist of one or more text lines (@pxref{Text
+Lines, ,Motion by Text Lines, elisp, The Emacs Lisp Reference Manual})
+where each line has the header information of one article.  The header
+information is a tab-separated series of the header's contents including
+an article number, a subject, an author, a date, a message-id,
+references, etc.
+
+Those data enable Gnus to generate summary lines quickly.  However, if
+the server does not support @acronym{NOV} or you disable it purposely or
+for some reason, Gnus will try to generate the header information by
+parsing each article's headers one by one.  It will take time.
+Therefore, it is not usually a good idea to set nn*-nov-is-evil
+(@pxref{Slow/Expensive Connection}) to a non-@code{nil} value unless you
+know that the server makes wrong @acronym{NOV} data.
+
 @item level
 @cindex levels
 Each group is subscribed at some @dfn{level} or other (1-9).  The ones
@@ -27656,11 +27676,11 @@
 
 
 @node Slow/Expensive Connection
-@subsection Slow/Expensive NNTP Connection
+@subsection Slow/Expensive Connection
 
 If you run Emacs on a machine locally, and get your news from a machine
 over some very thin strings, you want to cut down on the amount of data
-Gnus has to get from the @acronym{NNTP} server.
+Gnus has to get from the server.
 
 @table @code
 
@@ -27672,9 +27692,25 @@
 doesn't suddenly decide to fetch the active file anyway.
 
 @item gnus-nov-is-evil
-This one has to be @code{nil}.  If not, grabbing article headers from
-the @acronym{NNTP} server will not be very fast.  Not all @acronym{NNTP} servers
-support @sc{xover}; Gnus will detect this by itself.
+@vindex gnus-nov-is-evil
+Usually this one must @emph{always} be @code{nil} (which is the
+default).  If, for example, you wish to not use @acronym{NOV}
+(@pxref{Terminology}) with the @code{nntp} back end (@pxref{Crosspost
+Handling}), set @code{nntp-nov-is-evil} to a non-@code{nil} value
+instead of setting this.  But you normally do not need to set
+@code{nntp-nov-is-evil} since Gnus by itself will detect whether the
+@acronym{NNTP} server supports @acronym{NOV}.  Anyway, grabbing article
+headers from the @acronym{NNTP} server will not be very fast if you tell
+Gnus not to use @acronym{NOV}.
+
+As the variables for the other back ends, there are
+@code{nndiary-nov-is-evil}, @code{nndir-nov-is-evil},
+@code{nnfolder-nov-is-evil}, @code{nnimap-nov-is-evil},
+@code{nnml-nov-is-evil}, @code{nnspool-nov-is-evil}, and
+@code{nnwarchive-nov-is-evil}.  Note that a non-@code{nil} value for
+@code{gnus-nov-is-evil} overrides all those variables.@footnote{Although
+the back ends @code{nnkiboze}, @code{nnslashdot}, @code{nnultimate}, and
+@code{nnwfm} don't have their own nn*-nov-is-evil.}
 @end table
 
 
@@ -27765,7 +27801,7 @@
 
 Set @code{gnus-show-threads}, @code{gnus-use-cross-reference} and
 @code{gnus-nov-is-evil} to @code{nil} to make entering and exiting the
-summary buffer faster.
+summary buffer faster.  Also @pxref{Slow/Expensive Connection}.
 
 
 @page
--- a/doc/misc/info.texi	Tue Oct 09 08:44:02 2007 +0000
+++ b/doc/misc/info.texi	Tue Oct 09 08:52:57 2007 +0000
@@ -869,6 +869,13 @@
 to revisit nodes in the history list in the forward direction, so that
 @kbd{r} will return you to the node you came from by typing @kbd{l}.
 
+@kindex L @r{(Info mode)}
+@findex Info-history
+@cindex history list of visited nodes
+  The @kbd{L} command (@code{Info-history} in Emacs) creates a virtual
+node that contains a list of all nodes you visited.  You can select
+a previously visited node from this menu to revisit it.
+
 @kindex d @r{(Info mode)}
 @findex Info-directory
 @cindex go to Directory node
--- a/etc/ChangeLog	Tue Oct 09 08:44:02 2007 +0000
+++ b/etc/ChangeLog	Tue Oct 09 08:52:57 2007 +0000
@@ -125,6 +125,10 @@
 
 	* e/README: New file, with most information formerly in Makefile.
 
+2007-09-05  Jason Rumney  <jasonr@gnu.org>
+
+	* NEWS.22: Mention focus-follows-mouse change.
+
 2007-08-22  Karl Berry  <karl@gnu.org>
 
 	* refcard.tex: Updates for printing.
@@ -174,7 +178,7 @@
 
 2007-07-25  Glenn Morris  <rgm@gnu.org>
 
-	*  Relicense all FSF files to GPLv3 or later.
+	* Relicense all FSF files to GPLv3 or later.
 
 	* COPYING: Switch to GPLv3.
 
--- a/etc/NEWS.22	Tue Oct 09 08:44:02 2007 +0000
+++ b/etc/NEWS.22	Tue Oct 09 08:52:57 2007 +0000
@@ -59,6 +59,17 @@
 special steps to use them. Emacs now has the appropriate resources linked
 in to make it use the scrollbars from the system theme.
 
+** focus-follows-mouse defaults to nil on MS Windows
+Previously this variable was incorrectly documented as having no effect
+on MS Windows, and the default was inappropriate for the majority of
+Windows installations. Users of software which modifies the behaviour of
+Windows to cause focus to follow the mouse will now need to explicitly set
+this variable.
+
+** The command gdba has been removed as gdb works now for those cases where it
+was needed.  In text command mode, if you have problems before execution has
+started, use M-x gud-gdb.
+
 * New Modes and Packages in Emacs 22.2
 
 ** bibtex-style-mode helps you write BibTeX's *.bst files.
@@ -73,7 +84,12 @@
 
 *** VC backends can provide completion of revision names.
 
-*** VC has some support for Mercurial (hg).
+*** VC backends can provide extra menu entries to be added to the "Version Control" menu.
+This can be used to add menu entries for backend specific functions.
+
+*** VC has some support for Mercurial (Hg).
+
+*** VC has some support for Monotone (Mtn).
 
 *** VC has some support for Bazaar (Bzr).
 
@@ -81,6 +97,9 @@
 
 * Lisp Changes in Emacs 22.2.
 
+** The command `repeat' will no more attempt to repeat a command bound
+to an input event.
+
 ** The function invisible-p returns non-nil if the character
    after a specified position is invisible.
 
@@ -1649,7 +1668,7 @@
 capabilities.
 
 The Org mode table editor can be integrated into any major mode by
-activating the minor orgtbl-mode.
+activating the minor mode, Orgtbl mode.
 
 The documentation for org-mode is in a separate manual; within Emacs,
 type "C-h i m org RET" to read that manual.  A reference card is
--- a/etc/PROBLEMS	Tue Oct 09 08:44:02 2007 +0000
+++ b/etc/PROBLEMS	Tue Oct 09 08:52:57 2007 +0000
@@ -536,6 +536,12 @@
 
 ** Miscellaneous problems
 
+*** Emacs uses 100% of CPU time
+
+This is a known problem with some versions of the Semantic package.
+The solution is to upgrade Semantic to version 2.0pre4 (distributed
+with CEDET 1.0pre4) or later.
+
 *** Self-documentation messages are garbled.
 
 This means that the file `etc/DOC-...' doesn't properly correspond
--- a/etc/THE-GNU-PROJECT	Tue Oct 09 08:44:02 2007 +0000
+++ b/etc/THE-GNU-PROJECT	Tue Oct 09 08:52:57 2007 +0000
@@ -306,7 +306,7 @@
    care whether these users had freedom, only that they should be
    numerous.
 
-   This lead to a paradoxical situation where two different ways of
+   This led to a paradoxical situation where two different ways of
    counting the amount of freedom gave different answers to the question,
    "Is this program free?" If you judged based on the freedom provided by
    the distribution terms of the MIT release, you would say that X was
--- a/lib-src/ChangeLog	Tue Oct 09 08:44:02 2007 +0000
+++ b/lib-src/ChangeLog	Tue Oct 09 08:52:57 2007 +0000
@@ -1,3 +1,9 @@
+2007-09-27  Jason Rumney  <jasonr@gnu.org>
+
+	* makefile.w32-in (emacsclient, emacsclientw): Link to COMCTL32.
+
+	* emacsclient.c (w32_window_app): Init common controls when windowed.
+
 2007-09-21  Glenn Morris  <rgm@gnu.org>
 
 	* emacstool.c: Remove file.
--- a/lib-src/emacsclient.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/lib-src/emacsclient.c	Tue Oct 09 08:52:57 2007 +0000
@@ -35,6 +35,7 @@
 # include <malloc.h>
 # include <stdlib.h>
 # include <windows.h>
+# include <commctrl.h>
 
 # define NO_SOCKETS_IN_FILE_SYSTEM
 
@@ -300,9 +301,13 @@
   char szTitle[MAX_PATH];
 
   if (window_app < 0)
-    /* Checking for STDOUT does not work; it's a valid handle also in
-       nonconsole apps.  Testing for the console title seems to work. */
-    window_app = (GetConsoleTitleA (szTitle, MAX_PATH) == 0);
+    {
+      /* Checking for STDOUT does not work; it's a valid handle also in
+         nonconsole apps.  Testing for the console title seems to work. */
+      window_app = (GetConsoleTitleA (szTitle, MAX_PATH) == 0);
+      if (window_app)
+        InitCommonControls();
+    }
 
   return window_app;
 }
--- a/lib-src/makefile.w32-in	Tue Oct 09 08:44:02 2007 +0000
+++ b/lib-src/makefile.w32-in	Tue Oct 09 08:52:57 2007 +0000
@@ -82,11 +82,11 @@
 
 $(BLD)/emacsclient.exe:		$(ECLIENTOBJS)
 # put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib
-		$(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) $(USER32) $(LIBS)
+		$(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) $(USER32) $(COMCTL32) $(LIBS)
 
 $(BLD)/emacsclientw.exe:	$(ECLIENTOBJS) $(TRES)
 # put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib
-		$(LINK) $(LINK_OUT)$@ $(TRES) -mwindows $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) $(USER32) $(LIBS)
+		$(LINK) $(LINK_OUT)$@ $(TRES) -mwindows $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) $(USER32) $(COMCTL32) $(LIBS)
 
 # emacsclient.$(O) depends on makefile.w32-in because makefile.w32-in
 # can be edited to define VERSION string, which is part of ECLIENT_CFLAGS.
--- a/lisp/ChangeLog	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/ChangeLog	Tue Oct 09 08:52:57 2007 +0000
@@ -1,3 +1,282 @@
+2007-10-08  Martin Rudalics  <rudalics@gmx.at>
+
+	* window.el (mouse-autoselect-window-cancel): Don't cancel for
+	select-window or select-frame events.
+	(handle-select-window): When autoselecting window set input
+	focus.  Restructure.
+
+	* frame.el (focus-follows-mouse): Moved to frame.c.
+	* cus-start.el (all): Add focus-follows-mouse.
+
+2007-10-08  Juanma Barranquero  <lekktu@gmail.com>
+
+	* bs.el (bs-mode): Make sure global-font-lock-mode doesn't
+	activate font-locking in the *buffer-selection* buffer.
+	(bs-show-sorted): Doc fix.
+
+	* bs.el (bs--get-marked-string, bs--get-modified-string)
+	(bs--get-readonly-string, bs--get-size-string, bs--get-name)
+	(bs--get-mode-name, bs-mode): Fix typos in docstrings.
+	(bs--format-aux): Doc fix.
+
+2007-10-08  Micha,Ak(Bl Cadilhac  <michael@cadilhac.name>
+
+	* progmodes/gud.el (gud-gud-gdb-command-name): Fix typo in docstring.
+
+2007-10-08  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gud.el (gud-gud-gdb-command-name): New option.
+	(gud-gdb): New function for old M-x gdb (text command mode).
+	(gud-gdb-command-name, gdb): Move to...
+
+	* progmodes/gdb-ui.el: ...here and adapt doc string.
+	(gud-gdba-command-name, gdba): Delete.
+
+2007-10-08  Juanma Barranquero  <lekktu@gmail.com>
+
+	* bs.el: Don't defvar `font-lock-verbose'.
+	(bs-config-clear, bs-kill, bs-string-show-normally, bs-sort-functions)
+	(bs--get-file-name): Fix typos in docstrings.
+	(bs--show-header): Use `dolist' instead of `mapcar'.
+	(bs-mode): Set `show-trailing-whitespace' to nil.
+	(bs-buffer-sort-function, bs-mouse-select-other-frame)
+	(bs-visits-non-file, bs-sort-buffer-interns-are-last, bs-show):
+	Doc fixes.
+
+2007-10-08  Adam Hupp  <adam@hupp.org>  (tiny change)
+
+	* progmodes/gdb-ui.el (pdb): Specify file for gud-break.
+
+2007-10-08  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gud.el (gdb): Make graphical mode the default and
+	switch to text command mode if appropriate, i.e., reverse previous
+	arrangement.
+	(gud-gdb-marker-filter): Adapt for above change.
+
+	* progmodes/gdb-ui.el (gdb-init-1): Don't set the values
+	gud-minor-mode and gud-marker-filter.
+	(gdb-fullname-regexp): New variable.
+	(gud-gdba-marker-filter): Use it to switch to text command
+	mode if appropriate.
+
+2007-10-08  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gud.el (gud-display-line): Find source buffer even when
+	GUD buffer has its own frame.
+
+2007-10-08  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* term/x-win.el (icon-map-list): Set to nil for 22.1 compatibility.
+
+2007-10-08  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* term/x-win.el (x-gtk-stock-map): Version is 22.2.
+
+2007-10-08  Martin Rudalics  <rudalics@gmx.at>
+
+	* allout.el (allout-before-change-handler): Replace got-char by
+	goto-char.
+
+2007-10-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc-svn.el (vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
+	Used to try and automatically enabled smerge-mode in the presence of
+	conflicts and to call `svn resolved' when the conflicts are gone.
+	(vc-svn-parse-status): Remember the svn-specific status.
+
+2007-10-08  Eli Zaretskii  <eliz@gnu.org>
+
+	* menu-bar.el (menu-bar-search-documentation-menu): Rename from
+	menu-bar-apropos-menu.  All users changed.
+	(menu-bar-help-menu): Change menu symbols to better match the text
+	displayed by the menu.
+
+2007-10-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* files.el (file-name-sans-versions): Use [:alnum:] and also allow
+	#, @, : and ^.
+
+2007-10-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* pcvs-defs.el (cvs-mode-map): Bind TAB and backtab.
+
+	* log-view.el (log-view-mode-map): Likewise.
+
+	* diff-mode.el (diff-mode-shared-map): Likewise.
+
+2007-10-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* files.el (file-name-sans-versions): Also allow `A-Z'.
+
+	* vc.el: Mention all supported VC backends.
+
+2007-10-08  Richard Stallman  <rms@gnu.org>
+
+	* wid-edit.el (widget-specify-button): Don't merge mouse-face with
+	neighbouring buttons.
+
+2007-10-08  Andreas Schwab  <schwab@suse.de>
+
+	* files.el (file-name-sans-versions): Also allow `_'.
+
+2007-10-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* files.el (file-name-sans-versions): Allow - and a-z in version names.
+
+	* log-view.el (log-view-mode-map, log-view-mode-menu):
+	Bind log-view-annotate-version.
+	(log-view-beginning-of-defun, log-view-end-of-defun)
+	(log-view-annotate-version): New functions.
+	(log-view-mode): Use log-view-beginning-of-defun and
+	log-view-end-of-defun.
+
+2007-10-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/easy-mmode.el (define-minor-mode): Fix staging.
+
+2007-10-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* wid-edit.el (widget-image-insert): Don't merge mouse-face with
+	neighbouring buttons.
+
+	* progmodes/compile.el (compilation-error-regexp-alist-alist):
+	Recognize gcc's use of "note" for informational messages.
+
+2007-10-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* textmodes/css-mode.el (css-electric-keys): electrick->electric.
+	(css-mode): Update correspondingly.
+
+2007-10-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* vc-git.el (vc-git-log-view-mode): Add font-lock patterns for
+	Signed-off-by, Acked-by and Merge.
+
+2007-10-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* ediff-init.el (ediff-verbose-p): This var is not a constant.
+
+2007-10-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc-mtn.el: New file.
+
+	* vc-hooks.el (vc-handled-backends): Add Mtn.
+
+2007-10-08  Eli Zaretskii  <eliz@gnu.org>
+
+	* files.el (find-file, find-file-other-window)
+	(find-file-other-frame, find-file-existing, find-file-read-only)
+	(find-file-read-only-other-window)
+	(find-file-read-only-other-frame)
+	(find-alternate-file-other-window, find-alternate-file): Doc fixes.
+
+2007-10-08  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gud.el (gdb-ready): New variable.
+	(gdb): Set it to nil.  Set gud-running to nil here...
+	(gud-common-init): ...instead of here.
+
+	* progmodes/gdb-ui.el (gdba, gdb-send, gdb-source-info):
+	Use gdb-ready.  Discard input until GDB is ready to accept it.
+
+2007-10-08  Martin Rudalics  <rudalics@gmx.at>
+
+	* dired.el (dired-warning): Inherit from font-lock-warning-face to
+	make it show up with eight colors.
+
+2007-10-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* diff-mode.el (diff-sanity-check-hunk): Fix up the case when unified
+	diffs are concatenated with no intervening line.
+
+2007-10-08  Dave Love  <fx@gnu.org>
+
+	* progmodes/python.el: Merge changes from Dave Love's v2007-Sep-10.
+	(python-font-lock-keywords): Update to the 2.5 version of the language.
+	(python-quote-syntax): Let-bind font-lock-syntactic-keywords to nil.
+	(python-backspace): Only behave funny in code.
+	(python-compilation-regexp-alist): Add PDB stack trace regexp.
+	(inferior-python-mode): Add PDB prompt regexp.
+	(python-fill-paragraph): Refine the fenced-string regexp.
+	(python-find-imports): Handle imports spanning several lines.
+	(python-mode): Add `class' to hideshow support.
+
+2007-10-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* pcvs.el (cvs-mode-add-change-log-entry-other-window): Use
+	add-log-buffer-file-name-function rather than bind buffer-file-name,
+	so we dont end up calling change-log-mode in *cvs* when `fi' is the
+	ChangeLog file itself.
+
+	* outline.el (outline-flag-region): Use front-advance.
+
+2007-10-08  Ilya Zakharevich  <ilyaz@cpan.org>
+
+	* progmodes/cperl-mode.el: Merge upstream 5.23.
+	(cperl-where-am-i): Remove function.
+	(cperl-backward-to-noncomment): Don't go too far when skipping POD/HEREs
+	(cperl-sniff-for-indent): De-invert [string] and [comment].
+	When looking for label, skip s:m:y:tr.
+	(cperl-indent-line): Likewise.
+	(cperl-mode): Don't assume `font-lock-multiline' is auto-local.
+	(cperl-windowed-init): Wrong `ps-print' handling.
+	Both thanks to Chong Yidong.
+	(cperl-look-at-leading-count): Could fail with unfinished RExen.
+	(cperl-find-pods-heres): If the second part of s()[] is missing,
+	don't try to highlight delimiters...
+
+2007-10-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/compile.el (compilation-get-file-structure): Complete last
+	change by also using spec-directory in the puthash.
+
+2007-10-08  Riccardo Murri  <riccardo.murri@gmail.com>
+
+	* vc-bzr.el (vc-bzr-file-name-relative): Use 'when' instead of 'and'.
+	(vc-bzr-status): Fix shadowing of variable 'status'.
+	(vc-bzr-workfile-version): Use correct path to 'last-revision' file.
+	Use `expand-file-name' instead of `concat'.
+	(vc-bzr-annotate-command): Use option name '--long' instead of '-l'.
+	Update annotation line regexp.  Fixes launchpad.net [Bug 137435].
+
+2007-10-08  Jason Rumney  <jasonr@gnu.org>
+
+	* frame.el (focus-follows-mouse): Doc-fix. Change default on w32.
+
+2007-10-08  Richard Stallman  <rms@gnu.org>
+
+	* emacs-lisp/lisp-mode.el (lisp-indent-offset): Make defcustom.
+	Add `safe-local-variable' property.
+	(lisp-body-indent): Likewise.
+
+2007-10-08  Richard Stallman  <rms@gnu.org>
+
+	* files.el (hack-local-variables-confirm): Rename arg VARS to ALL-VARS.
+	Add doc string.
+
+2007-10-08  Martin Rudalics  <rudalics@gmx.at>
+
+	* files.el (backup-buffer-copy): Try to overwrite old backup first.
+
+2007-10-08  Martin Rudalics  <rudalics@gmx.at>
+
+	* repeat.el (repeat): Use last-repeatable-command instead of
+	real-last-command.  Run pre- and post-command hooks for
+	self-insertion.  Update doc-string.
+
+2007-10-08  Alexandre Julliard  <julliard@winehq.org>
+
+	* vc-git.el (vc-git-state): Call git-add --refresh to update the
+	state of the file.
+	(vc-git-workfile-unchanged-p): Delegate implementation to vc-git-state.
+	(vc-git-create-repo): Fix invalid command.
+
+2007-10-08  Richard Stallman  <rms@gnu.org>
+
+	* textmodes/flyspell.el (flyspell-mode):
+	Catch errors in flyspell-mode-on.
+
 2007-10-09  Juanma Barranquero  <lekktu@gmail.com>
 
 	* term/x-win.el (x-alternatives-map): Remove spurious parenthesis.
--- a/lisp/allout.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/allout.el	Tue Oct 09 08:52:57 2007 +0000
@@ -2191,7 +2191,7 @@
   (when (and (featurep 'xemacs) (allout-mode-p))
     ;; process all of the pending overlays:
     (save-excursion
-      (got-char beg)
+      (goto-char beg)
       (let ((overlay (allout-get-invisibility-overlay)))
 	(allout-overlay-interior-modification-handler
 	 overlay nil beg end nil)))))
--- a/lisp/bs.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/bs.el	Tue Oct 09 08:52:57 2007 +0000
@@ -131,8 +131,6 @@
 
 ;;; Code:
 
-(defvar font-lock-verbose)
-
 ;; ----------------------------------------------------------------------
 ;; Globals for customization
 ;; ----------------------------------------------------------------------
@@ -244,7 +242,8 @@
 
 (defvar bs-buffer-sort-function nil
   "Sort function to sort the buffers that appear in Buffer Selection Menu.
-The function gets two arguments - the buffers to compare.")
+The function gets two arguments - the buffers to compare.
+It must return non-nil if the first buffer should sort before the second.")
 
 (defcustom bs-maximal-buffer-name-column 45
   "*Maximum column width for buffer names.
@@ -337,7 +336,7 @@
   :type 'string)
 
 (defcustom bs-string-show-normally  " "
-  "*String added in column 1 indicating a unmarked buffer."
+  "*String added in column 1 indicating an unmarked buffer."
   :group 'bs-appearance
   :type 'string)
 
@@ -393,9 +392,9 @@
     ("by nothing"  nil                  nil      nil))
   "*List of all possible sorting aspects for Buffer Selection Menu.
 You can add a new entry with a call to `bs-define-sort-function'.
-Each element is a list of four elements (NAME FUNCTION REGEXP-FOR-SORTING FACE)
+Each element is a list of four elements (NAME FUNCTION REGEXP-FOR-SORTING FACE).
 NAME specifies the sort order defined by function FUNCTION.
-FUNCTION nil means don't sort the buffer list.  Otherwise the functions
+FUNCTION nil means don't sort the buffer list.  Otherwise the function
 must have two parameters - the buffers to compare.
 REGEXP-FOR-SORTING is a regular expression which describes the
 column title to highlight.
@@ -620,7 +619,7 @@
 \\<bs-mode-map>
 Aside from two header lines each line describes one buffer.
 Move to a line representing the buffer you want to edit and select
-buffer by \\[bs-select] or SPC. Abort buffer list with \\[bs-kill].
+buffer by \\[bs-select] or SPC.  Abort buffer list with \\[bs-kill].
 There are many key commands similar to `Buffer-menu-mode' for
 manipulating the buffer list and buffers.
 For faster navigation each digit key is a digit argument.
@@ -653,11 +652,14 @@
   (use-local-map bs-mode-map)
   (make-local-variable 'font-lock-defaults)
   (make-local-variable 'font-lock-verbose)
+  (make-local-variable 'font-lock-global-modes)
   (buffer-disable-undo)
   (setq major-mode 'bs-mode
 	mode-name "Buffer-Selection-Menu"
 	buffer-read-only t
 	truncate-lines t
+	show-trailing-whitespace nil
+	font-lock-global-modes '(not bs-mode)
 	font-lock-defaults '(bs-mode-font-lock-keywords t)
 	font-lock-verbose nil)
   (run-mode-hooks 'bs-mode-hook))
@@ -669,7 +671,7 @@
     (setq bs--window-config-coming-from nil)))
 
 (defun bs-kill ()
-  "Let buffer disappear and reset window-configuration."
+  "Let buffer disappear and reset window configuration."
   (interactive)
   (bury-buffer (current-buffer))
   (bs--restore-window-config))
@@ -778,7 +780,7 @@
 (defun bs-mouse-select-other-frame (event)
   "Select selected line's buffer in new created frame.
 Leave Buffer Selection Menu.
-EVENT: a mouse click EVENT."
+EVENT: a mouse click event."
   (interactive "e")
   (mouse-set-point event)
   (bs-select-other-frame))
@@ -929,7 +931,7 @@
       (bs-up 1))))
 
 (defun bs-show-sorted ()
-  "Show buffer list sorted by buffer name."
+  "Show buffer list sorted by next sort aspect."
   (interactive)
   (setq bs--current-sort-function
 	(bs-next-config-aux (car bs--current-sort-function)
@@ -1020,13 +1022,13 @@
     (forward-line 1)))
 
 (defun bs-visits-non-file (buffer)
-  "Return t or nil whether BUFFER visits no file.
+  "Return whether BUFFER visits no file.
 A value of t means BUFFER belongs to no file.
 A value of nil means BUFFER belongs to a file."
   (not (buffer-file-name buffer)))
 
 (defun bs-sort-buffer-interns-are-last (b1 b2)
-  "Function for sorting internal buffers B1 and B2 at the end of all buffers."
+  "Function for sorting internal buffers at the end of all buffers."
   (string-match "^\\*" (buffer-name b2)))
 
 ;; ----------------------------------------------------------------------
@@ -1034,7 +1036,7 @@
 ;; ----------------------------------------------------------------------
 
 (defun bs-config-clear ()
-  "*Reset all variables which specify a configuration.
+  "Reset all variables which specify a configuration.
 These variables are `bs-dont-show-regexp', `bs-must-show-regexp',
 `bs-dont-show-function', `bs-must-show-function' and
 `bs-buffer-sort-function'."
@@ -1274,7 +1276,7 @@
 (defun bs--get-marked-string (start-buffer all-buffers)
   "Return a string which describes whether current buffer is marked.
 START-BUFFER is the buffer where we started buffer selection.
-ALL-BUFFERS is the list of buffer appearing in Buffer Selection Menu.
+ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu.
 The result string is one of `bs-string-current', `bs-string-current-marked',
 `bs-string-marked', `bs-string-show-normally', `bs-string-show-never', or
 `bs-string-show-always'."
@@ -1299,19 +1301,19 @@
 (defun bs--get-modified-string (start-buffer all-buffers)
   "Return a string which describes whether current buffer is modified.
 START-BUFFER is the buffer where we started buffer selection.
-ALL-BUFFERS is the list of buffer appearing in Buffer Selection Menu."
+ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu."
   (if (buffer-modified-p) "*" " "))
 
 (defun bs--get-readonly-string (start-buffer all-buffers)
   "Return a string which describes whether current buffer is read only.
 START-BUFFER is the buffer where we started buffer selection.
-ALL-BUFFERS is the list of buffer appearing in Buffer Selection Menu."
+ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu."
   (if buffer-read-only "%" " "))
 
 (defun bs--get-size-string (start-buffer all-buffers)
   "Return a string which describes the size of current buffer.
 START-BUFFER is the buffer where we started buffer selection.
-ALL-BUFFERS is the list of buffer appearing in Buffer Selection Menu."
+ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu."
   (int-to-string (buffer-size)))
 
 (defun bs--get-name (start-buffer all-buffers)
@@ -1319,7 +1321,7 @@
 The name of current buffer gets additional text properties
 for mouse highlighting.
 START-BUFFER is the buffer where we started buffer selection.
-ALL-BUFFERS is the list of buffer appearing in Buffer Selection Menu."
+ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu."
   (propertize (buffer-name)
               'help-echo "mouse-2: select this buffer, mouse-3: select in other frame"
               'mouse-face 'highlight))
@@ -1327,7 +1329,7 @@
 (defun bs--get-mode-name (start-buffer all-buffers)
   "Return the name of mode of current buffer for Buffer Selection Menu.
 START-BUFFER is the buffer where we started buffer selection.
-ALL-BUFFERS is the list of buffer appearing in Buffer Selection Menu."
+ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu."
   mode-name)
 
 (defun bs--get-file-name (start-buffer all-buffers)
@@ -1336,7 +1338,7 @@
 If current mode is `dired-mode' or `shell-mode' it returns the
 default directory.
 START-BUFFER is the buffer where we started buffer selection.
-ALL-BUFFERS is the list of buffer appearing in Buffer Selection Menu."
+ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu."
   (propertize (if (member major-mode '(shell-mode dired-mode))
                   default-directory
                 (or buffer-file-name ""))
@@ -1372,7 +1374,7 @@
     string))
 
 (defun bs--format-aux (string align len)
-  "Generate a string with STRING with alignment ALIGN and length LEN.
+  "Pad STRING to length LEN with alignment ALIGN.
 ALIGN is one of the symbols `left', `middle', or `right'."
   (let* ((width (length string))
          (len (max len width)))
@@ -1383,9 +1385,8 @@
 
 (defun bs--show-header ()
   "Insert header for Buffer Selection Menu in current buffer."
-  (mapcar '(lambda (string)
-	     (insert string "\n"))
-	  (bs--create-header)))
+  (dolist (string (bs--create-header))
+    (insert string "\n")))
 
 (defun bs--get-name-length ()
   "Return value of `bs--name-entry-length'."
@@ -1471,7 +1472,7 @@
   "Make a menu of buffers so you can manipulate buffers or the buffer list.
 \\<bs-mode-map>
 There are many key commands similar to `Buffer-menu-mode' for
-manipulating buffer list and buffers itself.
+manipulating the buffer list and the buffers themselves.
 User can move with [up] or [down], select a buffer
 by \\[bs-select] or [SPC]\n
 Type \\[bs-kill] to leave Buffer Selection Menu without a selection.
--- a/lisp/cus-start.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/cus-start.el	Tue Oct 09 08:52:57 2007 +0000
@@ -170,6 +170,7 @@
 	     ;; fns.c
 	     (use-dialog-box menu boolean "21.1")
 	     (use-file-dialog menu boolean "22.1")
+	     (focus-follows-mouse frames boolean "20.3")
 	     ;; frame.c
 	     (default-frame-alist frames
 	       (repeat (cons :format "%v"
--- a/lisp/diff-mode.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/diff-mode.el	Tue Oct 09 08:52:57 2007 +0000
@@ -110,6 +110,8 @@
     ("N" . diff-file-next)
     ("p" . diff-hunk-prev)
     ("P" . diff-file-prev)
+    ("\t" . diff-hunk-next)
+    ([backtab] . diff-hunk-prev)
     ("k" . diff-hunk-kill)
     ("K" . diff-file-kill)
     ;; From compilation-minor-mode.
@@ -1269,7 +1271,16 @@
             (while
                 (case (char-after)
                   (?\s (decf before) (decf after) t)
-                  (?- (decf before) t)
+                  (?-
+                   (if (and (looking-at diff-file-header-re)
+                            (zerop before) (zerop after))
+                       ;; No need to query: this is a case where two patches
+                       ;; are concatenated and only counting the lines will
+                       ;; give the right result.  Let's just add an empty
+                       ;; line so that our code which doesn't count lines
+                       ;; will not get confused.
+                       (progn (save-excursion (insert "\n")) nil)
+                     (decf before) t))
                   (?+ (decf after) t)
                   (t
                    (cond
--- a/lisp/dired.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/dired.el	Tue Oct 09 08:52:57 2007 +0000
@@ -335,7 +335,9 @@
   "Face name used for flagged files.")
 
 (defface dired-warning
-  '((t (:inherit font-lock-comment-face)))
+  ;; Inherit from font-lock-warning-face since with min-colors 8
+  ;; font-lock-comment-face is not colored any more.
+  '((t (:inherit font-lock-warning-face)))
   "Face used to highlight a part of a buffer that needs user attention."
   :group 'dired-faces
   :version "22.1")
--- a/lisp/ediff-init.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/ediff-init.el	Tue Oct 09 08:52:57 2007 +0000
@@ -1410,7 +1410,7 @@
 ;;; Misc
 
 ;; if nil, this silences some messages
-(defconst ediff-verbose-p t)
+(defvar ediff-verbose-p t)
 
 (defcustom ediff-autostore-merges  'group-jobs-only
   "*Save the results of merge jobs automatically.
--- a/lisp/emacs-lisp/easy-mmode.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/emacs-lisp/easy-mmode.el	Tue Oct 09 08:52:57 2007 +0000
@@ -139,8 +139,8 @@
     (setq body (list* lighter keymap body) lighter nil keymap nil))
    ((keywordp keymap) (push keymap body) (setq keymap nil)))
 
-  (let* ((last-message (current-message))
-	 (mode-name (symbol-name mode))
+  (let* ((last-message (make-symbol "last-message"))
+         (mode-name (symbol-name mode))
 	 (pretty-name (easy-mmode-pretty-mode-name mode lighter))
 	 (globalp nil)
 	 (set nil)
@@ -222,28 +222,30 @@
 	 ;; Use `toggle' rather than (if ,mode 0 1) so that using
 	 ;; repeat-command still does the toggling correctly.
 	 (interactive (list (or current-prefix-arg 'toggle)))
-	 (setq ,mode
-	       (cond
-		((eq arg 'toggle) (not ,mode))
-		(arg (> (prefix-numeric-value arg) 0))
-		(t
-		 (if (null ,mode) t
-		   (message
-		    "Toggling %s off; better pass an explicit argument."
-		    ',mode)
-		   nil))))
-	 ,@body
-	 ;; The on/off hooks are here for backward compatibility only.
-	 (run-hooks ',hook (if ,mode ',hook-on ',hook-off))
-	 (if (called-interactively-p)
-	     (progn
-	       ,(if globalp `(customize-mark-as-set ',mode))
-	       ;; Avoid overwriting a message shown by the body,
-               ;; but do overwrite previous messages.
-	       (unless  ,(and (current-message)
-                              (not (equal last-message (current-message))))
-		 (message ,(format "%s %%sabled" pretty-name)
-			  (if ,mode "en" "dis")))))
+	 (let ((,last-message (current-message)))
+           (setq ,mode
+                 (cond
+                  ((eq arg 'toggle) (not ,mode))
+                  (arg (> (prefix-numeric-value arg) 0))
+                  (t
+                   (if (null ,mode) t
+                     (message
+                      "Toggling %s off; better pass an explicit argument."
+                      ',mode)
+                     nil))))
+           ,@body
+           ;; The on/off hooks are here for backward compatibility only.
+           (run-hooks ',hook (if ,mode ',hook-on ',hook-off))
+           (if (called-interactively-p)
+               (progn
+                 ,(if globalp `(customize-mark-as-set ',mode))
+                 ;; Avoid overwriting a message shown by the body,
+                 ;; but do overwrite previous messages.
+                 (unless (and (current-message)
+                              (not (equal ,last-message
+                                          (current-message))))
+                   (message ,(format "%s %%sabled" pretty-name)
+                            (if ,mode "en" "dis"))))))
 	 (force-mode-line-update)
 	 ;; Return the new setting.
 	 ,mode)
@@ -539,5 +541,5 @@
 
 (provide 'easy-mmode)
 
-;;; arch-tag: d48a5250-6961-4528-9cb0-3c9ea042a66a
+;; arch-tag: d48a5250-6961-4528-9cb0-3c9ea042a66a
 ;;; easy-mmode.el ends here
--- a/lisp/emacs-lisp/lisp-mode.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/emacs-lisp/lisp-mode.el	Tue Oct 09 08:52:57 2007 +0000
@@ -784,8 +784,13 @@
 	  (let ((comment-start nil) (comment-start-skip nil))
 	    (do-auto-fill))))))
 
-(defvar lisp-indent-offset nil
-  "If non-nil, indent second line of expressions that many more columns.")
+(defcustom lisp-indent-offset nil
+  "If non-nil, indent second line of expressions that many more columns."
+  :group 'lisp
+  :type '(choice nil integer))
+(put 'lisp-body-indent 'safe-local-variable
+     (lambda (x) (or (null x) (integerp x))))
+
 (defvar lisp-indent-function 'lisp-indent-function)
 
 (defun lisp-indent-line (&optional whole-exp)
@@ -1025,8 +1030,11 @@
 	      (method
 		(funcall method indent-point state)))))))
 
-(defvar lisp-body-indent 2
-  "Number of columns to indent the second line of a `(def...)' form.")
+(defcustom lisp-body-indent 2
+  "Number of columns to indent the second line of a `(def...)' form."
+  :group 'lisp
+  :type 'integer)
+(put 'lisp-body-indent 'safe-local-variable 'integerp)
 
 (defun lisp-indent-specform (count state indent-point normal-indent)
   (let ((containing-form-start (elt state 1))
--- a/lisp/files.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/files.el	Tue Oct 09 08:52:57 2007 +0000
@@ -1107,6 +1107,13 @@
 but the visited file name is available through the minibuffer history:
 type M-n to pull it into the minibuffer.
 
+You can visit files on remote machines by specifying something
+like /ssh:SOME_REMOTE_MACHINE:FILE for the file name.  You can
+also visit local files as a different user by specifying
+/sudo::FILE for the file name.
+See the Info node `(tramp)Filename Syntax' in the Tramp Info
+manual, for more about this.
+
 Interactively, or if WILDCARDS is non-nil in a call from Lisp,
 expand wildcards (if any) and visit multiple files.  You can
 suppress wildcard expansion by setting `find-file-wildcards' to nil.
@@ -1123,8 +1130,9 @@
 
 (defun find-file-other-window (filename &optional wildcards)
   "Edit file FILENAME, in another window.
-May create a new window, or reuse an existing one.
-See the function `display-buffer'.
+
+Like \\[find-file] (which see), but creates a new window or reuses
+an existing one.  See the function `display-buffer'.
 
 Interactively, the default if you just type RET is the current directory,
 but the visited file name is available through the minibuffer history:
@@ -1145,8 +1153,9 @@
 
 (defun find-file-other-frame (filename &optional wildcards)
   "Edit file FILENAME, in another frame.
-May create a new frame, or reuse an existing one.
-See the function `display-buffer'.
+
+Like \\[find-file] (which see), but creates a new frame or reuses
+an existing one.  See the function `display-buffer'.
 
 Interactively, the default if you just type RET is the current directory,
 but the visited file name is available through the minibuffer history:
@@ -1167,7 +1176,7 @@
 
 (defun find-file-existing (filename)
    "Edit the existing file FILENAME.
-Like \\[find-file] but only allow a file that exists, and do not allow
+Like \\[find-file], but only allow a file that exists, and do not allow
 file names with wildcards."
    (interactive (nbutlast (find-file-read-args "Find existing file: " t)))
    (if (and (not (interactive-p)) (not (file-exists-p filename)))
@@ -1177,7 +1186,7 @@
 
 (defun find-file-read-only (filename &optional wildcards)
   "Edit file FILENAME but don't allow changes.
-Like \\[find-file] but marks buffer as read-only.
+Like \\[find-file], but marks buffer as read-only.
 Use \\[toggle-read-only] to permit editing."
   (interactive
    (find-file-read-args "Find file read-only: "
@@ -1194,7 +1203,7 @@
 
 (defun find-file-read-only-other-window (filename &optional wildcards)
   "Edit file FILENAME in another window but don't allow changes.
-Like \\[find-file-other-window] but marks buffer as read-only.
+Like \\[find-file-other-window], but marks buffer as read-only.
 Use \\[toggle-read-only] to permit editing."
   (interactive
    (find-file-read-args "Find file read-only other window: "
@@ -1211,7 +1220,7 @@
 
 (defun find-file-read-only-other-frame (filename &optional wildcards)
   "Edit file FILENAME in another frame but don't allow changes.
-Like \\[find-file-other-frame] but marks buffer as read-only.
+Like \\[find-file-other-frame], but marks buffer as read-only.
 Use \\[toggle-read-only] to permit editing."
   (interactive
    (find-file-read-args "Find file read-only other frame: "
@@ -1230,6 +1239,8 @@
   "Find file FILENAME as a replacement for the file in the next window.
 This command does not select that window.
 
+See \\[find-file] for the possible forms of the FILENAME argument.
+
 Interactively, or if WILDCARDS is non-nil in a call from Lisp,
 expand wildcards (if any) and replace the file with multiple files."
   (interactive
@@ -1255,6 +1266,8 @@
 If the current buffer now contains an empty file that you just visited
 \(presumably by mistake), use this command to visit the file you really want.
 
+See \\[find-file] for the possible forms of the FILENAME argument.
+
 Interactively, or if WILDCARDS is non-nil in a call from Lisp,
 expand wildcards (if any) and replace the file with multiple files.
 
@@ -2542,7 +2555,11 @@
 
 (put 'c-set-style 'safe-local-eval-function t)
 
-(defun hack-local-variables-confirm (vars unsafe-vars risky-vars)
+(defun hack-local-variables-confirm (all-vars unsafe-vars risky-vars)
+  "Get confirmation before setting up local variable values.
+ALL-VARS is the list of all variables to be set up.
+UNSAFE-VARS is the list of those that aren't marked as safe or risky.
+RISKY-VARS is the list of those that are marked as risky."
   (if noninteractive
       nil
     (let ((name (if buffer-file-name
@@ -2573,7 +2590,7 @@
 !  -- to apply the local variables list, and permanently mark these
       values (*) as safe (in the future, they will be set automatically.)\n\n")
 	    (insert "\n\n"))
-	  (dolist (elt vars)
+	  (dolist (elt all-vars)
 	    (cond ((member elt unsafe-vars)
 		   (insert "  * "))
 		  ((member elt risky-vars)
@@ -3183,18 +3200,22 @@
 	  ;; loosen them later, whereas it's impossible to close the
 	  ;; time-window of loose permissions otherwise.
 	  (set-default-file-modes ?\700)
-	  (while (condition-case ()
-		     (progn
-		       (and (file-exists-p to-name)
-			    (delete-file to-name))
-		       (copy-file from-name to-name nil t)
-		       nil)
-		   (file-already-exists t))
-	    ;; The file was somehow created by someone else between
-	    ;; `delete-file' and `copy-file', so let's try again.
-	    ;; rms says "I think there is also a possible race
-	    ;; condition for making backup files" (emacs-devel 20070821).
-	    nil))
+	  (when (condition-case nil
+		    ;; Try to overwrite old backup first.
+		    (copy-file from-name to-name t t)
+		  (error t))
+	    (while (condition-case nil
+		       (progn
+			 (when (file-exists-p to-name)
+			   (delete-file to-name))
+			 (copy-file from-name to-name nil t)
+			 nil)
+		     (file-already-exists t))
+	      ;; The file was somehow created by someone else between
+	      ;; `delete-file' and `copy-file', so let's try again.
+	      ;; rms says "I think there is also a possible race
+	      ;; condition for making backup files" (emacs-devel 20070821).
+	      nil)))
       ;; Reset the umask.
       (set-default-file-modes umask)))
   (and modes
@@ -3223,7 +3244,7 @@
 			 (length name))
 		   (if keep-backup-version
 		       (length name)
-		     (or (string-match "\\.~[0-9.]+~\\'" name)
+		     (or (string-match "\\.~[-[:alnum:]:#@^._]+~\\'" name)
 			 (string-match "~\\'" name)
 			 (length name))))))))
 
--- a/lisp/follow.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/follow.el	Tue Oct 09 08:52:57 2007 +0000
@@ -35,7 +35,7 @@
 ;; The feeling of a "virtual window" has been accomplished by the use
 ;; of two major techniques:
 ;;
-;; * The windows always displays adjacent sections of the buffer.
+;; * The windows always display adjacent sections of the buffer.
 ;;   This means that whenever one window is moved, all the
 ;;   others will follow.  (Hence the name Follow Mode.)
 ;;
@@ -46,8 +46,8 @@
 ;;
 ;; Follow mode comes to its prime when a large screen and two
 ;; side-by-side window are used.  The user can, with the help of Follow
-;; mode, use two full-height windows as though they would have been
-;; one.  Imagine yourself editing a large function, or section of text,
+;; mode, use two full-height windows as though they are one.
+;; Imagine yourself editing a large function, or section of text,
 ;; and being able to use 144 lines instead of the normal 72... (your
 ;; mileage may vary).
 
@@ -77,7 +77,7 @@
 ;;
 ;;   As you can see, the right-hand window starts at line 73, the line
 ;;   immediately below the end of the left-hand window.  As long as
-;;   `follow-mode' is active, the two windows will follow eachother!
+;;   `follow-mode' is active, the two windows will follow each other!
 ;;
 ;; * Play around and enjoy! Scroll one window and watch the other.
 ;;   Jump to the beginning or end.  Press `Cursor down' at the last
@@ -101,10 +101,9 @@
 ;; (global-set-key [f7] 'follow-delete-other-windows-and-split)
 
 
-;; There exists two system variables that controls the appearence of
-;; lines that are wider than the window containing them.  The default
-;; is to truncate long lines whenever a window isn't as wide as the
-;; frame.
+;; There exist two system variables that control the appearence of
+;; lines wider than the window containing them.  The default is to
+;; truncate long lines whenever a window isn't as wide as the frame.
 ;;
 ;; To make sure lines are never truncated, please place the following
 ;; lines in your init file:
@@ -123,8 +122,8 @@
 
 
 ;; The correct way to cofigurate Follow mode, or any other mode for
-;; that matter, is to create one (or more) function that does
-;; whatever you would like to do.  The function is then added to
+;; that matter, is to create one or more functions that do
+;; whatever you would like to do.  These functions are then added to
 ;; a hook.
 ;;
 ;; When `Follow' mode is activated, functions stored in the hook
@@ -144,8 +143,8 @@
 
 ;; Usage:
 ;;
-;; To activate issue the command "M-x follow-mode"
-;; and press return.  To deactivate, do it again.
+;; To activate, issue the command "M-x follow-mode"
+;; and press Return.  To deactivate, do it again.
 ;;
 ;; The following is a list of commands useful when follow-mode is active.
 ;;
@@ -156,10 +155,10 @@
 ;;		Like `follow-scroll-up', but in the other direction.
 ;;
 ;;	follow-delete-other-windows-and-split	 C-c . 1
-;;		Maximise the visible area of the current buffer,
+;;		Maximize the visible area of the current buffer,
 ;;		and enter Follow Mode. 	This is a very convenient
-;;		way to start Follow Mode, hence it is recomended
-;;		that this command is added to the global keymap.
+;;		way to start Follow Mode, hence we recomend that
+;;		this command be added to the global keymap.
 ;;
 ;;	follow-recenter				 C-c . C-l
 ;;		Place the point in the center of the middle window,
@@ -170,7 +169,7 @@
 ;;		in this frame.
 ;;
 ;;	follow-switch-to-buffer-all		 C-c . C-b
-;;		Switch buffer in all windows in the active frame.
+;;		Switch buffer in all windows in the selected frame.
 ;;
 ;;	follow-switch-to-current-buffer-all
 ;;		Show the current buffer in all windows on the current
@@ -207,7 +206,7 @@
 ;;
 ;; In an ideal world, follow mode would have been implemented in the
 ;; kernel of the display routines, making sure that the windows (using
-;; follow mode) ALWAYS are aligned.  On planet earth, however, we must
+;; follow mode) ALWAYS are aligned.  On planet Earth, however, we must
 ;; accept a solution where we ALMOST ALWAYS can make sure that the
 ;; windows are aligned.
 ;;
@@ -1965,13 +1964,13 @@
   (follow-invalidate-cache)
 
   ;; Normally, if the display has been changed, it is redrawn.  All
-  ;; windows showing only the end of a buffer is unconditionally
-  ;; recentered, we can't prevent it by calling
+  ;; windows showing only the end of a buffer are unconditionally
+  ;; recentered; we can't prevent that by calling
   ;; `follow-avoid-tail-recenter'.
   ;;
-  ;; By performing a redisplay on our own, Emacs need not perform
-  ;; the above described redisplay.  (However, by performing it when
-  ;; there are input available just seems to make things worse.)
+  ;; We force a redisplay here on our own, so Emacs does need to.
+  ;; (However, redisplaying when there's input available just seems
+  ;; to make things worse, so we exclude that case.)
   (if (and follow-avoid-tail-recenter-p
 	   (not (input-pending-p)))
       (sit-for 0)))
--- a/lisp/frame.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/frame.el	Tue Oct 09 08:52:57 2007 +0000
@@ -815,17 +815,6 @@
 	(nreverse frame-initial-geometry-arguments))
   (cdr param-list))
 
-(defcustom focus-follows-mouse (not (eq window-system 'mac))
-  "*Non-nil if window system changes focus when you move the mouse.
-You should set this variable to tell Emacs how your window manager
-handles focus, since there is no way in general for Emacs to find out
-automatically.
-
-This variable does not have any effect on MS-Windows."
-  :type 'boolean
-  :group 'frames
-  :version "20.3")
-
 (defun select-frame-set-input-focus (frame)
   "Select FRAME, raise it, and set input focus, if possible."
     (select-frame frame)
--- a/lisp/gnus/ChangeLog	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/gnus/ChangeLog	Tue Oct 09 08:52:57 2007 +0000
@@ -14,6 +14,51 @@
 	(gnus-article-followup-with-original): When `transient-mark-mode' is
 	off, refrain from active-region behavior for followups.
 
+2007-10-08  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* mm-util.el (mm-charset-synonym-alist): Alias gbk to cp936.
+
+2007-10-04  Reiner Steib  <Reiner.Steib@gmx.de>
+
+        * Relicense "GPLv2 or later" files to "GPLv3 or later".
+
+2007-09-13  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-sum.el (gnus-newsgroup-maximum-articles): Move from gnus.el.
+	Suggested by Leo <sdl.web@gmail.com>.
+
+	* gnus.el: Do.
+
+2007-09-13  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus.el (gnus-newsgroup-maximum-articles): Rename from
+	gnus-maximum-newsgroup.  Suggested by Leo <sdl.web@gmail.com>.
+
+	* gnus-agent.el (gnus-agent-fetch-headers): Do.
+
+	* gnus-sum.el (gnus-articles-to-read, gnus-list-of-unread-articles)
+	(gnus-list-of-read-articles, gnus-sequence-of-unread-articles): Do.
+
+2007-09-13  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* nnmbox.el (nnmbox-request-article): Don't assume delim regexp matches
+	newline.
+	(nnmbox-request-accept-article): Don't change article in source buffer;
+	narrow to header to use message-fetch-field rather than
+	nnmail-fetch-field; use with-current-buffer instead of save-excursion.
+	(nnmbox-request-replace-article): Quote lines that'll be misidentified
+	as delimiters; make sure article ends with newline.
+	(nnmbox-delete-mail): Correct last position of article to be deleted;
+	ignore X-Gnus-Newsgroup header in article body.
+	(nnmbox-save-mail): Quote lines looking like delimiters at the right
+	positions; make sure article ends with newline.
+
+2007-09-05  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-cus.el (gnus-score-extra): New widget.
+	(gnus-score-extra-convert): New function.
+	(gnus-score-customize): Use it for Extra.
+
 2007-08-23  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* mml.el (mml-generate-mime): Make sure it uses multibyte temp buffer.
--- a/lisp/gnus/gnus-agent.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/gnus/gnus-agent.el	Tue Oct 09 08:52:57 2007 +0000
@@ -1765,12 +1765,13 @@
                                (gnus-agent-find-parameter group
                                                           'agent-predicate)))))
          (articles (if fetch-all
-		       (if gnus-maximum-newsgroup
+		       (if gnus-newsgroup-maximum-articles
 			   (let ((active (gnus-active group)))
 			     (gnus-uncompress-range
 			      (cons (max (car active)
 					 (- (cdr active)
-					    gnus-maximum-newsgroup -1))
+					    gnus-newsgroup-maximum-articles
+					    -1))
 				    (cdr active))))
 			 (gnus-uncompress-range (gnus-active group)))
                      (gnus-list-of-unread-articles group)))
--- a/lisp/gnus/gnus-cus.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/gnus/gnus-cus.el	Tue Oct 09 08:52:57 2007 +0000
@@ -766,6 +766,67 @@
 				       ,group))))
   widget)
 
+(define-widget 'gnus-score-extra 'group
+  "Edit score entries for extra headers."
+  :convert-widget 'gnus-score-extra-convert)
+
+(defun gnus-score-extra-convert (widget)
+  ;; Set args appropriately.
+  (let* ((tag (widget-get widget :tag))
+	 (item `(const :format "" :value ,(downcase tag)))
+	 (match '(string :tag "Match"))
+	 (score '(choice :tag "Score"
+			 (const :tag "default" nil)
+			 (integer :format "%v"
+				  :hide-front-space t)))
+	 (expire '(choice :tag "Expire"
+			  (const :tag "off" nil)
+			  (integer :format "%v"
+				   :hide-front-space t)))
+	 (type '(choice :tag "Type"
+			:value s
+			;; I should really create a forgiving :match
+			;; function for each type below, that only
+			;; looked at the first letter.
+			(const :tag "Regexp" r)
+			(const :tag "Regexp (fixed case)" R)
+			(const :tag "Substring" s)
+			(const :tag "Substring (fixed case)" S)
+			(const :tag "Exact" e)
+			(const :tag "Exact (fixed case)" E)
+			(const :tag "Word" w)
+			(const :tag "Word (fixed case)" W)
+			(const :tag "default" nil)))
+	 (header (if gnus-extra-headers
+		     (let (name)
+		       `(choice :tag "Header"
+				,@(mapcar (lambda (h)
+					    (setq name (symbol-name h))
+					    (list 'const :tag name name))
+					  gnus-extra-headers)
+				(string :tag "Other" :format "%v")))
+		   '(string :tag "Header")))
+	 (group `(group ,match ,score ,expire ,type ,header))
+	 (doc (concat (or (widget-get widget :doc)
+			  (concat "Change score based on the " tag
+				  " header.\n")))))
+    (widget-put
+     widget :args
+     `(,item
+       (repeat :inline t
+	       :indent 0
+	       :tag ,tag
+	       :doc ,doc
+	       :format "%t:\n%h%v%i\n\n"
+	       (choice :format "%v"
+		       :value ("" nil nil s
+			       ,(if gnus-extra-headers
+				    (symbol-name (car gnus-extra-headers))
+				  ""))
+		       ,group
+		       sexp)))))
+  widget)
+
 (defvar gnus-custom-scores)
 (defvar gnus-custom-score-alist)
 
@@ -822,7 +883,7 @@
 				     (gnus-score-string :tag "Subject")
 				     (gnus-score-string :tag "References")
 				     (gnus-score-string :tag "Xref")
-				     (gnus-score-string :tag "Extra")
+				     (gnus-score-extra :tag "Extra")
 				     (gnus-score-string :tag "Message-ID")
 				     (gnus-score-integer :tag "Lines")
 				     (gnus-score-integer :tag "Chars")
--- a/lisp/gnus/gnus-sum.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/gnus/gnus-sum.el	Tue Oct 09 08:52:57 2007 +0000
@@ -1029,6 +1029,17 @@
   :type '(repeat symbol)
   :group 'gnus-charset)
 
+(defcustom gnus-newsgroup-maximum-articles nil
+  "The maximum number of articles a newsgroup.
+If this is a number, old articles in a newsgroup exceeding this number
+are silently ignored.  If it is nil, no article is ignored.  Note that
+setting this variable to a number might prevent you from reading very
+old articles."
+  :group 'gnus-group-select
+  :version "22.2"
+  :type '(choice (const :tag "No limit" nil)
+		 integer))
+
 (gnus-define-group-parameter
  ignored-charsets
  :type list
@@ -5472,11 +5483,13 @@
 	      ;; articles in the group, or (if that's nil), the
 	      ;; articles in the cache.
 	      (or
-	       (if gnus-maximum-newsgroup
+	       (if gnus-newsgroup-maximum-articles
 		   (let ((active (gnus-active group)))
 		     (gnus-uncompress-range
 		      (cons (max (car active)
-				 (- (cdr active) gnus-maximum-newsgroup -1))
+				 (- (cdr active)
+				    gnus-newsgroup-maximum-articles
+				    -1))
 			    (cdr active))))
 		 (gnus-uncompress-range (gnus-active group)))
 	       (gnus-cache-articles-in-group group))
@@ -6540,8 +6553,9 @@
   (let* ((read (gnus-info-read (gnus-get-info group)))
 	 (active (or (gnus-active group) (gnus-activate-group group)))
 	 (last (cdr active))
-	 (bottom (if gnus-maximum-newsgroup
-		     (max (car active) (- last gnus-maximum-newsgroup -1))
+	 (bottom (if gnus-newsgroup-maximum-articles
+		     (max (car active)
+			  (- last gnus-newsgroup-maximum-articles -1))
 		   (car active)))
 	 first nlast unread)
     ;; If none are read, then all are unread.
@@ -6585,9 +6599,11 @@
 	  (gnus-list-range-difference
 	   (gnus-sorted-complement
 	    (gnus-uncompress-range
-	     (if gnus-maximum-newsgroup
+	     (if gnus-newsgroup-maximum-articles
 		 (cons (max (car active)
-			    (- (cdr active) gnus-maximum-newsgroup -1))
+			    (- (cdr active)
+			       gnus-newsgroup-maximum-articles
+			       -1))
 		       (cdr active))
 	       active))
 	    (gnus-list-of-unread-articles group))
@@ -6601,8 +6617,9 @@
   (let* ((read (gnus-info-read (gnus-get-info group)))
 	 (active (or (gnus-active group) (gnus-activate-group group)))
 	 (last (cdr active))
-	 (bottom (if gnus-maximum-newsgroup
-		     (max (car active) (- last gnus-maximum-newsgroup -1))
+	 (bottom (if gnus-newsgroup-maximum-articles
+		     (max (car active)
+			  (- last gnus-newsgroup-maximum-articles -1))
 		   (car active)))
 	 first nlast unread)
     ;; If none are read, then all are unread.
--- a/lisp/gnus/gnus.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/gnus/gnus.el	Tue Oct 09 08:52:57 2007 +0000
@@ -1501,17 +1501,6 @@
   :type '(choice (const :tag "No limit" nil)
 		 integer))
 
-(defcustom gnus-maximum-newsgroup nil
-  "The maximum number of articles a newsgroup.
-If this is a number, old articles in a newsgroup exceeding this number
-are silently ignored.  If it is nil, no article is ignored.  Note that
-setting this variable to a number might prevent you from reading very
-old articles."
-  :group 'gnus-group-select
-  :version "22.2"
-  :type '(choice (const :tag "No limit" nil)
-		 integer))
-
 (defcustom gnus-use-long-file-name (not (memq system-type '(usg-unix-v xenix)))
   "*Non-nil means that the default name of a file to save articles in is the group name.
 If it's nil, the directory form of the group name is used instead.
--- a/lisp/gnus/mm-util.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/gnus/mm-util.el	Tue Oct 09 08:52:57 2007 +0000
@@ -256,6 +256,12 @@
     ,@(when (and (not (mm-coding-system-p 'windows-31j))
 		 (mm-coding-system-p 'cp932))
 	'((windows-31j . cp932)))
+    ;; Charset name: GBK, Charset aliases: CP936, MS936, windows-936
+    ;; http://www.iana.org/assignments/charset-reg/GBK
+    ;; Emacs 22.1 has cp936, but not gbk, so we alias it:
+    ,@(when (and (not (mm-coding-system-p 'gbk))
+		 (mm-coding-system-p 'cp936))
+	'((gbk . cp936)))
     )
   "A mapping from unknown or invalid charset names to the real charset names.
 
--- a/lisp/gnus/nnmbox.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/gnus/nnmbox.el	Tue Oct 09 08:52:57 2007 +0000
@@ -153,11 +153,11 @@
 	(re-search-backward (concat "^" message-unix-mail-delimiter) nil t)
 	(setq start (point))
 	(forward-line 1)
-	(or (and (re-search-forward
-		  (concat "^" message-unix-mail-delimiter) nil t)
-		 (forward-line -1))
-	    (goto-char (point-max)))
-	(setq stop (point))
+	(setq stop (if (re-search-forward (concat "^"
+						  message-unix-mail-delimiter)
+					  nil 'move)
+		       (match-beginning 0)
+		     (point)))
 	(let ((nntp-server-buffer (or buffer nntp-server-buffer)))
 	  (set-buffer nntp-server-buffer)
 	  (erase-buffer)
@@ -313,39 +313,45 @@
   (nnmbox-possibly-change-newsgroup group server)
   (nnmail-check-syntax)
   (let ((buf (current-buffer))
-	result)
-    (goto-char (point-min))
-    ;; The From line may have been quoted by movemail.
-    (when (looking-at (concat ">" message-unix-mail-delimiter))
-      (delete-char 1))
-    (if (looking-at "X-From-Line: ")
-	(replace-match "From ")
-      (insert "From nobody " (current-time-string) "\n"))
+	result cont)
     (and
      (nnmail-activate 'nnmbox)
-     (progn
-       (set-buffer buf)
+     (with-temp-buffer
+       (insert-buffer-substring buf)
        (goto-char (point-min))
-       (search-forward "\n\n" nil t)
-       (forward-line -1)
+       (cond (;; The From line may have been quoted by movemail.
+	      (looking-at (concat ">" message-unix-mail-delimiter))
+	      (delete-char 1)
+	      (forward-line 1))
+	     ((looking-at "X-From-Line: ")
+	      (replace-match "From ")
+	      (forward-line 1))
+	     (t
+	      (insert "From nobody " (current-time-string) "\n")))
+       (narrow-to-region (point)
+			 (if (search-forward "\n\n" nil 'move)
+			     (1- (point))
+			   (point)))
        (while (re-search-backward "^X-Gnus-Newsgroup: " nil t)
 	 (delete-region (point) (progn (forward-line 1) (point))))
        (when nnmail-cache-accepted-message-ids
-	 (nnmail-cache-insert (nnmail-fetch-field "message-id") 
+	 (nnmail-cache-insert (message-fetch-field "message-id")
 			      group
-			      (nnmail-fetch-field "subject")
-			      (nnmail-fetch-field "from")))
+			      (message-fetch-field "subject")
+			      (message-fetch-field "from")))
+       (widen)
        (setq result (if (stringp group)
 			(list (cons group (nnmbox-active-number group)))
 		      (nnmail-article-group 'nnmbox-active-number)))
-       (if (and (null result)
-		(yes-or-no-p "Moved to `junk' group; delete article? "))
-	   (setq result 'junk)
-	 (setq result (car (nnmbox-save-mail result)))))
-     (save-excursion
-       (set-buffer nnmbox-mbox-buffer)
+       (prog1
+	   (if (and (null result)
+		    (yes-or-no-p "Moved to `junk' group; delete article? "))
+	       (setq result 'junk)
+	     (setq result (car (nnmbox-save-mail result))))
+	 (setq cont (buffer-string))))
+     (with-current-buffer nnmbox-mbox-buffer
        (goto-char (point-max))
-       (insert-buffer-substring buf)
+       (insert cont)
        (when last
 	 (when nnmail-cache-accepted-message-ids
 	   (nnmail-cache-close))
@@ -360,7 +366,20 @@
     (if (not (nnmbox-find-article article))
 	nil
       (nnmbox-delete-mail t t)
-      (insert-buffer-substring buffer)
+      (insert
+       (with-temp-buffer
+	 (insert-buffer-substring buffer)
+	 (goto-char (point-min))
+	 (when (looking-at "X-From-Line:")
+	   (delete-region (point) (progn (forward-line 1) (point))))
+	 (while (re-search-forward (concat "^" message-unix-mail-delimiter)
+				   nil t)
+	   (goto-char (match-beginning 0))
+	   (insert ">"))
+	 (goto-char (point-max))
+	 (unless (bolp)
+	   (insert "\n"))
+	 (buffer-string)))
       (nnmbox-save-buffer)
       t)))
 
@@ -430,21 +449,20 @@
   (save-excursion
     (save-restriction
       (narrow-to-region
-       (save-excursion
-	 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t)
-	 (if leave-delim (progn (forward-line 1) (point))
-	   (match-beginning 0)))
-       (progn
-	 (forward-line 1)
-	 (or (and (re-search-forward (concat "^" message-unix-mail-delimiter)
-				     nil t)
-		  (if (and (not (bobp)) leave-delim)
-		      (progn (forward-line -2) (point))
-		    (match-beginning 0)))
-	     (point-max))))
+       (prog2
+	   (re-search-backward (concat "^" message-unix-mail-delimiter) nil t)
+	   (if leave-delim (progn (forward-line 1) (point))
+	     (match-beginning 0))
+	 (forward-line 1))
+       (or (and (re-search-forward (concat "^" message-unix-mail-delimiter)
+				   nil t)
+		(match-beginning 0))
+	   (point-max)))
       (goto-char (point-min))
       ;; Only delete the article if no other group owns it as well.
-      (when (or force (not (re-search-forward "^X-Gnus-Newsgroup: " nil t)))
+      (when (or force
+		(not (re-search-forward "^X-Gnus-Newsgroup: " nil t))
+		(search-backward "\n\n" nil t))
 	(delete-region (point-min) (point-max))))))
 
 (defun nnmbox-possibly-change-newsgroup (newsgroup &optional server)
@@ -552,24 +570,26 @@
   (let ((delim (concat "^" message-unix-mail-delimiter)))
     (goto-char (point-min))
     ;; This might come from somewhere else.
-    (unless (looking-at delim)
-      (insert "From nobody " (current-time-string) "\n")
-      (goto-char (point-min)))
+    (if (looking-at delim)
+	(forward-line 1)
+      (insert "From nobody " (current-time-string) "\n"))
     ;; Quote all "From " lines in the article.
-    (forward-line 1)
     (while (re-search-forward delim nil t)
-      (beginning-of-line)
-      (insert "> "))
-    (nnmail-insert-lines)
-    (nnmail-insert-xref group-art)
-    (nnmbox-insert-newsgroup-line group-art)
-    (let ((alist group-art))
-      (while alist
-	(nnmbox-record-active-article (car alist))
-	(setq alist (cdr alist))))
-    (run-hooks 'nnmail-prepare-save-mail-hook)
-    (run-hooks 'nnmbox-prepare-save-mail-hook)
-    group-art))
+      (goto-char (match-beginning 0))
+      (insert ">")))
+  (goto-char (point-max))
+  (unless (bolp)
+    (insert "\n"))
+  (nnmail-insert-lines)
+  (nnmail-insert-xref group-art)
+  (nnmbox-insert-newsgroup-line group-art)
+  (let ((alist group-art))
+    (while alist
+      (nnmbox-record-active-article (car alist))
+      (setq alist (cdr alist))))
+  (run-hooks 'nnmail-prepare-save-mail-hook)
+  (run-hooks 'nnmbox-prepare-save-mail-hook)
+  group-art)
 
 (defun nnmbox-insert-newsgroup-line (group-art)
   (save-excursion
--- a/lisp/log-view.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/log-view.el	Tue Oct 09 08:52:57 2007 +0000
@@ -92,9 +92,12 @@
     ("m" . log-view-toggle-mark-entry)
     ;; ("e" . cvs-mode-edit-log)
     ("d" . log-view-diff)
+    ("a" . log-view-annotate-version)
     ("f" . log-view-find-version)
     ("n" . log-view-msg-next)
     ("p" . log-view-msg-prev)
+    ("\t" . log-view-msg-next)
+    ([backtab] . log-view-msg-prev)
     ("N" . log-view-file-next)
     ("P" . log-view-file-prev)
     ("\M-n" . log-view-file-next)
@@ -114,6 +117,7 @@
     ["Mark Log Entry for Diff"  set-mark-command]
     ["Diff Revisions"  log-view-diff]
     ["Visit Version"  log-view-find-version]
+    ["Annotate Version"  log-view-annotate-version]
     ["Next Log Entry"  log-view-msg-next]
     ["Previous Log Entry"  log-view-msg-prev]
     ["Next File"  log-view-file-next]
@@ -187,6 +191,10 @@
   "Major mode for browsing CVS log output."
   (setq buffer-read-only t)
   (set (make-local-variable 'font-lock-defaults) log-view-font-lock-defaults)
+  (set (make-local-variable 'beginning-of-defun-function) 
+       'log-view-beginning-of-defun)
+  (set (make-local-variable 'end-of-defun-function) 
+       'log-view-end-of-defun)
   (set (make-local-variable 'cvs-minor-wrap-function) 'log-view-minor-wrap))
 
 ;;;;
@@ -281,6 +289,51 @@
 	  (setq pos (overlay-end ov))))
       marked-list)))
 
+(defun log-view-beginning-of-defun ()
+  ;; This assumes that a log entry starts with a line matching
+  ;; `log-view-message-re'.  Modes that derive from `log-view-mode'
+  ;; for which this assumption is not valid will have to provide
+  ;; another implementation of this function.  `log-view-msg-prev'
+  ;; does a similar job to this function, we can't use it here
+  ;; directly because it prints messages that are not appropriate in
+  ;; this context and it does not move to the beginning of the buffer
+  ;; when the point is before the first log entry.
+
+  ;; `log-view-beginning-of-defun' and `log-view-end-of-defun' have
+  ;; been checked to work with logs produced by RCS, CVS, git,
+  ;; mercurial and subversion.
+
+  (re-search-backward log-view-message-re nil 'move))
+
+(defun log-view-end-of-defun ()
+  ;; The idea in this function is to search for the beginning of the
+  ;; next log entry using `log-view-message-re' and then go back one
+  ;; line when finding it.  Modes that derive from `log-view-mode' for
+  ;; which this assumption is not valid will have to provide another
+  ;; implementation of this function.
+
+  ;; Look back and if there is no entry there it means we are before
+  ;; the first log entry, so go forward until finding one.
+  (unless (save-excursion (re-search-backward log-view-message-re nil t))
+    (re-search-forward log-view-message-re nil t))
+
+  ;; In case we are at the end of log entry going forward a line will
+  ;; make us find the next entry when searching. If we are inside of
+  ;; an entry going forward a line will still keep the point inside
+  ;; the same entry.
+  (forward-line 1)
+
+  ;; In case we are at the beginning of an entry, move past it.
+  (when (looking-at log-view-message-re)
+    (goto-char (match-end 0))
+    (forward-line 1))
+
+  ;; Search for the start of the next log entry.  Go to the end of the
+  ;; buffer if we could not find a next entry.
+  (when (re-search-forward log-view-message-re nil 'move)
+    (goto-char (match-beginning 0))
+    (forward-line -1)))
+
 (defvar cvs-minor-current-files)
 (defvar cvs-branch-prefix)
 (defvar cvs-secondary-branch-prefix)
@@ -320,6 +373,14 @@
     (switch-to-buffer (vc-find-version (log-view-current-file)
                                        (log-view-current-tag)))))
 
+(defun log-view-annotate-version (pos)
+  "Annotate the version at point."
+  (interactive "d")
+  (save-excursion
+    (goto-char pos)
+    (switch-to-buffer (vc-annotate (log-view-current-file)
+				   (log-view-current-tag)))))
+
 ;;
 ;; diff
 ;;
--- a/lisp/menu-bar.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/menu-bar.el	Tue Oct 09 08:52:57 2007 +0000
@@ -1253,7 +1253,8 @@
   '(menu-item "Describe Buffer Modes" describe-mode
 	      :help "Describe this buffer's major and minor mode"))
 
-(defvar menu-bar-apropos-menu (make-sparse-keymap "Apropos"))
+(defvar menu-bar-search-documentation-menu
+  (make-sparse-keymap "Search Documentation"))
 (defun menu-bar-read-lispref ()
   "Display the Emacs Lisp Reference manual in Info mode."
   (interactive)
@@ -1281,37 +1282,37 @@
   (info "elisp")
   (Info-index topic))
 
-(define-key menu-bar-apropos-menu [apropos-documentation]
+(define-key menu-bar-search-documentation-menu [search-documentation-strings]
   '(menu-item "Search Documentation Strings..." apropos-documentation
               :help
 	      "Find functions and variables whose doc strings match a regexp"))
-(define-key menu-bar-apropos-menu [apropos]
+(define-key menu-bar-search-documentation-menu [find-any-object-by-name]
   '(menu-item "Find Any Object by Name..."  apropos
               :help "Find symbols of any kind whose names match a regexp"))
-(define-key menu-bar-apropos-menu [apropos-value]
+(define-key menu-bar-search-documentation-menu [find-option-by-value]
   '(menu-item "Find Options by Value..." apropos-value
               :help "Find variables whose values match a regexp"))
-(define-key menu-bar-apropos-menu [apropos-variables]
+(define-key menu-bar-search-documentation-menu [find-options-by-name]
   '(menu-item "Find Options by Name..." apropos-variable
 	      :help "Find variables whose names match a regexp"))
-(define-key menu-bar-apropos-menu [apropos-commands]
+(define-key menu-bar-search-documentation-menu [find-commands-by-name]
   '(menu-item "Find Commands by Name..." apropos-command
 	      :help "Find commands whose names match a regexp"))
-(define-key menu-bar-apropos-menu [sep1]
+(define-key menu-bar-search-documentation-menu [sep1]
   '("--"))
-(define-key menu-bar-apropos-menu [emacs-command-node]
+(define-key menu-bar-search-documentation-menu [lookup-command-in-manual]
   '(menu-item "Look Up Command in User Manual..." Info-goto-emacs-command-node
 	      :help "Display manual section that describes a command"))
-(define-key menu-bar-apropos-menu [emacs-key-command-node]
+(define-key menu-bar-search-documentation-menu [lookup-key-in-manual]
   '(menu-item "Look Up Key in User Manual..." Info-goto-emacs-key-command-node
 	      :help "Display manual section that describes a key"))
-(define-key menu-bar-apropos-menu [elisp-index-search]
+(define-key menu-bar-search-documentation-menu [lookup-subject-in-elisp-manual]
   '(menu-item "Look Up Subject in ELisp Manual..." elisp-index-search
 	      :help "Find description of a subject in Emacs Lisp manual"))
-(define-key menu-bar-apropos-menu [emacs-index-search]
+(define-key menu-bar-search-documentation-menu [lookup-subject-in-emacs-manual]
   '(menu-item "Look Up Subject in User Manual..." emacs-index-search
 	      :help "Find description of a subject in Emacs User manual"))
-(define-key menu-bar-apropos-menu [emacs-glossary]
+(define-key menu-bar-search-documentation-menu [emacs-terminology]
   '(menu-item "Emacs Terminology" search-emacs-glossary
 	      :help "Display the Glossary section of the Emacs manual"))
 
@@ -1325,16 +1326,16 @@
 (define-key menu-bar-manuals-menu [order-emacs-manuals]
   '(menu-item "Ordering Manuals" view-order-manuals
 	      :help "How to order manuals from the Free Software Foundation"))
-(define-key menu-bar-manuals-menu [info-apropos]
+(define-key menu-bar-manuals-menu [lookup-subject-in-all-manuals]
   '(menu-item "Lookup Subject in all manuals..." info-apropos
 	      :help "Find description of a subject in all installed manuals"))
-(define-key menu-bar-manuals-menu [info]
+(define-key menu-bar-manuals-menu [other-manuals]
   '(menu-item "All Other Manuals (Info)" Info-directory
 	      :help "Read any of the installed manuals"))
-(define-key menu-bar-manuals-menu [info-elisp]
+(define-key menu-bar-manuals-menu [emacs-lisp-reference]
   '(menu-item "Emacs Lisp Reference" menu-bar-read-lispref
 	      :help "Read the Emacs Lisp Reference manual"))
-(define-key menu-bar-manuals-menu [info-elintro]
+(define-key menu-bar-manuals-menu [emac-lisp-intro]
   '(menu-item "Introduction to Emacs Lisp" menu-bar-read-lispintro
 	      :help "Read the Introduction to Emacs Lisp Programming"))
 
@@ -1370,15 +1371,15 @@
 (define-key menu-bar-help-menu [finder-by-keyword]
   '(menu-item "Find Emacs Packages" finder-by-keyword
 	      :help "Find packages and features by keyword"))
-(define-key menu-bar-help-menu [manuals]
+(define-key menu-bar-help-menu [more-manuals]
   (list 'menu-item "More Manuals" menu-bar-manuals-menu))
 (define-key menu-bar-help-menu [emacs-manual]
   '(menu-item "Read the Emacs Manual" info-emacs-manual
 	      :help "Full documentation of Emacs features"))
 (define-key menu-bar-help-menu [describe]
   (list 'menu-item "Describe" menu-bar-describe-menu))
-(define-key menu-bar-help-menu [apropos]
-  (list 'menu-item "Search Documentation" menu-bar-apropos-menu))
+(define-key menu-bar-help-menu [search-documentation]
+  (list 'menu-item "Search Documentation" menu-bar-search-documentation-menu))
 (define-key menu-bar-help-menu [sep1]
   '("--"))
 (define-key menu-bar-help-menu [eliza]
@@ -1387,7 +1388,7 @@
 (define-key menu-bar-help-menu [report-emacs-bug]
   '(menu-item "Send Bug Report..." report-emacs-bug
 	      :help "Send e-mail to Emacs maintainers"))
-(define-key menu-bar-help-menu [emacs-problems]
+(define-key menu-bar-help-menu [emacs-known-problems]
   '(menu-item "Emacs Known Problems" view-emacs-problems
 	      :help "Read about known problems with Emacs"))
 (define-key menu-bar-help-menu [emacs-news]
--- a/lisp/outline.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/outline.el	Tue Oct 09 08:52:57 2007 +0000
@@ -710,7 +710,10 @@
 If FLAG is nil then text is shown, while if FLAG is t the text is hidden."
   (remove-overlays from to 'invisible 'outline)
   (when flag
-    (let ((o (make-overlay from to)))
+    ;; We use `front-advance' here because the invisible text begins at the
+    ;; very end of the heading, before the newline, so text inserted at FROM
+    ;; belongs to the heading rather than to the entry.
+    (let ((o (make-overlay from to nil 'front-advance)))
       (overlay-put o 'invisible 'outline)
       (overlay-put o 'isearch-open-invisible
 		   (or outline-isearch-open-invisible-function
--- a/lisp/pcvs-defs.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/pcvs-defs.el	Tue Oct 09 08:52:57 2007 +0000
@@ -347,6 +347,8 @@
     (" " .	cvs-mode-next-line)
     ("n" .	cvs-mode-next-line)
     ("p" .	cvs-mode-previous-line)
+    ("\t" .	cvs-mode-next-line)
+    ([backtab] . cvs-mode-previous-line)
     ;; M- keys are usually those that operate on modules
     ;;("\M-C".	cvs-mode-rcs2log) ; i.e. "Create a ChangeLog"
     ;;("\M-t".	cvs-rtag)
--- a/lisp/pcvs.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/pcvs.el	Tue Oct 09 08:52:57 2007 +0000
@@ -2213,13 +2213,21 @@
 (defun-cvs-mode cvs-mode-add-change-log-entry-other-window ()
   "Add a ChangeLog entry in the ChangeLog of the current directory."
   (interactive)
+  ;; Require `add-log' explicitly, because if it gets autoloaded when we call
+  ;; add-change-log-entry-other-window below, the
+  ;; add-log-buffer-file-name-function ends up unbound when we leave the `let'.
+  (require 'add-log)
   (dolist (fi (cvs-mode-marked nil nil))
     (let* ((default-directory (cvs-expand-dir-name (cvs-fileinfo->dir fi)))
-	   (buffer-file-name (expand-file-name (cvs-fileinfo->file fi))))
-      (if (file-directory-p buffer-file-name)
-          ;; Be careful to use a directory name, otherwise add-log starts
-          ;; looking for a ChangeLog file in the parent dir.
-          (setq buffer-file-name (file-name-as-directory buffer-file-name)))
+	   (add-log-buffer-file-name-function
+            (lambda ()
+              (let ((file (expand-file-name (cvs-fileinfo->file fi))))
+                (if (file-directory-p file)
+                    ;; Be careful to use a directory name, otherwise add-log
+                    ;; starts looking for a ChangeLog file in the
+                    ;; parent dir.
+                    (file-name-as-directory file)
+                  file)))))
       (kill-local-variable 'change-log-default-name)
       (save-excursion (add-change-log-entry-other-window)))))
 
--- a/lisp/progmodes/compile.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/progmodes/compile.el	Tue Oct 09 08:52:57 2007 +0000
@@ -240,7 +240,7 @@
 \\([0-9]+\\)\\(?:\\([.:]\\)\\([0-9]+\\)\\)?\
 \\(?:-\\([0-9]+\\)?\\(?:\\3\\([0-9]+\\)\\)?\\)?:\
 \\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\
- *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|instantiated from\\)\\|\
+ *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|instantiated from\\|[Nn]ote\\)\\|\
 \[0-9]?\\(?:[^0-9\n]\\|$\\)\\|[0-9][0-9][0-9]\\)"
      1 (2 . 5) (4 . 6) (7 . 8))
 
@@ -1932,8 +1932,7 @@
 In the former case, FILENAME may be relative or absolute.
 
 The file-structure looks like this:
-  (list (list FILENAME [DIR-FROM-PREV-MSG]) FMT LINE-STRUCT...)
-"
+  (list (list FILENAME [DIR-FROM-PREV-MSG]) FMT LINE-STRUCT...)"
   (or (gethash file compilation-locs)
       ;; File was not previously encountered, at least not in the form passed.
       ;; Let's normalize it and look again.
@@ -1977,9 +1976,7 @@
 		 ;; directories have the same name:
 		 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-08/msg00463.html
 		 (or (gethash (cons filename spec-directory) compilation-locs)
-		     ;; TODO should this, without spec-directory, be
-		     ;; done at all?
-		     (puthash (list filename)
+		     (puthash (cons filename spec-directory)
 			      (list (list filename spec-directory) fmt)
 			      compilation-locs))
 		 compilation-locs))))
--- a/lisp/progmodes/cperl-mode.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/progmodes/cperl-mode.el	Tue Oct 09 08:52:57 2007 +0000
@@ -2635,7 +2635,8 @@
 	  (t
 	   (skip-chars-forward " \t")
 	   (if (listp indent) (setq indent (car indent)))
-	   (cond ((looking-at "[A-Za-z_][A-Za-z_0-9]*:[^:]")
+	   (cond ((and (looking-at "[A-Za-z_][A-Za-z_0-9]*:[^:]")
+		       (not (looking-at "[smy]:\\|tr:")))
 		  (and (> indent 0)
 		       (setq indent (max cperl-min-label-indent
 					 (+ indent cperl-label-offset)))))
@@ -2810,9 +2811,9 @@
 			  (vector 'indentable 'first-line p))))
 		  ((get-text-property char-after-pos 'REx-part2)
 		   (vector 'REx-part2 (point)))
-		  ((nth 3 state)
+		  ((nth 4 state)
 		   [comment])
-		  ((nth 4 state)
+		  ((nth 3 state)
 		   [string])
 		  ;; XXXX Do we need to special-case this?
 		  ((null containing-sexp)
@@ -2918,7 +2919,9 @@
 			(let ((colon-line-end 0))
 			  (while
 			      (progn (skip-chars-forward " \t\n")
-				     (looking-at "#\\|[a-zA-Z0-9_$]*:[^:]\\|=[a-zA-Z]"))
+				     ;; s: foo : bar :x is NOT label
+				     (and (looking-at "#\\|\\([a-zA-Z0-9_$]+\\):[^:]\\|=[a-zA-Z]")
+					  (not (looking-at "[sym]:\\|tr:"))))
 			    ;; Skip over comments and labels following openbrace.
 			    (cond ((= (following-char) ?\#)
 				   (forward-line 1))
@@ -2989,8 +2992,7 @@
 			  (vector 'code-start-in-block containing-sexp char-after
 				  (and delim (not is-block)) ; is a HASH
 				  old-indent ; brace first thing on a line
-				  nil (point) ; nothing interesting before
-				  ))))))))))))))
+				  nil (point))))))))))))))) ; nothing interesting before
 
 (defvar cperl-indent-rules-alist
   '((pod nil)				; via `syntax-type' property
@@ -3004,9 +3006,7 @@
   "Alist of indentation rules for CPerl mode.
 The values mean:
   nil: do not indent;
-  number: add this amount of indentation.
-
-Not finished.")
+  number: add this amount of indentation.")
 
 (defun cperl-calculate-indent (&optional parse-data) ; was parse-start
   "Return appropriate indentation for current line as Perl code.
@@ -3131,8 +3131,8 @@
 	 ;;
 	 ((eq 'have-prev-sibling (elt i 0))
 	  ;; [have-prev-sibling sibling-beg colon-line-end block-start]
-	  (goto-char (elt i 1))
-	  (if (> (elt i 2) (point)) ; colon-line-end; After-label, same line
+	  (goto-char (elt i 1))		; sibling-beg
+	  (if (> (elt i 2) (point)) ; colon-line-end; have label before point
 	      (if (> (current-indentation)
 		     cperl-min-label-indent)
 		  (- (current-indentation) cperl-label-offset)
@@ -3184,170 +3184,6 @@
        (t
 	(error "Got strange value of indent: %s" i))))))
 
-(defvar cperl-indent-alist
-  '((string nil)
-    (comment nil)
-    (toplevel 0)
-    (toplevel-after-parenth 2)
-    (toplevel-continued 2)
-    (expression 1))
-  "Alist of indentation rules for CPerl mode.
-The values mean:
-  nil: do not indent;
-  number: add this amount of indentation.
-
-Not finished, not used.")
-
-(defun cperl-where-am-i (&optional parse-start start-state)
-  ;; Unfinished
-  "Return a list of lists ((TYPE POS)...) of good points before the point.
-POS may be nil if it is hard to find, say, when TYPE is `string' or `comment'.
-
-Not finished, not used."
-  (save-excursion
-    (let* ((start-point (point)) unused
-	   (s-s (cperl-get-state))
-	   (start (nth 0 s-s))
-	   (state (nth 1 s-s))
-	   (prestart (nth 3 s-s))
-	   (containing-sexp (car (cdr state)))
-	   (case-fold-search nil)
-	   (res (list (list 'parse-start start) (list 'parse-prestart prestart))))
-      (cond ((nth 3 state)		; In string
-	     (setq res (cons (list 'string nil (nth 3 state)) res))) ; What started string
-	    ((nth 4 state)		; In comment
-	     (setq res (cons '(comment) res)))
-	    ((null containing-sexp)
-	     ;; Line is at top level.
-	     ;; Indent like the previous top level line
-	     ;; unless that ends in a closeparen without semicolon,
-	     ;; in which case this line is the first argument decl.
-	     (cperl-backward-to-noncomment (or parse-start (point-min)))
-	     ;;(skip-chars-backward " \t\f\n")
-	     (cond
-	      ((or (bobp)
-		   (memq (preceding-char) (append ";}" nil)))
-	       (setq res (cons (list 'toplevel start) res)))
-	      ((eq (preceding-char) ?\) )
-	       (setq res (cons (list 'toplevel-after-parenth start) res)))
-	      (t
-	       (setq res (cons (list 'toplevel-continued start) res)))))
-	    ((/= (char-after containing-sexp) ?{)
-	     ;; line is expression, not statement:
-	     ;; indent to just after the surrounding open.
-	     ;; skip blanks if we do not close the expression.
-	     (setq res (cons (list 'expression-blanks
-				   (progn
-				     (goto-char (1+ containing-sexp))
-				     (or (looking-at "[ \t]*\\(#\\|$\\)")
-					 (skip-chars-forward " \t"))
-				     (point)))
-			     (cons (list 'expression containing-sexp) res))))
-	    ((progn
-	       ;; Containing-expr starts with \{.  Check whether it is a hash.
-	       (goto-char containing-sexp)
-	       (not (cperl-block-p)))
-	     (setq res (cons (list 'expression-blanks
-				   (progn
-				     (goto-char (1+ containing-sexp))
-				     (or (looking-at "[ \t]*\\(#\\|$\\)")
-					 (skip-chars-forward " \t"))
-				     (point)))
-			     (cons (list 'expression containing-sexp) res))))
-	    (t
-	     ;; Statement level.
-	     (setq res (cons (list 'in-block containing-sexp) res))
-	     ;; Is it a continuation or a new statement?
-	     ;; Find previous non-comment character.
-	     (cperl-backward-to-noncomment containing-sexp)
-	     ;; Back up over label lines, since they don't
-	     ;; affect whether our line is a continuation.
-	     ;; Back up comma-delimited lines too ?????
-	     (while (or (eq (preceding-char) ?\,)
-			(save-excursion (cperl-after-label)))
-	       (if (eq (preceding-char) ?\,)
-		   ;; Will go to beginning of line, essentially
-		   ;; Will ignore embedded sexpr XXXX.
-		   (cperl-backward-to-start-of-continued-exp containing-sexp))
-	       (beginning-of-line)
-	       (cperl-backward-to-noncomment containing-sexp))
-	     ;; Now we get the answer.
-	     (if (not (memq (preceding-char) (append ";}{" '(nil)))) ; Was ?\,
-		 ;; This line is continuation of preceding line's statement.
-		 (list (list 'statement-continued containing-sexp))
-	       ;; This line starts a new statement.
-	       ;; Position following last unclosed open.
-	       (goto-char containing-sexp)
-	       ;; Is line first statement after an open-brace?
-	       (or
-		;; If no, find that first statement and indent like
-		;; it.  If the first statement begins with label, do
-		;; not believe when the indentation of the label is too
-		;; small.
-		(save-excursion
-		  (forward-char 1)
-		  (let ((colon-line-end 0))
-		    (while (progn (skip-chars-forward " \t\n" start-point)
-				  (and (< (point) start-point)
-				       (looking-at
-					"#\\|[a-zA-Z_][a-zA-Z0-9_]*:[^:]")))
-		      ;; Skip over comments and labels following openbrace.
-		      (cond ((= (following-char) ?\#)
-			     ;;(forward-line 1)
-			     (end-of-line))
-			    ;; label:
-			    (t
-			     (save-excursion (end-of-line)
-					     (setq colon-line-end (point)))
-			     (search-forward ":"))))
-		    ;; Now at the point, after label, or at start
-		    ;; of first statement in the block.
-		    (and (< (point) start-point)
-			 (if (> colon-line-end (point))
-			     ;; Before statement after label
-			     (if (> (current-indentation)
-				    cperl-min-label-indent)
-				 (list (list 'label-in-block (point)))
-			       ;; Do not believe: `max' is involved
-			       (list
-				(list 'label-in-block-min-indent (point))))
-			   ;; Before statement
-			   (list 'statement-in-block (point))))))
-		;; If no previous statement,
-		;; indent it relative to line brace is on.
-		;; For open brace in column zero, don't let statement
-		;; start there too.  If cperl-indent-level is zero,
-		;; use cperl-brace-offset + cperl-continued-statement-offset instead.
-		;; For open-braces not the first thing in a line,
-		;; add in cperl-brace-imaginary-offset.
-
-		;; If first thing on a line:  ?????
-		(setq unused		; This is not finished...
-		(+ (if (and (bolp) (zerop cperl-indent-level))
-		       (+ cperl-brace-offset cperl-continued-statement-offset)
-		     cperl-indent-level)
-		   ;; Move back over whitespace before the openbrace.
-		   ;; If openbrace is not first nonwhite thing on the line,
-		   ;; add the cperl-brace-imaginary-offset.
-		   (progn (skip-chars-backward " \t")
-			  (if (bolp) 0 cperl-brace-imaginary-offset))
-		   ;; If the openbrace is preceded by a parenthesized exp,
-		   ;; move to the beginning of that;
-		   ;; possibly a different line
-		   (progn
-		     (if (eq (preceding-char) ?\))
-			 (forward-sexp -1))
-		     ;; Get initial indentation of the line we are on.
-		     ;; If line starts with label, calculate label indentation
-		     (if (save-excursion
-			   (beginning-of-line)
-			   (looking-at "[ \t]*[a-zA-Z_][a-zA-Z_0-9]*:[^:]"))
-			 (if (> (current-indentation) cperl-min-label-indent)
-			     (- (current-indentation) cperl-label-offset)
-			   (cperl-calculate-indent))
-		       (current-indentation)))))))))
-      res)))
-
 (defun cperl-calculate-indent-within-comment ()
   "Return the indentation amount for line, assuming that
 the current line is to be regarded as part of a block comment."
@@ -3742,12 +3578,10 @@
 	(set-syntax-table reset-st))))
 
 (defsubst cperl-look-at-leading-count (is-x-REx e)
-  (if (and (> (point) e)
-	   ;; return nil on failure, no moving
-	   (re-search-forward (concat "\\="
-				      (if is-x-REx "[ \t\n]*" "")
-				      "[{?+*]")
-			      (1- e) t))
+  (if (and
+       (< (point) e)
+       (re-search-forward (concat "\\=" (if is-x-REx "[ \t\n]*" "") "[{?+*]")
+			  (1- e) t))	; return nil on failure, no moving
       (if (eq ?\{ (preceding-char)) nil
 	(cperl-postpone-fontification
 	 (1- (point)) (point)
@@ -4791,8 +4625,8 @@
 		    (if (and is-REx is-x-REx)
 			(put-text-property (1+ b) (1- e)
 					   'syntax-subtype 'x-REx)))
-		  (if i2
-		      (progn
+		  (if (and i2 e1 b1 (> e1 b1))
+		      (progn		; No errors finding the second part...
 			(cperl-postpone-fontification
 			 (1- e1) e1 'face my-cperl-delimiters-face)
 			(if (and (not (eobp))
@@ -4891,14 +4725,16 @@
       (beginning-of-line)
       (if (memq (setq pr (get-text-property (point) 'syntax-type))
 		'(pod here-doc here-doc-delim))
-	  (cperl-unwind-to-safe nil)
-	(or (and (looking-at "^[ \t]*\\(#\\|$\\)")
-		 (not (memq pr '(string prestring))))
-	    (progn (cperl-to-comment-or-eol) (bolp))
-	    (progn
-	      (skip-chars-backward " \t")
-	      (if (< p (point)) (goto-char p))
-	      (setq stop t)))))))
+	  (progn
+	    (cperl-unwind-to-safe nil)
+	    (setq pr (get-text-property (point) 'syntax-type))))
+      (or (and (looking-at "^[ \t]*\\(#\\|$\\)")
+	       (not (memq pr '(string prestring))))
+	  (progn (cperl-to-comment-or-eol) (bolp))
+	  (progn
+	    (skip-chars-backward " \t")
+	    (if (< p (point)) (goto-char p))
+	    (setq stop t))))))
 
 ;; Used only in `cperl-calculate-indent'...
 (defun cperl-block-p ()		   ; Do not C-M-q !  One string contains ";" !
@@ -5723,10 +5559,11 @@
 (defun cperl-windowed-init ()
   "Initialization under windowed version."
   (cond ((featurep 'ps-print)
-	 (unless cperl-faces-init
-	   (if (boundp 'font-lock-multiline)
-	       (setq cperl-font-lock-multiline t))
-	   (cperl-init-faces)))
+	 (or cperl-faces-init
+	     (progn
+	       (and (boundp 'font-lock-multiline)
+		    (setq cperl-font-lock-multiline t))
+	       (cperl-init-faces))))
 	((not cperl-faces-init)
 	 (add-hook 'font-lock-mode-hook
 		   (function
@@ -9041,7 +8878,7 @@
 	  (cperl-fontify-syntaxically to)))))
 
 (defvar cperl-version
-  (let ((v  "Revision: 5.22"))
+  (let ((v  "Revision: 5.23"))
     (string-match ":\\s *\\([0-9.]+\\)" v)
     (substring v (match-beginning 1) (match-end 1)))
   "Version of IZ-supported CPerl package this file is based on.")
--- a/lisp/progmodes/gdb-ui.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/progmodes/gdb-ui.el	Tue Oct 09 08:52:57 2007 +0000
@@ -34,8 +34,7 @@
 ;; Emacs 21 such as the fringe/display margin for breakpoints, and the toolbar
 ;; (see the GDB Graphical Interface section in the Emacs info manual).
 
-;; By default, M-x gdb will start the debugger. However, if you have customised
-;; gud-gdb-command-name, then start it with M-x gdba.
+;; By default, M-x gdb will start the debugger.
 
 ;; This file has evolved from gdba.el that was included with GDB 5.0 and
 ;; written by Tom Lord and Jim Kingdon.  It uses GDB's annotation interface.
@@ -218,10 +217,11 @@
   "List of changed register numbers (strings).")
 
 ;;;###autoload
-(defun gdba (command-line)
+(defun gdb (command-line)
   "Run gdb on program FILE in buffer *gud-FILE*.
-The directory containing FILE becomes the initial working directory
-and source-file directory for your debugger.
+The directory containing FILE becomes the initial working
+directory and source-file directory for your debugger.
+
 
 If `gdb-many-windows' is nil (the default value) then gdb just
 pops up the GUD buffer unless `gdb-show-main' is t.  In this case
@@ -266,13 +266,61 @@
 | RET      gdb-frames-select        | SPC    gdb-toggle-breakpoint     |
 |                                   | RET    gdb-goto-breakpoint       |
 |                                   | D      gdb-delete-breakpoint     |
-+-----------------------------------+----------------------------------+"
-  ;;
-  (interactive (list (gud-query-cmdline 'gdba)))
-  ;;
-  ;; Let's start with a basic gud-gdb buffer and then modify it a bit.
-  (gdb command-line)
-  (gdb-init-1))
++-----------------------------------+----------------------------------+
+
+To run GDB in text command mode, replace the GDB \"--annotate=3\"
+option with \"--fullname\" either in the minibuffer for the
+current Emacs session, or the custom variable
+`gud-gdb-command-name' for all future sessions.  You need to use
+text command mode to debug multiple programs within one Emacs
+session."
+  (interactive (list (gud-query-cmdline 'gdb)))
+
+  (when (and gud-comint-buffer
+	   (buffer-name gud-comint-buffer)
+	   (get-buffer-process gud-comint-buffer)
+	   (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)))
+	(gdb-restore-windows)
+	(error
+	 "Multiple debugging requires restarting in text command mode"))
+
+  (gud-common-init command-line nil 'gud-gdba-marker-filter)
+  (set (make-local-variable 'gud-minor-mode) 'gdba)
+
+  (gud-def gud-break  "break %f:%l"  "\C-b" "Set breakpoint at current line.")
+  (gud-def gud-tbreak "tbreak %f:%l" "\C-t"
+	   "Set temporary breakpoint at current line.")
+  (gud-def gud-remove "clear %f:%l" "\C-d" "Remove breakpoint at current line")
+  (gud-def gud-step   "step %p"     "\C-s" "Step one source line with display.")
+  (gud-def gud-stepi  "stepi %p"    "\C-i" "Step one instruction with display.")
+  (gud-def gud-next   "next %p"     "\C-n" "Step one line (skip functions).")
+  (gud-def gud-nexti  "nexti %p" nil   "Step one instruction (skip functions).")
+  (gud-def gud-cont   "cont"     "\C-r" "Continue with display.")
+  (gud-def gud-finish "finish"   "\C-f" "Finish executing current function.")
+  (gud-def gud-jump
+	   (progn (gud-call "tbreak %f:%l") (gud-call "jump %f:%l"))
+	   "\C-j" "Set execution address to current line.")
+
+  (gud-def gud-up     "up %p"     "<" "Up N stack frames (numeric arg).")
+  (gud-def gud-down   "down %p"   ">" "Down N stack frames (numeric arg).")
+  (gud-def gud-print  "print %e"  "\C-p" "Evaluate C expression at point.")
+  (gud-def gud-pstar  "print* %e" nil
+	   "Evaluate C dereferenced pointer expression at point.")
+
+  ;; For debugging Emacs only.
+  (gud-def gud-pv "pv1 %e"      "\C-v" "Print the value of the lisp variable.")
+
+  (gud-def gud-until  "until %l" "\C-u" "Continue to current line.")
+  (gud-def gud-run    "run"	 nil    "Run the program.")
+
+  (local-set-key "\C-i" 'gud-gdb-complete-command)
+  (setq comint-prompt-regexp "^(.*gdb[+]?) *")
+  (setq paragraph-start comint-prompt-regexp)
+  (setq gdb-first-prompt t)
+  (setq gud-running nil)
+  (setq gdb-ready nil)
+  (setq gud-filter-pending-text nil)
+  (run-hooks 'gdb-mode-hook))
 
 (defcustom gdb-debug-log-max 128
   "Maximum size of `gdb-debug-log'.  If nil, size is unlimited."
@@ -465,9 +513,6 @@
       expr)))
 
 (defun gdb-init-1 ()
-  (set (make-local-variable 'gud-minor-mode) 'gdba)
-  (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter)
-  ;;
   (gud-def gud-break (if (not (string-match "Machine" mode-name))
 			 (gud-call "break %f:%l" arg)
 		       (save-excursion
@@ -599,7 +644,7 @@
   (gdb-enqueue-input (list "server list\n" 'ignore))
   (gdb-enqueue-input (list "server info source\n" 'gdb-source-info))
 
-  (run-hooks 'gdba-mode-hook))
+  (run-hooks 'gdb-mode-hook))
 
 (defun gdb-get-version ()
   (goto-char (point-min))
@@ -1124,20 +1169,21 @@
 (defun gdb-send (proc string)
   "A comint send filter for gdb.
 This filter may simply queue input for a later time."
-  (with-current-buffer gud-comint-buffer
-    (let ((inhibit-read-only t))
-      (remove-text-properties (point-min) (point-max) '(face))))
-    (if gud-running
-	(progn
-	  (let ((item (concat string "\n")))
-	    (if gdb-enable-debug (push (cons 'send item) gdb-debug-log))
-	    (process-send-string proc item)))
-      (if (string-match "\\\\\\'" string)
-	  (setq gdb-continuation (concat gdb-continuation string "\n"))
-	(let ((item (concat gdb-continuation string
-			 (if (not comint-input-sender-no-newline) "\n"))))
-	  (gdb-enqueue-input item)
-	  (setq gdb-continuation nil)))))
+  (when gdb-ready
+      (with-current-buffer gud-comint-buffer
+	(let ((inhibit-read-only t))
+	  (remove-text-properties (point-min) (point-max) '(face))))
+      (if gud-running
+	  (progn
+	    (let ((item (concat string "\n")))
+	      (if gdb-enable-debug (push (cons 'send item) gdb-debug-log))
+	      (process-send-string proc item)))
+	(if (string-match "\\\\\\'" string)
+	    (setq gdb-continuation (concat gdb-continuation string "\n"))
+	  (let ((item (concat gdb-continuation string
+			      (if (not comint-input-sender-no-newline) "\n"))))
+	    (gdb-enqueue-input item)
+	    (setq gdb-continuation nil))))))
 
 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it
 ;; is a query, or other non-top-level prompt.
@@ -1193,8 +1239,8 @@
 ;; any newlines.
 ;;
 
-(defcustom gud-gdba-command-name "gdb -annotate=3"
-  "Default command to execute an executable under the GDB-UI debugger."
+(defcustom gud-gdb-command-name "gdb --annotate=3"
+  "Default command to execute an executable under the GDB debugger."
   :type 'string
   :group 'gud
   :version "22.1")
@@ -1506,6 +1552,10 @@
       (set-window-buffer source-window buffer))
     source-window))
 
+;; Derived from gud-gdb-marker-regexp
+(defvar gdb-fullname-regexp
+  (concat "\\(.:?[^" ":" "\n]*\\)" ":" "\\([0-9]*\\)" ":" ".*"))
+
 (defun gud-gdba-marker-filter (string)
   "A gud marker filter for gdb.  Handle a burst of output from GDB."
   (if gdb-flush-pending-output
@@ -1522,34 +1572,50 @@
       ;;
       ;; Process all the complete markers in this chunk.
       (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc)
-	(let ((annotation (match-string 1 gud-marker-acc)))
-	  ;;
-	  ;; Stuff prior to the match is just ordinary output.
-	  ;; It is either concatenated to OUTPUT or directed
-	  ;; elsewhere.
-	  (setq output
-		(gdb-concat-output
-		 output
-		 (substring gud-marker-acc 0 (match-beginning 0))))
-	  ;;
-	  ;; Take that stuff off the gud-marker-acc.
-	  (setq gud-marker-acc (substring gud-marker-acc (match-end 0)))
+	(let ((annotation (match-string 1 gud-marker-acc))
+	      (before (substring gud-marker-acc 0 (match-beginning 0)))
+	      (after (substring gud-marker-acc (match-end 0))))
 	  ;;
 	  ;; Parse the tag from the annotation, and maybe its arguments.
 	  (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
 	  (let* ((annotation-type (match-string 1 annotation))
 		 (annotation-arguments (match-string 2 annotation))
 		 (annotation-rule (assoc annotation-type
-					 gdb-annotation-rules)))
+					 gdb-annotation-rules))
+		 (fullname (string-match gdb-fullname-regexp annotation-type)))
+
+	    ;; Stuff prior to the match is just ordinary output.
+	    ;; It is either concatenated to OUTPUT or directed
+	    ;; elsewhere.
+	    (setq output
+		  (gdb-concat-output output
+				     (concat before (if fullname "\n"))))
+
+	    ;; Take that stuff off the gud-marker-acc.
+	    (setq gud-marker-acc after)
+
 	    ;; Call the handler for this annotation.
 	    (if annotation-rule
 		(funcall (car (cdr annotation-rule))
 			 annotation-arguments)
-	      ;; Else the annotation is not recognized.  Ignore it silently,
-	      ;; so that GDB can add new annotations without causing
-	      ;; us to blow up.
-	      ))))
-      ;;
+
+	      ;; Switch to gud-gdb-marker-filter if appropriate.
+	      (when fullname
+
+		;; Extract the frame position from the marker.
+		(setq gud-last-frame (cons (match-string 1 annotation)
+					   (string-to-number
+					    (match-string 2 annotation))))
+
+		(set (make-local-variable 'gud-minor-mode) 'gdb)
+		(set (make-local-variable 'gud-marker-filter)
+		     'gud-gdb-marker-filter)))
+
+	    ;; Else the annotation is not recognized.  Ignore it silently,
+	    ;; so that GDB can add new annotations without causing
+	    ;; us to blow up.
+	    )))
+
       ;; Does the remaining text end in a partial line?
       ;; If it does, then keep part of the gud-marker-acc until we get more.
       (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'"
@@ -2801,7 +2867,7 @@
   (let ((answer (get-buffer-window buf 0))
 	(must-split nil))
     (if answer
-	(display-buffer buf nil 0)	;Raise the frame if necessary.
+	(display-buffer buf nil 0)	;Deiconify the frame if necessary.
       ;; The buffer is not yet displayed.
       (pop-to-buffer gud-comint-buffer)	;Select the right frame.
       (let ((window (get-lru-window)))
@@ -2996,7 +3062,8 @@
    (gdb-get-buffer-create 'gdb-breakpoints-buffer)
    (if gdb-show-main
        (let ((pop-up-windows t))
-	 (display-buffer (gud-find-file gdb-main-file))))))
+	 (display-buffer (gud-find-file gdb-main-file)))))
+ (setq gdb-ready t))
 
 (defun gdb-get-location (bptno line flag)
   "Find the directory containing the relevant source file.
--- a/lisp/progmodes/gud.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/progmodes/gud.el	Tue Oct 09 08:52:57 2007 +0000
@@ -104,6 +104,8 @@
   "Non-nil if debugged program is running.
 Used to grey out relevant toolbar icons.")
 
+(defvar gdb-ready nil)
+
 ;; Use existing Info buffer, if possible.
 (defun gud-goto-info ()
   "Go to relevant Emacs info node."
@@ -592,8 +594,9 @@
 ;; History of argument lists passed to gdb.
 (defvar gud-gdb-history nil)
 
-(defcustom gud-gdb-command-name "gdb --annotate=3"
-  "Default command to execute an executable under the GDB debugger."
+(defcustom gud-gud-gdb-command-name "gdb --fullname"
+  "Default command to run an executable under GDB in text command mode.
+The option \"--fullname\" must be included in this value."
    :type 'string
    :group 'gud)
 
@@ -638,14 +641,6 @@
     (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc)
       (let ((match (match-string 1 gud-marker-acc)))
 
-	;; Pick up stopped annotation if attaching to process.
-	(if (string-equal match "stopped") (setq gdb-active-process t))
-
-	;; Using annotations, switch to gud-gdba-marker-filter.
-	(when (string-equal match "prompt")
-	  (require 'gdb-ui)
-	  (gdb-prompt nil))
-
 	(setq
 	 ;; Append any text before the marker to the output we're going
 	 ;; to return - we don't include the marker in this text.
@@ -654,13 +649,7 @@
 
 	 ;; Set the accumulator to the remaining text.
 
-	 gud-marker-acc (substring gud-marker-acc (match-end 0)))
-
-	;; Pick up any errors that occur before first prompt annotation.
-	(if (string-equal match "error-begin")
-	    (put-text-property 0 (length gud-marker-acc)
-			       'face font-lock-warning-face
-			       gud-marker-acc))))
+	 gud-marker-acc (substring gud-marker-acc (match-end 0)))))
 
     ;; Does the remaining text look like it might end with the
     ;; beginning of another marker?  If it does, then keep it in
@@ -712,8 +701,9 @@
 (defvar gud-filter-pending-text nil
   "Non-nil means this is text that has been saved for later in `gud-filter'.")
 
+;; The old gdb command.  The new one is in gdb-ui.el.
 ;;;###autoload
-(defun gdb (command-line)
+(defun gud-gdb (command-line)
   "Run gdb on program FILE in buffer *gud-FILE*.
 The directory containing FILE becomes the initial working
 directory and source-file directory for your debugger.  By
@@ -726,7 +716,9 @@
 `gud-gdb-command-name' for all future sessions.  You need to use
 text command mode to debug multiple programs within one Emacs
 session."
-  (interactive (list (gud-query-cmdline 'gdb)))
+  (interactive (list (gud-query-cmdline 'gud-gdb)))
+
+  (require 'gdb-ui)
 
   (when (and gud-comint-buffer
 	   (buffer-name gud-comint-buffer)
@@ -736,8 +728,8 @@
 	(error
 	 "Multiple debugging requires restarting in text command mode"))
 
-  (gud-common-init command-line nil 'gud-gdb-marker-filter)
-  (set (make-local-variable 'gud-minor-mode) 'gdb)
+  (gud-common-init command-line nil 'gud-gdba-marker-filter)
+  (set (make-local-variable 'gud-minor-mode) 'gdba)
 
   (gud-def gud-break  "break %f:%l"  "\C-b" "Set breakpoint at current line.")
   (gud-def gud-tbreak "tbreak %f:%l" "\C-t"
@@ -769,8 +761,10 @@
   (setq comint-prompt-regexp "^(.*gdb[+]?) *")
   (setq paragraph-start comint-prompt-regexp)
   (setq gdb-first-prompt t)
+  (setq gud-running nil)
+  (setq gdb-ready nil)
   (setq gud-filter-pending-text nil)
-  (run-hooks 'gdb-mode-hook))
+  (run-hooks 'gud-gdb-mode-hook))
 
 ;; One of the nice features of GDB is its impressive support for
 ;; context-sensitive command completion.  We preserve that feature
@@ -1643,7 +1637,7 @@
   (gud-common-init command-line nil 'gud-pdb-marker-filter)
   (set (make-local-variable 'gud-minor-mode) 'pdb)
 
-  (gud-def gud-break  "break %l"     "\C-b" "Set breakpoint at current line.")
+  (gud-def gud-break  "break %f:%l"  "\C-b" "Set breakpoint at current line.")
   (gud-def gud-remove "clear %f:%l"  "\C-d" "Remove breakpoint at current line")
   (gud-def gud-step   "step"         "\C-s" "Step one source line with display.")
   (gud-def gud-next   "next"         "\C-n" "Step one line (skip functions).")
@@ -2527,7 +2521,6 @@
 	 (and file-word (file-name-nondirectory file))))
   (set (make-local-variable 'gud-marker-filter) marker-filter)
   (if find-file (set (make-local-variable 'gud-find-file) find-file))
-  (setq gud-running nil)
   (setq gud-last-last-frame nil)
 
   (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter)
@@ -2635,7 +2628,7 @@
 	   ;;  process-buffer is current-buffer
 	   (unwind-protect
 	       (progn
-		 ;; Write something in *compilation* and hack its mode line,
+		 ;; Write something in the GUD buffer and hack its mode line,
 		 (set-buffer (process-buffer proc))
 		 ;; Fix the mode line.
 		 (setq mode-line-process
@@ -2691,11 +2684,14 @@
 	 (buffer
 	  (with-current-buffer gud-comint-buffer
 	    (gud-find-file true-file)))
-	 (window (and buffer (or (get-buffer-window buffer)
-				 (if (memq gud-minor-mode '(gdbmi gdba))
-				     (unless (gdb-display-source-buffer buffer)
-				       (gdb-display-buffer buffer nil)))
-				 (display-buffer buffer))))
+	 (window (and buffer
+		      (or (get-buffer-window buffer)
+			  (if (memq gud-minor-mode '(gdbmi gdba))
+			      (or (if (get-buffer-window buffer 0)
+				      (display-buffer buffer nil 0))
+				  (unless (gdb-display-source-buffer buffer)
+				    (gdb-display-buffer buffer nil))))
+			  (display-buffer buffer))))
 	 (pos))
     (if buffer
 	(progn
--- a/lisp/progmodes/python.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/progmodes/python.el	Tue Oct 09 08:52:57 2007 +0000
@@ -1,4 +1,4 @@
-;;; python.el --- silly walks for Python
+;;; python.el --- silly walks for Python  -*- coding: iso-8859-1 -*-
 
 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007  Free Software Foundation, Inc.
 
@@ -89,17 +89,17 @@
 
 (defvar python-font-lock-keywords
   `(,(rx symbol-start
-	 ;; From v 2.4 reference.
+	 ;; From v 2.5 reference, § keywords.
 	 ;; def and class dealt with separately below
-	 (or "and" "assert" "break" "continue" "del" "elif" "else"
+	 (or "and" "as" "assert" "break" "continue" "del" "elif" "else"
 	     "except" "exec" "finally" "for" "from" "global" "if"
 	     "import" "in" "is" "lambda" "not" "or" "pass" "print"
-	     "raise" "return" "try" "while" "yield"
-	     ;; Future keywords
-	     "as" "None" "with"
+	     "raise" "return" "try" "while" "with" "yield"
              ;; Not real keywords, but close enough to be fontified as such
              "self" "True" "False")
 	 symbol-end)
+    (,(rx symbol-start "None" symbol-end) ; See § Keywords in 2.5 manual.
+     . font-lock-constant-face)
     ;; Definitions
     (,(rx symbol-start (group "class") (1+ space) (group (1+ (or word ?_))))
      (1 font-lock-keyword-face) (2 font-lock-type-face))
@@ -151,7 +151,8 @@
     (cond
      ;; Consider property for the last char if in a fenced string.
      ((= n 3)
-      (let ((syntax (syntax-ppss)))
+      (let* ((font-lock-syntactic-keywords nil)
+	     (syntax (syntax-ppss)))
 	(when (eq t (nth 3 syntax))	; after unclosed fence
 	  (goto-char (nth 8 syntax))	; fence position
 	  (skip-chars-forward "uUrR")	; skip any prefix
@@ -163,8 +164,9 @@
 	       (= (match-beginning 1) (match-end 1))) ; prefix is null
 	  (and (= n 1)			; prefix
 	       (/= (match-beginning 1) (match-end 1)))) ; non-empty
-      (unless (nth 3 (syntax-ppss))
-        (eval-when-compile (string-to-syntax "|"))))
+      (let ((font-lock-syntactic-keywords nil))
+        (unless (nth 3 (syntax-ppss))
+          (eval-when-compile (string-to-syntax "|")))))
      ;; Otherwise (we're in a non-matching string) the property is
      ;; nil, which is OK.
      )))
@@ -348,7 +350,7 @@
 		    (error nil))))))))
 
 (defun python-comment-line-p ()
-  "Return non-nil if current line has only a comment."
+  "Return non-nil iff current line has only a comment."
   (save-excursion
     (end-of-line)
     (when (eq 'comment (syntax-ppss-context (syntax-ppss)))
@@ -356,7 +358,7 @@
       (looking-at (rx (or (syntax comment-start) line-end))))))
 
 (defun python-blank-line-p ()
-  "Return non-nil if current line is blank."
+  "Return non-nil iff current line is blank."
   (save-excursion
     (beginning-of-line)
     (looking-at "\\s-*$")))
@@ -850,7 +852,7 @@
   "Skip out of any nested brackets.
 Skip forward if FORWARD is non-nil, else backward.
 If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point.
-Return non-nil if skipping was done."
+Return non-nil iff skipping was done."
   (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss))))
 	(forward (if forward -1 1)))
     (unless (zerop depth)
@@ -1083,13 +1085,15 @@
 
 (defun python-backspace (arg)
   "Maybe delete a level of indentation on the current line.
-Do so if point is at the end of the line's indentation.
+Do so if point is at the end of the line's indentation outside
+strings and comments.
 Otherwise just call `backward-delete-char-untabify'.
 Repeat ARG times."
   (interactive "*p")
   (if (or (/= (current-indentation) (current-column))
 	  (bolp)
-	  (python-continuation-line-p))
+	  (python-continuation-line-p)
+	  (python-in-string/comment))
       (backward-delete-char-untabify arg)
     ;; Look for the largest valid indentation which is smaller than
     ;; the current indentation.
@@ -1190,6 +1194,10 @@
      1 2)
     (,(rx " in file " (group (1+ not-newline)) " on line "
 	  (group (1+ digit)))
+     1 2)
+    ;; pdb stack trace
+    (,(rx line-start "> " (group (1+ (not (any "(\"<"))))
+	  "(" (group (1+ digit)) ")" (1+ (not (any "("))) "()")
      1 2))
   "`compilation-error-regexp-alist' for inferior Python.")
 
@@ -1199,7 +1207,7 @@
     (define-key map "\C-c\C-l" 'python-load-file)
     (define-key map "\C-c\C-v" 'python-check)
     ;; Note that we _can_ still use these commands which send to the
-    ;; Python process even at the prompt provided we have a normal prompt,
+    ;; Python process even at the prompt iff we have a normal prompt,
     ;; i.e. '>>> ' and not '... '.  See the comment before
     ;; python-send-region.  Fixme: uncomment these if we address that.
 
@@ -1245,7 +1253,7 @@
   ;; Still required by `comint-redirect-send-command', for instance
   ;; (and we need to match things like `>>> ... >>> '):
   (set (make-local-variable 'comint-prompt-regexp)
-       (rx line-start (1+ (and (repeat 3 (any ">.")) " "))))
+       (rx line-start (1+ (and (or (repeat 3 (any ">.")) "(Pdb)") " "))))
   (set (make-local-variable 'compilation-error-regexp-alist)
        python-compilation-regexp-alist)
   (compilation-shell-minor-mode 1))
@@ -1737,47 +1745,57 @@
 	      (jython-mode)))))))
 
 (defun python-fill-paragraph (&optional justify)
-  "`fill-paragraph-function' handling comments and multi-line strings.
-If any of the current line is a comment, fill the comment or the
-paragraph of it that point is in, preserving the comment's
-indentation and initial comment characters.  Similarly if the end
-of the current line is in or at the end of a multi-line string.
-Otherwise, do nothing."
+  "`fill-paragraph-function' handling multi-line strings and possibly comments.
+If any of the current line is in or at the end of a multi-line string,
+fill the string or the paragraph of it that point is in, preserving
+the strings's indentation."
   (interactive "P")
   (or (fill-comment-paragraph justify)
-      ;; The `paragraph-start' and `paragraph-separate' variables
-      ;; don't allow us to delimit the last paragraph in a multi-line
-      ;; string properly, so narrow to the string and then fill around
-      ;; (the end of) the current line.
       (save-excursion
 	(end-of-line)
 	(let* ((syntax (syntax-ppss))
 	       (orig (point))
-	       (start (nth 8 syntax))
-	       end)
-	  (cond ((eq t (nth 3 syntax))	      ; in fenced string
-		 (goto-char (nth 8 syntax))   ; string start
+	       start end)
+	  (cond ((nth 4 syntax)	; comment.   fixme: loses with trailing one
+		 (let (fill-paragraph-function)
+		   (fill-paragraph justify)))
+		;; The `paragraph-start' and `paragraph-separate'
+		;; variables don't allow us to delimit the last
+		;; paragraph in a multi-line string properly, so narrow
+		;; to the string and then fill around (the end of) the
+		;; current line.
+		((eq t (nth 3 syntax))      ; in fenced string
+		 (goto-char (nth 8 syntax)) ; string start
+		 (setq start (line-beginning-position))
 		 (setq end (condition-case () ; for unbalanced quotes
-                               (progn (forward-sexp) (point))
+                               (progn (forward-sexp)
+                                      (- (point) 3))
                              (error (point-max)))))
-		((re-search-backward "\\s|\\s-*\\=" nil t) ; end of fenced
-							   ; string
+		((re-search-backward "\\s|\\s-*\\=" nil t) ; end of fenced string
 		 (forward-char)
 		 (setq end (point))
 		 (condition-case ()
 		     (progn (backward-sexp)
-			    (setq start (point)))
-		   (error (setq end nil)))))
+			    (setq start (line-beginning-position)))
+		   (error nil))))
 	  (when end
 	    (save-restriction
 	      (narrow-to-region start end)
 	      (goto-char orig)
-              (let ((paragraph-separate
-                     ;; Make sure that fenced-string delimiters that stand
-                     ;; on their own line stay there.
-                     (concat "[ \t]*['\"]+[ \t]*$\\|" paragraph-separate)))
-                (fill-paragraph justify))))))
-      t))
+	      ;; Avoid losing leading and trailing newlines in doc
+	      ;; strings written like:
+	      ;;   """
+	      ;;   ...
+	      ;;   """
+	      (let* ((paragraph-separate
+		      (concat ".*\\s|\"\"$" ; newline after opening quotes
+			      "\\|\\(?:" paragraph-separate "\\)"))
+		     (paragraph-start
+		      (concat ".*\\s|\"\"[ \t]*[^ \t].*" ; not newline after
+					; opening quotes
+			      "\\|\\(?:" paragraph-separate "\\)"))
+		     (fill-paragraph-function))
+		(fill-paragraph justify))))))) t)
 
 (defun python-shift-left (start end &optional count)
   "Shift lines in region COUNT (the prefix arg) columns to the left.
@@ -1886,9 +1904,12 @@
 	(goto-char (point-min))
 	(while (re-search-forward "^import\\>\\|^from\\>" nil t)
 	  (unless (syntax-ppss-context (syntax-ppss))
-	    (push (buffer-substring (line-beginning-position)
-				    (line-beginning-position 2))
-		  lines)))
+	    (let ((start (line-beginning-position)))
+	      ;; Skip over continued lines.
+	      (while (and (eq ?\\ (char-before (line-end-position)))
+			  (= 0 (forward-line 1))))
+	      (push (buffer-substring start (line-beginning-position 2))
+		    lines))))
 	(setq python-imports
 	      (if lines
 		  (apply #'concat
@@ -2280,7 +2301,7 @@
   ;; since it isn't (can't be) indentation-based.  Also hide-level
   ;; doesn't seem to work properly.
   (add-to-list 'hs-special-modes-alist
-	       `(python-mode "^\\s-*def\\>" nil "#"
+	       `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#"
 		 ,(lambda (arg)
 		   (python-end-of-defun)
 		   (skip-chars-backward " \t\n"))
--- a/lisp/repeat.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/repeat.el	Tue Oct 09 08:52:57 2007 +0000
@@ -152,6 +152,11 @@
 ;; with auto-filling.  Most problems are eliminated by remembering what we're
 ;; self-inserting, so we only need to get it from the undo information once.
 
+;; With Emacs 22.2 the variable `last-repeatable-command' stores the
+;; most recently executed command that was not bound to an input event.
+;; `repeat' now repeats that command instead of `real-last-command' to
+;; avoid a "... must be bound to an event with parameters" error.
+
 (defvar repeat-last-self-insert nil
   "If last repeated command was `self-insert-command', it inserted this.")
 
@@ -198,13 +203,18 @@
 ;;;###autoload
 (defun repeat (repeat-arg)
   "Repeat most recently executed command.
-With prefix arg, apply new prefix arg to that command; otherwise, use
-the prefix arg that was used before (if any).
+With prefix arg, apply new prefix arg to that command; otherwise,
+use the prefix arg that was used before (if any).
 This command is like the `.' command in the vi editor.
 
-If this command is invoked by a multi-character key sequence, it can then
-be repeated by repeating the final character of that sequence.  This behavior
-can be modified by the global variable `repeat-on-final-keystroke'."
+If this command is invoked by a multi-character key sequence, it
+can then be repeated by repeating the final character of that
+sequence.  This behavior can be modified by the global variable
+`repeat-on-final-keystroke'.
+
+`repeat' ignores commands bound to input events.  Hence the term
+\"most recently executed command\" shall be read as \"most
+recently executed command not bound to an input event\"."
   ;; The most recently executed command could be anything, so surprises could
   ;; result if it were re-executed in a context where new dynamically
   ;; localized variables were shadowing global variables in a `let' clause in
@@ -214,17 +224,19 @@
   ;; "repeat-" prefix, reserved by this package, for *local* variables that
   ;; might be visible to re-executed commands, including this function's arg.
   (interactive "P")
-  (when (eq real-last-command 'repeat)
-    (setq real-last-command repeat-previous-repeated-command))
-  (when (null real-last-command)
+  (when (eq last-repeatable-command 'repeat)
+    (setq last-repeatable-command repeat-previous-repeated-command))
+  (cond
+   ((null last-repeatable-command)
     (error "There is nothing to repeat"))
-  (when (eq real-last-command 'mode-exit)
-    (error "real-last-command is mode-exit & can't be repeated"))
-  (when (memq real-last-command repeat-too-dangerous)
-    (error "Command %S too dangerous to repeat automatically" real-last-command))
-  (setq this-command                      real-last-command
-        repeat-num-input-keys-at-repeat   num-input-keys)
-  (setq repeat-previous-repeated-command this-command)
+   ((eq last-repeatable-command 'mode-exit)
+    (error "last-repeatable-command is mode-exit & can't be repeated"))
+   ((memq last-repeatable-command repeat-too-dangerous)
+    (error "Command %S too dangerous to repeat automatically"
+	   last-repeatable-command)))
+  (setq this-command last-repeatable-command
+	repeat-previous-repeated-command last-repeatable-command
+        repeat-num-input-keys-at-repeat num-input-keys)
   (when (null repeat-arg)
     (setq repeat-arg last-prefix-arg))
   ;; Now determine whether to loop on repeated taps of the final character
@@ -234,25 +246,29 @@
   ;; needs to be saved.
   (let ((repeat-repeat-char
          (if (eq repeat-on-final-keystroke t)
-             ;; allow any final input event that was a character
-             (when (eq last-command-char
-                       last-command-event)
-               last-command-char)
+	     ;; The following commented out since it's equivalent to
+	     ;; last-comment-char (martin 2007-08-29).
+;;;              ;; allow any final input event that was a character
+;;;              (when (eq last-command-char
+;;;                        last-command-event)
+;;;                last-command-char)
+	     last-command-char
            ;; allow only specified final keystrokes
            (car (memq last-command-char
                       (listify-key-sequence
                        repeat-on-final-keystroke))))))
-    (if (memq real-last-command '(exit-minibuffer
-				  minibuffer-complete-and-exit
-				  self-insert-and-exit))
+    (if (memq last-repeatable-command '(exit-minibuffer
+					minibuffer-complete-and-exit
+					self-insert-and-exit))
         (let ((repeat-command (car command-history)))
           (repeat-message "Repeating %S" repeat-command)
           (eval repeat-command))
       (if (null repeat-arg)
-          (repeat-message "Repeating command %S" real-last-command)
-        (setq current-prefix-arg                   repeat-arg)
-        (repeat-message "Repeating command %S %S" repeat-arg real-last-command))
-      (if (eq real-last-command 'self-insert-command)
+          (repeat-message "Repeating command %S" last-repeatable-command)
+        (setq current-prefix-arg repeat-arg)
+        (repeat-message
+	 "Repeating command %S %S" repeat-arg last-repeatable-command))
+      (if (eq last-repeatable-command 'self-insert-command)
           (let ((insertion
                  (if (<= (- num-input-keys
                             repeat-num-input-keys-at-self-insert)
@@ -275,18 +291,22 @@
 	    (setq insertion (substring insertion -1))
 	    (let ((count (prefix-numeric-value repeat-arg))
 		  (i 0))
+	      ;; Run pre- and post-command hooks for self-insertion too.
+	      (run-hooks 'pre-command-hook)
 	      (while (< i count)
 		(repeat-self-insert insertion)
-		(setq i (1+ i)))))
-	(let ((indirect (indirect-function real-last-command)))
+		(setq i (1+ i)))
+	      (run-hooks 'post-command-hook)))
+	(let ((indirect (indirect-function last-repeatable-command)))
 	  (if (or (stringp indirect)
 		  (vectorp indirect))
-	      ;; Bind real-last-command so that executing the macro
-	      ;; does not alter it.
-	      (let ((real-last-command real-last-command))
-		(execute-kbd-macro real-last-command))
+	      ;; Bind real-last-command so that executing the macro does
+	      ;; not alter it.  Do the same for last-repeatable-command.
+	      (let ((real-last-command real-last-command)
+		    (last-repeatable-command last-repeatable-command))
+		(execute-kbd-macro last-repeatable-command))
             (run-hooks 'pre-command-hook)
-	    (call-interactively real-last-command)
+	    (call-interactively last-repeatable-command)
             (run-hooks 'post-command-hook)))))
     (when repeat-repeat-char
       ;; A simple recursion here gets into trouble with max-lisp-eval-depth
@@ -295,6 +315,7 @@
       ;; max-lisp-eval-depth), but if I now locally disable the repeat char I
       ;; can iterate indefinitely here around a single level of recursion.
       (let (repeat-on-final-keystroke)
+	(setq real-last-command 'repeat)
         (while (eq (read-event) repeat-repeat-char)
 	  ;; Make each repetition undo separately.
 	  (undo-boundary)
--- a/lisp/term/x-win.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/term/x-win.el	Tue Oct 09 08:52:57 2007 +0000
@@ -2679,5 +2679,62 @@
 
 (provide 'x-win)
 
+(defcustom x-gtk-stock-map
+  '(
+    ("etc/images/new" . "gtk-new")
+    ("etc/images/open" . "gtk-open")
+    ("etc/images/diropen" . "n:system-file-manager")
+    ("etc/images/close" . "gtk-close")
+    ("etc/images/save" . "gtk-save")
+    ("etc/images/saveas" . "gtk-save-as")
+    ("etc/images/undo" . "gtk-undo")
+    ("etc/images/cut" . "gtk-cut")
+    ("etc/images/copy" . "gtk-copy")
+    ("etc/images/paste" . "gtk-paste")
+    ("etc/images/search" . "gtk-find")
+    ("etc/images/print" . "gtk-print")
+    ("etc/images/preferences" . "gtk-preferences")
+    ("etc/images/help" . "gtk-help")
+    ("etc/images/left-arrow" . "gtk-go-back")
+    ("etc/images/right-arrow" . "gtk-go-forward")
+    ("etc/images/home" . "gtk-home")
+    ("etc/images/jump-to" . "gtk-jump-to")
+    ("etc/images/index" . "gtk-index")
+    ("etc/images/search" . "gtk-find")
+    ("etc/images/exit" . "gtk-quit"))
+  "How icons for tool bars are mapped to Gtk+ stock items.
+Emacs must be compiled with the Gtk+ toolkit for this to have any effect.
+A value that begins with n: denotes a named icon instead of a stock icon."
+  :version "22.2"
+  :type 'alist
+  :group 'x)
+
+(defvar icon-map-list nil
+  "*A list of alists that maps icon file names to stock/named icons.
+The alists are searched in the order they appear.  The first match is used.
+The keys in the alists are file names without extension and with two directory
+components.  For example, to map /usr/share/emacs/22.1.1/etc/images/open.xpm
+to stock item gtk-open, use:
+
+  (\"etc/images/open\" . \"gtk-open\")
+
+Themes also have named icons.  To map to one of those, use n: before the name:
+
+  (\"etc/images/diropen\" . \"n:system-file-manager\")
+
+The list elements are either the symbol name for the alist or the alist itself.")
+
+(defun x-gtk-map-stock (file)
+  "Map icon with file name FILE to a Gtk+ stock name, using `x-gtk-stock-map'."
+  (let* ((file-sans (file-name-sans-extension file))
+	 (key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)" file-sans)
+		   (match-string 1 file-sans)))
+	 (value))
+    (mapc (lambda (elem)
+ 	    (let ((assoc (if (symbolp elem) (symbol-value elem) elem)))
+	      (or value (setq value (assoc-string (or key file-sans) assoc)))))
+	    icon-map-list)
+    (and value (cdr value))))
+
 ;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
 ;;; x-win.el ends here
--- a/lisp/textmodes/css-mode.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/textmodes/css-mode.el	Tue Oct 09 08:52:57 2007 +0000
@@ -173,7 +173,7 @@
     "word-spacing" "z-index")
   "Identifiers for properties.")
 
-(defcustom css-electrick-keys '(?\} ?\;) ;; '()
+(defcustom css-electric-keys '(?\} ?\;) ;; '()
   "Self inserting keys which should trigger re-indentation."
   :type '(repeat character)
   :options '((?\} ?\;))
@@ -270,10 +270,10 @@
   (set (make-local-variable 'indent-line-function) 'css-indent-line)
   (set (make-local-variable 'fill-paragraph-function)
        'css-fill-paragraph)
-  (when css-electrick-keys
+  (when css-electric-keys
     (let ((fc (make-char-table 'auto-fill-chars)))
       (set-char-table-parent fc auto-fill-chars)
-      (dolist (c css-electrick-keys)
+      (dolist (c css-electric-keys)
         (aset fc c 'indent-according-to-mode))
       (set (make-local-variable 'auto-fill-chars) fc))))
 
--- a/lisp/textmodes/flyspell.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/textmodes/flyspell.el	Tue Oct 09 08:52:57 2007 +0000
@@ -495,7 +495,10 @@
   :keymap flyspell-mode-map
   :group 'flyspell
   (if flyspell-mode
-      (flyspell-mode-on)
+      (condition-case ()
+	  (flyspell-mode-on)
+	(error (message "Enabling Flyspell mode gave an error")
+	       (flyspell-mode -1)))
     (flyspell-mode-off)))
 
 ;;;###autoload
--- a/lisp/vc-bzr.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/vc-bzr.el	Tue Oct 09 08:52:57 2007 +0000
@@ -5,7 +5,7 @@
 ;; Author: Dave Love <fx@gnu.org>, Riccardo Murri <riccardo.murri@gmail.com>
 ;; Keywords: tools
 ;; Created: Sept 2006
-;; Version: 2007-08-03
+;; Version: 2007-09-05
 ;; URL: http://launchpad.net/vc-bzr
 
 ;; This file is free software; you can redistribute it and/or modify
@@ -164,7 +164,7 @@
   (lexical-let*
       ((filename* (expand-file-name filename))
        (rootdir (vc-bzr-root (file-name-directory filename*))))
-    (and rootdir 
+    (when rootdir 
          (file-relative-name filename* rootdir))))
 
 ;; FIXME:  Also get this in a non-registered sub-directory.
@@ -200,13 +200,13 @@
                          (if (file-directory-p file) "/?" "")
                          "[ \t\n]*$")
                  nil t)
-            (let ((status (match-string 1)))
+            (lexical-let ((statusword (match-string 1)))
               ;; Erase the status text that matched.
               (delete-region (match-beginning 0) (match-end 0))
               (setq status
                     (and (equal ret 0) ; Seems redundant.  --Stef
                          (intern (replace-regexp-in-string " " ""
-                                                           status))))))
+                                                         statusword))))))
           (when status
             (goto-char (point-min))
             (skip-chars-forward " \n\t") ;Throw away spaces.
@@ -241,12 +241,12 @@
 (defun vc-bzr-workfile-version (file)
   (lexical-let*
       ((rootdir (vc-bzr-root file))
-       (branch-format-file (concat rootdir "/" vc-bzr-admin-branch-format-file))
-       (revhistory-file (concat rootdir "/" vc-bzr-admin-revhistory))
-       (lastrev-file (concat rootdir "/" vc-bzr-admin-lastrev)))
-    ;; Count lines in .bzr/branch/revision-history to avoid forking a
-    ;; bzr process.  This looks at internal files.  May break if they
-    ;; change their format.
+       (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file
+                                             rootdir))
+       (revhistory-file (expand-file-name vc-bzr-admin-revhistory rootdir))
+       (lastrev-file (expand-file-name vc-bzr-admin-lastrev rootdir)))
+    ;; This looks at internal files to avoid forking a bzr process.
+    ;; May break if they change their format.
     (if (file-exists-p branch-format-file)
         (with-temp-buffer
           (insert-file-contents branch-format-file) 
@@ -261,7 +261,6 @@
            ((looking-at "Bazaar Branch Format 6 (bzr 0.15)")
             ;; revno is the first number in .bzr/branch/last-revision
             (insert-file-contents lastrev-file) 
-            (goto-char (line-end-position))
             (if (re-search-forward "[0-9]+" nil t)
                 (buffer-substring (match-beginning 0) (match-end 0))))))
       ;; fallback to calling "bzr revno"
@@ -417,14 +416,14 @@
   "Prepare BUFFER for `vc-annotate' on FILE.
 Each line is tagged with the revision number, which has a `help-echo'
 property containing author and date information."
-  (apply #'vc-bzr-command "annotate" buffer 0 file "-l" "--all"
+  (apply #'vc-bzr-command "annotate" buffer 0 file "--long" "--all"
          (if version (list "-r" version)))
   (with-current-buffer buffer
     ;; Store the tags for the annotated source lines in a hash table
     ;; to allow saving space by sharing the text properties.
     (setq vc-bzr-annotation-table (make-hash-table :test 'equal))
     (goto-char (point-min))
-    (while (re-search-forward "^\\( *[0-9]+\\) \\(.+\\) +\\([0-9]\\{8\\}\\) |"
+    (while (re-search-forward "^\\( *[0-9]+\\) +\\(.+\\) +\\([0-9]\\{8\\}\\) |"
                               nil t)
       (let* ((rev (match-string 1))
              (author (match-string 2))
@@ -432,9 +431,6 @@
              (key (match-string 0))
              (tag (gethash key vc-bzr-annotation-table)))
         (unless tag
-          (save-match-data
-            (string-match " +\\'" author)
-            (setq author (substring author 0 (match-beginning 0))))
           (setq tag (propertize rev 'help-echo (concat "Author: " author
                                                        ", date: " date)
                                 'mouse-face 'highlight))
@@ -575,7 +571,6 @@
 (eval-after-load "vc"
   '(add-to-list 'vc-directory-exclusion-list vc-bzr-admin-dirname t))
 
-
 (provide 'vc-bzr)
 ;; arch-tag: 8101bad8-4e92-4e7d-85ae-d8e08b4e7c06
 ;;; vc-bzr.el ends here
--- a/lisp/vc-git.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/vc-git.el	Tue Oct 09 08:52:57 2007 +0000
@@ -143,6 +143,7 @@
 
 (defun vc-git-state (file)
   "Git-specific version of `vc-state'."
+  (call-process "git" nil nil nil "add" "--refresh" "--" (file-relative-name file))
   (let ((diff (vc-git--run-command-string file "diff-index" "-z" "HEAD" "--")))
     (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} [ADMU]\0[^\0]+\0" diff))
         'edited
@@ -189,24 +190,7 @@
   'implicit)
 
 (defun vc-git-workfile-unchanged-p (file)
-  ;; The reason this does not use the result of vc-git-state is that
-  ;; git-diff-index (used by vc-git-state) doesn't refresh the cached
-  ;; stat info, so if the file has been modified it will always show
-  ;; up as modified in vc-git-state, even if the change has been
-  ;; undone, until git-update-index --refresh is run.
-
-  ;; OTOH the vc-git-workfile-unchanged-p implementation checks the
-  ;; actual content, so it will detect the case of a file reverted
-  ;; back to its original state.
-
-  ;; The ideal implementation would be to refresh the stat cache and
-  ;; then call vc-git-state, but at the moment there's no git command
-  ;; to refresh a single file, so this will have to be added first.
-  (let ((sha1 (vc-git--run-command-string file "hash-object" "--"))
-        (head (vc-git--run-command-string file "ls-tree" "-z" "HEAD" "--")))
-    (and head
-         (string-match "[0-7]\\{6\\} blob \\([0-9a-f]\\{40\\}\\)\t[^\0]+\0" head)
-         (string= (car (split-string sha1 "\n")) (match-string 1 head)))))
+  (eq 'up-to-date (vc-git-state file)))
 
 (defun vc-git-mode-line-string (file)
   "Return string for placement into the modeline for FILE."
@@ -232,7 +216,7 @@
 
 (defun vc-git-create-repo ()
   "Create a new Git repository."
-  (vc-git-command "init" nil 0 nil))
+  (vc-git-command nil 0 nil "init"))
 
 (defun vc-git-register (files &optional rev comment)
   "Register FILE into the git version-control system."
@@ -318,6 +302,14 @@
 	   ("^Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
 	    (1 'change-log-name)
 	    (2 'change-log-email))
+	   ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
+	    (1 'change-log-name))
+	   ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
+	    (1 'change-log-name)
+	    (2 'change-log-email))
+	   ("^Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)"
+	    (1 'change-log-acknowledgement)
+	    (2 'change-log-acknowledgement))
 	   ("^Date:   \\(.+\\)" (1 'change-log-date))
 	   ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
 
--- a/lisp/vc-hooks.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/vc-hooks.el	Tue Oct 09 08:52:57 2007 +0000
@@ -62,9 +62,10 @@
   :type 'regexp
   :group 'vc)
 
-(defcustom vc-handled-backends '(RCS CVS SVN SCCS Bzr Git Hg Arch MCVS)
-  ;; Bzr, Git, Hg, Arch and MCVS come last because they are per-tree
-  ;; rather than per-dir.
+(defcustom vc-handled-backends '(RCS CVS SVN SCCS Bzr Git Hg Mtn Arch MCVS)
+  ;; RCS, CVS, SVN and SCCS come first because they are per-dir
+  ;; rather than per-tree.  RCS comes first because of the multibackend
+  ;; support intended to use RCS for local commits (with a remote CVS server).
   "List of version control backends for which VC will be used.
 Entries in this list will be tried in order to determine whether a
 file is under that sort of version control.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/vc-mtn.el	Tue Oct 09 08:52:57 2007 +0000
@@ -0,0 +1,285 @@
+;;; vc-mtn.el --- VC backend for Monotone
+
+;; Copyright (C) 2007  Free Software Foundation, Inc.
+
+;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
+;; Keywords: 
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; 
+
+;;; Code:
+
+(eval-when-compile (require 'cl) (require 'vc))
+
+;; Clear up the cache to force vc-call to check again and discover
+;; new functions when we reload this file.
+(put 'Mtn 'vc-functions nil)
+
+(defvar vc-mtn-command "mtn")
+(unless (executable-find vc-mtn-command)
+  ;; vc-mtn.el is 100% non-functional without the `mtn' executable.
+  (setq vc-handled-backends (delq 'Mtn vc-handled-backends)))
+
+;;;###autoload
+(defconst vc-mtn-admin-dir "_MTN")
+;;;###autoload
+(defconst vc-mtn-admin-format (concat vc-mtn-admin-dir "/format"))
+
+;;;###autoload (defun vc-mtn-registered (file)
+;;;###autoload   (if (vc-find-root file vc-mtn-admin-format)
+;;;###autoload       (progn
+;;;###autoload         (load "vc-mtn")
+;;;###autoload         (vc-mtn-registered file))))
+
+(defun vc-mtn-revision-granularity () 'repository)
+(defun vc-mtn-checkout-model (file) 'implicit)
+
+(defun vc-mtn-root (file)
+  (setq file (if (file-directory-p file)
+                 (file-name-as-directory file)
+               (file-name-directory file)))
+  (or (vc-file-getprop file 'vc-mtn-root)
+      (vc-file-setprop file 'vc-mtn-root
+                       (vc-find-root file vc-mtn-admin-format))))
+
+
+(defun vc-mtn-registered (file)
+  (let ((root (vc-mtn-root file)))
+    (when root
+      (vc-mtn-state file))))
+
+(defun vc-mtn-command (buffer okstatus files &rest flags)
+  "A wrapper around `vc-do-command' for use in vc-mtn.el."
+  (apply 'vc-do-command buffer okstatus vc-mtn-command files flags))
+
+(defun vc-mtn-state (file)
+  ;; If `mtn' fails or returns status>0, or if the search files, just
+  ;; return nil.
+  (ignore-errors
+    (with-temp-buffer
+      (vc-mtn-command t 0 file "status")
+      (goto-char (point-min))
+      (re-search-forward "^  \\(?:patched \\(.*\\)\\|no changes$\\)")
+      (if (match-end 1)
+          'edited
+        'up-to-date))))
+
+(defun vc-mtn-workfile-version (file)
+  ;; If `mtn' fails or returns status>0, or if the search fails, just
+  ;; return nil.
+  (ignore-errors
+    (with-temp-buffer
+      (vc-mtn-command t 0 file "status")
+      (goto-char (point-min))
+      (re-search-forward "Current branch: \\(.*\\)\nChanges against parent \\(.*\\)")
+      (match-string 2))))
+
+(defun vc-mtn-workfile-branch (file)
+  ;; If `mtn' fails or returns status>0, or if the search files, just
+  ;; return nil.
+  (ignore-errors
+    (with-temp-buffer
+      (vc-mtn-command t 0 file "status")
+      (goto-char (point-min))
+      (re-search-forward "Current branch: \\(.*\\)\nChanges against parent \\(.*\\)")
+      (match-string 1))))
+
+(defun vc-mtn-workfile-unchanged-p (file)
+  (not (eq (vc-mtn-state file) 'edited)))
+
+;; Mode-line rewrite code copied from vc-arch.el.
+
+(defcustom vc-mtn-mode-line-rewrite
+  '(("\\`[^:/#]*[:/#]" . ""))           ;Drop the host part.
+  "Rewrite rules to shorten Mtn's revision names on the mode-line."
+  :type '(repeat (cons regexp string))
+  :group 'vc)
+
+(defun vc-mtn-mode-line-string (file)
+  "Return string for placement in modeline by `vc-mode-line' for FILE."
+  (let ((branch (vc-mtn-workfile-branch file)))
+    (dolist (rule vc-mtn-mode-line-rewrite)
+      (if (string-match (car rule) branch)
+	  (setq branch (replace-match (cdr rule) t nil branch))))
+    (format "Mtn%c%s"
+	    (case (vc-state file)
+	      ((up-to-date needs-patch) ?-)
+	      (added ?@)
+	      (t ?:))
+	    branch)))
+
+(defun vc-mtn-register (files &optional rest)
+  (vc-mtn-command nil 0 files "add"))
+
+(defun vc-mtn-responsible-p (file) (vc-mtn-root file))
+(defun vc-mtn-could-register (file) (vc-mtn-root file))
+
+(defun vc-mtn-checkin (files rev comment)
+  (vc-mtn-command nil 0 files "commit" "-m" comment))
+
+(defun vc-mtn-find-version (file rev buffer)
+  (vc-mtn-command buffer 0 file "cat" "-r" rev))
+
+;; (defun vc-mtn-checkout (file &optional editable rev)
+;;   )
+
+(defun vc-mtn-revert (file &optional contents-done)
+  (unless contents-done
+    (vc-mtn-command nil 0 file "revert")))
+
+;; (defun vc-mtn-roolback (files)
+;;   )
+
+(defun vc-mtn-print-log (files &optional buffer)
+  (vc-mtn-command buffer 0 files "log"))
+
+(define-derived-mode vc-mtn-log-view-mode log-view-mode "Mtn-Log-View"
+  ;; TODO: Not sure what to do about file markers for now.
+  (set (make-local-variable 'log-view-file-re) "\\'\\`")
+  ;; TODO: Use a more precise regexp than "[ |/]+" to avoid false positives
+  ;; in the ChangeLog text.
+  (set (make-local-variable 'log-view-message-re)
+       "^[ |/]+Revision: \\([0-9a-f]+\\)")
+  (require 'add-log)                    ;For change-log faces.
+  (set (make-local-variable 'log-view-font-lock-keywords)
+       (append log-view-font-lock-keywords
+               '(("^[ |]+Author: \\(.*\\)" (1 'change-log-email))
+                 ("^[ |]+Date: \\(.*\\)" (1 'change-log-date-face))))))
+
+;; (defun vc-mtn-show-log-entry (version)
+;;   )
+
+(defun vc-mtn-wash-log (file))
+
+(defalias 'vc-mtn-diff-tree 'vc-mtn-diff)
+(defun vc-mtn-diff (files &optional rev1 rev2 buffer)
+  (apply 'vc-mtn-command (or buffer "*vc-diff*") 1 files "diff"
+         (append (if rev1 (list "-r" rev1)) (if rev2 (list "-r" rev2)))))
+
+(defun vc-mtn-annotate-command (file buf &optional rev)
+  (apply 'vc-mtn-command buf 0 file "annotate"
+         (if rev (list "-r" rev))))
+
+(defconst vc-mtn-annotate-full-re
+  "^ *\\([0-9a-f]+\\)\\.* by [^ ]+ \\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\): ")
+(defconst vc-mtn-annotate-any-re
+  (concat "^\\(?: +: \\|" vc-mtn-annotate-full-re "\\)"))
+
+(defun vc-mtn-annotate-time ()
+  (when (looking-at vc-mtn-annotate-any-re)
+    (goto-char (match-end 0))
+    (let ((year (match-string 2)))
+      (if (not year)
+          ;; Look for the date on a previous line.
+          (save-excursion
+            (get-text-property (1- (previous-single-property-change
+                                    (point) 'vc-mtn-time nil (point-min)))
+                               'vc-mtn-time))
+        (let ((time (vc-annotate-convert-time
+                     (encode-time 0 0 0
+                                  (string-to-number (match-string 4))
+                                  (string-to-number (match-string 3))
+                                  (string-to-number year)
+                                  t))))
+          (let ((inhibit-read-only t)
+                (inhibit-modification-hooks t))
+            (put-text-property (match-beginning 0) (match-end 0)
+                               'vc-mtn-time time))
+          time)))))
+
+(defun vc-mtn-annotate-extract-revision-at-line ()
+  (save-excursion
+    (when (or (looking-at vc-mtn-annotate-full-re)
+              (re-search-backward vc-mtn-annotate-full-re nil t))
+      (match-string 1))))
+
+;;; Revision completion.
+
+(defun vc-mtn-list-tags ()
+  (with-temp-buffer
+    (vc-mtn-command t 0 nil "list" "tags")
+    (goto-char (point-min))
+    (let ((tags ()))
+      (while (re-search-forward "^[^ ]+" nil t)
+        (push (match-string 0) tags))
+      tags)))
+
+(defun vc-mtn-list-branches ()
+  (with-temp-buffer
+    (vc-mtn-command t 0 nil "list" "branches")
+    (goto-char (point-min))
+    (let ((branches ()))
+      (while (re-search-forward "^.+" nil t)
+        (push (match-string 0) branches))
+      branches)))
+
+(defun vc-mtn-list-revision-ids (prefix)
+  (with-temp-buffer
+    (vc-mtn-command t 0 nil "complete" "revision" prefix)
+    (goto-char (point-min))
+    (let ((ids ()))
+      (while (re-search-forward "^.+" nil t)
+        (push (match-string 0) ids))
+      ids)))
+
+(defun vc-mtn-revision-completion-table (file)
+  ;; TODO: Implement completion for for selectors
+  ;; TODO: Implement completion for composite selectors.
+  (lexical-let ((file file))
+    (lambda (string pred action)
+      (cond
+       ;; "Tag" selectors.
+       ((string-match "\\`t:" string)
+        (complete-with-action action
+                              (mapcar (lambda (tag) (concat "t:" tag))
+                                      (vc-mtn-list-tags))
+                              string pred))
+       ;; "Branch" selectors.
+       ((string-match "\\`b:" string)
+        (complete-with-action action
+                              (mapcar (lambda (tag) (concat "b:" tag))
+                                      (vc-mtn-list-branches))
+                              string pred))
+       ;; "Head" selectors.  Not sure how they differ from "branch" selectors.
+       ((string-match "\\`h:" string)
+        (complete-with-action action
+                              (mapcar (lambda (tag) (concat "h:" tag))
+                                      (vc-mtn-list-branches))
+                              string pred))
+       ;; "ID" selectors.
+       ((string-match "\\`i:" string)
+        (complete-with-action action
+                              (mapcar (lambda (tag) (concat "i:" tag))
+                                      (vc-mtn-list-revision-ids
+                                       (substring string (match-end 0))))
+                              string pred))
+       (t
+        (complete-with-action action
+                              '("t:" "b:" "h:" "i:"
+                                ;; Completion not implemented for these.
+                                "a:" "c:" "d:" "e:" "l:")
+                              string pred))))))
+        
+        
+
+(provide 'vc-mtn)
+
+;; arch-tag: 2b89ffbc-cbb8-405a-9080-2eafd4becb70
+;;; vc-mtn.el ends here
--- a/lisp/vc-svn.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/vc-svn.el	Tue Oct 09 08:52:57 2007 +0000
@@ -521,6 +521,33 @@
       ;; behavior for different modules on the same server.
       (match-string 1))))
 
+(defun vc-svn-resolve-when-done ()
+  "Call \"svn resolved\" if the conflict markers have been removed."
+  (save-excursion
+    (goto-char (point-min))
+    (if (not (re-search-forward "^<<<<<<< " nil t))
+        (vc-svn-command nil 0 buffer-file-name "resolved"))))
+
+;; Inspired by vc-arch-find-file-hook.
+(defun vc-svn-find-file-hook ()
+  (when (eq ?C (vc-file-getprop buffer-file-name 'vc-svn-status))
+    ;; If the file is marked as "conflicted", then we should try and call
+    ;; "svn resolved" when applicable.
+    (if (save-excursion
+          (goto-char (point-min))
+          (re-search-forward "^<<<<<<< " nil t))
+        ;; There are conflict markers.
+        (progn
+          (smerge-mode 1)
+          (add-hook 'after-save-hook 'vc-svn-resolve-when-done nil t))
+      ;; There are no conflict markers.  This is problematic: maybe it means
+      ;; the conflict has been resolved and we should immediately call "svn
+      ;; resolved", or it means that the file's type does not allow Svn to
+      ;; use conflict markers in which case we don't really know what to do.
+      ;; So let's just punt for now.
+      nil)
+    (message "There are unresolved conflicts in this file")))
+
 (defun vc-svn-parse-status (&optional filename)
   "Parse output of \"svn status\" command in the current buffer.
 Set file properties accordingly.  Unless FILENAME is non-nil, parse only
@@ -543,6 +570,8 @@
 	;; Use the last-modified revision, so that searching in vc-print-log
 	;; output works.
 	(vc-file-setprop file 'vc-workfile-version (match-string 3))
+        ;; Remember Svn's own status.
+        (vc-file-setprop file 'vc-svn-status status)
 	(vc-file-setprop
 	 file 'vc-state
 	 (cond
--- a/lisp/vc.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/vc.el	Tue Oct 09 08:52:57 2007 +0000
@@ -64,8 +64,8 @@
 ;; This mode is fully documented in the Emacs user's manual.
 ;;
 ;; Supported version-control systems presently include CVS, RCS, GNU
-;; Arch, Subversion, Bzr, Mercurial, Meta-CVS, and SCCS (or its free
-;; replacement, CSSC).
+;; Arch, Subversion, Bzr, Git, Mercurial, Meta-CVS, Monotone and SCCS
+;; (or its free replacement, CSSC).
 ;;
 ;; Some features will not work with old RCS versions.  Where
 ;; appropriate, VC finds out which version you have, and allows or
--- a/lisp/wid-edit.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/wid-edit.el	Tue Oct 09 08:52:57 2007 +0000
@@ -405,7 +405,17 @@
     (unless (widget-get widget :suppress-face)
       (overlay-put overlay 'face (widget-apply widget :button-face-get))
       (overlay-put overlay 'mouse-face
-		   (widget-apply widget :mouse-face-get)))
+		   ;; Make new list structure for the mouse-face value
+		   ;; so that different widgets will have
+		   ;; different `mouse-face' property values
+		   ;; and will highlight separately.
+		   (let ((mouse-face-value
+			  (widget-apply widget :mouse-face-get)))
+		     ;; If it's a list, copy it.
+		     (if (listp mouse-face-value)
+			 (copy-sequence mouse-face-value)
+		       ;; If it's a symbol, put it in a list.
+		       (list mouse-face-value)))))
     (overlay-put overlay 'pointer 'hand)
     (overlay-put overlay 'follow-link follow-link)
     (overlay-put overlay 'help-echo help-echo)))
@@ -656,7 +666,9 @@
       (progn (widget-put widget :suppress-face t)
 	     (insert-image image
 			   (propertize
-			    tag 'mouse-face widget-button-pressed-face)))
+                            ;; Use a `list' so it's unique and won't get
+                            ;; accidentally merged with neighbouring images.
+			    tag 'mouse-face (list widget-button-pressed-face))))
     (insert tag)))
 
 (defun widget-move-and-invoke (event)
--- a/lisp/window.el	Tue Oct 09 08:44:02 2007 +0000
+++ b/lisp/window.el	Tue Oct 09 08:52:57 2007 +0000
@@ -899,10 +899,13 @@
   "Cancel delayed window autoselection.
 Optional argument FORCE means cancel unconditionally."
   (unless (and (not force)
-	       ;; Don't cancel while the user drags a scroll bar.
-	       (eq this-command 'scroll-bar-toolkit-scroll)
-	       (memq (nth 4 (event-end last-input-event))
-		     '(handle end-scroll)))
+	       ;; Don't cancel for select-window or select-frame events
+	       ;; or when the user drags a scroll bar.
+	       (or (memq this-command
+			 '(handle-select-window handle-switch-frame))
+		   (and (eq this-command 'scroll-bar-toolkit-scroll)
+			(memq (nth 4 (event-end last-input-event))
+			      '(handle end-scroll)))))
     (setq mouse-autoselect-window-state nil)
     (when (timerp mouse-autoselect-window-timer)
       (cancel-timer mouse-autoselect-window-timer))
@@ -990,33 +993,39 @@
   "Handle select-window events."
   (interactive "e")
   (let ((window (posn-window (event-start event))))
-    (when (and (window-live-p window)
-	       ;; Don't switch if we're currently in the minibuffer.
-	       ;; This tries to work around problems where the minibuffer gets
-	       ;; unselected unexpectedly, and where you then have to move
-	       ;; your mouse all the way down to the minibuffer to select it.
-	       (not (window-minibuffer-p (selected-window)))
-	       ;; Don't switch to a minibuffer window unless it's active.
-	       (or (not (window-minibuffer-p window))
-		   (minibuffer-window-active-p window)))
-      (unless (and (numberp mouse-autoselect-window)
-		   (not (zerop mouse-autoselect-window))
-		   (not (eq mouse-autoselect-window-state 'select))
-		   (progn
-		     ;; Cancel any delayed autoselection.
-		     (mouse-autoselect-window-cancel t)
-		     ;; Start delayed autoselection from current mouse position
-		     ;; and window.
-		     (mouse-autoselect-window-start (mouse-position) window)
-		     ;; Executing a command cancels delayed autoselection.
-		     (add-hook
-		      'pre-command-hook 'mouse-autoselect-window-cancel)))
+    (unless (or (not (window-live-p window))
+		;; Don't switch if we're currently in the minibuffer.
+		;; This tries to work around problems where the
+		;; minibuffer gets unselected unexpectedly, and where
+		;; you then have to move your mouse all the way down to
+		;; the minibuffer to select it.
+		(window-minibuffer-p (selected-window))
+		;; Don't switch to minibuffer window unless it's active.
+		(and (window-minibuffer-p window)
+		     (not (minibuffer-window-active-p window)))
+		;; Don't switch when autoselection shall be delayed.
+		(and (numberp mouse-autoselect-window)
+		     (not (zerop mouse-autoselect-window))
+		     (not (eq mouse-autoselect-window-state 'select))
+		     (progn
+		       ;; Cancel any delayed autoselection.
+		       (mouse-autoselect-window-cancel t)
+		       ;; Start delayed autoselection from current mouse position
+		       ;; and window.
+		       (mouse-autoselect-window-start (mouse-position) window)
+		       ;; Executing a command cancels delayed autoselection.
+		       (add-hook
+			'pre-command-hook 'mouse-autoselect-window-cancel))))
+      (when mouse-autoselect-window
 	;; Reset state of delayed autoselection.
 	(setq mouse-autoselect-window-state nil)
-	(when mouse-autoselect-window
-	  ;; Run `mouse-leave-buffer-hook' when autoselecting window.
-	  (run-hooks 'mouse-leave-buffer-hook))
-	(select-window window)))))
+	;; Set input focus to handle cross-frame movement.  Bind
+	;; `focus-follows-mouse' to avoid moving the mouse cursor.
+	(let (focus-follows-mouse)
+	  (select-frame-set-input-focus (window-frame window)))
+	;; Run `mouse-leave-buffer-hook' when autoselecting window.
+	(run-hooks 'mouse-leave-buffer-hook))
+      (select-window window))))
 
 (define-key ctl-x-map "2" 'split-window-vertically)
 (define-key ctl-x-map "3" 'split-window-horizontally)
--- a/nt/ChangeLog	Tue Oct 09 08:44:02 2007 +0000
+++ b/nt/ChangeLog	Tue Oct 09 08:52:57 2007 +0000
@@ -1,3 +1,9 @@
+2007-09-27  Jason Rumney  <jasonr@gnu.org>
+
+	* gmake.defs (COMCTL32): New system library.
+
+	* nmake.defs (COMCTL32): New system library.
+
 2007-09-06  Glenn Morris  <rgm@gnu.org>
 
 	* configure.bat:
--- a/nt/gmake.defs	Tue Oct 09 08:44:02 2007 +0000
+++ b/nt/gmake.defs	Tue Oct 09 08:52:57 2007 +0000
@@ -170,6 +170,7 @@
 BASE_LIBS	= $(libc) $(baselibs)
 
 ADVAPI32	= -ladvapi32
+COMCTL32	= -lcomctl32
 COMDLG32	= -lcomdlg32
 GDI32		= -lgdi32
 MPR		= -lmpr
--- a/nt/nmake.defs	Tue Oct 09 08:44:02 2007 +0000
+++ b/nt/nmake.defs	Tue Oct 09 08:52:57 2007 +0000
@@ -117,6 +117,7 @@
 BASE_LIBS	= $(libc) $(baselibs) oldnames.lib
 
 ADVAPI32	= advapi32.lib
+COMCTL32	= comctl32.lib
 COMDLG32	= comdlg32.lib
 GDI32		= gdi32.lib
 MPR		= mpr.lib
--- a/src/ChangeLog	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/ChangeLog	Tue Oct 09 08:52:57 2007 +0000
@@ -1,3 +1,85 @@
+2007-10-08  Martin Rudalics  <rudalics@gmx.at>
+
+	* keyboard.c (kbd_buffer_get_event): Break loop waiting for input
+	when there's an unread command event.
+
+	* frame.c (focus_follows_mouse): Moved here from frame.el to allow
+	window autoselection act appropriately when leaving selected frame.
+	(syms_of_frame): Initialize focus_follows_mouse.
+	* frame.h (focus_follows_mouse): Extern it.
+	* macterm.c (XTread_socket): When focus_follows_mouse is nil
+	make SELECT_WINDOW_EVENT only if we don't leave the selected
+	frame.
+	* msdos.c (dos_rawgetc): Likewise.
+	* w32term.c (w32_read_socket): Likewise.
+	* xterm.c (handle_one_xevent): Likewise.
+	* xdisp.c (syms_of_xdisp): In doc-string of
+	mouse-autoselect-window mention focus-follows-mouse.
+
+2007-10-08  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macterm.c (mac_load_query_font): Fix missing return value.
+	[USE_CG_DRAWING] (mac_define_fringe_bitmap, mac_destroy_fringe_bitmap):
+	Add BLOCK_INPUT.
+
+2007-10-08  Richard Stallman  <rms@gnu.org>
+
+	* xdisp.c (get_window_cursor_type): Implement documented behavior
+	for cursor-in-non-selected-windows = t.
+
+2007-10-08  Jason Rumney  <jasonr@gnu.org>
+
+	* w32.c (w32_get_resource): Always close registry keys.
+
+2007-10-08  Jason Rumney  <jasonr@gnu.org>
+
+	* makefile.w32-in (LIBS): Add COMCTL32.
+
+	* w32fns.c (globals_of_w32fns): Init common controls.
+
+2007-10-08  Richard Stallman  <rms@gnu.org>
+
+	* image.c (our_memory_buffer): Renamed from omfib_buffer.
+
+2007-10-08  Richard Stallman  <rms@gnu.org>
+
+	* buffer.c (Foverlays_at): Doc fix.
+
+2007-10-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* fns.c (Fplist_put): Preserve uneven tail data.
+
+2007-10-08  Peter O'Gorman  <bug-gnu-emacs@mlists.thewrittenword.com>  (tiny change)
+
+	* termhooks.h (enum event_kind): Remove trailing comma.
+
+	* frame.h (enum): Remove trailing comma.
+
+2007-10-08  Dhuvra Krishnamurthy  <dhuvrakm@gmail.com>  (tiny change)
+
+	* w32proc.c (delete_child): Don't terminate threads of zombies.
+
+2007-10-08  Martin Rudalics  <rudalics@gmx.at>
+
+	* keyboard.h (struct kboard): New elt Vlast_repeatable_command.
+
+	* keyboard.c (syms_of_keyboard): Set up new Lisp variable
+	last-repeatable-command.
+	(init_kboard): Initialize Vlast_repeatable_command.
+	(command_loop_1): Set it to real_this_command unless that was
+	bound to an input event.
+	(mark_kboards): Mark it.
+
+2007-10-08  Richard Stallman  <rms@gnu.org>
+
+	* eval.c (condition-case): Doc fix.
+
+2007-10-08  Masatake YAMATO  <jet@gyve.org>
+
+	* xfaces.c (tty_supports_face_attributes_p): Fix code
+	for LFACE_INVERSE_INDEX and LFACE_BACKGROUND_INDEX; code
+	was copied and not edited.
+
 2007-10-09  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	Add new `input-decode-map' keymap and use it for temrinal
@@ -1622,6 +1704,10 @@
 	customizable variable.  Rather explicitly check whether the
 	height of the window that shall be splitted is at least as large
 	as split_height_threshold.
+	(Fwindow_full_width_p): New defun.
+	(syms_of_window): Defsubr it.
+
+	* window.h: Add EXFUN for Fwindow_full_width_p.
 
 2007-07-14  Jason Rumney  <jasonr@gnu.org>
 
--- a/src/ChangeLog.10	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/ChangeLog.10	Tue Oct 09 08:52:57 2007 +0000
@@ -1,4 +1,391 @@
+<<<<<<< TREE
 2007-04-24  Chong Yidong  <cyd@stupidchicken.com>
+=======
+2007-10-06  Martin Rudalics  <rudalics@gmx.at>
+
+	* keyboard.c (kbd_buffer_get_event): Break loop waiting for input
+	when there's an unread command event.
+
+	* frame.c (focus_follows_mouse): Moved here from frame.el to allow
+	window autoselection act appropriately when leaving selected frame.
+	(syms_of_frame): Initialize focus_follows_mouse.
+	* frame.h (focus_follows_mouse): Extern it.
+	* macterm.c (XTread_socket): When focus_follows_mouse is nil
+	make SELECT_WINDOW_EVENT only if we don't leave the selected
+	frame.
+	* msdos.c (dos_rawgetc): Likewise.
+	* w32term.c (w32_read_socket): Likewise.
+	* xterm.c (handle_one_xevent): Likewise.
+	* xdisp.c (syms_of_xdisp): In doc-string of
+	mouse-autoselect-window mention focus-follows-mouse.
+
+2007-10-06  Andreas Schwab  <schwab@suse.de>
+
+	* fileio.c (Fwrite_region): Ignore EINVAL error from fsync.
+
+2007-10-05  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macterm.c (mac_load_query_font): Fix missing return value.
+	[USE_CG_DRAWING] (mac_define_fringe_bitmap, mac_destroy_fringe_bitmap):
+	Add BLOCK_INPUT.
+
+2007-10-04  Juanma Barranquero  <lekktu@gmail.com>
+
+	* image.c (syms_of_image) <image-types>: Fix typo in docstring.
+
+2007-10-02  Richard Stallman  <rms@gnu.org>
+
+	* xdisp.c (get_window_cursor_type): Implement documented behavior
+	for cursor-in-non-selected-windows = t.
+
+2007-10-01  Juanma Barranquero  <lekktu@gmail.com>
+
+       * lread.c (Fload): Fix typo in docstring.
+
+2007-09-29  Juri Linkov  <juri@jurta.org>
+
+	* emacs.c (standard_args): Change priority of "--no-splash"
+	from 40 to 3.  Add "--no-desktop" with the same priority.
+
+2007-09-29  Jason Rumney  <jasonr@gnu.org>
+
+	* w32.c (w32_get_resource): Always close registry keys.
+
+2007-09-27  Jason Rumney  <jasonr@gnu.org>
+
+	* makefile.w32-in (LIBS): Add COMCTL32.
+
+	* w32fns.c (globals_of_w32fns): Init common controls.
+
+2007-09-21  Richard Stallman  <rms@gnu.org>
+
+	* image.c (our_memory_buffer): Renamed from omfib_buffer.
+
+2007-09-21  Juanma Barranquero  <lekktu@gmail.com>
+
+	* w32term.c (x_draw_glyph_string): Use strike_through_color, not
+	underline_color, to draw strike-through.
+
+2007-09-20  Glenn Morris  <rgm@gnu.org>
+
+	* process.c (Fmake_network_process): Doc fix.
+
+2007-09-19  Richard Stallman  <rms@gnu.org>
+
+	* buffer.c (Foverlays_at): Doc fix.
+
+2007-09-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* fns.c (Fplist_put): Preserve uneven tail data.
+
+2007-09-16  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* gtkutil.c (xg_get_image_for_pixmap): Always create a GdkPixbuf
+	when we have no file name for the icon.
+	(xg_tool_bar_expose_callback): Remove.
+	(xg_create_tool_bar): Don't connect expose signal to
+	xg_tool_bar_expose_callback.
+
+2007-09-16  Andreas Schwab  <schwab@suse.de>
+
+	* alloc.c (reset_malloc_hooks): Set the hooks to the previous
+	values instead of zapping them.
+
+2007-09-15  Glenn Morris  <rgm@gnu.org>
+
+	* s/hpux.h: No longer define `static' as nothing.
+
+2007-09-14  Glenn Morris  <rgm@gnu.org>
+
+	* fringe.c (init_fringe_bitmap) <swap nibble>: Move to file scope.
+	* gtkutil.c (xg_separator_p) <separator_names>: Move to file scope.
+	* image.c (our_memory_fill_input_buffer) <buffer>: Move to file
+	scope and rename to omfib_buffer for clarity.
+	(gif_load) <interlace_start, interlace_increment>: Move to file scope.
+
+2007-09-14  Peter O'Gorman  <bug-gnu-emacs@mlists.thewrittenword.com>  (tiny change)
+
+	* gtkutil.c (xg_get_file_with_chooser): Move GCPRO1 after declarations.
+
+	* termhooks.h (enum event_kind): Remove trailing comma.
+
+	* frame.h (enum): Remove trailing comma.
+
+2007-09-14  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* keyboard.c, xterm.c, xfaces.c (abs): #undef before #define.
+
+2007-09-12  Glenn Morris  <rgm@gnu.org>
+
+	* gtkutil.c (cnt): Rename to menu_grab_callback_cnt for clarity.
+	(menu_grab_callback): All uses changed.
+
+	* xselect.c (cnt): Rename to x_reply_selection_request_cnt for clarity.
+	(x_reply_selection_request): All uses changed.
+
+2007-09-06  Pixel  <pixel@mandriva.com>  (tiny change)
+
+	* image.c (gif_load): Fix bug: Handle nonexistent colormap.
+
+2007-09-06  Glenn Morris  <rgm@gnu.org>
+
+	* gtkutil.c (menu_grab_callback) <cnt>:
+	* xselect.c (x_reply_selection_request) <cnt>: Move static
+	variable to file scope.
+
+2007-09-02  Dhuvra Krishnamurthy  <dhuvrakm@gmail.com>  (tiny change)
+
+	* w32proc.c (delete_child): Don't terminate threads of zombies.
+
+2007-09-02  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* keyboard.c: Qrtl is new.
+	(parse_tool_bar_item): Handle :rtl keyword.
+	(syms_of_keyboard): Intern :rtl keyword.
+
+	* dispextern.h (enum tool_bar_item_idx): Add TOOL_BAR_ITEM_RTL_IMAGE.
+
+	* gtkutil.c (file_for_image, find_rtl_image): New functions.
+	(xg_get_image_for_pixmap): Use file_for_image
+	(update_frame_tool_bar): If direction is RTL, use RTL image if
+	defined.  Use Gtk stock images or named theme icons if defined.
+
+2007-08-29  Martin Rudalics  <rudalics@gmx.at>
+
+	* keyboard.h (struct kboard): New elt Vlast_repeatable_command.
+
+	* keyboard.c (syms_of_keyboard): Set up new Lisp variable
+	last-repeatable-command.
+	(init_kboard): Initialize Vlast_repeatable_command.
+	(command_loop_1): Set it to real_this_command unless that was
+	bound to an input event.
+	(mark_kboards): Mark it.
+
+2007-08-28  Juanma Barranquero  <lekktu@gmail.com>
+
+	* image.c (syms_of_image) <image-library-alist, cross-disabled-images>:
+	Doc fixes.
+
+2007-08-28  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* gtkutil.c (xg_tool_bar_expose_callback): Just do SET_FRAME_GARBAGED
+	so no Lisp code is executed.
+
+2007-08-27  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macterm.c (x_draw_composite_glyph_string_foreground): Draw rectangle
+	for nonexistent or zero-width glyph in composition glyph.
+
+2007-08-27  Richard Stallman  <rms@gnu.org>
+
+	* eval.c (condition-case): Doc fix.
+
+2007-08-27  Masatake YAMATO  <jet@gyve.org>
+
+	* xfaces.c (tty_supports_face_attributes_p): Fix code
+	for LFACE_INVERSE_INDEX and LFACE_BACKGROUND_INDEX; code
+	was copied and not edited.
+
+2007-08-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* lread.c (load_warn_old_style_backquotes): Fix up array size typo.
+
+2007-08-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* lread.c (Qold_style_backquotes): New var.
+	(syms_of_lread): Init and staticpro it.
+	(load_warn_old_style_backquotes): New fun.
+	(Fload): Use them to warn about old style backquotes.
+	(end_of_file_error, Fload): Remove unused vars.
+
+	* lisp.h (Fclear_face_cache, Fx_send_client_event): Declare.
+
+	* lread.c (Vold_style_backquotes): New var.
+	(syms_of_lread): Init and export it to Elisp.
+	(read1): Set it when we find an old-style (back)quote.
+
+2007-08-22  Jason Rumney  <jasonr@gnu.org>
+
+	* w32reg.c (SYSTEM_DEFAULT_RESOURCES): Add missing NULL terminator.
+
+2007-08-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* insdel.c (reset_var_on_error): New fun.
+	(signal_before_change, signal_after_change):
+	Use it to reset (after|before)-change-functions to nil in case of error.
+	Bind inhibit-modification-hooks to t.
+	Don't bind (after|before)-change-functions to nil while they run.
+
+2007-08-19  Andreas Schwab  <schwab@suse.de>
+
+	* alloc.c (pure): Round PURESIZE up.
+
+2007-08-17  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* xterm.c (handle_one_xevent): Remove check that mouse click is in
+	active frame.
+
+2007-08-15  Philippe Waroquiers  <philippe.waroquiers@eurocontrol.int>
+
+	* term.c (tty_default_color_capabilities): Declare static
+	variables in file scope, to avoid HPUX compiler problem.
+
+2007-08-13  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* gtkutil.c (update_frame_tool_bar): Use -1 as index
+	to gtk_toolbar_insert.
+
+2007-08-11  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* xterm.c (x_draw_image_glyph_string): Adjust stipple origin when
+	filling pixmap with stippled background.
+
+2007-08-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* print.c (new_backquote_output): Rename from old_backquote_output.
+	(print): Inverse its logic (according to its name) so as to match the
+	behavior of new_backquote_flag in lread.c.
+
+2007-08-09  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* gmalloc.c (posix_memalign): New function.
+
+2007-08-08  Glenn Morris  <rgm@gnu.org>
+
+	* Replace `iff' in doc-strings and comments.
+
+2007-08-07  Chong Yidong  <cyd@stupidchicken.com>
+
+	* dispextern.h (struct image): New members.
+
+	* image.c: Sync to trunk version.
+	(search_image_cache, uncache_image, image-refresh): New functions.
+	Check for fg and bg colors.
+	(lookup_image): Use search_image_cache.  Cache fg and bg colors.
+	(pbm_load): Another check for invalid image data.
+	(png_load): Ignore default background field.
+
+	* xdisp.c (move_it_by_lines): Remove incorrect optimization.
+
+2007-08-07  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* gmalloc.c (__malloc_initialize): Remove pthread_once.  Not needed.
+
+2007-08-07  Sam Steingold  <sds@gnu.org>
+
+	* gmalloc.c (__morecore): Fix the declaration to comply with the
+	definition.
+
+2007-08-07  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* emacs.c (main)
+	[HAVE_GTK_AND_PTHREAD && !SYSTEM_MALLOC && !DOUG_LEA_MALLOC]:
+	Call malloc_enable_thread on interactive startup.
+
+	* gmalloc.c (_malloc_thread_enabled_p) [USE_PTHREAD]: New variable.
+	(LOCK, UNLOCK, LOCK_ALIGNED_BLOCKS, UNLOCK_ALIGNED_BLOCKS)
+	[USE_PTHREAD]: Conditionalize with it.
+	(malloc_atfork_handler_prepare, malloc_atfork_handler_parent)
+	(malloc_atfork_handler_child, malloc_enable_thread) [USE_PTHREAD]:
+	New functions.
+
+2007-08-06  Chong Yidong  <cyd@stupidchicken.com>
+
+	* xdisp.c (redisplay_window): When restoring original buffer
+	position, make sure it is still valid.
+
+2007-08-06  Martin Rudalics  <rudalics@gmx.at>
+
+	* window.c (window_min_size_2): New function.
+	(window_min_size_1, size_window, Fdisplay_buffer)
+	(Fsplit_window, adjust_window_trailing_edge): Use it to avoid
+	windows without mode- or header-lines when window-min-height is
+	too small.
+	(size_window): Reset nodelete_p after testing it, following an
+	earlier note by Kim F. Storm.
+	(display_buffer): Do not set split_height_threshold to twice the
+	value of window_min_height to avoid changing the value of a
+	customizable variable.  Rather explicitly check whether the
+	height of the window that shall be splitted is at least as large
+	as split_height_threshold.
+	(Fwindow_full_width_p): New defun.
+	(syms_of_window): Defsubr it.
+
+	* window.h: Add EXFUN for Fwindow_full_width_p.
+
+2007-08-06  Andreas Schwab  <schwab@suse.de>
+
+	* window.c (Fdisplay_buffer): Use NILP.
+	(Fset_window_scroll_bars): Likewise.
+
+2007-08-03  Richard Stallman  <rms@gnu.org>
+
+	* fileio.c (Fvisited_file_modtime): Use make_time.
+
+2007-08-01  Ryo Yoshitake  <ryo@shiftmode.net>  (tiny change)
+
+	* mac.c (init_mac_osx_environment): Adjust load-path on self-contained
+	build.
+
+2007-07-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* eval.c (init_eval_once): Bump max_lisp_eval_depth to 400.
+
+2007-07-25  Glenn Morris  <rgm@gnu.org>
+
+	* Relicense all FSF files to GPLv3 or later.
+
+	* COPYING: Switch to GPLv3.
+
+2007-07-24  Jason Rumney  <jasonr@gnu.org>
+
+	* w32fns.c (x_real_positions): Get real position from OS instead of
+	calculating it.
+
+2007-07-23  Jason Rumney  <jasonr@gnu.org>
+
+	* filelock.c (current_lock_owner): Allow for @ sign in username.
+
+2007-07-20  Eli Zaretskii  <eliz@gnu.org>
+
+	* makefile.w32-in (clean): Don't delete *~.
+
+	* w32proc.c (IMAGE_NT_OPTIONAL_HDR32_MAGIC, IMAGE_OPTIONAL_HEADER32):
+	Define if not defined.
+
+2007-07-18  Jason Rumney  <jasonr@gnu.org>
+
+	* w32proc.c (w32_executable_type): Handle 64 bit executables.
+
+2007-07-16  Juanma Barranquero  <lekktu@gmail.com>
+
+	* coding.c (Ffind_operation_coding_system):
+	* eval.c (For, Fand, Fprogn):
+	* keyboard.c (Ftrack_mouse):
+	* print.c (Fwith_output_to_temp_buffer):
+	* window.c (Fsave_window_excursion): Doc fixes (some reported
+	by Johan Bockg,Ae(Brd).
+
+2007-07-15  Richard Stallman  <rms@gnu.org>
+
+	* data.c (Fsetq_default): Doc fix.
+
+	* eval.c (Fsetq): Doc fix.
+
+2007-07-11  Jason Rumney  <jasonr@gnu.org>
+
+	* makefile.w32-in (LIBS): Include OLE32.
+
+	* w32fns.c (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
+	(w32_msg_pump) <WM_DESTROY>: Uninitialize COM.
+
+2007-06-28  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macterm.c [USE_MAC_TSM] (mac_handle_text_input_event):
+	Check WINDOWP before using XWINDOW.
+
+2007-06-27  Juanma Barranquero  <lekktu@gmail.com>
+>>>>>>> MERGE-SOURCE
 
 	* Branch for 22.1.
 
--- a/src/buffer.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/buffer.c	Tue Oct 09 08:52:57 2007 +0000
@@ -3968,7 +3968,7 @@
 
 
 DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0,
-       doc: /* Return a list of the overlays that contain position POS.  */)
+       doc: /* Return a list of the overlays that contain the character at POS.  */)
      (pos)
      Lisp_Object pos;
 {
--- a/src/eval.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/eval.c	Tue Oct 09 08:52:57 2007 +0000
@@ -1355,14 +1355,15 @@
 If an error happens, the first applicable handler is run.
 
 The car of a handler may be a list of condition names
-instead of a single condition name.
-
-When a handler handles an error,
-control returns to the condition-case and the handler BODY... is executed
-with VAR bound to (SIGNALED-CONDITIONS . SIGNAL-DATA).
-VAR may be nil; then you do not get access to the signal information.
-
-The value of the last BODY form is returned from the condition-case.
+instead of a single condition name.  Then it handles all of them.
+
+When a handler handles an error, control returns to the `condition-case'
+and it executes the handler's BODY...
+with VAR bound to (SIGNALED-CONDITIONS . SIGNAL-DATA) from the error.
+(If VAR is nil, the handler can't access that information.)
+Then the value of the last BODY form is returned from the `condition-case'
+expression.
+
 See also the function `signal' for more info.
 usage: (condition-case VAR BODYFORM &rest HANDLERS)  */)
      (args)
--- a/src/fns.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/fns.c	Tue Oct 09 08:52:57 2007 +0000
@@ -2060,7 +2060,7 @@
       prev = tail;
       QUIT;
     }
-  newcell = Fcons (prop, Fcons (val, Qnil));
+  newcell = Fcons (prop, Fcons (val, NILP (prev) ? plist : XCDR (XCDR (prev))));
   if (NILP (prev))
     return newcell;
   else
--- a/src/frame.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/frame.c	Tue Oct 09 08:52:57 2007 +0000
@@ -123,6 +123,8 @@
 Lisp_Object Vmouse_position_function;
 Lisp_Object Vmouse_highlight;
 Lisp_Object Vdelete_frame_functions;
+
+int focus_follows_mouse;
 
 static void
 set_menu_bar_lines_1 (window, n)
@@ -4492,6 +4494,21 @@
 
 This variable is local to the current terminal and cannot be buffer-local.  */);
 
+  DEFVAR_BOOL ("focus-follows-mouse", &focus_follows_mouse,
+	       doc: /* Non-nil if window system changes focus when you move the mouse.
+You should set this variable to tell Emacs how your window manager
+handles focus, since there is no way in general for Emacs to find out
+automatically.  */);
+#ifdef HAVE_WINDOW_SYSTEM
+#if defined(HAVE_NTGUI) || defined(MAC_OS)
+  focus_follows_mouse = 0;
+#else
+  focus_follows_mouse = 1;
+#endif
+#else
+  focus_follows_mouse = 0;
+#endif
+	 
   staticpro (&Vframe_list);
 
   defsubr (&Sactive_minibuffer_window);
--- a/src/frame.h	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/frame.h	Tue Oct 09 08:52:57 2007 +0000
@@ -37,6 +37,11 @@
 
 extern int message_buf_print;
 
+/* Nonzero means window system changes focus when moving the
+   mouse.  */
+
+extern int focus_follows_mouse;
+
 
 /* The structure representing a frame.  */
 
@@ -1030,7 +1035,7 @@
   FULLSCREEN_WIDTH      = 1,
   FULLSCREEN_HEIGHT     = 2,
   FULLSCREEN_BOTH       = 3,
-  FULLSCREEN_WAIT       = 4,
+  FULLSCREEN_WAIT       = 4
 };
 
 
--- a/src/keyboard.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/keyboard.c	Tue Oct 09 08:52:57 2007 +0000
@@ -1612,6 +1612,8 @@
   /* Do this after running Vpost_command_hook, for consistency.  */
   current_kboard->Vlast_command = Vthis_command;
   current_kboard->Vreal_last_command = real_this_command;
+  if (!CONSP (last_command_char))
+    current_kboard->Vlast_repeatable_command = real_this_command;
 
   while (1)
     {
@@ -1987,6 +1989,8 @@
 	{
 	  current_kboard->Vlast_command = Vthis_command;
 	  current_kboard->Vreal_last_command = real_this_command;
+	  if (!CONSP (last_command_char))
+	    current_kboard->Vlast_repeatable_command = real_this_command;
 	  cancel_echoing ();
 	  this_command_key_count = 0;
 	  this_command_key_count_reset = 0;
@@ -4098,6 +4102,12 @@
   /* Wait until there is input available.  */
   for (;;)
     {
+      /* Break loop if there's an unread command event.  Needed in
+	 moused window autoselection which uses a timer to insert such
+	 events.  */
+      if (CONSP (Vunread_command_events))
+	break;
+      
       if (kbd_fetch_ptr != kbd_store_ptr)
 	break;
 #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
@@ -11483,6 +11493,7 @@
   kb->Vlast_command = Qnil;
   kb->Vreal_last_command = Qnil;
   kb->Vkeyboard_translate_table = Qnil;
+  kb->Vlast_repeatable_command = Qnil;
   kb->Vprefix_arg = Qnil;
   kb->Vlast_prefix_arg = Qnil;
   kb->kbd_queue = Qnil;
@@ -11990,6 +12001,11 @@
   DEFVAR_KBOARD ("real-last-command", Vreal_last_command,
 		 doc: /* Same as `last-command', but never altered by Lisp code.  */);
 
+  DEFVAR_KBOARD ("last-repeatable-command", Vlast_repeatable_command,
+		 doc: /* Last command that may be repeated.
+The last command executed that was not bound to an input event.
+This is the command `repeat' will try to repeat.  */);
+
   DEFVAR_LISP ("this-command", &Vthis_command,
 	       doc: /* The command now being executed.
 The command can set this variable; whatever is put here
@@ -12461,6 +12477,7 @@
       mark_object (kb->Vlast_command);
       mark_object (kb->Vreal_last_command);
       mark_object (kb->Vkeyboard_translate_table);
+      mark_object (kb->Vlast_repeatable_command);
       mark_object (kb->Vprefix_arg);
       mark_object (kb->Vlast_prefix_arg);
       mark_object (kb->kbd_queue);
--- a/src/keyboard.h	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/keyboard.h	Tue Oct 09 08:52:57 2007 +0000
@@ -87,6 +87,9 @@
     /* User-supplied table to translate input characters through.  */
     Lisp_Object Vkeyboard_translate_table;
     
+    /* Last command that may be repeated by `repeat'.  */
+    Lisp_Object Vlast_repeatable_command;
+
     /* The prefix argument for the next command, in raw form.  */
     Lisp_Object Vprefix_arg;
 
--- a/src/macterm.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/macterm.c	Tue Oct 09 08:52:57 2007 +0000
@@ -2360,6 +2360,9 @@
 
   for (i = 0; i < h; i++)
     bits[i] = ~bits[i];
+
+  BLOCK_INPUT;
+
   provider = CGDataProviderCreateWithData (NULL, bits,
 					   sizeof (unsigned short) * h, NULL);
   if (provider)
@@ -2369,6 +2372,8 @@
 					     provider, NULL, 0);
       CGDataProviderRelease (provider);
     }
+
+  UNBLOCK_INPUT;
 }
 
 static void
@@ -2379,7 +2384,11 @@
     return;
 
   if (fringe_bmp[which])
-    CGImageRelease (fringe_bmp[which]);
+    {
+      BLOCK_INPUT;
+      CGImageRelease (fringe_bmp[which]);
+      UNBLOCK_INPUT;
+    }
   fringe_bmp[which] = 0;
 }
 #endif
@@ -8757,7 +8766,7 @@
 
       font_id = atsu_find_font_from_family_name (family);
       if (font_id == kATSUInvalidFontID)
-	return;
+	return NULL;
       size_fixed = Long2Fix (size);
       bold_p = (fontface & bold) != 0;
       italic_p = (fontface & italic) != 0;
@@ -12148,7 +12157,13 @@
 			     will be selected only when it is active.  */
 			  if (WINDOWP (window)
 			      && !EQ (window, last_window)
-			      && !EQ (window, selected_window))
+			      && !EQ (window, selected_window)
+			      /* For click-to-focus window managers
+			         create event iff we don't leave the
+			         selected frame.  */
+			      && (focus_follows_mouse
+				  || (EQ (XWINDOW (window)->frame,
+					  XWINDOW (selected_window)->frame))))
 			    {
 			      inev.kind = SELECT_WINDOW_EVENT;
 			      inev.frame_or_window = window;
--- a/src/makefile.w32-in	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/makefile.w32-in	Tue Oct 09 08:52:57 2007 +0000
@@ -148,6 +148,7 @@
 	$(SHELL32)	\
 	$(WINSPOOL)	\
 	$(OLE32)	\
+	$(COMCTL32)	\
 	$(libc)
 
 #
--- a/src/msdos.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/msdos.c	Tue Oct 09 08:52:57 2007 +0000
@@ -3393,7 +3393,13 @@
 		 it is active.  */
 	      if (WINDOWP (mouse_window)
 		  && !EQ (mouse_window, last_mouse_window)
-		  && !EQ (mouse_window, selected_window))
+		  && !EQ (window, selected_window)
+		  /* For click-to-focus window managers
+		     create event iff we don't leave the
+		     selected frame.  */
+		  && (focus_follows_mouse
+		      || (EQ (XWINDOW (window)->frame,
+			      XWINDOW (selected_window)->frame))))
 		{
 		  event.kind = SELECT_WINDOW_EVENT;
 		  event.frame_or_window = mouse_window;
--- a/src/s/hpux.h	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/s/hpux.h	Tue Oct 09 08:52:57 2007 +0000
@@ -173,7 +173,9 @@
    longer needed.  Try uncommenting the following if you have problems
    on older versions.  */
 
-/*#define static */
+/* This is unnecessary in HPUX versions 10.20, 11.0, 11.11, 11.23.  */
+
+/* #define static  */
 
 /* Define extra libraries to load.
    This should have -lBSD, but that library is said to make
--- a/src/termhooks.h	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/termhooks.h	Tue Oct 09 08:52:57 2007 +0000
@@ -185,7 +185,7 @@
 
   /* Queued from XTread_socket when session manager sends
      save yourself before shutdown. */
-  SAVE_SESSION_EVENT,
+  SAVE_SESSION_EVENT
 
 #ifdef MAC_OS
   /* Generated when an Apple event, a HICommand event, or a Services
@@ -194,11 +194,11 @@
      symbols, respectively.  Member `arg' is a Lisp object converted
      from the received Apple event.  Parameters for non-Apple events
      are converted to those in Apple events.  */
-  MAC_APPLE_EVENT,
+  , MAC_APPLE_EVENT
 #endif
 
 #ifdef HAVE_GPM
-  GPM_CLICK_EVENT
+  , GPM_CLICK_EVENT
 #endif
 };
 
--- a/src/w32.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/w32.c	Tue Oct 09 08:52:57 2007 +0000
@@ -927,6 +927,7 @@
 	  && (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL
 	  && RegQueryValueEx (hrootkey, key, NULL, lpdwtype, lpvalue, &cbData) == ERROR_SUCCESS)
 	{
+          RegCloseKey (hrootkey);
 	  return (lpvalue);
 	}
 
@@ -943,6 +944,7 @@
 	  && (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL
 	  && RegQueryValueEx (hrootkey, key, NULL, lpdwtype, lpvalue, &cbData) == ERROR_SUCCESS)
 	{
+          RegCloseKey (hrootkey);
 	  return (lpvalue);
 	}
 
--- a/src/w32fns.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/w32fns.c	Tue Oct 09 08:52:57 2007 +0000
@@ -48,6 +48,7 @@
 
 #include "bitmaps/gray.xbm"
 
+#include <commctrl.h>
 #include <commdlg.h>
 #include <shellapi.h>
 #include <ctype.h>
@@ -9100,6 +9101,9 @@
 	      &w32_ansi_code_page,
 	      doc: /* The ANSI code page used by the system.  */);
   w32_ansi_code_page = GetACP ();
+
+  /* MessageBox does not work without this when linked to comctl32.dll 6.0.  */
+  InitCommonControls ();
 }
 
 #undef abort
--- a/src/w32proc.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/w32proc.c	Tue Oct 09 08:52:57 2007 +0000
@@ -216,12 +216,18 @@
 	  /* let the thread exit cleanly if possible */
 	  cp->status = STATUS_READ_ERROR;
 	  SetEvent (cp->char_consumed);
+#if 0
+          /* We used to forceably terminate the thread here, but it
+             is normally unnecessary, and in abnormal cases, the worst that
+             will happen is we have an extra idle thread hanging around
+             waiting for the zombie process.  */
 	  if (WaitForSingleObject (cp->thrd, 1000) != WAIT_OBJECT_0)
 	    {
 	      DebPrint (("delete_child.WaitForSingleObject (thread) failed "
 			 "with %lu for fd %ld\n", GetLastError (), cp->fd));
 	      TerminateThread (cp->thrd, 0);
 	    }
+#endif
 	}
       CloseHandle (cp->thrd);
       cp->thrd = NULL;
--- a/src/w32term.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/w32term.c	Tue Oct 09 08:52:57 2007 +0000
@@ -4380,7 +4380,13 @@
 		     only when it is active.  */
 		  if (WINDOWP(window)
 		      && !EQ (window, last_window)
-		      && !EQ (window, selected_window))
+		      && !EQ (window, selected_window)
+		      /* For click-to-focus window managers
+			 create event iff we don't leave the
+			 selected frame.  */
+		      && (focus_follows_mouse
+			  || (EQ (XWINDOW (window)->frame,
+				  XWINDOW (selected_window)->frame))))
 		    {
 		      inev.kind = SELECT_WINDOW_EVENT;
 		      inev.frame_or_window = window;
--- a/src/xdisp.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/xdisp.c	Tue Oct 09 08:52:57 2007 +0000
@@ -21355,7 +21355,7 @@
       non_selected = 1;
     }
 
-  /* Nonselected window or nonselected frame.  */
+  /* Detect a nonselected window or nonselected frame.  */
   else if (w != XWINDOW (f->selected_window)
 #ifdef HAVE_WINDOW_SYSTEM
 	   || f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame
@@ -21374,13 +21374,6 @@
   if (NILP (b->cursor_type))
     return NO_CURSOR;
 
-  /* Use cursor-in-non-selected-windows for non-selected window or frame.  */
-  if (non_selected)
-    {
-      alt_cursor = b->cursor_in_non_selected_windows;
-      return get_specified_cursor_type (alt_cursor, width);
-    }
-
   /* Get the normal cursor type for this window.  */
   if (EQ (b->cursor_type, Qt))
     {
@@ -21390,6 +21383,21 @@
   else
     cursor_type = get_specified_cursor_type (b->cursor_type, width);
 
+  /* Use cursor-in-non-selected-windows instead
+     for non-selected window or frame.  */
+  if (non_selected)
+    {
+      alt_cursor = b->cursor_in_non_selected_windows;
+      if (!EQ (Qt, alt_cursor))
+	return get_specified_cursor_type (alt_cursor, width);
+      /* t means modify the normal cursor type.  */
+      if (cursor_type == FILLED_BOX_CURSOR)
+	cursor_type = HOLLOW_BOX_CURSOR;
+      else if (cursor_type == BAR_CURSOR && *width > 1)
+	--*width;
+      return cursor_type;
+    }
+
   /* Use normal cursor if not blinked off.  */
   if (!w->cursor_off_p)
     {
@@ -24194,7 +24202,10 @@
 mouse pointer enters it.
 
 Autoselection selects the minibuffer only if it is active, and never
-unselects the minibuffer if it is active.  */);
+unselects the minibuffer if it is active.
+
+When customizing this variable make sure that the actual value of
+`focus-follows-mouse' matches the behavior of your window manager.  */);
   Vmouse_autoselect_window = Qnil;
 
   DEFVAR_LISP ("auto-resize-tool-bars", &Vauto_resize_tool_bars,
--- a/src/xfaces.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/xfaces.c	Tue Oct 09 08:52:57 2007 +0000
@@ -6085,7 +6085,7 @@
   val = attrs[LFACE_INVERSE_INDEX];
   if (!UNSPECIFIEDP (val))
     {
-      if (face_attr_equal_p (val, def_attrs[LFACE_UNDERLINE_INDEX]))
+      if (face_attr_equal_p (val, def_attrs[LFACE_INVERSE_INDEX]))
 	return 0;		/* same as default */
       else
 	test_caps |= TTY_CAP_INVERSE;
@@ -6128,7 +6128,7 @@
   bg = attrs[LFACE_BACKGROUND_INDEX];
   if (STRINGP (bg))
     {
-      Lisp_Object def_bg = def_attrs[LFACE_FOREGROUND_INDEX];
+      Lisp_Object def_bg = def_attrs[LFACE_BACKGROUND_INDEX];
 
       if (face_attr_equal_p (bg, def_bg))
 	return 0;		/* same as default */
--- a/src/xterm.c	Tue Oct 09 08:44:02 2007 +0000
+++ b/src/xterm.c	Tue Oct 09 08:52:57 2007 +0000
@@ -6715,7 +6715,13 @@
                    will be selected only when it is active.  */
                 if (WINDOWP (window)
                     && !EQ (window, last_window)
-                    && !EQ (window, selected_window))
+		    && !EQ (window, selected_window)
+		    /* For click-to-focus window managers
+		       create event iff we don't leave the
+		       selected frame.  */
+		    && (focus_follows_mouse
+			|| (EQ (XWINDOW (window)->frame,
+				XWINDOW (selected_window)->frame))))
                   {
                     inev.ie.kind = SELECT_WINDOW_EVENT;
                     inev.ie.frame_or_window = window;