changeset 83096:eb7e8d483840

Merged in changes from CVS trunk Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-200 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-201 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-202 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-203 Add entry for macroexpand-all to NEWS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-204 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-205 Add macroexpand-all to lisp reference manual * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-206 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-207 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-208 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-209 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-210 More RCS keyword removal * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-211 File-permission tweaks * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-212 Checkout from CVS with unexpanded RCS keywords git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-136
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 13 Apr 2004 17:17:13 +0000
parents b448166f5664 (current diff) 746c40973d25 (diff)
children 01716205773e
files etc/ONEWS etc/cs-survival.tex etc/fr-survival.tex etc/pl-refcard.tex etc/sk-survival.tex etc/termcap.src leim/CXTERM-DIC/4Corner.tit leim/CXTERM-DIC/CCDOSPY.tit leim/CXTERM-DIC/Punct.tit leim/CXTERM-DIC/QJ.tit leim/CXTERM-DIC/SW.tit leim/CXTERM-DIC/TONEPY.tit lib-src/b2m.pl lib-src/rcs2log lib-src/vcdiff lisp/ChangeLog lisp/allout.el lisp/emacs-lisp/bytecomp.el lisp/loadup.el lisp/url/url-about.el lisp/url/url-auth.el lisp/url/url-cache.el lisp/url/url-cookie.el lisp/url/url-dav.el lisp/url/url-file.el lisp/url/url-handlers.el lisp/url/url-history.el lisp/url/url-http.el lisp/url/url-https.el lisp/url/url-ldap.el lisp/url/url-mailto.el lisp/url/url-methods.el lisp/url/url-news.el lisp/url/url-parse.el lisp/url/url-util.el lisp/url/url-vars.el lisp/url/url.el lisp/vc-cvs.el lisp/vc-hooks.el lisp/vc-rcs.el lisp/vc-sccs.el lisp/vc.el lispintro/mkinstalldirs lispref/mkinstalldirs man/eshell.texi man/mh-e.texi man/pcl-cvs.texi man/speedbar.texi man/woman.texi mkinstalldirs src/Makefile.in src/buffer.c
diffstat 73 files changed, 2413 insertions(+), 547 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Tue Apr 13 17:12:30 2004 +0000
+++ b/etc/NEWS	Tue Apr 13 17:17:13 2004 +0000
@@ -150,6 +150,9 @@
 
 ** M-x diff uses diff-mode instead of compilation-mode.
 
+** M-x compare-windows now can automatically skip non-matching text to
+resync points in both windows.
+
 ** New command `strokes-global-set-stroke-string'.
 This is like `strokes-global-set-stroke', but it allows you to bind
 the stroke directly to a string to insert.  This is convenient for
@@ -329,6 +332,31 @@
 ** New command `kill-whole-line' kills an entire line at once.
 By default, it is bound to C-S-<backspace>.
 
+** Dired mode:
+
+*** New faces dired-header, dired-mark, dired-marked, dired-flagged,
+dired-ignored, dired-directory, dired-symlink, dired-warning
+introduced for Dired mode instead of font-lock faces.
+
+*** New Dired command `dired-compare-directories' to mark files with
+different file attributes in two dired buffers.
+
++++
+*** In Dired's ! command (dired-do-shell-command), `*' and `?' now
+control substitution of the file names only when they are surrounded
+by whitespace.  This means you can now use them as shell wildcards
+too.  If you want to use just plain `*' as a wildcard, type `*""'; the
+doublequotes make no difference in the shell, but they prevent
+special treatment in `dired-do-shell-command'.
+
++++
+*** Dired's v command now runs external viewers to view certain
+types of files.  The variable `dired-view-command-alist' controls
+what external viewers to use and when.
+
+*** In Dired, the w command now copies the current line's file name
+into the kill ring.
+
 ** Info mode:
 +++
 *** Info now hides node names in menus and cross references by default.
@@ -339,6 +367,12 @@
 Info files on your system for a string, and builds a menu of the
 possible matches.
 
++++
+*** The default value for `Info-scroll-prefer-subnodes' is now nil.
+
+---
+*** Info-index offers completion.
+
 ** Support for the SQLite interpreter has been added to sql.el by calling
 'sql-sqlite'.
 
@@ -755,9 +789,6 @@
 in a directory or in a file.  See the documentation of the user option
 `display-time-mail-directory'.
 
-+++
-** The default value for `Info-scroll-prefer-subnodes' is now nil.
-
 ---
 ** LDAP support now defaults to ldapsearch from OpenLDAP version 2.
 
@@ -815,9 +846,6 @@
 screen size.  (For now, this does not work with some window managers.)
 
 ---
-** Info-index offers completion.
-
----
 ** Emacs now tries to set up buffer coding systems for HTML/XML files
 automatically.
 
@@ -953,19 +981,6 @@
 changes the behavior of motion commands like C-e and C-p.
 
 +++
-** In Dired's ! command (dired-do-shell-command), `*' and `?' now
-control substitution of the file names only when they are surrounded
-by whitespace.  This means you can now use them as shell wildcards
-too.  If you want to use just plain `*' as a wildcard, type `*""'; the
-doublequotes make no difference in the shell, but they prevent
-special treatment in `dired-do-shell-command'.
-
-+++
-** Dired's v command now runs external viewers to view certain
-types of files.  The variable `dired-view-command-alist' controls
-what external viewers to use and when.
-
-+++
 ** Unquoted `$' in file names do not signal an error any more when
 the corresponding environment variable does not exist.
 Instead, the `$ENVVAR' text is left as is, so that `$$' quoting
@@ -1033,9 +1048,6 @@
 if the arg is negative, it marks the current and the preceding
 paragraphs.
 
-** In Dired, the w command now copies the current line's file name
-into the kill ring.
-
 +++
 ** The variables dired-free-space-program and dired-free-space-args
 have been renamed to directory-free-space-program and
@@ -1586,6 +1598,14 @@
 to the text before point.  If there is text in the buffer after point,
 it remains unchanged.
 
+** Visual feedback of *Completions* buffer is enhanced.
+Faces are put on the common prefix substrings and the first uncommon
+charachters of each completion candidate in the *Completions* buffer.
+`completion-de-emphasis' is put on the common prefix substrings as the
+face; and `completion-emphasis' is put on the first uncommon
+charachters. By default `completion-de-emphasis' is inherited from
+`default' face. `completion-emphasis' is inherited from `bold' face.
+
 +++
 ** New user option `inhibit-startup-buffer-menu'.
 When loading many files, for instance with `emacs *', Emacs normally
@@ -1692,6 +1712,8 @@
 
 * New modes and packages in Emacs 21.4
 
+** The new python.el package is used to edit Python and Jython programs.
+
 ** The URL package (which had been part of W3) is now part of Emacs.
 
 +++
@@ -2041,6 +2063,11 @@
 `format' are now documented.  Some flags that were accepted but not
 implemented (such as "*") are no longer accepted.
 
+** New function `macroexpand-all' expands all macros in a form.
+It is similar to the Common-Lisp function of the same name.
+One difference is that it guarantees to return the original argument
+if no expansion is done, which may be tested using `eq'.
+
 +++
 ** New function `delete-dups' destructively removes `equal' duplicates
 from a list.  Of several `equal' occurrences of an element in the list,
--- a/etc/ONEWS	Tue Apr 13 17:12:30 2004 +0000
+++ b/etc/ONEWS	Tue Apr 13 17:17:13 2004 +0000
@@ -1029,7 +1029,7 @@
 *** RCS customization.
 
 There is a new variable vc-consult-headers.  If it is t (the default),
-VC searches for RCS headers in working files (like `$Id: ONEWS,v 1.9 2003/09/01 15:44:58 miles Exp $') and
+VC searches for RCS headers in working files (like `$Id$') and
 determines the state of the file from them, not from the master file.
 This is fast and more reliable when you use branches.  (The variable
 was already present in Emacs 19.29, but didn't get mentioned in the
--- a/etc/cs-survival.tex	Tue Apr 13 17:12:30 2004 +0000
+++ b/etc/cs-survival.tex	Tue Apr 13 17:17:13 2004 +0000
@@ -2,9 +2,6 @@
 % Title:  GNU Emacs Survival Card
 % Author: Wlodek Bzyl <matwb@univ.gda.pl>
 %
-% $Revision: 1.3 $
-% $Date: 2003/09/01 15:44:59 $
-%
 %**start of header
 
 % User interface is `plain.tex' and macros described below
@@ -24,7 +21,7 @@
   \endinput
 \fi
 
-% Copyright (c) 2000 Free Software Foundation, Inc.
+% Copyright (c) 2000, 2004 Free Software Foundation, Inc.
 
 % This file is part of GNU Emacs.
 
--- a/etc/fr-survival.tex	Tue Apr 13 17:12:30 2004 +0000
+++ b/etc/fr-survival.tex	Tue Apr 13 17:17:13 2004 +0000
@@ -3,9 +3,6 @@
 % Title:  GNU Emacs Survival Card
 % Author: Wlodek Bzyl <matwb@univ.gda.pl>
 %
-% $Revision: 1.3 $
-% $Date: 2003/09/01 15:44:59 $
-%
 %**start of header
 
 % User interface is `plain.tex' and macros described below
@@ -25,7 +22,7 @@
   \endinput
 \fi
 
-% Copyright (c) 2000 Free Software Foundation, Inc.
+% Copyright (c) 2000, 2004 Free Software Foundation, Inc.
 
 % This file is part of GNU Emacs.
 
--- a/etc/pl-refcard.tex	Tue Apr 13 17:12:30 2004 +0000
+++ b/etc/pl-refcard.tex	Tue Apr 13 17:17:13 2004 +0000
@@ -1,8 +1,5 @@
 %&mex
 %=====================================================================
-% $Revision: 1.4 $
-% $Date: 2003/09/01 15:44:59 $
-%=====================================================================
 % Reference Card for GNU Emacs version 20 on Unix systems was
 % translated into Polish language by W{\l}odek Bzyl (matwb@univ.gda.pl)
 % who also added new section on `Dired' and added info about Polish
@@ -35,7 +32,7 @@
 
 \columnsperpage=2
 
-% Copyright (c) 1999 Free Software Foundation, Inc.
+% Copyright (c) 1999, 2004 Free Software Foundation, Inc.
 
 % This file is part of GNU Emacs.
 
--- a/etc/sk-survival.tex	Tue Apr 13 17:12:30 2004 +0000
+++ b/etc/sk-survival.tex	Tue Apr 13 17:17:13 2004 +0000
@@ -2,9 +2,6 @@
 % Title:  GNU Emacs Survival Card
 % Author: Wlodek Bzyl <matwb@univ.gda.pl>
 %
-% $Revision: 1.3 $
-% $Date: 2003/09/01 15:44:59 $
-%
 %**start of header
 
 % User interface is `plain.tex' and macros described below
@@ -24,7 +21,7 @@
   \endinput
 \fi
 
-% Copyright (c) 2000 Free Software Foundation, Inc.
+% Copyright (c) 2000, 2004 Free Software Foundation, Inc.
 
 % This file is part of GNU Emacs.
 
--- a/etc/termcap.src	Tue Apr 13 17:12:30 2004 +0000
+++ b/etc/termcap.src	Tue Apr 13 17:17:13 2004 +0000
@@ -10,7 +10,6 @@
 #
 #------------------------------------------------------------------------------
 #	Version 10.2.1
-#	$Date: 2003/02/04 14:30:42 $
 #	terminfo syntax
 #
 #	Eric S. Raymond		(current maintainer)
--- a/leim/CXTERM-DIC/4Corner.tit	Tue Apr 13 17:12:30 2004 +0000
+++ b/leim/CXTERM-DIC/4Corner.tit	Tue Apr 13 17:17:13 2004 +0000
@@ -1,4 +1,3 @@
-# $Id: 4Corner.tit,v 1.3 2003/09/01 15:44:59 miles Exp $
 # HANZI input table for cxterm
 # To be used by cxterm, convert me to .cit format first
 # .cit version 2
--- a/leim/CXTERM-DIC/CCDOSPY.tit	Tue Apr 13 17:12:30 2004 +0000
+++ b/leim/CXTERM-DIC/CCDOSPY.tit	Tue Apr 13 17:17:13 2004 +0000
@@ -1,4 +1,3 @@
-# $Id: CCDOSPY.tit,v 1.2 2003/09/01 15:44:59 miles Exp $
 # HANZI input table for cxterm
 # To be used by cxterm, convert me to .cit format first
 # .cit version 1
--- a/leim/CXTERM-DIC/Punct.tit	Tue Apr 13 17:12:30 2004 +0000
+++ b/leim/CXTERM-DIC/Punct.tit	Tue Apr 13 17:17:13 2004 +0000
@@ -1,4 +1,3 @@
-# $Id: Punct.tit,v 1.2 2003/09/01 15:44:59 miles Exp $
 # HANZI input table for cxterm
 # To be used by cxterm, convert me to .cit format first
 # .cit version 1
--- a/leim/CXTERM-DIC/QJ.tit	Tue Apr 13 17:12:30 2004 +0000
+++ b/leim/CXTERM-DIC/QJ.tit	Tue Apr 13 17:17:13 2004 +0000
@@ -1,4 +1,3 @@
-# $Id: QJ.tit,v 1.2 2003/09/01 15:44:59 miles Exp $
 # HANZI input table for cxterm
 # To be used by cxterm, convert me to .cit format first
 # .cit version 1
--- a/leim/CXTERM-DIC/SW.tit	Tue Apr 13 17:12:30 2004 +0000
+++ b/leim/CXTERM-DIC/SW.tit	Tue Apr 13 17:17:13 2004 +0000
@@ -1,4 +1,3 @@
-# $Id: SW.tit,v 1.2 2003/09/01 15:44:59 miles Exp $
 # HANZI input table for cxterm
 # To be used by cxterm, convert me to .cit format first
 # .cit version 1
--- a/leim/CXTERM-DIC/TONEPY.tit	Tue Apr 13 17:12:30 2004 +0000
+++ b/leim/CXTERM-DIC/TONEPY.tit	Tue Apr 13 17:17:13 2004 +0000
@@ -1,4 +1,3 @@
-# $Id: TONEPY.tit,v 1.2 2003/09/01 15:44:59 miles Exp $
 # HANZI input table for cxterm
 # To be used by cxterm, convert me to .cit format first
 # .cit version 1
--- a/lib-src/b2m.pl	Tue Apr 13 17:12:30 2004 +0000
+++ b/lib-src/b2m.pl	Tue Apr 13 17:17:13 2004 +0000
@@ -30,7 +30,7 @@
 use Date::Parse;
 
 my($whoami) = basename $0;
-my($version) = '$Revision: 1.6 $';
+my($version) = '$Revision$';
 my($usage) = "Usage: $whoami [--help] [--version] [--[no]full-headers] [Babyl-file]
 \tBy default, full headers are printed.\n";
 
--- a/lib-src/rcs2log	Tue Apr 13 17:12:30 2004 +0000
+++ b/lib-src/rcs2log	Tue Apr 13 17:17:13 2004 +0000
@@ -29,7 +29,7 @@
 
 Report bugs to <bug-gnu-emacs@gnu.org>.'
 
-Id='$Id: rcs2log,v 1.53 2004/02/15 07:41:58 uid65632 Exp $'
+Id='$Id$'
 
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003,
 # 2004 Free Software Foundation, Inc.
--- a/lib-src/vcdiff	Tue Apr 13 17:12:30 2004 +0000
+++ b/lib-src/vcdiff	Tue Apr 13 17:17:13 2004 +0000
@@ -3,7 +3,7 @@
 # Enhanced sccs diff utility for use with vc mode.
 # This version is more compatible with rcsdiff(1).
 #
-# Copyright (C) 1992, 1993, 1995, 1997, 2001
+# Copyright (C) 1992, 1993, 1995, 1997, 2001, 2004
 #   Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
@@ -23,8 +23,6 @@
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 #
-#	$Id: vcdiff,v 1.8 2003/09/01 15:45:03 miles Exp $
-#
 
 DIFF="diff"
 usage="$0: Usage: vcdiff [--brief] [-q] [-r<sid1>] [-r<sid2>] [diffopts] sccsfile..."
--- a/lisp/ChangeLog	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/ChangeLog	Tue Apr 13 17:17:13 2004 +0000
@@ -1,3 +1,111 @@
+2004-04-12  Joe Buehler  <jbuehler@hekiman.com>
+
+	* loadup.el: Add cygwin to system-type list, for unexec() support.
+
+2004-04-12  John Paul Wallington  <jpw@gnu.org>
+
+	* ibuffer.el (ibuffer-delete-window-on-quit): Remove.
+	(ibuffer-restore-window-config-on-quit): New variable to replace
+	`ibuffer-delete-window-on-quit'.  Update all references.
+	(ibuffer-prev-window-config): New variable.
+	(ibuffer-quit): Restore previous window configuration instead of
+	deleting window.
+	(ibuffer): Save window configuration before showing Ibuffer buffer.
+
+	* help.el (describe-mode): Doc fix.
+
+	* url/url-cookie.el (url-cookie-handle-set-cookie): Replace calls
+	to obsolete `assoc-ignore-case' with calls to `assoc-string'.
+
+2004-04-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/compile.el (compilation-mode-font-lock-keywords): Fix test
+	not to treat nil as a function.
+
+	* vc-arch.el (vc-arch-root): Be a bit more careful.
+	(vc-arch-register): Save the buffer if we modified it.
+	(vc-arch-delete-rej-if-obsolete): Save excursion.
+	(vc-arch-find-file-hook): Use the simpler after-save-hook.
+	(vc-arch-responsible-p, vc-arch-init-version): New functions.
+
+	* net/ldap.el (ldap-search): Use list*.
+
+2004-04-12  Juri Linkov  <juri@jurta.org>
+
+	* info.el (Info-follow-reference): Allow multiline reference name.
+
+2004-04-11  Dave Love  <fx@gnu.org>
+
+	* url/url-mailto.el (url-mailto):
+	* url/url-history.el (url-history-setup-save-timer):
+	* url/url-cookie.el (url-cookie-setup-save-timer): Avoid warnings.
+
+	* url/url-file.el (url-file-build-filename): Don't use
+	directory-sep-char.
+
+	* url/url-auth.el (url-register-auth-scheme): Fix `format' call.
+
+	* url/url-about.el (url-scheme-registry): Defvar.
+	(url-about): Use text/plain.
+
+	* url/url-vars.el (cl): Don't require.
+	(url): Add :version.
+	(url-bug-address): Use bug-gnu-emacs.
+
+	* url/url-util.el (url-hexify-string): Don't give multibyte error
+	for char <16.
+	(mail-header-extract): Autoload.
+
+	* url/url-parse.el: Doc fixes.
+
+	* url/url-ldap.el (ldap): Require.
+	(url-ldap): Fix `format' call.
+	(url-ldap-certificate-formatter): Avoid warning.
+
+	* url/url-https.el (url-https-create-secure-wrapper): Use modern
+	backquotes.
+
+	* url/url-dav.el (url-dav-rename-file): Fix args of `signal'.
+	(url-intersection): New.
+	(url-dav-supported-p): Use it.
+	(url-dav-save-resource): Declare url-http-response-status special.
+
+	* url/url-cache.el (url-util): Require.
+
+	* emacs-lisp/bytecomp.el (byte-compile-cond): Fix last change.
+
+	* progmodes/python.el: New file.
+
+2004-04-11  Andre Spiegel  <spiegel@gnu.org>
+
+	* vc-hooks.el (vc-arg-list): Function removed.
+	(vc-default-workfile-unchanged-p): Use condition-case to check for
+	backward compatibility.
+
+	* vc.el (vc-print-log): Use condition-case to check for backward
+	compatibility.
+
+2004-04-11  Juri Linkov  <juri@jurta.org>
+
+	* dired.el (dired-faces): New defgroup.
+	(dired-header, dired-mark, dired-marked, dired-flagged)
+	(dired-warning, dired-directory, dired-symlink, dired-ignored):
+	New faces.
+	(dired-header-face, dired-mark-face, dired-marked-face)
+	(dired-flagged-face, dired-warning-face, dired-directory-face)
+	(dired-symlink-face, dired-ignored-face): New face variables.
+	(dired-font-lock-keywords): Use them instead of font-lock faces.
+	Split the rule for dired marks into 3 separate rules: for marks,
+	marked file names and flagged file names.
+
+	* help-mode.el (help-make-xrefs): Add a final newline to the
+	*Help* buffer.
+
+2004-04-11  John Paul Wallington  <jpw@gnu.org>
+
+	* replace.el (occur-engine): Distinguish between one and several
+	matches in the matches per buffer heading.
+
 2004-04-11  Kim F. Storm  <storm@cua.dk>
 
 	* ido.el (ido-confirm-unique-completion): New defcustom.
--- a/lisp/allout.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/allout.el	Tue Apr 13 17:17:13 2004 +0000
@@ -507,7 +507,7 @@
 ;;;_  : Version
 ;;;_   = allout-version
 (defvar allout-version
-  (let ((rcs-rev "$Revision: 1.48 $"))
+  (let ((rcs-rev "$Revision$"))
     (condition-case err
 	(save-match-data
 	  (string-match "Revision: \\([0-9]+\\.[0-9]+\\)" rcs-rev)
--- a/lisp/dired.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/dired.el	Tue Apr 13 17:17:13 2004 +0000
@@ -288,21 +288,96 @@
 of the line (\\n or \\r).
 Subexpression 2 must end right before the \\n or \\r.")
 
+(defgroup dired-faces nil
+  "Faces used by dired."
+  :group 'dired
+  :group 'faces)
+
+(defface dired-header
+  '((t (:inherit font-lock-type-face)))
+  "Face used for directory headers."
+  :group 'dired-faces
+  :version "21.4")
+(defvar dired-header-face 'dired-header
+  "Face name used for directory headers.")
+
+(defface dired-mark
+  '((t (:inherit font-lock-constant-face)))
+  "Face used for dired marks."
+  :group 'dired-faces
+  :version "21.4")
+(defvar dired-mark-face 'dired-mark
+  "Face name used for dired marks.")
+
+(defface dired-marked
+  '((t (:inherit font-lock-warning-face)))
+  "Face used for marked files."
+  :group 'dired-faces
+  :version "21.4")
+(defvar dired-marked-face 'dired-marked
+  "Face name used for marked files.")
+
+(defface dired-flagged
+  '((t (:inherit font-lock-warning-face)))
+  "Face used for flagged files."
+  :group 'dired-faces
+  :version "21.4")
+(defvar dired-flagged-face 'dired-flagged
+  "Face name used for flagged files.")
+
+(defface dired-warning
+  '((t (:inherit font-lock-comment-face)))
+  "Face used to highlight a part of a buffer that needs user attention."
+  :group 'dired-faces
+  :version "21.4")
+(defvar dired-warning-face 'dired-warning
+  "Face name used for a part of a buffer that needs user attention.")
+
+(defface dired-directory
+  '((t (:inherit font-lock-function-name-face)))
+  "Face used for subdirectories."
+  :group 'dired-faces
+  :version "21.4")
+(defvar dired-directory-face 'dired-directory
+  "Face name used for subdirectories.")
+
+(defface dired-symlink
+  '((t (:inherit font-lock-keyword-face)))
+  "Face used for symbolic links."
+  :group 'dired-faces
+  :version "21.4")
+(defvar dired-symlink-face 'dired-symlink
+  "Face name used for symbolic links.")
+
+(defface dired-ignored
+  '((t (:inherit font-lock-string-face)))
+  "Face used for files suffixed with `completion-ignored-extensions'."
+  :group 'dired-faces
+  :version "21.4")
+(defvar dired-ignored-face 'dired-ignored
+  "Face name used for files suffixed with `completion-ignored-extensions'.")
+
 (defvar dired-font-lock-keywords
   (list
    ;;
    ;; Directory headers.
-   (list dired-subdir-regexp '(1 font-lock-type-face))
+   (list dired-subdir-regexp '(1 dired-header-face))
+   ;;
+   ;; Dired marks.
+   (list dired-re-mark '(0 dired-mark-face))
    ;;
    ;; We make heavy use of MATCH-ANCHORED, since the regexps don't identify the
    ;; file name itself.  We search for Dired defined regexps, and then use the
    ;; Dired defined function `dired-move-to-filename' before searching for the
    ;; simple regexp ".+".  It is that regexp which matches the file name.
    ;;
-   ;; Dired marks.
-   (list dired-re-mark
-	 '(0 font-lock-constant-face)
-	 '(".+" (dired-move-to-filename) nil (0 font-lock-warning-face)))
+   ;; Marked files.
+   (list (concat "^[" (char-to-string dired-marker-char) "]")
+         '(".+" (dired-move-to-filename) nil (0 dired-marked-face)))
+   ;;
+   ;; Flagged files.
+   (list (concat "^[" (char-to-string dired-del-marker) "]")
+         '(".+" (dired-move-to-filename) nil (0 dired-flagged-face)))
    ;; People who are paranoid about security would consider this more
    ;; important than other things such as whether it is a directory.
    ;; But we don't want to encourage paranoia, so our default
@@ -311,33 +386,33 @@
 ;;;   ;; Files that are group or world writable.
 ;;;   (list (concat dired-re-maybe-mark dired-re-inode-size
 ;;;		 "\\([-d]\\(....w....\\|.......w.\\)\\)")
-;;;	 '(1 font-lock-comment-face)
-;;;	 '(".+" (dired-move-to-filename) nil (0 font-lock-comment-face)))
+;;;	 '(1 dired-warning-face)
+;;;	 '(".+" (dired-move-to-filename) nil (0 dired-warning-face)))
    ;; However, we don't need to highlight the file name, only the
    ;; permissions, to win generally.  -- fx.
    ;; Fixme: we could also put text properties on the permission
    ;; fields with keymaps to frob the permissions, somewhat a la XEmacs.
    (list (concat dired-re-maybe-mark dired-re-inode-size
 		 "[-d]....\\(w\\)....")	; group writable
-	 '(1 font-lock-comment-face))
+	 '(1 dired-warning-face))
    (list (concat dired-re-maybe-mark dired-re-inode-size
 		 "[-d].......\\(w\\).")	; world writable
-	 '(1 font-lock-comment-face))
+	 '(1 dired-warning-face))
    ;;
    ;; Subdirectories.
    (list dired-re-dir
-	 '(".+" (dired-move-to-filename) nil (0 font-lock-function-name-face)))
+	 '(".+" (dired-move-to-filename) nil (0 dired-directory-face)))
    ;;
    ;; Symbolic links.
    (list dired-re-sym
-	 '(".+" (dired-move-to-filename) nil (0 font-lock-keyword-face)))
+	 '(".+" (dired-move-to-filename) nil (0 dired-symlink-face)))
    ;;
    ;; Files suffixed with `completion-ignored-extensions'.
    '(eval .
      ;; It is quicker to first find just an extension, then go back to the
      ;; start of that file name.  So we do this complex MATCH-ANCHORED form.
      (list (concat "\\(" (regexp-opt completion-ignored-extensions) "\\|#\\)$")
-	   '(".+" (dired-move-to-filename) nil (0 font-lock-string-face)))))
+	   '(".+" (dired-move-to-filename) nil (0 dired-ignored-face)))))
   "Additional expressions to highlight in Dired mode.")
 
 ;;; Macros must be defined before they are used, for the byte compiler.
--- a/lisp/emacs-lisp/bytecomp.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Tue Apr 13 17:17:13 2004 +0000
@@ -3377,12 +3377,13 @@
 		 (byte-compile-goto 'byte-goto donetag)
 		 (byte-compile-out-tag nexttag)))))
     ;; Last clause
-    (and (cdr clause) (not (eq (car clause) t))
-	 (progn (byte-compile-maybe-guarded (car clause)
-					    (byte-compile-form (car clause)))
-		(byte-compile-goto-if nil for-effect donetag)
-		(setq clause (cdr clause))))
-    (byte-compile-body-do-effect clause)
+    (let ((guard (car clause)))
+      (and (cdr clause) (not (eq guard t))
+	   (progn (byte-compile-form guard)
+		  (byte-compile-goto-if nil for-effect donetag)
+		  (setq clause (cdr clause))))
+      (byte-compile-maybe-guarded guard
+	(byte-compile-body-do-effect clause)))
     (byte-compile-out-tag donetag)))
 
 (defun byte-compile-and (form)
--- a/lisp/help-mode.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/help-mode.el	Tue Apr 13 17:17:13 2004 +0000
@@ -432,11 +432,13 @@
 	(goto-char (point-max))
 	(while (and (not (bobp)) (bolp))
 	  (delete-char -1))
+        (insert "\n")
         ;; Make a back-reference in this buffer if appropriate.
         (when help-xref-stack
-	  (insert "\n\n")
+	  (insert "\n")
 	  (help-insert-xref-button help-back-label 'help-back
-				   (current-buffer))))
+				   (current-buffer))
+          (insert "\n")))
       ;; View mode steals RET from us.
       (set (make-local-variable 'minor-mode-overriding-map-alist)
            (list (cons 'view-mode help-xref-override-view-map)))
--- a/lisp/help.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/help.el	Tue Apr 13 17:17:13 2004 +0000
@@ -564,11 +564,13 @@
 
 (defun describe-mode (&optional buffer)
   "Display documentation of current major mode and minor modes.
-The major mode description comes first, followed by the minor modes,
-each on a separate page.
-For this to work correctly for a minor mode, the mode's indicator variable
-\(listed in `minor-mode-alist') must also be a function whose documentation
-describes the minor mode."
+A brief summary of the minor modes comes first, followed by the
+major mode description.  This is followed by detailed
+descriptions of the minor modes, each on a separate page.
+
+For this to work correctly for a minor mode, the mode's indicator
+variable \(listed in `minor-mode-alist') must also be a function
+whose documentation describes the minor mode."
   (interactive)
   (help-setup-xref (list #'describe-mode (or buffer (current-buffer)))
 		   (interactive-p))
--- a/lisp/ibuffer.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/ibuffer.el	Tue Apr 13 17:17:13 2004 +0000
@@ -786,8 +786,11 @@
     (define-key map [down-mouse-3] 'ibuffer-mouse-popup-menu)
     map))
 
-(defvar ibuffer-delete-window-on-quit nil
-  "Whether or not to delete the window upon exiting `ibuffer'.")
+(defvar ibuffer-restore-window-config-on-quit nil
+  "If non-nil, restore previous window configuration upon exiting `ibuffer'.")
+
+(defvar ibuffer-prev-window-config nil
+  "Window configuration before starting Ibuffer.")
 
 (defvar ibuffer-did-modification nil)
 
@@ -2183,13 +2186,14 @@
 
 (defun ibuffer-quit ()
   "Quit this `ibuffer' session.
-Delete the current window iff `ibuffer-delete-window-on-quit' is non-nil."
+Try to restore the previous window configuration iff
+`ibuffer-restore-window-config-on-quit' is non-nil."
   (interactive)
-  (if ibuffer-delete-window-on-quit
-      (progn
+  (if ibuffer-restore-window-config-on-quit
+      (progn 
 	(bury-buffer)
 	(unless (= (count-windows) 1)
-	  (delete-window)))
+	  (set-window-configuration ibuffer-prev-window-config)))
     (bury-buffer)))
 
 ;;;###autoload
@@ -2232,6 +2236,7 @@
   (interactive "P")
   (when ibuffer-use-other-window
     (setq other-window-p t))
+  (setq ibuffer-prev-window-config (current-window-configuration))
   (let ((buf (get-buffer-create (or name "*Ibuffer*"))))
     (if other-window-p
 	(funcall (if noselect #'(lambda (buf) (display-buffer buf t)) #'pop-to-buffer) buf)
@@ -2243,7 +2248,7 @@
 	(select-window (get-buffer-window buf))
 	(or (eq major-mode 'ibuffer-mode)
 	    (ibuffer-mode))
-	(setq ibuffer-delete-window-on-quit other-window-p)
+	(setq ibuffer-restore-window-config-on-quit other-window-p)
 	(when shrink
 	  (setq ibuffer-shrink-to-minimum-size shrink))
 	(when qualifiers
@@ -2470,7 +2475,7 @@
   (set (make-local-variable 'ibuffer-cached-eliding-string) nil)
   (set (make-local-variable 'ibuffer-cached-elide-long-columns) nil)
   (set (make-local-variable 'ibuffer-current-format) nil)
-  (set (make-local-variable 'ibuffer-delete-window-on-quit) nil)
+  (set (make-local-variable 'ibuffer-restore-window-config-on-quit) nil)
   (set (make-local-variable 'ibuffer-did-modification) nil)
   (set (make-local-variable 'ibuffer-tmp-hide-regexps) nil)
   (set (make-local-variable 'ibuffer-tmp-show-regexps) nil)
--- a/lisp/info.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/info.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1840,7 +1840,8 @@
           (if (and (save-excursion
                      (goto-char (+ (point) 5)) ; skip a possible *note
                      (re-search-backward "\\*note[ \n\t]+" nil t)
-                     (looking-at (concat "\\*note[ \n\t]+" (Info-following-node-name-re))))
+                     (looking-at (concat "\\*note[ \n\t]+"
+                                         (Info-following-node-name-re "^.,\t"))))
                    (<= (point) (match-end 0)))
               (goto-char (match-beginning 0))))
       ;; Go to the reference closest to point
--- a/lisp/loadup.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/loadup.el	Tue Apr 13 17:17:13 2004 +0000
@@ -340,7 +340,7 @@
       (dump-emacs "emacs" "temacs")
       (message "%d pure bytes used" pure-bytes-used)
       ;; Recompute NAME now, so that it isn't set when we dump.
-      (if (not (memq system-type '(ms-dos windows-nt)))
+      (if (not (memq system-type '(ms-dos windows-nt cygwin)))
 	  (let ((name (concat "emacs-" emacs-version)))
 	    (while (string-match "[^-+_.a-zA-Z0-9]+" name)
 	      (setq name (concat (downcase (substring name 0 (match-beginning 0)))
--- a/lisp/net/ldap.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/net/ldap.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,6 +1,6 @@
 ;;; ldap.el --- client interface to LDAP for Emacs
 
-;; Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 02, 2004  Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;; Maintainer: Pavel Janík <Pavel@Janik.cz>
@@ -36,6 +36,7 @@
 ;;; Code:
 
 (require 'custom)
+(eval-when-compile (require 'cl))
 
 (defgroup ldap nil
   "Lightweight Directory Access Protocol."
@@ -464,17 +465,16 @@
       (error "No LDAP host specified"))
   (let ((host-plist (cdr (assoc host ldap-host-parameters-alist)))
 	result)
-    (setq result (ldap-search-internal (append host-plist
-					       (list 'host host
-						     'filter filter
-						     'attributes attributes
-						     'attrsonly attrsonly
-						     'withdn withdn))))
+    (setq result (ldap-search-internal (list* 'host host
+					      'filter filter
+					      'attributes attributes
+					      'attrsonly attrsonly
+					      'withdn withdn
+					      host-plist)))
     (if ldap-ignore-attribute-codings
 	result
-      (mapcar (function
-	       (lambda (record)
-		 (mapcar 'ldap-decode-attribute record)))
+      (mapcar (lambda (record)
+		(mapcar 'ldap-decode-attribute record))
 	      result))))
 
 
--- a/lisp/progmodes/compile.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/progmodes/compile.el	Tue Apr 13 17:17:13 2004 +0000
@@ -679,7 +679,7 @@
 	  (if (consp line) (setq end-line (cdr line) line (car line)))
 	  (if (consp col)	(setq end-col (cdr col)	  col (car col)))
 	  
-	  (if (symbolp line)
+	  (if (functionp line)
 	      ;; The old compile.el had here an undocumented hook that
 	      ;; allowed `line' to be a function that computed the actual
 	      ;; error location.  Let's do our best.
@@ -1370,12 +1370,14 @@
   (interactive (list last-input-event))
   (or (compilation-buffer-p (current-buffer))
       (error "Not in a compilation buffer"))
-  (let ((pos (if event (posn-point (event-end event)) (point))))
-    (if (get-text-property (point) 'directory)
-	(dired-other-window (car (get-text-property pos 'directory)))
-      (push-mark)
-      (setq compilation-current-error pos)
-      (next-error 0))))
+  (let* ((loc (event-end event))
+	 (pos (posn-point loc)))
+    (with-selected-window (posn-window loc)
+      (if (get-text-property pos 'directory)
+	  (dired-other-window (car (get-text-property pos 'directory)))
+	(push-mark)
+	(setq compilation-current-error pos)
+	(next-error 0)))))
 
 ;; Return a compilation buffer.
 ;; If the current buffer is a compilation buffer, return it.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/progmodes/python.el	Tue Apr 13 17:17:13 2004 +0000
@@ -0,0 +1,1499 @@
+;;; python.el --- silly walks for Python
+
+;; Copyright (C) 2003, 04  Free Software Foundation, Inc.
+
+;; Author: Dave Love <fx@gnu.org>
+;; Created: Nov 2003
+;; Keywords: languages
+
+;; This file is part of GNU Emacs.
+
+;; 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 2, 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., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; Major mode for editing Python, with support for inferior processes.
+
+;; There is another Python mode, python-mode.el, used by XEmacs and
+;; maintained with Python.  That isn't covered by an FSF copyright
+;; assignment, unlike this code, and seems not to be well-maintained
+;; for Emacs (though I've submitted fixes).  This mode is rather
+;; simpler and is, perhaps, better in other ways.  In particular,
+;; using the syntax functions with text properties maintained by
+;; font-lock should make it more correct with arbitrary string and
+;; comment contents.
+
+;; This doesn't implement all the facilities of python-mode.el.  Some
+;; just need doing, e.g. catching exceptions in the inferior Python
+;; buffer (but see M-x pdb for debugging).  [Atually, the use of
+;; `compilation-minor-mode' now is probably enough for that.]  Others
+;; don't seem appropriate.  For instance, `forward-into-nomenclature'
+;; should be done separately, since it's not specific to Python, and
+;; I've installed a minor mode to do the job properly in Emacs 22.
+;; Other things seem more natural or canonical here, e.g. the
+;; {beginning,end}-of-defun implementation dealing with nested
+;; definitions, and the inferior mode following `cmuscheme'.  (The
+;; inferior mode should be able to find the source of errors from
+;; `python-send-region' & al via `compilation-minor-mode', but I can't
+;; make that work with the current (March '04) compile.el.)
+;; Successive TABs cycle between possible indentations for the line.
+
+;; Even where it has similar facilities, this is incompatible with
+;; python-mode.el in various respects.  For instance, various key
+;; bindings are changed to obey Emacs conventions, and things like
+;; marking blocks and `beginning-of-defun' behave differently.
+
+;;; Code:
+
+(require 'syntax)			; ensure appropriate version
+;; It's messy to autoload the relevant comint functions so that comint
+;; is only required when inferior Python is used.
+(require 'comint)
+
+(defgroup python nil
+  "Silly walks in the Python language"
+  :group 'languages
+  :link '(emacs-commentary-link "python"))
+
+;;;###autoload
+(add-to-list 'interpreter-mode-alist '("jython" . jython-mode))
+;;;###autoload
+(add-to-list 'interpreter-mode-alist '("python" . python-mode))
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
+
+;;;; Font lock
+
+(defvar python-font-lock-keywords
+  `(,(rx (and word-start
+	      ;; From v 2.3 reference.
+	      ;; def and class dealt with separately below
+	      (or "and" "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")
+	      word-end))
+   (,(rx (and word-start (group "class") (1+ space) (group (1+ word))))
+    (1 font-lock-keyword-face) (2 font-lock-type-face))
+   (,(rx (and word-start (group "def") (1+ space) (group (1+ word))))
+    (1 font-lock-keyword-face) (2 font-lock-function-name-face))))
+
+(defconst python-font-lock-syntactic-keywords
+  ;; Make outer chars of matching triple-quote sequences into generic
+  ;; string delimiters.  Fixme: Is there a better way?
+  `((,(rx (and (group (optional (any "uUrR"))) ; prefix gets syntax property
+	       (optional (any "rR"))	; possible second prefix
+	       (group (syntax string-quote))	; maybe gets property
+	       (backref 2)			; per first quote
+	       (group (backref 2))))		; maybe gets property
+     (1 (python-quote-syntax 1)) (2 (python-quote-syntax 2))
+     (3 (python-quote-syntax 3)))
+    ;; This doesn't really help.
+;;;     (,(rx (and ?\\ (group ?\n))) (1 " "))
+    ))
+
+(defun python-quote-syntax (n)
+  "Put `syntax-table' property correctly on triple quote.
+Used for syntactic keywords.  N is the match number (1, 2 or 3)."
+  ;; Given a triple quote, we have to look backwards for a previous
+  ;; occurrence of the sequence to know whether this is an opening or
+  ;; closing triple.  We also have to sort out a possible prefix --
+  ;; well, we don't _have_ to, but I think it should be treated as
+  ;; part of the string.
+  (let ((tag (save-excursion
+	       (goto-char (match-beginning 0))
+	       (unless (eq ?\\ (char-before))
+		 (cond
+		  ;; Look for a previous string fence.
+		  ((or (zerop (skip-syntax-backward "^|"))
+		       (bobp))
+		   'start)		; no previous string fence
+		  ;; Check fence on a matching quote.
+		  ((eq (char-before) (char-after (match-beginning 2)))
+		   (if (eq (char-before) (char-after))
+		       'end		; fence ended string
+		     'start))		; began string
+		  ;; Check for matching prefixed string.
+		  ((and (memq (char-before) '(?u ?U ?r ?R))
+			(skip-chars-forward "rR"))
+		   (if (eq (char-after) (char-after (match-beginning 2)))
+		       'end))	       ; else non-matching: return nil
+		  ;; For non-matching quote,  start new string.
+		  ((/= (char-before) (char-after))
+		   'start))))))
+    (if (if (eq tag 'start)		; Maybe starts a new string.
+	    ;; Initial property if this is the prefix (empty or not) or
+	    ;; isn't the prefix and the prefix is empty.
+	    (or (= n 1) (and (= n 2) (= (match-beginning 1) (match-end 1))))
+	  (and (eq tag 'end)		; Maybe ends existing string.
+	       (= n 3)))		; Match is at end.
+	(eval-when-compile (string-to-syntax "|"))
+      ;; Otherwise the property is nil, which is OK.
+      )))
+
+;; This isn't currently in `font-lock-defaults' as probably not worth
+;; it -- we basically only mess with a few normally-symbol characters.
+
+;; (defun python-font-lock-syntactic-face-function (state)
+;;   "`font-lock-syntactic-face-function' for Python mode.
+;; Returns the string or comment face as usual, with side effect of putting
+;; a `syntax-table' property on the inside of the string or comment which is
+;; the standard syntax table."
+;;   (if (nth 3 state)
+;;       (save-excursion
+;; 	(goto-char (nth 8 state))
+;; 	(condition-case nil
+;; 	    (forward-sexp)
+;; 	  (error nil))
+;; 	(put-text-property (1+ (nth 8 state)) (1- (point))
+;; 			   'syntax-table (standard-syntax-table))
+;; 	'font-lock-string-face)
+;;     (put-text-property (1+ (nth 8 state)) (line-end-position)
+;; 			   'syntax-table (standard-syntax-table))
+;;     'font-lock-comment-face))
+
+;;;; Keymap and syntax
+
+(defvar python-mode-map
+  (let ((map (make-sparse-keymap)))
+    ;; Mostly taken from python-mode.el.
+    (define-key map ":" 'python-electric-colon)
+    (define-key map "\177" 'python-backspace)
+    (define-key map "\C-c<" 'python-shift-left)
+    (define-key map "\C-c>" 'python-shift-right)
+    (define-key map "\C-c\C-k" 'python-mark-block)
+    (define-key map "\C-c\C-n" 'python-next-statement)
+    (define-key map "\C-c\C-p" 'python-previous-statement)
+    (define-key map "\C-c\C-u" 'python-beginning-of-block)
+    (define-key map "\C-c\C-f" 'python-describe-symbol)
+    (define-key map "\C-c\C-w" 'python-check)
+    (define-key map "\C-c\C-v" 'python-check) ; a la sgml-mode
+    (define-key map "\C-c\C-s" 'python-send-string)
+    (define-key map [?\C-\M-x] 'python-send-defun)
+    (define-key map "\C-c\C-r" 'python-send-region)
+    (define-key map "\C-c\M-r" 'python-send-region-and-go)
+    (define-key map "\C-c\C-c" 'python-send-buffer)
+    (define-key map "\C-c\C-z" 'python-switch-to-python)
+    (define-key map "\C-c\C-m" 'python-load-file)
+    (define-key map "\C-c\C-l" 'python-load-file) ; a la cmuscheme
+    ;; Fixme: Add :help to menu.
+    (easy-menu-define python-menu map "Python Mode menu"
+      '("Python"
+	["Shift region left" python-shift-left :active mark-active]
+	["Shift region right" python-shift-right :active mark-active]
+	"-"
+	["Mark block" python-mark-block]
+	["Mark def/class" mark-defun
+	 :help "Mark innermost definition around point"]
+	"-"
+	["Start of block" python-beginning-of-block]
+	["End of block" python-end-of-block]
+	["Start of def/class" beginning-of-defun
+	 :help "Go to start of innermost definition around point"]
+	["End of def/class" end-of-defun
+	 :help "Go to end of innermost definition around point"]
+	"-"
+	["Start interpreter" run-python
+	 :help "Run `inferior' Python in separate buffer"]
+	["Import/reload file" python-load-file
+	 :help "Load into inferior Python session"]
+	["Eval buffer" python-send-buffer
+	 :help "Evaluate buffer en bloc in inferior Python session"]
+	["Eval region" python-send-region :active mark-active
+	 :help "Evaluate region en bloc in inferior Python session"]
+	["Eval def/class" python-send-defun
+	 :help "Evaluate current definition in inferior Python session"]
+	["Switch to interpreter" python-switch-to-python
+	 :help "Switch to inferior Python buffer"]
+	["Check file" python-check :help "Run pychecker"]
+	["Debugger" pdb :help "Run pdb under GUD"]
+	"-"
+	["Help on symbol" python-describe-symbol
+	 :help "Use pydoc on symbol at point"]))
+    map))
+
+(defvar python-mode-syntax-table
+  (let ((table (make-syntax-table)))
+    ;; Give punctuation syntax to ASCII that normally has symbol
+    ;; syntax or has word syntax and isn't a letter.
+    (let ((symbol (string-to-syntax "_"))
+	  (sst (standard-syntax-table)))
+      (dotimes (i 128)
+	(unless (= i ?_)
+	  (if (equal symbol (aref sst i))
+	      (modify-syntax-entry i "." table)))))
+    (modify-syntax-entry ?$ "." table)
+    (modify-syntax-entry ?% "." table)
+    ;; exceptions
+    (modify-syntax-entry ?# "<" table)
+    (modify-syntax-entry ?\n ">" table)
+    (modify-syntax-entry ?' "\"" table)
+    (modify-syntax-entry ?` "$" table)
+    table))
+
+;;;; Utility stuff
+
+(defsubst python-in-string/comment ()
+  "Return non-nil if point is in a Python literal (a comment or string).
+Optional argument LIM indicates the beginning of the containing form,
+i.e. the limit on how far back to scan."
+  (syntax-ppss-context (syntax-ppss)))
+
+(defconst python-space-backslash-table
+  (let ((table (copy-syntax-table python-mode-syntax-table)))
+    (modify-syntax-entry ?\\ " " table)
+    table)
+  "`python-mode-syntax-table' with backslash given whitespace syntax.")
+
+(defun python-skip-comments/blanks (&optional backward)
+  "Skip comments and blank lines.
+BACKWARD non-nil means go backwards, otherwise go forwards.  Backslash is
+treated as whitespace so that continued blank lines are skipped.
+Doesn't move out of comments -- should be outside or at end of line."
+  (with-syntax-table python-space-backslash-table
+    (forward-comment (if backward
+			 most-negative-fixnum
+		       most-positive-fixnum))))
+
+(defun python-backslash-continuation-line-p ()
+  "Non-nil if preceding line ends with backslash that is not in a comment."
+  (and (eq ?\\ (char-before (line-end-position 0)))
+       (not (syntax-ppss-context (syntax-ppss)))))
+
+(defun python-continuation-line-p ()
+  "Return non-nil if current line continues a previous one.
+The criteria are that the previous line ends in a backslash outside
+comments and strings, or that the bracket/paren nesting depth is nonzero."
+  (or (and (eq ?\\ (char-before (line-end-position 0)))
+	   (not (syntax-ppss-context (syntax-ppss))))
+      (/= 0 (syntax-ppss-depth
+	     (save-excursion	  ; syntax-ppss with arg changes point
+	       (syntax-ppss (line-beginning-position)))))))
+
+(defun python-comment-line-p ()
+  "Return non-nil if current line has only a comment or is blank."
+  (save-excursion
+    (back-to-indentation)
+    (looking-at (rx (or (syntax comment-start) line-end)))))
+
+(defun python-beginning-of-string ()
+  "Go to beginning of string around point.
+Do nothing if not in string."
+  (let ((state (syntax-ppss)))
+    (when (nth 3 state)
+      (goto-char (nth 8 state)))))
+
+(defun python-open-block-statement-p (&optional bos)
+  "Return non-nil if statement at point opens a block.
+BOS non-nil means point is known to be at beginning of statement."
+  (save-excursion
+    (unless bos (python-beginning-of-statement))
+    (and (not (python-comment-line-p))
+	 (re-search-forward (rx (and ?: (0+ space)
+				     (optional (and (syntax comment-start)
+						    (0+ not-newline)))
+				     line-end))
+			    (save-excursion (python-end-of-statement))
+			    t)
+	 (not (python-in-string/comment)))))
+
+(defun python-close-block-statement-p (&optional bos)
+  "Return non-nil if current line is a statement closing a block.
+BOS non-nil means point is at beginning of statement.
+The criteria are that the line isn't a comment or in string and starts with
+keyword `raise', `break', `continue' or `pass'."
+  (save-excursion
+    (unless bos (python-beginning-of-statement))
+    (back-to-indentation)
+    (looking-at (rx (and (or "return" "raise" "break" "continue" "pass")
+			 word-end)))))
+
+(defun python-outdent-p ()
+  "Return non-nil if current line should outdent a level."
+  (save-excursion
+    (back-to-indentation)
+    (and (looking-at (rx (and (or (and (or "else" "finally") word-end)
+				  (and (or "except" "elif") word-end
+				       (1+ (not (any ?:)))))
+			      (optional space) ":" (optional space)
+			      (or (syntax comment-start) line-end))))
+	 (progn (end-of-line)
+		(not (python-in-string/comment)))
+	 ;; Ensure there's a previous statement and move to it.
+	 (zerop (python-previous-statement))
+	 (not (python-close-block-statement-p t))
+	 ;; Fixme: check this
+	 (not (looking-at (rx (and (or (and (or "if" "elif" "except"
+						"for" "while")
+					    word-end (1+ (not (any ?:))))
+				       (and "try" word-end))
+				   (optional space) ":" (optional space)
+				   (or (syntax comment-start) line-end)))))
+	 (progn (end-of-line)
+		(not (python-in-string/comment))))))
+
+;;;; Indentation.
+
+(defcustom python-indent 4
+  "*Number of columns for a unit of indentation in Python mode.
+See also `\\[python-guess-indent]'"
+  :group 'python
+  :type 'integer)
+
+(defcustom python-guess-indent t
+  "*Non-nil means Python mode guesses `python-indent' for the buffer."
+  :type 'boolean
+  :group 'python)
+
+(defcustom python-indent-string-contents t
+  "*Non-nil means indent contents of multi-line strings together.
+This means indent them the same as the preceding non-blank line.
+Otherwise indent them to column zero."
+  :type '(choice (const :tag "Align with preceding" t)
+		 (const :tag "Indent to column 0" nil))
+  :group 'python)
+
+(defcustom python-honour-comment-indentation nil
+  "Non-nil means indent relative to preceding comment line.
+Only do this for comments where the leading comment character is followed
+by space."
+  :type 'boolean
+  :group 'python)
+
+(defcustom python-continuation-offset 4
+  "*Number of columns of additional indentation for continuation lines.
+Continuation lines follow a backslash-terminated line starting a statement."
+  :group 'python
+  :type 'integer)
+
+(defun python-guess-indent ()
+  "Guess step for indentation of current buffer.
+Set `python-indent' locally to the value guessed."
+  (interactive)
+  (save-excursion
+    (goto-char (point-min))
+    (let (done indent)
+      (while (and (not done) (not (eobp)))
+	(when (and (re-search-forward (rx (and ?: (0+ space)
+					       (or (syntax comment-start)
+						   line-end)))
+				      nil 'move)
+		   (python-open-block-statement-p))
+	  (save-excursion
+	    (python-beginning-of-statement)
+	    (let ((initial (current-indentation)))
+	      (if (zerop (python-next-statement))
+		  (setq indent (- (current-indentation) initial)))
+	      (if (and (>= indent 2) (<= indent 8)) ; sanity check
+		  (setq done t))))))
+      (when done
+	(when (/= indent (default-value 'python-indent))
+	  (set (make-local-variable 'python-indent) indent)
+	  (unless (= tab-width python-indent)
+	    (setq indent-tabs-mode nil)))
+	indent))))
+
+(defun python-calculate-indentation ()
+  "Calculate Python indentation for line at point."
+  (save-excursion
+    (beginning-of-line)
+    (let ((syntax (syntax-ppss))
+	  start)
+      (cond
+       ((eq 'string (syntax-ppss-context syntax)) ; multi-line string
+	(if (not python-indent-string-contents)
+	    0
+	  (save-excursion
+	    ;; Find indentation of preceding non-blank line within string.
+	    (setq start (nth 8 syntax))
+	    (forward-line -1)
+	    (while (and (< start (point)) (looking-at "\\s-*$"))
+	      (forward-line -1))
+	    (current-indentation))))
+       ((python-continuation-line-p)
+	(let ((point (point))
+	      (open-start (cadr syntax)))
+	  (if open-start
+	      ;; Inside bracketed expression.
+	      (progn
+		(goto-char (1+ open-start))
+		;; Look for first item in list (preceding point) and
+		;; align with it, if found.
+		(if (with-syntax-table python-space-backslash-table
+		      (let ((parse-sexp-ignore-comments t))
+			(condition-case ()
+			    (progn (forward-sexp)
+				   (backward-sexp)
+				   (< (point) point))
+			  (error nil))))
+		    (current-column)
+		  ;; Otherwise indent relative to statement start, one
+		  ;; level per bracketing level.
+		  (goto-char (1+ open-start))
+		  (python-beginning-of-statement)
+		  (+ (current-indentation) (* (car syntax) python-indent))))
+	    ;; Otherwise backslash-continued.
+	    (forward-line -1)
+	    (if (python-continuation-line-p)
+		;; We're past first continuation line.  Align with
+		;; previous line.
+		(current-indentation)
+	      ;; First continuation line.  Indent one step, with an
+	      ;; extra one if statement opens a block.
+	      (save-excursion
+		(python-beginning-of-statement)
+		(+ (current-indentation) python-continuation-offset
+		   (if (python-open-block-statement-p t)
+		       python-indent
+		     0)))))))
+       ((bobp) 0)
+       ;; Fixme: Like python-mode.el; not convinced by this.
+       ((looking-at (rx (and (0+ space) (syntax comment-start)
+			     (not (any " \t\n"))))) ; non-indentable comment
+	(current-indentation))
+       (t (let ((point (point)))
+	    (if python-honour-comment-indentation
+		;; Back over whitespace, newlines, non-indentable comments.
+		(catch 'done
+		  (while t
+		    (if (cond ((bobp))
+			      ;; not at comment start
+			      ((not (forward-comment -1))
+			       (python-beginning-of-statement)
+			       t)
+			      ;; trailing comment
+			      ((/= (current-column) (current-indentation))
+			       (python-beginning-of-statement)
+			       t)
+			      ;; indentable comment like python-mode.el
+			      ((and (looking-at (rx (and (syntax comment-start)
+							 (or space line-end))))
+				    (/= 0 (current-column)))))
+			(throw 'done t))))
+	      ;; Else back over all comments.
+	      (python-skip-comments/blanks t)
+	      (python-beginning-of-statement))
+	    ;; don't lose on bogus outdent
+	    (max 0 (+ (current-indentation)
+		      (or (cond ((python-open-block-statement-p t)
+				 python-indent)
+				((python-close-block-statement-p t)
+				 (- python-indent)))
+			  (progn (goto-char point)
+				 (if (python-outdent-p)
+				     (- python-indent)))
+			  0)))))))))
+
+;;;; Cycling through the possible indentations with successive TABs.
+
+;; These don't need to be buffer-local since they're only relevant
+;; during a cycle.
+
+;; Alist of possible indentations and start of statement they would close.
+(defvar python-indent-list nil
+  "Internal use.")
+;; Length of the above
+(defvar python-indent-list-length nil
+  "Internal use.")
+;; Current index into the alist.
+(defvar python-indent-index nil
+  "Internal use.")
+
+(defun python-initial-text ()
+  "Text of line following indentation and ignoring any trailing comment."
+  (buffer-substring (+ (line-beginning-position) (current-indentation))
+		    (save-excursion
+		      (end-of-line)
+		      (forward-comment -1)
+		      (point))))
+
+(defun python-indentation-levels ()
+  "Return a list of possible indentations for this statement.
+Includes the default indentation and those which would close all
+enclosing blocks."
+  (save-excursion
+    (let ((levels (list (cons (current-indentation) nil))))
+      ;; Only one possibility if we immediately follow a block open or
+      ;; are in a continuation line.
+      (unless (or (python-continuation-line-p)
+		  (save-excursion (and (python-previous-statement)
+				       (python-open-block-statement-p t))))
+	(while (python-beginning-of-block)
+	  (push (cons (current-indentation) (python-initial-text))
+		levels)))
+      levels)))
+
+;; This is basically what `python-indent-line' would be if we didn't
+;; do the cycling.
+(defun python-indent-line-1 ()
+  "Subroutine of `python-indent-line'."
+  (let ((target (python-calculate-indentation))
+	(pos (- (point-max) (point))))
+    (if (= target (current-indentation))
+	(if (< (current-column) (current-indentation))
+	    (back-to-indentation))
+      (beginning-of-line)
+      (delete-horizontal-space)
+      (indent-to target)
+      (if (> (- (point-max) pos) (point))
+	  (goto-char (- (point-max) pos))))))
+
+;; Fixme: Is the arg necessary?
+(defun python-indent-line (&optional arg)
+  "Indent current line as Python code.
+When invoked via `indent-for-tab-command', cycle through possible
+indentations for current line.  The cycle is broken by a command different
+from `indent-for-tab-command', i.e. successive TABs do the cycling."
+  (interactive)
+  ;; Don't do extra work if invoked via `indent-region', for instance.
+  (if (not (eq this-command 'indent-for-tab-command))
+      (python-indent-line-1)
+    (if (eq last-command this-command)
+	(if (= 1 python-indent-list-length)
+	    (message "Sole indentation")
+	  (progn (setq python-indent-index (% (1+ python-indent-index)
+					      python-indent-list-length))
+		 (beginning-of-line)
+		 (delete-horizontal-space)
+		 (indent-to (car (nth python-indent-index python-indent-list)))
+		 (let ((text (cdr (nth python-indent-index
+				       python-indent-list))))
+		   (if text (message "Closes: %s" text)))))
+      (python-indent-line-1)
+      (setq python-indent-list (python-indentation-levels)
+	    python-indent-list-length (length python-indent-list)
+	    python-indent-index (1- python-indent-list-length)))))
+
+;;;; Movement.
+
+(defun python-beginning-of-defun ()
+  "`beginning-of-defun-function' for Python.
+Finds beginning of innermost nested class or method definition.
+Returns the name of the definition found at the end, or nil if reached
+start of buffer."
+  (let ((ci (current-indentation))
+	(def-re (rx (and line-start (0+ space) (or "def" "class")
+			 (1+ space)
+			 (group (1+ (or word (syntax symbol)))))))
+	point found lep def-line)
+    (if (python-comment-line-p)
+	(setq ci most-positive-fixnum))
+    (while (and (not (bobp)) (not found))
+      ;; Treat bol at beginning of function as outside function so
+      ;; that successive C-M-a makes progress backwards.
+      (setq def-line (looking-at def-re))
+      (unless (bolp) (end-of-line))
+      (setq lep (line-end-position))
+      (if (and (re-search-backward def-re nil 'move)
+	       ;; Must be less indented or matching top level, or
+	       ;; equally indented if we started on a definition line.
+	       (let ((in (current-indentation)))
+	       (or (and (zerop ci) (zerop in))
+		   (= lep (line-end-position)) ; on initial line
+		   (and def-line (= in ci))
+		   (< in ci)))
+	       (not (python-in-string/comment)))
+	  (setq found t)))))
+
+(defun python-end-of-defun ()
+  "`end-of-defun-function' for Python.
+Finds end of innermost nested class or method definition."
+  (let ((orig (point))
+	(pattern (rx (and line-start (0+ space)
+			  (or "def" "class") space))))
+    ;; Go to start of current block and check whether it's at top
+    ;; level.  If it is, and not a block start, look forward for
+    ;; definition statement.
+    (when (python-comment-line-p)
+      (end-of-line)
+      (forward-comment most-positive-fixnum))
+    (if (not (python-open-block-statement-p))
+	(python-beginning-of-block))
+    (if (zerop (current-indentation))
+	(unless (python-open-block-statement-p)
+	  (while (and (re-search-forward pattern nil 'move)
+		      (python-in-string/comment))) ; just loop
+	  (unless (eobp)
+	    (beginning-of-line)))
+      ;; Don't move before top-level statement that would end defun.
+      (end-of-line)
+      (python-beginning-of-defun))
+    ;; If we got to the start of buffer, look forward for
+    ;; definition statement.
+    (if (and (bobp) (not (looking-at "def\\|class")))
+	(while (and (not (eobp))
+		    (re-search-forward pattern nil 'move)
+		    (python-in-string/comment)))) ; just loop
+    ;; We're at a definition statement (or end-of-buffer).
+    (unless (eobp)
+      (python-end-of-block)
+      ;; Count trailing space in defun (but not trailing comments).
+      (skip-syntax-forward " >")
+      (beginning-of-line))
+    ;; Catch pathological case like this, where the beginning-of-defun
+    ;; skips to a definition we're not in:
+    ;; if ...:
+    ;;     ...
+    ;; else:
+    ;;     ...  # point here
+    ;;     ...
+    ;;     def ...
+    (if (< (point) orig)
+	(goto-char (point-max)))))
+
+(defun python-beginning-of-statement ()
+  "Go to start of current statement.
+Accounts for continuation lines, multi-line strings, and multi-line bracketed
+expressions."
+  (beginning-of-line)
+  (python-beginning-of-string)
+  (while (python-continuation-line-p)
+    (beginning-of-line)
+    (if (python-backslash-continuation-line-p)
+	(while (python-backslash-continuation-line-p)
+	  (forward-line -1))
+      (python-beginning-of-string)
+      ;; Skip forward out of nested brackets.
+      (condition-case ()		; beware invalid syntax
+	  (progn (backward-up-list (syntax-ppss-depth (syntax-ppss))) t)
+	(error (end-of-line)))))
+  (back-to-indentation))
+
+(defun python-end-of-statement ()
+  "Go to the end of the current statement and return point.
+Usually this is the start of the next line, but if this is a
+multi-line statement we need to skip over the continuation lines.
+On a comment line, go to end of line."
+  (end-of-line)
+  (while (let (comment)
+	   ;; Move past any enclosing strings and sexps, or stop if
+	   ;; we're in a comment.
+	   (while (let ((s (syntax-ppss)))
+		    (cond ((eq 'comment (syntax-ppss-context s))
+			   (setq comment t)
+			   nil)
+			  ((eq 'string (syntax-ppss-context s))
+			   ;; Go to start of string and skip it.
+			   (goto-char (nth 8 s))
+			   (condition-case () ; beware invalid syntax
+			       (progn (forward-sexp) t)
+			     (error (end-of-line))))
+			  ((> (syntax-ppss-depth s) 0)
+			   ;; Skip forward out of nested brackets.
+			   (condition-case () ; beware invalid syntax
+			       (progn (backward-up-list
+				       (- (syntax-ppss-depth s)))
+				      t)
+			     (error (end-of-line))))))
+	     (end-of-line))
+	   (unless comment
+	     (eq ?\\ (char-before))))	; Line continued?
+    (end-of-line 2))			; Try next line.
+  (point))
+
+(defun python-previous-statement (&optional count)
+  "Go to start of previous statement.
+With argument COUNT, do it COUNT times.  Stop at beginning of buffer.
+Return count of statements left to move."
+  (interactive "p")
+  (unless count (setq count 1))
+  (if (< count 0)
+      (python-next-statement (- count))
+    (python-beginning-of-statement)
+    (while (and (> count 0) (not (bobp)))
+      (python-skip-comments/blanks t)
+      (python-beginning-of-statement)
+      (unless (bobp) (setq count (1- count))))
+    count))
+
+(defun python-next-statement (&optional count)
+  "Go to start of next statement.
+With argument COUNT, do it COUNT times.  Stop at end of buffer.
+Return count of statements left to move."
+  (interactive "p")
+  (unless count (setq count 1))
+  (if (< count 0)
+      (python-previous-statement (- count))
+    (beginning-of-line)
+    (while (and (> count 0) (not (eobp)))
+      (python-end-of-statement)
+      (python-skip-comments/blanks)
+      (setq count (1- count)))
+    count))
+
+(defun python-beginning-of-block (&optional arg)
+  "Go to start of current block.
+With numeric arg, do it that many times.  If ARG is negative, call
+`python-end-of-block' instead.
+If point is on the first line of a block, use its outer block.
+If current statement is in column zero, don't move and return nil.
+Otherwise return non-nil."
+  (interactive "p")
+  (unless arg (setq arg 1))
+  (cond
+   ((zerop arg))
+   ((< arg 0) (python-end-of-block (- arg)))
+   (t
+    (let ((point (point)))
+      (if (python-comment-line-p)
+	  (python-skip-comments/blanks t))
+      (python-beginning-of-statement)
+      (let ((ci (current-indentation)))
+	(if (zerop ci)
+	    (not (goto-char point))	; return nil
+	  ;; Look upwards for less indented statement.
+	  (if (catch 'done
+;;; This is slower than the below.
+;;; 	  (while (zerop (python-previous-statement))
+;;; 	    (when (and (< (current-indentation) ci)
+;;; 		       (python-open-block-statement-p t))
+;;; 	      (beginning-of-line)
+;;; 	      (throw 'done t)))
+		(while (and (zerop (forward-line -1)))
+		  (when (and (< (current-indentation) ci)
+			     (not (python-comment-line-p))
+			     ;; Move to beginning to save effort in case
+			     ;; this is in string.
+			     (progn (python-beginning-of-statement) t)
+			     (python-open-block-statement-p t))
+		    (beginning-of-line)
+		    (throw 'done t)))
+		(not (goto-char point))) ; Failed -- return nil
+	      (python-beginning-of-block (1- arg)))))))))
+
+(defun python-end-of-block (&optional arg)
+  "Go to end of current block.
+With numeric arg, do it that many times.  If ARG is negative, call
+`python-beginning-of-block' instead.
+If current statement is in column zero and doesn't open a block, don't
+move and return nil.  Otherwise return t."
+  (interactive "p")
+  (unless arg (setq arg 1))
+  (if (< arg 0)
+      (python-beginning-of-block (- arg)))
+  (while (and (> arg 0)
+	      (let* ((point (point))
+		     (_ (if (python-comment-line-p)
+			    (python-skip-comments/blanks t)))
+		     (ci (current-indentation))
+		     (open (python-open-block-statement-p)))
+		(if (and (zerop ci) (not open))
+		    (not (goto-char point))
+		  (catch 'done
+		    (while (zerop (python-next-statement))
+		      (when (or (and open (<= (current-indentation) ci))
+				(< (current-indentation) ci))
+			(python-skip-comments/blanks t)
+			(beginning-of-line 2)
+			(throw 'done t)))
+		    (not (goto-char point))))))
+    (setq arg (1- arg)))
+  (zerop arg))
+
+;;;; Imenu.
+
+(defun python-imenu-create-index ()
+  "`imenu-create-index-function' for Python.
+
+Makes nested Imenu menus from nested `class' and `def' statements.
+The nested menus are headed by an item referencing the outer
+definition; it has a space prepended to the name so that it sorts
+first with `imenu--sort-by-name'."
+  (unless (boundp 'recursing)		; dynamically bound below
+    (goto-char (point-min)))		; normal call from Imenu
+  (let (index-alist			; accumulated value to return
+	name is-class pos)
+    (while (re-search-forward
+	    (rx (and line-start (0+ space) ; leading space
+		     (or (group "def") (group "class"))	    ; type
+		     (1+ space) (group (1+ (or word ?_))))) ; name
+	    nil t)
+      (unless (python-in-string/comment)
+	(let ((pos (match-beginning 0))
+	      (name (match-string-no-properties 3)))
+	  (if (match-beginning 2)	; def or class?
+	      (setq name (concat "class " name)))
+	  (save-restriction
+	    (narrow-to-defun)
+	    (let* ((recursing t)
+		   (sublist (python-imenu-create-index)))
+	      (if sublist
+		  (progn (push (cons (concat " " name) pos) sublist)
+			 (push (cons name sublist) index-alist))
+		(push (cons name pos) index-alist)))))))
+    (nreverse index-alist)))
+
+;;;; `Electric' commands.
+
+(defun python-electric-colon (arg)
+  "Insert a colon and maybe outdent the line if it is a statement like `else'.
+With numeric ARG, just insert that many colons.  With \\[universal-argument],
+just insert a single colon."
+  (interactive "*P")
+  (self-insert-command (if (not (integerp arg)) 1 arg))
+  (and (not arg)
+       (eolp)
+       (python-outdent-p)
+       (not (python-in-string/comment))
+       (> (current-indentation) (python-calculate-indentation))
+       (python-indent-line)))		; OK, do it
+(put 'python-electric-colon 'delete-selection t)
+
+(defun python-backspace (arg)
+  "Maybe delete a level of indentation on the current line.
+If not at the end of line's indentation, or on a comment line, just call
+`backward-delete-char-untabify'.  With ARG, repeat that many times."
+  (interactive "*p")
+  (if (or (/= (current-indentation) (current-column))
+	  (bolp)
+	  (python-continuation-line-p))
+      (backward-delete-char-untabify arg)
+    (let ((indent 0))
+      (save-excursion
+	(while (and (> arg 0) (python-beginning-of-block))
+	  (setq arg (1- arg)))
+	(when (zerop arg)
+	  (setq indent (current-indentation))
+	  (message "Closes %s" (python-initial-text))))
+      (delete-horizontal-space)
+      (indent-to indent))))
+(put 'python-backspace 'delete-selection 'supersede)
+
+;;;; pychecker
+
+(defcustom python-check-command "pychecker --stdlib"
+  "*Command used to check a Python file."
+  :type 'string
+  :group 'python)
+
+(defvar python-saved-check-command nil
+  "Internal use.")
+
+(autoload 'compilation-start "compile")
+
+;; After `sgml-validate-command'.
+(defun python-check (command)
+  "Check a Python file (default current buffer's file).
+Runs COMMAND, a shell command, as if by `compile'.
+See `python-check-command' for the default."
+  (interactive
+   (list (read-string "Checker command: "
+		      (or python-saved-check-command
+			  (concat python-check-command " "
+				  (let ((name (buffer-file-name)))
+				    (if name
+					(file-name-nondirectory name))))))))
+  (setq python-saved-check-command command)
+  (save-some-buffers (not compilation-ask-about-save) nil)
+  (compilation-start command))
+
+;;;; Inferior mode stuff (following cmuscheme).
+
+(defcustom python-python-command "python"
+  "*Shell command to run Python interpreter.
+Any arguments can't contain whitespace."
+  :group 'python
+  :type 'string)
+
+(defcustom python-jython-command "jython"
+  "*Shell command to run Jython interpreter.
+Any arguments can't contain whitespace."
+  :group 'python
+  :type 'string)
+
+(defvar python-command python-python-command
+  "Actual command used to run Python.
+May be `python-python-command' or `python-jython-command'.
+Additional arguments are added when the command is used by `run-python'
+et al.")
+
+(defvar python-buffer nil
+  "*The current python process buffer.
+To run multiple Python processes, start the first with \\[run-python].
+It will be in a buffer named *Python*.  Rename that with
+\\[rename-buffer].  Now start a new process with \\[run-python].  It
+will be in a new buffer, named *Python*.  Switch between the different
+process buffers with \\[switch-to-buffer].
+
+Commands that send text from source buffers to Python processes have
+to choose a process to send to.  This is determined by global variable
+`python-buffer'.  Suppose you have three inferior Pythons running:
+    Buffer	Process
+    foo		python
+    bar		python<2>
+    *Python*    python<3>
+If you do a \\[python-send-region-and-go] command on some Python source
+code, what process does it go to?
+
+- In a process buffer (foo, bar, or *Python*), send it to that process.
+- In some other buffer (e.g. a source file), send it to the process
+  attached to `python-buffer'.
+Process selection is done by function `python-proc'.
+
+Whenever \\[run-python] starts a new process, it resets `python-buffer'
+to be the new process's buffer.  If you only run one process, this will
+do the right thing.  If you run multiple processes, you can change
+`python-buffer' to another process buffer with \\[set-variable].")
+
+(define-derived-mode inferior-python-mode comint-mode "Inferior Python"
+  "Major mode for interacting with an inferior Python process.
+A Python process can be started with \\[run-python].
+
+Hooks `comint-mode-hook' and `inferior-python-mode-hook' are run in
+that order.
+
+You can send text to the inferior Python process from other buffers containing
+Python source.
+ * `python-switch-to-python' switches the current buffer to the Python
+    process buffer.
+ * `python-send-region' sends the current region to the Python process.
+ * `python-send-region-and-go' switches to the Python process buffer
+    after sending the text.
+For running multiple processes in multiple buffers, see `python-buffer'.
+
+\\{inferior-python-mode-map}"
+  :group 'python
+  (set-syntax-table python-mode-syntax-table)
+  (setq mode-line-process '(":%s"))
+  ;; Fixme: Maybe install some python-mode bindings too.
+  (define-key inferior-python-mode-map "\C-c\C-l" 'python-load-file)
+  (define-key inferior-python-mode-map "\C-c\C-z" 'python-switch-to-python)
+  (setq comint-input-filter #'python-input-filter))
+
+(defcustom inferior-python-filter-regexp "\\`\\s-*\\S-?\\S-?\\s-*\\'"
+  "*Input matching this regexp is not saved on the history list.
+Default ignores all inputs of 0, 1, or 2 non-blank characters."
+  :type 'regexp
+  :group 'python)
+
+(defvar python-orig-start-line nil
+  "Line number at start of region sent to inferior Python.")
+
+(defvar python-orig-file nil
+  "File name to associate with errors found in inferior Python.")
+
+(defun python-input-filter (str)
+  "`comint-input-filter' function for inferior Python.
+Don't save anything matching `inferior-python-filter-regexp'.
+Also resets variables for adjusting error messages."
+  (setq python-orig-file nil
+	python-orig-start-line 1)
+  (not (string-match inferior-python-filter-regexp str)))
+
+;; Fixme: Loses with quoted whitespace.
+(defun python-args-to-list (string)
+  (let ((where (string-match "[ \t]" string)))
+    (cond ((null where) (list string))
+	  ((not (= where 0))
+	   (cons (substring string 0 where)
+		 (python-args-to-list (substring string (+ 1 where)))))
+	  (t (let ((pos (string-match "[^ \t]" string)))
+	       (if pos (python-args-to-list (substring string pos))))))))
+
+(defvar compilation-minor-mode-map)
+(defvar compilation-error-list)
+(defvar compilation-parsing-end)
+
+(defconst python-compilation-regexp-alist
+  `((,(rx (and line-start (1+ (any " \t")) "File \""
+	       (group (1+ (not (any "\"<")))) ; avoid `<stdin>' &c
+	       "\", line " (group (1+ digit))))
+     1 python-compilation-line-number))
+  "`compilation-error-regexp-alist' for inferior Python.")
+
+(defun python-compilation-line-number (file col)
+  "Return error descriptor of error found for FILE, column COL.
+Used as line-number hook function in `python-compilation-regexp-alist'."
+  (let ((line (save-excursion
+		(goto-char (match-beginning 2))
+		(read (current-buffer)))))
+    (list (point-marker) (if python-orig-file
+			     (list python-orig-file default-directory)
+			   file)
+	  (+ line (1- python-orig-start-line))
+	  nil)))
+
+;;;###autoload
+(defun run-python (cmd)
+  "Run an inferior Python process, input and output via buffer *Python*.
+CMD is the Python command to run.
+If there is a process already running in `*Python*', switch to
+that buffer.  With argument, allows you to edit the initial
+command line (default is the value of `python-command'); `-i' and
+`-c' args will be added to this to support evaluations in the
+REPL.  Runs the hooks `inferior-python-mode-hook' \(after the
+`comint-mode-hook' is run).  \(Type \\[describe-mode] in the
+process buffer for a list of commands.)"
+  (interactive (list (if current-prefix-arg
+			 (read-string "Run Python: " python-command)
+		       python-command)))
+  ;; Fixme: Consider making `python-buffer' buffer-local as a buffer
+  ;; (not a name) in Python buffers from which `run-python' &c is
+  ;; invoked.  Would support multiple processes better.
+  (if (not (comint-check-proc "*Python*"))
+      (let ((cmdlist (append (python-args-to-list cmd)
+			     '("-i" "-c" "\
+from os import remove as _emacs_rem
+def _emacs_execfile (file):
+    try:
+        execfile (file)
+    finally:
+        _emacs_rem (file)
+"))))
+	(set-buffer (apply 'make-comint "Python" (car cmdlist) nil
+			   (cdr cmdlist)))
+	(inferior-python-mode)
+	(setq comint-output-filter-functions nil)))
+  (setq python-command cmd)
+  (setq python-buffer "*Python*")
+  (pop-to-buffer "*Python*")
+  (compilation-minor-mode 1)
+  (add-hook 'comint-input-filter-functions 'python-input-filter nil t)
+  ;; Avoid clobbering comint bindings.
+  (set (make-local-variable 'minor-mode-overriding-map-alist)
+       `((compilation-minor-mode
+	  . ,(let ((map (make-sparse-keymap)))
+	       ;; It would be useful to put keymap properties on the
+	       ;; error lines so that we could use RET and mouse-2 on
+	       ;; them directly.  These bindings will only DTRT with
+	       ;; the font-lock-style compilation mode.
+	       (define-key map [mouse-2] #'python-mouse-2-command)
+	       (define-key map "\C-m" #'python-RET-command)
+	       (if (boundp 'compilation-menu-map)
+		   (define-key map [menu-bar compilation]
+		     (cons "Errors" compilation-menu-map)))
+	       map))))
+  (set (make-local-variable 'compilation-error-regexp-alist)
+       python-compilation-regexp-alist))
+
+(defun python-mouse-2-command (event)
+  "Command bound to `mouse-2' in inferior Python buffer.
+Selects Comint or Compilation mode command as appropriate."
+  (interactive "e")
+  ;; This only works with the font-lock-based compilation mode.
+  (call-interactively
+   (lookup-key (if (save-window-excursion
+		     (save-excursion
+		       (mouse-set-point event)
+		       (consp (get-text-property (line-beginning-position)
+						 'message))))
+		   compilation-mode-map
+		 comint-mode-map)
+	       [mouse-2])))
+
+(defun python-RET-command ()
+  "Command bound to `RET' in inferior Python buffer.
+Selects Comint or Compilation mode command as appropriate."
+  (interactive)
+  ;; This only works with the font-lock-based compilation mode.
+  (call-interactively
+   (lookup-key (if (consp (get-text-property (line-beginning-position)
+					     'message))
+		   compilation-mode-map
+		 comint-mode-map)
+	       "\C-m")))
+
+(defun python-send-region (start end)
+  "Send the region to the inferior Python process."
+  ;; The region is evaluated from a temporary file.  This avoids
+  ;; problems with blank lines, which have different semantics
+  ;; interactively and in files.  It also saves the inferior process
+  ;; buffer filling up with interpreter prompts.  We need a function
+  ;; to remove the temporary file when it has been evaluated, which
+  ;; unfortunately means using a not-quite pristine interpreter
+  ;; initially.  Unfortunately we also get tracebacks which look like:
+  ;; 
+  ;; >>> Traceback (most recent call last):
+  ;;   File "<stdin>", line 1, in ?
+  ;;   File "<string>", line 4, in _emacs_execfile
+  ;;   File "/tmp/py7734RSB", line 11
+  ;;
+  ;; The compilation-minor-mode parsing takes care of relating the
+  ;; reference to the temporary file to the source.  Fixme:
+  ;; comint-filter the first two lines of the traceback?
+  (interactive "r")
+  (let* ((f (make-temp-file "py"))
+	 (command (format "_emacs_execfile(%S)\n" f))
+	 (orig-file (buffer-file-name))
+	 (orig-line (save-restriction
+		      (widen)
+		      (line-number-at-pos start))))
+    (if (save-excursion
+	  (goto-char start)
+	  (/= 0 (current-indentation)))	; need dummy block
+	(write-region "if True:\n" nil f nil 'nomsg))
+    (write-region start end f t 'nomsg)
+    (when python-buffer
+      (with-current-buffer python-buffer
+	(let ((end (marker-position (process-mark
+				     (get-buffer-process python-buffer)))))
+	  (set (make-local-variable 'python-orig-file) orig-file)
+	  (set (make-local-variable 'python-orig-start-line) orig-line)
+	  (set (make-local-variable 'compilation-error-list) nil)
+	  ;; (set (make-local-variable 'compilation-old-error-list) nil)
+	  (let ((comint-input-filter-functions
+		 (delete 'python-input-filter comint-input-filter-functions)))
+	    (comint-send-string (python-proc) command))
+	  (set-marker compilation-parsing-end end)
+	  (setq compilation-last-buffer (current-buffer)))))))
+
+(defun python-send-string (string)
+  "Evaluate STRING in inferior Python process."
+  (interactive "sPython command: ")
+  (comint-send-string (python-proc) string))
+
+(defun python-send-buffer ()
+  "Send the current buffer to the inferior Python process."
+  (interactive)
+  (python-send-region (point-min) (point-max)))
+
+(defun python-send-defun ()
+  "Send the current defun (class or method) to the inferior Python process."
+  (interactive)
+  (save-excursion (python-send-region (progn (beginning-of-defun) (point))
+				      (progn (end-of-defun) (point)))))
+
+(defun python-switch-to-python (eob-p)
+  "Switch to the Python process buffer.
+With prefix arg, position cursor at end of buffer."
+  (interactive "P")
+  (if (get-buffer python-buffer)
+      (pop-to-buffer python-buffer)
+    (error "No current process buffer.  See variable `python-buffer'"))
+  (when eob-p
+    (push-mark)
+    (goto-char (point-max))))
+
+(add-to-list 'debug-ignored-errors "^No current process buffer.")
+
+(defun python-send-region-and-go (start end)
+  "Send the region to the inferior Python process.
+Then switch to the process buffer."
+  (interactive "r")
+  (python-send-region start end)
+  (python-switch-to-python t))
+
+(defcustom python-source-modes '(python-mode jython-mode)
+  "*Used to determine if a buffer contains Python source code.
+If it's loaded into a buffer that is in one of these major modes, it's
+considered a Python source file by `python-load-file'.
+Used by these commands to determine defaults."
+  :type '(repeat function)
+  :group 'python)
+
+(defvar python-prev-dir/file nil
+  "Caches (directory . file) pair used in the last `python-load-file' command.
+Used for determining the default in the next one.")
+
+(defun python-load-file (file-name)
+  "Load a Python file FILE-NAME into the inferior Python process.
+If the file has extension `.py' import or reload it as a module.
+Treating it as a module keeps the global namespace clean, provides
+function location information for debugging, and supports users of
+module-qualified names."
+  (interactive (comint-get-source "Load Python file: " python-prev-dir/file
+				  python-source-modes
+				  t)) ; because execfile needs exact name
+  (comint-check-source file-name) ; Check to see if buffer needs saved.
+  (setq python-prev-dir/file (cons (file-name-directory file-name)
+				   (file-name-nondirectory file-name)))
+  (comint-send-string
+   (python-proc)
+   (if (string-match "\\.py\\'" file-name)
+       ;; Fixme: make sure the directory is in the path list
+       (let ((module (file-name-sans-extension
+		      (file-name-nondirectory file-name))))
+	 (format "\
+if globals().has_key('%s'):
+    reload(%s)
+else:
+    import %s
+" module module module))
+     (format "execfile('%s')\n" filename))))
+
+;; Fixme: Should this start a process if there isn't one?  (Unlike cmuscheme.)
+(defun python-proc ()
+  "Return the current Python process.  See variable `python-buffer'."
+  (let ((proc (get-buffer-process (if (eq major-mode 'inferior-python-mode)
+				      (current-buffer)
+				    python-buffer))))
+    (or proc (error "No current process.  See variable `python-buffer'"))))
+
+;;;; Context-sensitive help.
+
+;; Fixme: Investigate adapting this to eldoc.
+
+(defun python-describe-symbol (symbol)
+  "Get help on SYMBOL using `pydoc'.
+Interactively, prompt for symbol."
+  (interactive
+   (let ((symbol (current-word))
+	 (enable-recursive-minibuffers t)
+	 val)
+     (setq val (read-string (if symbol
+				(format "Describe variable (default %s): "
+				      symbol)
+			      "Describe variable: ")
+			    nil nil symbol))
+     (list (or val symbol))))
+  (if (equal symbol "") (error "No symbol"))
+  (let* ((mod (if (string-match "\\(\\.[^.]+\\)\\'" symbol)
+		  (substring symbol 0 (match-beginning 1))))
+	 (import (when mod (concat "import " mod "\n"))))
+    (with-output-to-temp-buffer "*Python Output*"
+      (princ (shell-command-to-string
+	      (format "%s -c 'import pydoc %s
+try: pydoc.help(%S)
+except: print \"No help available on:\", %S'"
+		      ;; Fixme: Is this necessarily right?
+		      (car (split-string python-command))
+		      (or import "") symbol symbol))))))
+
+(add-to-list 'debug-ignored-errors "^No symbol")
+
+;;;; Info-look functionality.
+
+(require 'info-look)
+;; We should be able to add info-lookup specs without loading the file first.
+;; E.g. by setting a buffer-local var or something like that.  --Stef
+(let ((version (let ((s (shell-command-to-string (concat python-command
+							 " -V"))))
+		 (string-match "^Python \\([0-9]+\\.[0-9]+\\>\\)" s)
+		 (match-string 1 s)))
+      ;; Whether info files have a Python version suffix, e.g. in Debian.
+      (versioned (save-window-excursion
+		   (condition-case ()
+		       ;; The call to `info' might create a new frame if
+		       ;; pop-up-frames or special-display-buffers are used.
+		       ;; So I disabled it until we find a better way
+		       ;; to handle this situation.  Maybe Debian should just
+		       ;; fix their install somehow.  --Stef
+		       ;; (progn (info "(python2.3-lib)Miscellaneous Index")
+		       ;; 	      (Info-last)
+		       ;; 	      (Info-exit)
+		       ;; 	      t)
+		       nil
+		     (error nil)))))
+  (info-lookup-maybe-add-help
+   :mode 'python-mode
+   :regexp "[[:alnum:]_]+"
+   :doc-spec
+   ;; Fixme: Add python-ref?  Can this reasonably be made specific
+   ;; to indices with different rules?
+   (if versioned
+       '((,(concat "(python" version "-lib)Module Index"))
+	 (,(concat "(python" version "-lib)Class-Exception-Object Index"))
+	 (,(concat "(python" version "-lib)Function-Method-Variable Index"))
+	 (,(concat "(python" version "-lib)Miscellaneous Index")))
+     '(("(python-lib)Module Index")
+       ("(python-lib)Class-Exception-Object Index")
+       ("(python-lib)Function-Method-Variable Index")
+       ("(python-lib)Miscellaneous Index")))))
+
+;;;; Miscellancy.
+
+(defcustom python-jython-packages '("java" "javax" "org" "com")
+  "Packages implying `jython-mode'.
+If these are imported near the beginning of the buffer, `python-mode'
+actually punts to `jython-mode'."
+  :type '(repeat string)
+  :group 'python)
+
+;; Called from `python-mode', this causes a recursive call of the
+;; mode.  See logic there to break out of the recursion.
+(defun python-maybe-jython ()
+  "Invoke `jython-mode' if the buffer appears to contain Jython code.
+The criterion is either a match for `jython-mode' via
+`interpreter-mode-alist' or an import of a module from the list
+`python-jython-packages'."
+  ;; The logic is taken from python-mode.el.
+  (save-excursion
+    (goto-char (point-min))
+    (let ((interpreter (if (looking-at auto-mode-interpreter-regexp)
+			   (match-string 2))))
+      (if (and interpreter (eq 'jython-mode
+			       (cdr (assoc (file-name-nondirectory interpreter)
+					   interpreter-mode-alist))))
+	  (jython-mode)
+	(if (catch 'done
+	      (while (re-search-forward
+		      (rx (and line-start (or "import" "from") (1+ space)
+			       (group (1+ (not (any " \t\n."))))))
+		      (+ (point) 10000)	; Probably not worth customizing.
+		      t)
+		(if (member (match-string 1) python-jython-packages)
+		    (throw 'done t))))
+	    (jython-mode))))))
+
+(defun python-fill-paragraph (&optional justify)
+  "Like \\[fill-paragraph], but handle 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."
+  (interactive "P")
+  (or (fill-comment-paragraph justify)
+      (let ((paragraph-start (concat paragraph-start
+				     "\\|\\s-*\\(:?#\\s\"\\|\\s|\\|#")))
+	(fill-paragraph justify))
+      t))
+
+(defun python-shift-left (start end &optional count)
+  "Shift lines in region COUNT (the prefix arg) columns to the left.
+COUNT defaults to `python-indent'.  If region isn't active, just shift
+current line.  The region shifted includes the lines in which START and
+END lie.  It is an error if any lines in the region are indented less than
+COUNT columns."
+  (interactive (if mark-active
+		   (list (region-beginning) (region-end) current-prefix-arg)
+		 (list (point) (point) current-prefix-arg)))
+  (if count
+      (setq count (prefix-numeric-value count))
+    (setq count python-indent))
+  (when (> count 0)
+    (save-excursion
+      (goto-char start)
+      (while (< (point) end)
+	(if (and (< (current-indentation) count)
+		 (not (looking-at "[ \t]*$")))
+	    (error "Can't shift all lines enough"))
+	(forward-line))
+      (indent-rigidly start end (- count)))))
+
+(add-to-list 'debug-ignored-errors "^Can't shift all lines enough")
+
+(defun python-shift-right (start end &optional count)
+  "Shift lines in region COUNT (the prefix arg) columns to the right.
+COUNT defaults to `python-indent'.  If region isn't active, just shift
+current line.  The region shifted includes the lines in which START and
+END lie."
+  (interactive (if mark-active
+		   (list (region-beginning) (region-end) current-prefix-arg)
+		 (list (point) (point) current-prefix-arg)))
+  (if count
+      (setq count (prefix-numeric-value count))
+    (setq count python-indent))
+  (indent-rigidly start end count))
+
+(defun python-outline-level ()
+  "`outline-level' function for Python mode.
+The level is the number of `python-indent' steps of indentation."
+  (/ (current-indentation) python-indent))
+
+;; Fixme: Consider top-level assignments, imports, &c.
+(defun python-current-defun ()
+  "`add-log-current-defun-function' for Python."
+  (save-excursion
+    ;; Move up the tree of nested `class' and `def' blocks until we
+    ;; get to zero indentation, accumulating the defined names.
+    (let ((start t)
+	  accum)
+      (while (or start (> (current-indentation) 0))
+	(setq start nil)
+	(python-beginning-of-block)
+	(end-of-line)
+	(beginning-of-defun)
+	(if (looking-at (rx (and (0+ space) (or "def" "class") (1+ space)
+				 (group (1+ (or word (syntax symbol))))
+				 word-end)))
+	    (push (match-string 1) accum)))
+      (if accum (mapconcat 'identity accum ".")))))
+
+(defun python-mark-block ()
+  "Mark the block around point.
+Uses `python-beginning-of-block', `python-end-of-block'."
+  (interactive)
+  (push-mark)
+  (python-beginning-of-block)
+  (push-mark (point) nil t)
+  (python-end-of-block)
+  (exchange-point-and-mark))
+
+;;;; Modes.
+
+;;;###autoload
+(define-derived-mode python-mode fundamental-mode "Python"
+  "Major mode for editing Python files.
+Turns on Font Lock mode unconditionally since it is required for correct
+parsing of the source.
+See also `jython-mode', which is actually invoked if the buffer appears to
+contain Jython code.
+
+The Emacs commands which work with `defun's, e.g. \\[beginning-of-defun], deal
+with nested `def' and `class' blocks.  They take the innermost one as
+current without distinguishing method and class definitions.
+\\<python-mode-map>
+Colon is electric: it outdents the line if appropriate, e.g. for
+an else statement.  \\[python-backspace] at the beginning of an indented statement
+deletes a level of indentation to close the current block; otherwise it
+deletes a charcter backward.  TAB indents the current line relative to
+the preceding code.  Successive TABs, with no intervening command, cycle
+through the possibilities for indentation on the basis of enclosing blocks.
+
+\\{python-mode-map}"
+  :group 'python
+  (set (make-local-variable 'font-lock-defaults)
+       '(python-font-lock-keywords nil nil ((?_ . "w")) nil
+				   (font-lock-syntactic-keywords
+				    . python-font-lock-syntactic-keywords)
+;;; This probably isn't worth it.
+;;; 				   (font-lock-syntactic-face-function
+;;; 				    . python-font-lock-syntactic-face-function)
+				   ))
+  (set (make-local-variable 'parse-sexp-lookup-properties) t)
+  (set (make-local-variable 'comment-start) "# ")
+  ;; Fixme: define a comment-indent-function?
+  (set (make-local-variable 'indent-line-function) #'python-indent-line)
+  (set (make-local-variable 'paragraph-start) "\\s-*$")
+  (set (make-local-variable 'fill-paragraph-function)
+       'python-fill-paragraph)
+  (set (make-local-variable 'require-final-newline) t)
+  (set (make-local-variable 'add-log-current-defun-function)
+       #'python-current-defun)
+  ;; Fixme: Generalize to do all blocks?
+  (set (make-local-variable 'outline-regexp) "\\s-+\\(def\\|class\\)\\>")
+  (set (make-local-variable 'outline-level) #'python-outline-level)
+  (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil)
+  (make-local-variable 'python-saved-check-command)
+  (set (make-local-variable 'beginning-of-defun-function)
+       'python-beginning-of-defun)
+  (set (make-local-variable 'end-of-defun-function) 'python-end-of-defun)
+  (setq imenu-create-index-function #'python-imenu-create-index)
+  (unless font-lock-mode (font-lock-mode 1))
+  (when python-guess-indent (python-guess-indent))
+  (set (make-local-variable 'python-command) python-python-command)
+  (unless (boundp 'python-mode-running)	; kill the recursion from jython-mode
+    (let ((python-mode-running t))
+      (python-maybe-jython))))
+
+(custom-add-option 'python-mode-hook 'imenu-add-menubar-index)
+(custom-add-option 'python-mode-hook
+		   '(lambda ()
+		      "Turn on Indent Tabs mode."
+		      (set (make-local-variable 'indent-tabs-mode) t)))
+
+;;;###autoload
+(define-derived-mode jython-mode python-mode  "Jython"
+  "Major mode for editing Jython files.
+Like `python-mode', but sets up parameters for Jython subprocesses.
+Runs `jython-mode-hook' after `python-mode-hook'."
+  :group 'python
+  (set (make-local-variable 'python-command) python-jython-command))
+
+(provide 'python)
+;; arch-tag: 6fce1d99-a704-4de9-ba19-c6e4912b0554
+;;; python.el ends here
--- a/lisp/replace.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/replace.el	Tue Apr 13 17:17:13 2004 +0000
@@ -916,8 +916,9 @@
 		(goto-char headerpt)
 		(let ((beg (point))
 		      end)
-		  (insert (format "%d matches for \"%s\" in buffer: %s\n"
-				  matches regexp (buffer-name buf)))
+		  (insert (format "%d match%s for \"%s\" in buffer: %s\n"
+				  matches (if (= matches 1) "" "es")
+				  regexp (buffer-name buf)))
 		  (setq end (point))
 		  (add-text-properties beg end
 				       (append
--- a/lisp/url/url-about.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-about.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,33 +1,37 @@
 ;;; url-about.el --- Show internal URLs
+
+;; Copyright (c) 2001, 2004  Free Software Foundation, Inc.
+
 ;; Keywords: comm, data, processes, hypermedia
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 2001 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Emacs is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;;; Boston, MA 02111-1307, USA.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;;; Code:
+
 (eval-when-compile
   (require 'cl))
 (require 'url-util)
 (require 'url-parse)
 
 (defun url-probe-protocols ()
-  "Returns a list of all potential URL schemes."
+  "Return a list of all potential URL schemes."
   (or (get 'url-extension-protocols 'probed)
       (mapc (lambda (s) (url-scheme-get-property s 'name))
 	    (or (get 'url-extension-protocols 'schemes)
@@ -42,6 +46,8 @@
 		  (put 'url-extension-protocols 'schemes schemes)
 		  schemes)))))
 
+(defvar url-scheme-registry)
+
 (defun url-about-protocols (url)
   (url-probe-protocols)
   (insert "<html>\n"
@@ -89,11 +95,12 @@
     (if (fboundp func)
 	(progn
 	  (set-buffer (generate-new-buffer " *about-data*"))
-	  (insert "Content-type: text/html\n\n")
+	  (insert "Content-type: text/plain\n\n")
 	  (funcall func url)
 	  (current-buffer))
       (error "URL does not know about `%s'" item))))
 
 (provide 'url-about)
 
-;;; arch-tag: 65dd7fca-db3f-4cb1-8026-7dd37d4a460e
+;; arch-tag: 65dd7fca-db3f-4cb1-8026-7dd37d4a460e
+;;; url-about.el ends here
--- a/lisp/url/url-auth.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-auth.el	Tue Apr 13 17:17:13 2004 +0000
@@ -298,9 +298,9 @@
 	 (node (assoc type url-registered-auth-schemes)))
     (if (not (fboundp function))
 	(url-warn 'security
-		  (format (eval-when-compile
-			    "Tried to register `%s' as an auth scheme"
-			    ", but it is not a function!") function)))
+		  (format (concat
+			   "Tried to register `%s' as an auth scheme"
+			   ", but it is not a function!") function)))
 
     (if node
 	(setcdr node (cons function rating))
--- a/lisp/url/url-cache.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-cache.el	Tue Apr 13 17:17:13 2004 +0000
@@ -23,6 +23,7 @@
 ;;; Boston, MA 02111-1307, USA.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (require 'url-parse)
+(require 'url-util)
 
 (defcustom url-cache-directory
   (expand-file-name "cache" url-configuration-directory)
@@ -138,7 +139,7 @@
 
 (defun url-cache-create-filename-using-md5 (url)
   "Create a cached filename using MD5.
- Very fast if you are in XEmacs, suitably fast otherwise."
+Very fast if you have an `md5' primitive function, suitably fast otherwise."
   (require 'md5)
   (if url
       (let* ((url (if (vectorp url) (url-recreate-url url) url))
--- a/lisp/url/url-cookie.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-cookie.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,27 +1,30 @@
 ;;; url-cookie.el --- Netscape Cookie support
+
+;; Copyright (c) 1996 - 1999,2004  Free Software Foundation, Inc.
+;; Copyright (c) 1996 by William M. Perry <wmperry@cs.indiana.edu>
+
 ;; Keywords: comm, data, processes, hypermedia
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1996 by William M. Perry <wmperry@cs.indiana.edu>
-;;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Emacs is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;;; Boston, MA 02111-1307, USA.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;;; Code:
 
 (require 'timezone)
 (require 'url-util)
@@ -151,7 +154,7 @@
       (kill-buffer (current-buffer))))))
 
 (defun url-cookie-store (name value &optional expires domain path secure)
-  "Stores a netscape-style cookie"
+  "Store a netscape-style cookie."
   (let* ((storage (if secure url-cookie-secure-storage url-cookie-storage))
 	 (tmp storage)
 	 (cur nil)
@@ -232,7 +235,7 @@
 
 ;;;###autoload
 (defun url-cookie-retrieve (host path &optional secure)
-  "Retrieves all the netscape-style cookies for a specified HOST and PATH"
+  "Retrieve all the netscape-style cookies for a specified HOST and PATH."
   (let ((storage (if secure
 		     (append url-cookie-secure-storage url-cookie-storage)
 		   url-cookie-storage))
@@ -290,7 +293,7 @@
    (mapconcat 'identity (list "com" "edu" "net" "org" "gov" "mil" "int")
 	      "\\|")
    "\\)$")
-  "A regular expression of top-level domains that only require two matching
+  "A regexp of top level domains that only require two matching
 '.'s in the domain name in order to set a cookie.")
 
 (defcustom url-cookie-trusted-urls nil
@@ -329,14 +332,14 @@
   (setq url-cookies-changed-since-last-save t)
   (let* ((args (url-parse-args str t))
 	 (case-fold-search t)
-	 (secure (and (assoc-ignore-case "secure" args) t))
-	 (domain (or (cdr-safe (assoc-ignore-case "domain" args))
+	 (secure (and (assoc-string "secure" args t) t))
+	 (domain (or (cdr-safe (assoc-string "domain" args t))
 		     (url-host url-current-object)))
 	 (current-url (url-view-url t))
 	 (trusted url-cookie-trusted-urls)
 	 (untrusted url-cookie-untrusted-urls)
-	 (expires (cdr-safe (assoc-ignore-case "expires" args)))
-	 (path (or (cdr-safe (assoc-ignore-case "path" args))
+	 (expires (cdr-safe (assoc-string "expires" args t)))
+	 (path (or (cdr-safe (assoc-string "path" args t))
 		   (file-name-directory
 		    (url-filename url-current-object))))
 	 (rest nil))
@@ -374,7 +377,7 @@
 			      (match-string 3 expires) " "	; year
 			      (match-string 4 expires) ".00 " ; hour:minutes:seconds
 			      (match-string 6 expires)))) ":" ; timezone
-    
+
     (while (consp trusted)
       (if (string-match (car trusted) current-url)
 	  (setq trusted (- (match-end 0) (match-beginning 0)))
@@ -442,25 +445,23 @@
 (defun url-cookie-setup-save-timer ()
   "Reset the cookie saver timer."
   (interactive)
-  (cond
-   ((featurep 'itimer)
-    (ignore-errors (delete-itimer url-cookie-timer))
-    (setq url-cookie-timer nil)
-    (if url-cookie-save-interval
-	(setq url-cookie-timer
+  (ignore-errors
+    (cond ((fboundp 'cancel-timer) (cancel-timer url-cookie-timer))
+	  ((fboundp 'delete-itimer) (delete-itimer url-cookie-timer))))
+  (setq url-cookie-timer nil)
+  (if url-cookie-save-interval
+      (setq url-cookie-timer
+	    (cond
+	     ((fboundp 'run-at-time)
+	      (run-at-time url-cookie-save-interval
+			   url-cookie-save-interval
+			   'url-cookie-write-file))
+	     ((fboundp 'start-itimer)
 	      (start-itimer "url-cookie-saver" 'url-cookie-write-file
 			    url-cookie-save-interval
-			    url-cookie-save-interval))))
-   ((fboundp 'run-at-time)
-    (ignore-errors (cancel-timer url-cookie-timer))
-    (setq url-cookie-timer nil)
-    (if url-cookie-save-interval
-	(setq url-cookie-timer
-	      (run-at-time url-cookie-save-interval
-			   url-cookie-save-interval
-			   'url-cookie-write-file))))
-   (t nil)))
+			    url-cookie-save-interval))))))
 
 (provide 'url-cookie)
 
-;;; arch-tag: 2568751b-6452-4398-aa2d-303edadb54d7
+;; arch-tag: 2568751b-6452-4398-aa2d-303edadb54d7
+;;; url-cookie.el ends here
--- a/lisp/url/url-dav.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-dav.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,11 +1,13 @@
 ;;; url-dav.el --- WebDAV support
 
-;; Copyright (C) 2001 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2004  Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Maintainer: Bill Perry <wmperry@gnu.org>
 ;; Keywords: url, vc
 
+;; This file is part of GNU Emacs.
+
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation; either version 2, or (at your option)
@@ -21,6 +23,12 @@
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;; DAV is in RFC 2518.
+
+;;; Commentary:
+
+;;; Code:
+
 (eval-when-compile
   (require 'cl))
 
@@ -31,12 +39,23 @@
 (defvar url-dav-supported-protocols '(1 2)
   "List of supported DAV versions.")
 
+(defun url-intersection (l1 l2)
+  "Return a list of the elements occuring in both of the lists L1 and L2."
+  (if (null l2)
+      l2
+    (let (result)
+      (while l1
+	(if (member (car l1) l2)
+	    (setq result (cons (pop l1) result))
+	  (pop l1)))
+      (nreverse result))))
+
 ;;;###autoload
 (defun url-dav-supported-p (url)
   (and (featurep 'xml)
        (fboundp 'xml-expand-namespace)
-       (intersection url-dav-supported-protocols
-		     (plist-get (url-http-options url) 'dav))))
+       (url-intersection url-dav-supported-protocols
+			 (plist-get (url-http-options url) 'dav))))
 
 (defun url-dav-node-text (node)
   "Return the text data from the XML node NODE."
@@ -47,10 +66,10 @@
 
 
 ;;; Parsing routines for the actual node contents.
-;;;
-;;; I am not incredibly happy with how this code looks/works right
-;;; now, but it DOES work, and if we get the API right, our callers
-;;; won't have to worry about the internal representation.
+;;
+;; I am not incredibly happy with how this code looks/works right
+;; now, but it DOES work, and if we get the API right, our callers
+;; won't have to worry about the internal representation.
 
 (defconst url-dav-datatype-attribute
   'urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/dt)
@@ -86,8 +105,7 @@
   "List of regular expressions matching iso8601 dates.
 1st regular expression matches the date.
 2nd regular expression matches the time.
-3rd regular expression matches the (optional) timezone specification.
-")
+3rd regular expression matches the (optional) timezone specification.")
 
 (defun url-dav-process-date-property (node)
   (require 'parse-time)
@@ -357,11 +375,10 @@
 
 ;;; DAV request/response generation/processing
 (defun url-dav-process-response (buffer url)
-  "Parses a WebDAV response from BUFFER, interpreting it relative to URL.
+  "Parse a WebDAV response from BUFFER, interpreting it relative to URL.
 
 The buffer must have been retrieved by HTTP or HTTPS and contain an
-XML document.
-"
+XML document."
   (declare (special url-http-content-type
 		    url-http-response-status
 		    url-http-end-of-headers))
@@ -399,7 +416,7 @@
 
 (defun url-dav-request (url method tag body
 				 &optional depth headers namespaces)
-  "Performs WebDAV operation METHOD on URL.  Returns the parsed responses.
+  "Perform WebDAV operation METHOD on URL.  Return the parsed responses.
 Automatically creates an XML request body if TAG is non-nil.
 BODY is the XML document fragment to be enclosed by <TAG></TAG>.
 
@@ -412,8 +429,7 @@
 
 NAMESPACES is an assoc list of (NAMESPACE . EXPANSION), and these are
 added to the <TAG> element.  The DAV=DAV: namespace is automatically
-added to this list, so most requests can just pass in nil.
-"
+added to this list, so most requests can just pass in nil."
   ;; Take care of the default value for depth...
   (setq depth (or depth 0))
 
@@ -448,8 +464,7 @@
 
 Returns an assoc list, where the key is the filename (possibly a full
 URI), and the value is a standard property list of DAV property
-names (ie: DAV:resourcetype).
-"
+names (ie: DAV:resourcetype)."
   (url-dav-request url "PROPFIND" 'DAV:propfind
 		   (if attributes
 		       (mapconcat (lambda (attr)
@@ -471,8 +486,7 @@
 This will be used as the contents of the DAV:owner/DAV:href tag to
 identify the owner of a LOCK when requesting it.  This will be shown
 to other users when the DAV:lockdiscovery property is requested, so
-make sure you are comfortable with it leaking to the outside world.
-")
+make sure you are comfortable with it leaking to the outside world.")
 
 ;;;###autoload
 (defun url-dav-lock-resource (url exclusive &optional depth)
@@ -482,8 +496,7 @@
 
 Returns a cons-cell of (SUCCESSFUL-RESULTS . FAILURE-RESULTS).
 SUCCESSFUL-RESULTS is a list of (URL STATUS locktoken).
-FAILURE-RESULTS is a list of (URL STATUS).
-"
+FAILURE-RESULTS is a list of (URL STATUS)."
   (setq	exclusive (if exclusive "<DAV:exclusive/>" "<DAV:shared/>"))
   (let* ((body
 	  (concat
@@ -554,8 +567,7 @@
 ;;;###autoload
 (defun url-dav-unlock-resource (url lock-token)
   "Release the lock on URL represented by LOCK-TOKEN.
-Returns `t' iff the lock was successfully released.
-"
+Returns t iff the lock was successfully released."
   (declare (special url-http-response-status))
   (let* ((url-request-extra-headers (list (cons "Lock-Token"
 						(concat "<" lock-token ">"))))
@@ -612,6 +624,8 @@
 	 (url-debug 'dav "Unrecognized DAV:locktype (%S)" (car lock)))))
     modes))
 
+(autoload 'url-http-head-file-attributes "url-http")
+
 ;;;###autoload
 (defun url-dav-file-attributes (url)
   (let ((properties (cdar (url-dav-get-properties url)))
@@ -673,6 +687,7 @@
   "Save OBJ as URL using WebDAV.
 URL must be a fully qualified URL.
 OBJ may be a buffer or a string."
+  (declare (special url-http-response-status))
   (let ((buffer nil)
 	(result nil)
 	(url-request-extra-headers nil)
@@ -729,8 +744,7 @@
 (defun url-dav-delete-directory (url &optional recursive lock-token)
   "Delete the WebDAV collection URL.
 If optional second argument RECURSIVE is non-nil, then delete all
-files in the collection as well.
-"
+files in the collection as well."
   (let ((status nil)
 	(props nil)
 	(props nil))
@@ -779,8 +793,7 @@
  that are relative to the specified directory.
 If MATCH is non-nil, mention only file names that match the regexp MATCH.
 If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
- NOSORT is useful if you plan to sort the result yourself.
-"
+ NOSORT is useful if you plan to sort the result yourself."
   (let ((properties (url-dav-get-properties url '(DAV:resourcetype) 1))
 	(child-url nil)
 	(child-props nil)
@@ -860,7 +873,9 @@
 (defun url-dav-rename-file (oldname newname &optional overwrite)
   (if (not (and (string-match url-handler-regexp oldname)
 		(string-match url-handler-regexp newname)))
-      (signal 'file-error "Cannot rename between different URL backends" oldname newname))
+      (signal 'file-error
+	      (list "Cannot rename between different URL backends"
+		    oldname newname)))
 
   (let* ((headers nil)
 	 (props nil)
@@ -898,8 +913,7 @@
 ;;;###autoload
 (defun url-dav-file-name-all-completions (file url)
   "Return a list of all completions of file name FILE in directory DIRECTORY.
-These are all file names in directory DIRECTORY which begin with FILE.
-"
+These are all file names in directory DIRECTORY which begin with FILE."
   (url-dav-directory-files url nil (concat "^" file ".*")))
 
 ;;;###autoload
@@ -908,8 +922,7 @@
 Returns the longest string
 common to all file names in DIRECTORY that start with FILE.
 If there is only one and FILE matches it exactly, returns t.
-Returns nil if DIR contains no name starting with FILE.
-"
+Returns nil if DIR contains no name starting with FILE."
   (let ((matches (url-dav-file-name-all-completions file url))
 	(result nil))
     (cond
@@ -971,4 +984,5 @@
 
 (provide 'url-dav)
 
-;;; arch-tag: 2b14b7b3-888a-49b8-a490-17276a40e78e
+;; arch-tag: 2b14b7b3-888a-49b8-a490-17276a40e78e
+;;; url-dav.el ends here
--- a/lisp/url/url-file.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-file.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,27 +1,30 @@
 ;;; url-file.el --- File retrieval code
+
+;; Copyright (c) 1996 - 1999,2004  Free Software Foundation, Inc.
+;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
+
 ;; Keywords: comm, data, processes
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
-;;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Emacs is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;;; Boston, MA 02111-1307, USA.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;;; Code:
 
 (eval-when-compile (require 'cl))
 (require 'mailcap)
@@ -123,10 +126,13 @@
     ;; directory-sep-char as its separator?  Would it be safer to just
     ;; use '/' unconditionally and rely on the FTP server to
     ;; straighten it out for us?
+    ;; (if (and (file-directory-p filename)
+    ;;          (not (string-match (format "%c$" directory-sep-char) filename)))
+    ;;     (url-set-filename url (format "%s%c" filename directory-sep-char)))
     (if (and (file-directory-p filename)
-	     (not (string-match (format "%c$" directory-sep-char) filename)))
-	(url-set-filename url
-			  (format "%s%c" filename directory-sep-char)))
+	     (not (string-match "/\\'" filename)))
+	(url-set-filename url (format "%s/" filename)))
+
 
     ;; If it is a directory, look for an index file first.
     (if (and (file-directory-p filename)
@@ -235,4 +241,5 @@
 
 (provide 'url-file)
 
-;;; arch-tag: 010e914a-7313-494b-8a8c-6495a862157d
+;; arch-tag: 010e914a-7313-494b-8a8c-6495a862157d
+;;; url-file.el ends here
--- a/lisp/url/url-handlers.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-handlers.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,27 +1,30 @@
 ;;; url-handlers.el --- file-name-handler stuff for URL loading
+
+;; Copyright (c) 1996,97,98,1999,2004  Free Software Foundation, Inc.
+;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
+
 ;; Keywords: comm, data, processes, hypermedia
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
-;;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Emacs is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;;; Boston, MA 02111-1307, USA.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;;; Code:
 
 (require 'url)
 (require 'url-parse)
@@ -92,16 +95,19 @@
 particularly bad at this\).")
 
 ;;;###autoload
-(defun url-setup-file-name-handlers ()
-  "Setup file-name handlers."
-  (cond
-   ((not (boundp 'file-name-handler-alist))
-    nil)				; Don't load if no alist
-   ((rassq 'url-file-handler file-name-handler-alist)
-    nil)				; Don't load twice
-   (t
-    (push (cons url-handler-regexp 'url-file-handler)
-	  file-name-handler-alist))))
+(define-minor-mode url-handler-mode
+  "Use URL to handle URL-like file names."
+  :global t
+  (if (not (boundp 'file-name-handler-alist))
+      ;; Can't be turned ON anyway.
+      (setq url-handler-mode nil)
+    ;; Remove old entry, if any.
+    (setq file-name-handler-alist
+	  (delq (rassq 'url-file-handler file-name-handler-alist)
+		file-name-handler-alist))
+    (if url-handler-mode
+	(push (cons url-handler-regexp 'url-file-handler)
+	      file-name-handler-alist))))
 
 (defun url-run-real-handler (operation args)
   (let ((inhibit-file-name-handlers (cons 'url-file-handler
@@ -248,4 +254,5 @@
 
 (provide 'url-handlers)
 
-;;; arch-tag: 7300b99c-cc83-42ff-9147-79b2723c62ac
+;; arch-tag: 7300b99c-cc83-42ff-9147-79b2723c62ac
+;;; url-handlers.el ends here
--- a/lisp/url/url-history.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-history.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,27 +1,30 @@
 ;;; url-history.el --- Global history tracking for URL package
+
+;; Copyright (c) 1996 - 1999,2004  Free Software Foundation, Inc.
+;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
+
 ;; Keywords: comm, data, processes, hypermedia
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
-;;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Emacs is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;;; Boston, MA 02111-1307, USA.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;;; Code:
 
 ;; This can get a recursive require.
 ;;(require 'url)
@@ -77,28 +80,26 @@
   "Hash table for global history completion.")
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
 ;;;###autoload
 (defun url-history-setup-save-timer ()
   "Reset the history list timer."
   (interactive)
-  (cond
-   ((featurep 'itimer)
-    (ignore-errors (delete-itimer url-history-timer))
-    (setq url-history-timer nil)
-    (if url-history-save-interval
-	(setq url-history-timer
+  (ignore-errors 
+    (cond ((fboundp 'cancel-timer) (cancel-timer url-history-timer))
+	  ((fboundp 'delete-itimer) (delete-itimer url-history-timer))))
+  (setq url-history-timer nil)
+  (if url-history-save-interval
+      (setq url-history-timer
+	    (cond
+	     ((fboundp 'run-at-time)
+	      (run-at-time url-history-save-interval
+			   url-history-save-interval
+			   'url-history-save-history))
+	     ((fboundp 'start-itimer)
 	      (start-itimer "url-history-saver" 'url-history-save-history
 			    url-history-save-interval
-			    url-history-save-interval))))
-   ((fboundp 'run-at-time)
-    (ignore-errors (cancel-timer url-history-timer))
-    (setq url-history-timer nil)
-    (if url-history-save-interval
-	(setq url-history-timer
-	      (run-at-time url-history-save-interval
-			   url-history-save-interval
-			   'url-history-save-history))))
-   (t nil)))
+			    url-history-save-interval))))))
 
 ;;;###autoload
 (defun url-history-parse-history (&optional fname)
@@ -195,4 +196,5 @@
 
 (provide 'url-history)
 
-;;; arch-tag: fbbbaf63-db36-4e88-bc9f-2939aa93afb2
+;; arch-tag: fbbbaf63-db36-4e88-bc9f-2939aa93afb2
+;;; url-history.el ends here
--- a/lisp/url/url-http.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-http.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,27 +1,29 @@
 ;;; url-http.el --- HTTP retrieval routines
+
+;; Copyright (c) 1999, 2001, 2004  Free Software Foundation, Inc.
+
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Keywords: comm, data, processes
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1999, 2001 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Emacs is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;;; Boston, MA 02111-1307, USA.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Commentary:
+
+;;; Code:
 
 (eval-when-compile
   (require 'cl)
@@ -370,8 +372,7 @@
   (url-http-parse-response)
   (mail-narrow-to-head)
   ;;(narrow-to-region (point-min) url-http-end-of-headers)
-  (let ((version nil)
-	(class nil)
+  (let ((class nil)
 	(success nil))
     (setq class (/ url-http-response-status 100))
     (url-http-debug "Parsed HTTP headers: class=%d status=%d" class url-http-response-status)
@@ -1105,8 +1106,7 @@
 
 ;;;###autoload
 (defun url-http-file-exists-p (url)
-  (let ((version nil)
-	(status nil)
+  (let ((status nil)
 	(exists nil)
 	(buffer (url-http-head url)))
     (if (not buffer)
@@ -1219,5 +1219,5 @@
 
 (provide 'url-http)
 
-;;; arch-tag: ba7c59ae-c0f4-4a31-9617-d85f221732ee
+;; arch-tag: ba7c59ae-c0f4-4a31-9617-d85f221732ee
 ;;; url-http.el ends here
--- a/lisp/url/url-https.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-https.el	Tue Apr 13 17:17:13 2004 +0000
@@ -33,14 +33,14 @@
 (defalias 'url-https-expand-file-name 'url-http-expand-file-name)
 
 (defmacro url-https-create-secure-wrapper (method args)
-  (` (defun (, (intern (format (if method "url-https-%s" "url-https") method))) (, args)
-       (, (format "HTTPS wrapper around `%s' call." (or method "url-http")))
-       (condition-case ()
-	   (require 'ssl)
-	 (error
-	  (error "HTTPS support could not find `ssl' library.")))
-       (let ((url-gateway-method 'ssl))
-	 ((, (intern (format (if method "url-http-%s" "url-http") method))) (,@ (remove '&rest (remove '&optional args))))))))
+  `(defun ,(intern (format (if method "url-https-%s" "url-https") method)) ,args
+    ,(format "HTTPS wrapper around `%s' call." (or method "url-http"))
+    (condition-case ()
+	(require 'ssl)
+      (error
+       (error "HTTPS support could not find `ssl' library")))
+    (let ((url-gateway-method 'ssl))
+      ( ,(intern (format (if method "url-http-%s" "url-http") method)) ,@(remove '&rest (remove '&optional args))))))
 
 (url-https-create-secure-wrapper nil (url callback cbargs))
 (url-https-create-secure-wrapper file-exists-p (url))
--- a/lisp/url/url-ldap.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-ldap.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,30 +1,33 @@
 ;;; url-ldap.el --- LDAP Uniform Resource Locator retrieval code
+;; Copyright (c) 1998 - 1999, 2004 Free Software Foundation, Inc.
+
 ;; Keywords: comm, data, processes
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1998 - 1999 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Emacs is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;;; Boston, MA 02111-1307, USA.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;;; Code:
 
 (require 'url-vars)
 (require 'url-parse)
 (require 'url-util)
+(require 'ldap)
 
 ;; This has been implemented from RFC2255 'The LDAP URL Format' (Dec 1997)
 ;;
@@ -35,7 +38,7 @@
 ;; ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US
 ;;
 ;; For simple queries, I have verified compatibility with Netscape
-;; Communicator v4.5 under linux.
+;; Communicator v4.5 under GNU/Linux.
 ;;
 ;; For anything _useful_ though, like specifying the attributes,
 ;; scope, filter, or extensions, netscape claims the URL format is
@@ -92,8 +95,8 @@
   (condition-case ()
       (require 'ssl)
     (error nil))
-  (let ((vals (and (fboundp 'ssl-certificate-information)
-		   (ssl-certificate-information data))))
+  (let ((vals (if (fboundp 'ssl-certificate-information)
+		  (ssl-certificate-information data))))
     (if (not vals)
 	"<b>Unable to parse certificate</b>"
       (concat "<table border=0>\n"
@@ -104,9 +107,11 @@
 	      "</table>\n"))))
 
 (defun url-ldap-image-formatter (data)
-  (format "<img alt='JPEG Photo' src='data:image/jpeg;base64,%s'>" 
+  (format "<img alt='JPEG Photo' src='data:image/jpeg;base64,%s'>"
 	  (url-hexify-string (base64-encode-string data))))
 
+;; FIXME: This needs sorting out for the Emacs LDAP functions, specifically
+;; calls of ldap-open, ldap-close, ldap-search-internal
 ;;;###autoload
 (defun url-ldap (url)
   (save-excursion
@@ -210,7 +215,7 @@
 				    "</td></tr>\n")
 			  ;; Multiple matches, slightly uglier
 			  (insert "   <tr>\n"
-				  (format "    <td valign=top>" (length (cdr attr)))
+				  (format "    <td valign=top>")
 				  (url-ldap-attribute-pretty-name (car attr)) "</td><td>"
 				  (mapconcat (lambda (x)
 					       (url-ldap-attribute-pretty-desc (car attr) x))
@@ -229,4 +234,5 @@
 
 (provide 'url-ldap)
 
-;;; arch-tag: 6230e21c-41ae-4174-bd83-82c835676fc8
+;; arch-tag: 6230e21c-41ae-4174-bd83-82c835676fc8
+;;; url-ldap.el ends here
--- a/lisp/url/url-mailto.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-mailto.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,27 +1,30 @@
 ;;; url-mail.el --- Mail Uniform Resource Locator retrieval code
+
+;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc.
+;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
+
 ;; Keywords: comm, data, processes
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
-;;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Emacs is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;;; Boston, MA 02111-1307, USA.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;;; Code:
 
 (eval-when-compile (require 'cl))
 (require 'url-vars)
@@ -118,11 +121,12 @@
 	  (cond ((eq url-mail-command 'compose-mail)
 		 (funcall (get mail-user-agent 'sendfunc) nil))
 		;; otherwise, we can't be sure
-		((fboundp 'message-mail)
+		((fboundp 'message-send-and-exit)
 		 (message-send-and-exit))
 		(t (mail-send-and-exit nil)))))
     nil))
 
 (provide 'url-mailto)
 
-;;; arch-tag: 7b7ad52e-8760-497b-9444-75fae14e34c5
+;; arch-tag: 7b7ad52e-8760-497b-9444-75fae14e34c5
+;;; url-mailto.el ends here
--- a/lisp/url/url-methods.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-methods.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,27 +1,30 @@
 ;;; url-methods.el --- Load URL schemes as needed
+
+;; Copyright (c) 1996,97,98,1999,2004  Free Software Foundation, Inc.
+;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
+
 ;; Keywords: comm, data, processes, hypermedia
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1993 - 1996, 2004 by William M. Perry <wmperry@cs.indiana.edu>
-;;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Emacs is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;;; Boston, MA 02111-1307, USA.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;;; Code:
 
 (eval-when-compile
   (require 'cl))
@@ -144,4 +147,5 @@
 
 (provide 'url-methods)
 
-;;; arch-tag: 336863f8-5a07-4906-9be5-b3c6bcebbe67
+;; arch-tag: 336863f8-5a07-4906-9be5-b3c6bcebbe67
+;;; url-methods.el ends here
--- a/lisp/url/url-news.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-news.el	Tue Apr 13 17:17:13 2004 +0000
@@ -73,7 +73,7 @@
 		"   </p>\n"
 		"   <p>\n"
 		"    If you If you feel this is an error, <a href=\""
-		"mailto:" url-bug-address "\">send me mail</a>\n"
+		"mailto:" url-bug-address "\">send mail</a>\n"
 		"   </p>\n"
 		"  </div>\n"
 		" </body>\n"
@@ -89,7 +89,7 @@
   (if (string-match "/+$" newsgroup)
       (setq newsgroup (substring newsgroup 0 (match-beginning 0))))
 
-  ;; This saves us from checking new news if GNUS is already running
+  ;; This saves us from checking new news if Gnus is already running
   ;; FIXME - is it relatively safe to use gnus-alive-p here? FIXME
   (if (or (not (get-buffer gnus-group-buffer))
 	  (save-excursion
--- a/lisp/url/url-parse.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-parse.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,27 +1,31 @@
 ;;; url-parse.el --- Uniform Resource Locator parser
+
+;; Copyright (c) 1996,97,98,1999,2004  Free Software Foundation, Inc.
+;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
+
 ;; Keywords: comm, data, processes
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1993 - 1996, 2004 by William M. Perry <wmperry@cs.indiana.edu>
-;;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Emacs is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;;; Boston, MA 02111-1307, USA.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;;; Code:
+
 (require 'url-vars)
 
 (autoload 'url-scheme-get-property "url-methods")
@@ -84,6 +88,7 @@
   
 ;;;###autoload
 (defun url-recreate-url (urlobj)
+  "Recreate a URL string from the parsed URLOBJ."
   (concat (url-type urlobj) ":" (if (url-host urlobj) "//" "")
 	  (if (url-user urlobj)
 	      (concat (url-user urlobj)
@@ -111,7 +116,7 @@
 (defun url-generic-parse-url (url)
   "Return a vector of the parts of URL.
 Format is:
-\[proto username password hostname portnumber file reference attributes fullp\]"
+\[TYPE USER PASSWORD HOST PORT FILE TARGET ATTRIBUTES FULL\]"
   (cond
    ((null url)
     (make-vector 9 nil))
@@ -202,4 +207,5 @@
 
 (provide 'url-parse)
 
-;;; arch-tag: f338325f-71ab-4bee-93cc-78fb9a03d403
+;; arch-tag: f338325f-71ab-4bee-93cc-78fb9a03d403
+;;; url-parse.el ends here
--- a/lisp/url/url-util.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-util.el	Tue Apr 13 17:17:13 2004 +0000
@@ -27,6 +27,7 @@
 (require 'url-parse)
 (autoload 'timezone-parse-date "timezone")
 (autoload 'timezone-make-date-arpa-standard "timezone")
+(autoload 'mail-header-extract "mailheader")
 
 (defvar url-parse-args-syntax-table
   (copy-syntax-table emacs-lisp-mode-syntax-table)
@@ -292,9 +293,28 @@
 	(+ 10 (- x ?A)))
     (- x ?0)))
 
+;; Fixme: Is this definition better, and does it ever matter?
+
+;; (defun url-unhex-string (str &optional allow-newlines)
+;;   "Remove %XX, embedded spaces, etc in a url.
+;; If optional second argument ALLOW-NEWLINES is non-nil, then allow the
+;; decoding of carriage returns and line feeds in the string, which is normally
+;; forbidden in URL encoding."
+;;   (setq str (or str ""))
+;;   (setq str (replace-regexp-in-string "%[[:xdigit:]]\\{2\\}"
+;; 				      (lambda (match)
+;; 					(string (string-to-number
+;; 						 (substring match 1) 16)))
+;; 				      str t t))
+;;   (if allow-newlines
+;;       (replace-regexp-in-string "[\n\r]" (lambda (match)
+;; 					   (format "%%%.2X" (aref match 0)))
+;; 				str t t)
+;;     str))
+
 ;;;###autoload
 (defun url-unhex-string (str &optional allow-newlines)
-  "Remove %XXX embedded spaces, etc in a url.
+  "Remove %XX embedded spaces, etc in a url.
 If optional second argument ALLOW-NEWLINES is non-nil, then allow the
 decoding of carriage returns and line feeds in the string, which is normally
 forbidden in URL encoding."
@@ -334,11 +354,9 @@
    (lambda (char)
      ;; Fixme: use a char table instead.
      (if (not (memq char url-unreserved-chars))
-	 (if (< char 16)
-	     (format "%%0%X" char)
-	   (if (> char 255)
-	       (error "Hexifying multibyte character %s" str))
-	   (format "%%%X" char))
+	 (if (> char 255)
+	       (error "Hexifying multibyte character %s" str)
+	   (format "%%%02X" char))
        (char-to-string char)))
    str ""))
 
--- a/lisp/url/url-vars.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url-vars.el	Tue Apr 13 17:17:13 2004 +0000
@@ -24,13 +24,13 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (require 'mm-util)
-(eval-when-compile (require 'cl))
 
 (defconst url-version "Emacs"
   "Version number of URL package.")
 
 (defgroup url nil
   "Uniform Resource Locator tool"
+  :version "21.4"
   :group 'hypermedia)
 
 (defgroup url-file nil
@@ -94,7 +94,7 @@
   :type 'function
   :group 'url-cache)
 
-(defvar url-bug-address "w3-bugs@xemacs.org"
+(defconst url-bug-address "bug-gnu-emacs@gnu.org"
   "Where to send bug reports.")
 
 (defcustom url-personal-mail-address nil
--- a/lisp/url/url.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/url/url.el	Tue Apr 13 17:17:13 2004 +0000
@@ -1,31 +1,34 @@
 ;;; url.el --- Uniform Resource Locator retrieval tool
+
+;; Copyright (c) 1996,97,98,99,2001,2004  Free Software Foundation, Inc.
+;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
+
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Keywords: comm, data, processes, hypermedia
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
-;;; Copyright (c) 1996, 97, 98, 99, 2001 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Emacs is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;;; Boston, MA 02111-1307, USA.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
 
 ;; Registered URI schemes: http://www.iana.org/assignments/uri-schemes
 
+;;; Code:
+
 (eval-when-compile (require 'cl))
 ;; Don't require CL at runtime if we can avoid it (Emacs 21).
 ;; Otherwise we need it for hashing functions.  `puthash' was never
@@ -168,8 +171,7 @@
 	(setq buffer (funcall loader url callback cbargs))
       (setq buffer (funcall loader url))
       (if buffer
-	  (save-excursion
-	    (set-buffer buffer)
+	  (with-current-buffer buffer
 	    (apply callback cbargs))))
     (url-history-update-url url (current-time))
     buffer))
@@ -196,7 +198,7 @@
       (while (not retrieval-done)
 	(url-debug 'retrieval "Spinning in url-retrieve-synchronously: %S (%S)"
 		   retrieval-done asynch-buffer)
-	;; Quoth monnier:
+	;; Quoth Stef:
 	;; It turns out that the problem seems to be that the (sit-for
 	;; 0.1) below doesn't actually process the data: instead it
 	;; returns immediately because there is keyboard input
@@ -256,8 +258,7 @@
     (warn "(%s/%s) %s" class (or level 'warning) message)))
  (t
   (defun url-warn (class message &optional level)
-    (save-excursion
-      (set-buffer (get-buffer-create "*URL-WARNINGS*"))
+    (with-current-buffer (get-buffer-create "*URL-WARNINGS*")
       (goto-char (point-max))
       (save-excursion
 	(insert (format "(%s/%s) %s\n" class (or level 'warning) message)))
@@ -265,5 +266,5 @@
 
 (provide 'url)
 
-;;; arch-tag: bc182f1f-d187-4f10-b961-47af2066579a
+;; arch-tag: bc182f1f-d187-4f10-b961-47af2066579a
 ;;; url.el ends here
--- a/lisp/vc-arch.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/vc-arch.el	Tue Apr 13 17:17:13 2004 +0000
@@ -191,17 +191,22 @@
 	 (while (not (or root
 			 (equal file (setq file (file-name-directory file)))
 			 (null file)))
-	   (if (file-directory-p (expand-file-name "{arch}" file))
+	   ;; Check the =tagging-method, in case someone naively manually
+	   ;; creates a {arch} directory somewhere.
+	   (if (file-exists-p (expand-file-name "{arch}/=tagging-method" file))
 	       (setq root file)
 	     (setq file (directory-file-name file))))
 	 root))))
 
 (defun vc-arch-register (file &optional rev comment)
-  (if rev (error "Explicit initial revision not supported for Arch."))
+  (if rev (error "Explicit initial revision not supported for Arch"))
   (let ((tagmet (vc-arch-tagging-method file)))
     (if (and (memq tagmet '(tagline implicit)) comment-start)
 	(with-current-buffer (find-file-noselect file)
-	  (vc-arch-add-tagline))
+	  (if (buffer-modified-p)
+	      (error "Save %s first" (buffer-name)))
+	  (vc-arch-add-tagline)
+	  (save-buffer))
       (vc-arch-command nil 0 file "add"))))
 
 (defun vc-arch-registered (file)
@@ -272,7 +277,7 @@
 				(match-string 1)))
 		    'up-to-date
 		  'edited)))))))))
-	    
+
 (defun vc-arch-workfile-version (file)
   (let* ((root (expand-file-name "{arch}" (vc-arch-root file)))
 	 (defbranch (vc-arch-default-version file)))
@@ -328,14 +333,13 @@
 	   (looking-at "Conflicts occured, diff3 conflict markers left in file\\.")))))
 
 (defun vc-arch-delete-rej-if-obsolete ()
-  "For use in `write-file-functions'."
-  (let ((rej (concat buffer-file-name ".rej")))
-    (when (and buffer-file-name (vc-arch-diff3-rej-p rej))
-      (if (not (re-search-forward "^>>>>>>> " nil t))
-	  ;; The .rej file is obsolete.
-	  (condition-case nil (delete-file rej) (error nil)))))
-  ;; This did not save the buffer.
-  nil)
+  "For use in `after-save-hook'."
+  (save-excursion
+    (let ((rej (concat buffer-file-name ".rej")))
+      (when (and buffer-file-name (vc-arch-diff3-rej-p rej))
+	(if (not (re-search-forward "^<<<<<<< " nil t))
+	    ;; The .rej file is obsolete.
+	    (condition-case nil (delete-file rej) (error nil)))))))
 
 (defun vc-arch-find-file-hook ()
   (let ((rej (concat buffer-file-name ".rej")))
@@ -343,11 +347,11 @@
       (if (vc-arch-diff3-rej-p rej)
 	  (save-excursion
 	    (goto-char (point-min))
-	    (if (not (re-search-forward "^>>>>>>> " nil t))
+	    (if (not (re-search-forward "^<<<<<<< " nil t))
 		;; The .rej file is obsolete.
 		(condition-case nil (delete-file rej) (error nil))
 	      (smerge-mode 1)
-	      (add-hook 'write-file-functions
+	      (add-hook 'after-save-hook
 			'vc-arch-delete-rej-if-obsolete nil t)
 	      (message "There are unresolved conflicts in this file")))
 	(message "There are unresolved conflicts in %s"
@@ -403,10 +407,14 @@
 (defun vc-arch-rename-file (old new)
   (vc-arch-command nil 0 new "mv" (file-relative-name old)))
 
+(defalias 'vc-arch-responsible-p 'vc-arch-root)
+
 (defun vc-arch-command (buffer okstatus file &rest flags)
   "A wrapper around `vc-do-command' for use in vc-arch.el."
   (apply 'vc-do-command buffer okstatus vc-arch-command file flags))
 
+(defun vc-arch-init-version () nil)
+
 (provide 'vc-arch)
 
 ;;; arch-tag: a35c7c1c-5237-429d-88ef-3d718fd2e704
--- a/lisp/vc-cvs.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/vc-cvs.el	Tue Apr 13 17:17:13 2004 +0000
@@ -5,7 +5,7 @@
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Andre Spiegel <spiegel@gnu.org>
 
-;; $Id: vc-cvs.el,v 1.68 2004/03/21 15:45:31 spiegel Exp $
+;; $Id$
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/vc-hooks.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/vc-hooks.el	Tue Apr 13 17:17:13 2004 +0000
@@ -6,7 +6,7 @@
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 
-;; $Id: vc-hooks.el,v 1.165 2004/03/28 17:38:03 monnier Exp $
+;; $Id$
 
 ;; This file is part of GNU Emacs.
 
@@ -266,16 +266,6 @@
 (defmacro vc-call (fun file &rest args)
   ;; BEWARE!! `file' is evaluated twice!!
   `(vc-call-backend (vc-backend ,file) ',fun ,file ,@args))
-
-(defun vc-arg-list (backend fun)
-  "Return the argument list of BACKEND function FUN."
-  (let ((f (symbol-function (vc-find-backend-function backend fun))))
-    (if (listp f)
-        ;; loaded from .el file
-        (cadr f)
-      ;; loaded from .elc file
-      (aref f 0))))
-
 
 (defsubst vc-parse-buffer (pattern i)
   "Find PATTERN in the current buffer and return its Ith submatch."
@@ -472,12 +462,21 @@
 (defun vc-default-workfile-unchanged-p (backend file)
   "Check if FILE is unchanged by diffing against the master version.
 Return non-nil if FILE is unchanged."
-  (zerop (if (> (length (vc-arg-list backend 'diff)) 4)
+  (zerop (condition-case err
              ;; If the implementation supports it, let the output
              ;; go to *vc*, not *vc-diff*, since this is an internal call.
              (vc-call diff file nil nil "*vc*")
-           ;; for backward compatibility
-           (vc-call diff file))))
+           (wrong-number-of-arguments
+            ;; If this error came from the above call to vc-BACKEND-diff,
+            ;; try again without the optional buffer argument (for
+            ;; backward compatibility).  Otherwise, resignal.
+            (if (or (not (eq (cadr err)
+                             (indirect-function
+                              (vc-find-backend-function (vc-backend file)
+                                                        'diff))))
+                    (not (eq (caddr err) 5)))
+                (signal wrong-number-of-arguments err)
+              (vc-call diff file))))))
 
 (defun vc-workfile-version (file)
   "Return the version level of the current workfile FILE.
--- a/lisp/vc-rcs.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/vc-rcs.el	Tue Apr 13 17:17:13 2004 +0000
@@ -5,7 +5,7 @@
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 
-;; $Id: vc-rcs.el,v 1.39 2004/03/21 15:46:23 spiegel Exp $
+;; $Id$
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/vc-sccs.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/vc-sccs.el	Tue Apr 13 17:17:13 2004 +0000
@@ -5,7 +5,7 @@
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 
-;; $Id: vc-sccs.el,v 1.25 2004/03/21 15:49:55 spiegel Exp $
+;; $Id$
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/vc.el	Tue Apr 13 17:12:30 2004 +0000
+++ b/lisp/vc.el	Tue Apr 13 17:17:13 2004 +0000
@@ -7,7 +7,7 @@
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 ;; Keywords: tools
 
-;; $Id: vc.el,v 1.374 2004/03/28 22:00:19 monnier Exp $
+;; $Id$
 
 ;; This file is part of GNU Emacs.
 
@@ -2348,13 +2348,23 @@
     ;; Don't switch to the output buffer before running the command,
     ;; so that any buffer-local settings in the vc-controlled
     ;; buffer can be accessed by the command.
-    (if (> (length (vc-arg-list (vc-backend file) 'print-log)) 1)
+    (condition-case err
         (progn
           (vc-call print-log file "*vc-change-log*")
           (set-buffer "*vc-change-log*"))
-      ;; for backward compatibility
-      (vc-call print-log file)
-      (set-buffer "*vc*"))
+      (wrong-number-of-arguments
+       ;; If this error came from the above call to print-log, try again
+       ;; without the optional buffer argument (for backward compatibility).
+       ;; Otherwise, resignal.
+       (if (or (not (eq (cadr err)
+                        (indirect-function 
+                         (vc-find-backend-function (vc-backend file) 
+                                                   'print-log))))
+               (not (eq (caddr err) 2)))
+           (signal wrong-number-of-arguments err)
+         ;; for backward compatibility
+         (vc-call print-log file)
+         (set-buffer "*vc*"))))
     (pop-to-buffer (current-buffer))
     (log-view-mode)
     (vc-exec-after
--- a/lispintro/mkinstalldirs	Tue Apr 13 17:12:30 2004 +0000
+++ b/lispintro/mkinstalldirs	Tue Apr 13 17:17:13 2004 +0000
@@ -4,8 +4,6 @@
 # Created: 1993-05-16
 # Public domain
 
-# $Id: mkinstalldirs,v 1.1 2001/11/24 08:45:51 eliz Exp $
-
 errstatus=0
 
 for file
--- a/lispref/ChangeLog	Tue Apr 13 17:12:30 2004 +0000
+++ b/lispref/ChangeLog	Tue Apr 13 17:17:13 2004 +0000
@@ -1,3 +1,7 @@
+2004-04-12  Miles Bader  <miles@gnu.org>
+
+	* macros.texi (Expansion): Add description of `macroexpand-all'.
+
 2004-04-05  Jesper Harder  <harder@ifa.au.dk>
 
 	* variables.texi (Variable Aliases): Mention
--- a/lispref/display.texi	Tue Apr 13 17:12:30 2004 +0000
+++ b/lispref/display.texi	Tue Apr 13 17:17:13 2004 +0000
@@ -2022,8 +2022,8 @@
 These functions return the foreground color (or background color,
 respectively) of face @var{face}, as a string.
 
-If @var{inherit} is nil, only a color directly defined by the face is
-returned.  If @var{inherit} is non-nil, any faces specified by its
+If @var{inherit} is @code{nil}, only a color directly defined by the face is
+returned.  If @var{inherit} is non-@code{nil}, any faces specified by its
 @code{:inherit} attribute are considered as well, and if @var{inherit}
 is a face or a list of faces, then they are also considered, until a
 specified color is found.  To ensure that the return value is always
--- a/lispref/macros.texi	Tue Apr 13 17:12:30 2004 +0000
+++ b/lispref/macros.texi	Tue Apr 13 17:17:13 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998 Free Software Foundation, Inc.
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2004 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/macros
 @node Macros, Customization, Functions, Top
@@ -137,6 +137,28 @@
 @end smallexample
 @end defun
 
+
+@defun macroexpand-all form &optional environment
+@cindex macro expansion in entire form
+
+@code{macroexpand-all} expands macros like @code{macroexpand}, but
+will look for and expand all macros in @var{form}, not just at the
+top-level.
+
+In emacs-lisp, @code{macroexpand-all} guarantees that if no macros
+are expanded, the return value will be @code{eq} to @var{form}.
+
+Repeating the example used for @code{macroexpand} above with
+@code{macroexpand-all}, we see that @code{macroexpand-all} @emph{does}
+expand the embedded calls to @code{inc}:
+
+@smallexample
+(macroexpand-all '(inc2 r s))
+     @result{} (progn (setq r (1+ r)) (setq s (1+ s)))
+@end smallexample
+
+@end defun
+
 @node Compiling Macros
 @section Macros and Byte Compilation
 @cindex byte-compiling macros
--- a/lispref/mkinstalldirs	Tue Apr 13 17:12:30 2004 +0000
+++ b/lispref/mkinstalldirs	Tue Apr 13 17:17:13 2004 +0000
@@ -4,8 +4,6 @@
 # Created: 1993-05-16
 # Public domain
 
-# $Id: mkinstalldirs,v 1.1 2000/07/28 12:48:04 gerd Exp $
-
 errstatus=0
 
 for file
--- a/lispref/positions.texi	Tue Apr 13 17:12:30 2004 +0000
+++ b/lispref/positions.texi	Tue Apr 13 17:17:13 2004 +0000
@@ -411,8 +411,8 @@
 @defun line-number-at-pos &optional pos
 @cindex line number
 This function returns the line number in the current buffer
-corresponding the buffer position @var{pos}.  If @var{pos} is nil or
-omitted, the current buffer position is used.
+corresponding the buffer position @var{pos}.  If @var{pos} is @code{nil}
+or omitted, the current buffer position is used.
 @end defun
 
 @ignore
--- a/lispref/processes.texi	Tue Apr 13 17:12:30 2004 +0000
+++ b/lispref/processes.texi	Tue Apr 13 17:17:13 2004 +0000
@@ -1647,7 +1647,7 @@
 
 @defun open-network-stream-server name buffer-or-name service &optional sentinel filter
 Create a network server process for a TCP service.
-It returns nil if server processes are not supported; otherwise,
+It returns @code{nil} if server processes are not supported; otherwise,
 it returns a subprocess-object to represent the server.
 
 When a client connects to the specified service, Emacs creates a new
@@ -1843,8 +1843,8 @@
 @item :bindtodevice @var{device-name}
 If @var{device-name} is a non-empty string identifying a network
 interface name (see @code{network-interface-list}), only handle
-packets received on that interface.  If @var{device-name} is nil (the
-default), handle packets received on any interface.
+packets received on that interface.  If @var{device-name} is @code{nil}
+(the default), handle packets received on any interface.
 
 Using this option may require special privileges on some systems.
 
--- a/man/eshell.texi	Tue Apr 13 17:12:30 2004 +0000
+++ b/man/eshell.texi	Tue Apr 13 17:17:13 2004 +0000
@@ -1,5 +1,4 @@
 \input texinfo  @c -*-texinfo-*-
-@c "@(#)$Name:  $:$Id: eshell.texi,v 1.20 2003/11/26 17:12:11 ttn Exp $"
 @c %**start of header
 @setfilename ../info/eshell
 @settitle Eshell: The Emacs Shell
@@ -9,7 +8,7 @@
 @copying
 This manual is for Eshell, the Emacs shell.
 
-Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright @copyright{} 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
--- a/man/mh-e.texi	Tue Apr 13 17:12:30 2004 +0000
+++ b/man/mh-e.texi	Tue Apr 13 17:17:13 2004 +0000
@@ -1,5 +1,4 @@
 \input texinfo   @c -*-texinfo-*-
-@c $Id: mh-e.texi,v 1.15 2003/09/01 15:45:46 miles Exp $
 @c %**start of header
 @setfilename ../info/mh-e
 @settitle mh-e
@@ -16,7 +15,7 @@
 @cite{mh-e, The Emacs Interface to MH}, for mh-e, Version
 @value{VERSION}.
 
-Copyright 1995, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1995, 2001, 2002, 2004 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
--- a/man/pcl-cvs.texi	Tue Apr 13 17:12:30 2004 +0000
+++ b/man/pcl-cvs.texi	Tue Apr 13 17:17:13 2004 +0000
@@ -1,5 +1,4 @@
 \input texinfo  @c -*-texinfo-*-
-@c "@(#)$Name:  $:$Id: pcl-cvs.texi,v 1.23 2003/09/30 20:40:50 rms Exp $"
 @c %**start of header
 @setfilename ../info/pcl-cvs
 @settitle PCL-CVS --- Emacs Front-End to CVS
@@ -8,7 +7,7 @@
 
 @copying
 Copyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-1999, 2000, 2002 Free Software Foundation, Inc.
+1999, 2000, 2002, 2004 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
--- a/man/speedbar.texi	Tue Apr 13 17:12:30 2004 +0000
+++ b/man/speedbar.texi	Tue Apr 13 17:17:13 2004 +0000
@@ -1,12 +1,11 @@
 \input texinfo   @c -*-texinfo-*-
-@c $Id: speedbar.texi,v 1.13 2003/10/08 22:02:52 nickrob Exp $
 
 @setfilename ../info/speedbar
 @settitle Speedbar: File/Tag summarizing utility
 @syncodeindex fn cp
 
 @copying
-Copyright @copyright{} 1999, 2000, 2002 Free Software Foundation, Inc.
+Copyright @copyright{} 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
--- a/man/woman.texi	Tue Apr 13 17:12:30 2004 +0000
+++ b/man/woman.texi	Tue Apr 13 17:17:13 2004 +0000
@@ -1,5 +1,4 @@
 \input texinfo   @c -*-texinfo-*-
-@c $Id: woman.texi,v 1.16 2003/11/02 07:01:19 eliz Exp $
 @c %**start of header
 @setfilename ../info/woman
 @settitle WoMan: Browse Unix Manual Pages ``W.O. (without) Man''
@@ -18,7 +17,7 @@
 This file documents WoMan: A program to browse Unix manual pages `W.O.
 (without) man'.
 
-Copyright @copyright{} 2001, 2002 Free Software Foundation, Inc.
+Copyright @copyright{} 2001, 2002, 2004 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
--- a/mkinstalldirs	Tue Apr 13 17:12:30 2004 +0000
+++ b/mkinstalldirs	Tue Apr 13 17:17:13 2004 +0000
@@ -4,8 +4,6 @@
 # Created: 1993-05-16
 # Public domain
 
-# $Id: mkinstalldirs,v 1.2 2001/02/02 13:09:26 gerd Exp $
-
 errstatus=0
 
 for file
--- a/src/ChangeLog	Tue Apr 13 17:12:30 2004 +0000
+++ b/src/ChangeLog	Tue Apr 13 17:17:13 2004 +0000
@@ -1,6 +1,35 @@
+2004-04-12  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* buffer.c (Fmake_indirect_buffer): Throw an error if the intended
+	base buffer has been killed.  Correct the error message if the
+	base buffer does not exist.
+
+2004-04-12  Joe Buehler  <jbuehler@hekimian.com>
+
+	* s/cygwin.h: Changes for Cygwin unexec() support, changes in
+	Cygwin itself.  Add support for Xaw3d scrollbars.
+
+	* puresize.h: Set up PURE_P() for Cygwin unexec() support.
+
+	* lastfile.c: Define my_endbss[] for Cygwin unexec() support.
+
+	* gmalloc.c (__default_morecore): Use bss_sbrk(), not __sbrk(),
+	before Cygwin unexec.
+
+	* Makefile.in: Link changes for Cygwin unexec() support.
+
+2004-04-12  Andreas Schwab  <schwab@suse.de>
+
+	* buffer.c (Fmake_indirect_buffer): Check that NAME is a string.
+
+2004-04-11  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* buffer.c (Fgenerate_new_buffer_name): Return NAME argument if
+	IGNORE argument equals NAME.  Doc fix.
+
 2004-04-11  Masatake YAMATO  <jet@gyve.org>
 
-	* buffer.c (fix_start_end_in_overlays): make overlays 
+	* buffer.c (fix_start_end_in_overlays): Make overlays
 	empty if they are backwards.
 
 2004-04-07  Stefan Monnier  <monnier@iro.umontreal.ca>
--- a/src/Makefile.in	Tue Apr 13 17:12:30 2004 +0000
+++ b/src/Makefile.in	Tue Apr 13 17:17:13 2004 +0000
@@ -1,5 +1,5 @@
 # Makefile for GNU Emacs.
-# Copyright (C) 1985, 87, 88, 93, 94, 95, 99, 2000, 2001, 2003
+# Copyright (C) 1985, 87, 88, 93, 94, 95, 99, 2000, 01, 03, 2004
 # Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
@@ -564,6 +564,10 @@
 #endif
 #endif
 
+#ifdef CYGWIN
+CYGWIN_OBJ = sheap.o
+#endif
+
 #ifdef HAVE_CARBON
 mac = $(dot)$(dot)/mac/
 MAC_OBJ = mac.o macterm.o macfns.o macmenu.o fontset.o fringe.o image.o
@@ -586,7 +590,7 @@
 	process.o callproc.o \
 	region-cache.o sound.o atimer.o \
 	doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \
-	$(MSDOS_OBJ) $(MAC_OBJ)
+	$(MSDOS_OBJ) $(MAC_OBJ) $(CYGWIN_OBJ)
 
 /* Object files used on some machine or other.
    These go in the DOC file on all machines
@@ -643,7 +647,12 @@
 
 /* define otherobj as list of object files that make-docfile
    should not be told about.  */
+#ifdef CYGWIN
+/* Cygwin differs because of its unexec(). */
+otherobj= $(termcapobj) $(gmallocobj) $(rallocobj) lastfile.o vm-limit.o $(allocaobj) $(widgetobj) $(LIBOBJS)
+#else
 otherobj= $(termcapobj) lastfile.o $(mallocobj) $(allocaobj) $(widgetobj) $(LIBOBJS)
+#endif
 
 #ifdef HAVE_MOUSE
 #define MOUSE_SUPPORT ${lispsource}mouse.elc \
--- a/src/buffer.c	Tue Apr 13 17:12:30 2004 +0000
+++ b/src/buffer.c	Tue Apr 13 17:17:13 2004 +0000
@@ -521,7 +521,7 @@
        2, 3,
        "bMake indirect buffer (to buffer): \nBName of indirect buffer: ",
        doc: /* Create and return an indirect buffer for buffer BASE-BUFFER, named NAME.
-BASE-BUFFER should be an existing buffer (or buffer name).
+BASE-BUFFER should be a live buffer, or the name of an existing buffer.
 NAME should be a string which is not the name of an existing buffer.
 Optional argument CLONE non-nil means preserve BASE-BUFFER's state,
 such as major and minor modes, in the indirect buffer.
@@ -529,16 +529,20 @@
      (base_buffer, name, clone)
      Lisp_Object base_buffer, name, clone;
 {
-  Lisp_Object buf;
+  Lisp_Object buf, tem;
   struct buffer *b;
 
+  CHECK_STRING (name);
   buf = Fget_buffer (name);
   if (!NILP (buf))
     error ("Buffer name `%s' is in use", SDATA (name));
 
+  tem = base_buffer;
   base_buffer = Fget_buffer (base_buffer);
   if (NILP (base_buffer))
-    error ("No such buffer: `%s'", SDATA (name));
+    error ("No such buffer: `%s'", SDATA (tem));
+  if (NILP (XBUFFER (base_buffer)->name))
+    error ("Base buffer has been killed");
 
   if (SCHARS (name) == 0)
     error ("Empty string for buffer name is not allowed");
@@ -652,7 +656,7 @@
 }
 
 /* Reinitialize everything about a buffer except its name and contents
-   and local variables. 
+   and local variables.
    If called on an already-initialized buffer, the list of overlays
    should be deleted before calling this function, otherwise we end up
    with overlays that claim to belong to the buffer but the buffer
@@ -766,7 +770,7 @@
        doc: /* Return a string that is the name of no existing buffer based on NAME.
 If there is no live buffer named NAME, then return NAME.
 Otherwise modify name by appending `<NUMBER>', incrementing NUMBER
-until an unused name is found, and then return that name.
+\(starting at 2) until an unused name is found, and then return that name.
 Optional second argument IGNORE specifies a name that is okay to use
 \(if it is in the sequence to be tried)
 even if a buffer with that name exists.  */)
@@ -779,6 +783,9 @@
 
   CHECK_STRING (name);
 
+  tem = Fstring_equal (name, ignore);
+  if (!NILP (tem))
+    return name;
   tem = Fget_buffer (name);
   if (NILP (tem))
     return name;
--- a/src/gmalloc.c	Tue Apr 13 17:12:30 2004 +0000
+++ b/src/gmalloc.c	Tue Apr 13 17:17:13 2004 +0000
@@ -352,6 +352,10 @@
 #include <errno.h>
 
 /* How to really get more memory.  */
+#if defined(CYGWIN)
+extern __ptr_t bss_sbrk PP ((ptrdiff_t __size));
+extern int bss_sbrk_did_unexec;
+#endif
 __ptr_t (*__morecore) PP ((ptrdiff_t __size)) = __default_morecore;
 
 /* Debugging hook for `malloc'.  */
@@ -1572,7 +1576,14 @@
 __default_morecore (increment)
      __malloc_ptrdiff_t increment;
 {
-  __ptr_t result = (__ptr_t) __sbrk (increment);
+  __ptr_t result;
+#if defined(CYGWIN)
+  if (!bss_sbrk_did_unexec)
+    {
+      return bss_sbrk (increment);
+    }
+#endif
+  result = (__ptr_t) __sbrk (increment);
   if (result == (__ptr_t) -1)
     return NULL;
   return result;
--- a/src/lastfile.c	Tue Apr 13 17:12:30 2004 +0000
+++ b/src/lastfile.c	Tue Apr 13 17:17:13 2004 +0000
@@ -40,7 +40,7 @@
 
 char my_edata[] = "End of Emacs initialized data";
 
-#ifdef WINDOWSNT
+#if defined(WINDOWSNT) || defined(CYGWIN)
 /* Help unexec locate the end of the .bss area used by Emacs (which
    isn't always a separate section in NT executables).  */
 char my_endbss[1];
--- a/src/puresize.h	Tue Apr 13 17:12:30 2004 +0000
+++ b/src/puresize.h	Tue Apr 13 17:17:13 2004 +0000
@@ -68,7 +68,7 @@
 
 /* Define PURE_P.  */
 
-#ifdef VIRT_ADDR_VARIES
+#if defined(VIRT_ADDR_VARIES) || defined(CYGWIN)
 /* For machines like APOLLO where text and data can go anywhere
    in virtual memory.  */
 
--- a/src/s/cygwin.h	Tue Apr 13 17:12:30 2004 +0000
+++ b/src/s/cygwin.h	Tue Apr 13 17:17:13 2004 +0000
@@ -115,10 +115,8 @@
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 #define GETPGRP_NO_ARG 1
 #define SYSV_SYSTEM_DIR 1
-/* -lutil comes from inetutils and has pty functions in it */
-#define LIBS_SYSTEM -lutil
-/* undumping is not implemented yet */
-#define CANNOT_DUMP 1
+#define LIB_STANDARD_LIBSRC
+#define UNEXEC unexcw.o
 #define POSIX_SIGNALS 1
 /* force the emacs image to start high in memory, so dll relocation
    can put things in low memory without causing all sorts of grief for
@@ -137,7 +135,7 @@
 /*#define HAVE_VFORK*/
 /* Xaw3d causes problems -- might have been fixed by NARROWPROTO
    above, but I haven't tried it */
-#undef HAVE_XAW3D
+/*#undef HAVE_XAW3D*/
 
 /* vfork() interacts badly with setsid(), causing ptys to fail to
    change their controlling terminal */