changeset 109225:cf1662d15309

Merge from mainline.
author Katsumi Yamaoka <katsumi@flagship2>
date Sat, 19 Jun 2010 12:15:25 +0000
parents 91be20d0588d (current diff) aeb7617bd322 (diff)
children a4002b21a37b
files etc/NEWS.23 lisp/vc/vc-annotate.el lisp/vc/vc-svn.el
diffstat 40 files changed, 2168 insertions(+), 294 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jun 15 11:40:23 2010 +0000
+++ b/ChangeLog	Sat Jun 19 12:15:25 2010 +0000
@@ -1,6 +1,15 @@
+2010-06-16  Chong Yidong  <cyd@stupidchicken.com>
+
+	* INSTALL: Update font information (Bug#6389).
+
+2010-06-16  Glenn Morris  <rgm@gnu.org>
+
+	* INSTALL: General update.
+
 2010-06-12  Glenn Morris  <rgm@gnu.org>
 
-	* Makefile.in (install-arch-indep): Delete any old info .gz files first.
+	* Makefile.in (install-arch-indep): Delete any old info .gz files
+	first.
 
 2010-06-11  Glenn Morris  <rgm@gnu.org>
 
--- a/INSTALL	Tue Jun 15 11:40:23 2010 +0000
+++ b/INSTALL	Sat Jun 19 12:15:25 2010 +0000
@@ -5,32 +5,38 @@
 See the end of the file for license conditions.
 
 
-This file contains general information.  For more specific information
-for the Windows, GNUstep/Mac OS X, and MS-DOS ports, also see the files
-nt/INSTALL nextstep/INSTALL, and msdos/INSTALL.  For information
-specific to building from a Bazaar checkout (rather than a release), see
-the file INSTALL.BZR.
+This file contains general information on building GNU Emacs.
+For more information specific to the MS-Windows, GNUstep/Mac OS X, and
+MS-DOS ports, also read the files nt/INSTALL, nextstep/INSTALL, and
+msdos/INSTALL.  For information about building from a Bazaar checkout
+(rather than a release), also read the file INSTALL.BZR.
 
 
 BASIC INSTALLATION
 
-The simplest way to build Emacs is to use the `configure' shell script
-which attempts to guess correct values for various system-dependent
-variables and features and find the directories where various system
-headers and libraries are kept.  It then creates a `Makefile' in each
-subdirectory and a `config.h' file containing system-dependent
-definitions.  Running the `make' utility then builds the package for
-your system.
+On most Unix systems, you build Emacs by first running the `configure'
+shell script.  This attempts to deduce the correct values for
+various system-dependent variables and features, and find the
+directories where certain system headers and libraries are kept.
+In a few cases, you may need to explicitly tell configure where to
+find some things, or what options to use.
+
+`configure' creates a `Makefile' in several subdirectories, and a
+`src/config.h' file containing system-dependent definitions.
+Running the `make' utility then builds the package for your system.
 
 Here's the procedure to build Emacs using `configure' on systems which
-are supported by it.  If this simplified procedure fails, or if you
-are using a platform such as MS-Windows, where `configure' script
-doesn't work, you might need to use various non-default options, and
-maybe perform some of the steps manually.  The more detailed
-description in the rest of the sections of this guide will help you do
-that, so please refer to them if the simple procedure does not work.
+are supported by it.  In some cases, if the simplified procedure fails,
+you might need to use various non-default options, and maybe perform
+some of the steps manually.  The more detailed description in the other
+sections of this guide will help you do that, so please refer to those
+sections if you need to.
 
-  1. Make sure your system has at least 120 MB of free disk space.
+  1. Unpacking the Emacs 23.2 release requires about 170 MB of free
+  disk space.  Building Emacs uses about another 60 MB of space.
+  The final installed Emacs uses about 120 MB of disk space.
+  This includes the space-saving that comes from automatically
+  compressing the Lisp source files on installation.
 
   2a. `cd' to the directory where you unpacked Emacs and invoke the
       `configure' script:
@@ -43,8 +49,8 @@
 
 		 SOURCE-DIR/configure
 
-      where SOURCE-DIR is the top-level Emacs source directory.  This
-      may not work unless you use GNU make.
+      where SOURCE-DIR is the top-level Emacs source directory.
+      This may not work unless you use GNU make.
 
   3. When `configure' finishes, it prints several lines of details
      about the system configuration.  Read those details carefully
@@ -52,17 +58,18 @@
      system names, wrong places for headers or libraries, missing
      libraries that you know are installed on your system, etc.
 
-     If you find anything wrong, you will have to pass to `configure'
-     explicit machine configuration name, and one or more options
-     which tell it where to find various headers and libraries; refer
-     to DETAILED BUILDING AND INSTALLATION section below.
+     If you find anything wrong, you may have to pass to `configure'
+     one or more options specifying the explicit machine configuration
+     name, where to find various headers and libraries, etc.
+     Refer to the section DETAILED BUILDING AND INSTALLATION below.
 
-     If `configure' didn't find some image support libraries, such as
-     Xpm, jpeg, etc., and you want to use them refer to the subsection
-     "Image support libraries", below.
+     If `configure' didn't find some (optional) image support libraries,
+     such as Xpm, jpeg, etc., and you want to use them, refer to the
+     subsection "Image support libraries" below.
 
      If the details printed by `configure' don't make any sense to
-     you, assume that `configure' did its job and proceed.
+     you, but there are no obvious errors, assume that `configure' did
+     its job and proceed.
 
   4. If you need to run the `configure' script more than once (e.g.,
      with some non-default options), always clean the source
@@ -79,7 +86,7 @@
      in the `src' directory.  You can try this program, to make sure
      it works:
 
-		 src/emacs -q
+		 src/emacs -Q
 
   7. Assuming that the program `src/emacs' starts and displays its
      opening screen, you can install the program and its auxiliary
@@ -93,9 +100,13 @@
 
 		 make clean
 
-  You can also save some space by compressing (with `gzip') Info files
-  and installed Lisp source (.el) files which have corresponding .elc
-  versions.
+  You can delete the entire build directory if you do not plan to
+  build Emacs again, but it can be useful to keep for debugging.
+
+  Note that the install automatically saves space by compressing
+  (provided you have the `gzip' program) those installed Lisp source (.el)
+  files that have corresponding .elc versions.  You may also wish
+  to compress the installed Info files.
 
 
 ADDITIONAL DISTRIBUTION FILES
@@ -157,19 +168,15 @@
 running Emacs; however, note that Emacs will not be able to use
 colored icons in the toolbar if XPM support is not compiled in.
 
-Here's the list of these optional libraries, and the URLs where they
-can be found:
+Here's the list of some of these optional libraries, and the URLs
+where they can be found (in the unlikely event that your distribution
+does not provide them):
 
-  . libXaw3d for fancy 3D-style
-      scroll bars:    ftp://ftp.x.org/contrib/widgets/Xaw3d/
-  . libxpm for XPM:   ftp://ftp.x.org/contrib/libraries/
-		      Get version 3.4k or later, which lets Emacs
-		      use its own color allocation functions.
-  . libpng for PNG:   ftp://ftp.simplesystems.org/pub/libpng/png/
+  . libXaw3d          http://directory.fsf.org/project/xaw3d/
+  . libxpm for XPM:   http://www.x.org/releases/current/src/lib/
+  . libpng for PNG:   http://www.libpng.org/
   . libz (for PNG):   http://www.zlib.net/
-  . libjpeg for JPEG: ftp://ftp.uu.net/graphics/jpeg/
-                      Get version 6b -- 6a is reported to fail in
-                      Emacs.
+  . libjpeg for JPEG: http://www.ijg.org/
   . libtiff for TIFF: http://www.libtiff.org/
   . libgif for GIF:   http://sourceforge.net/projects/giflib/
 
@@ -178,61 +185,38 @@
 appropriate --without-LIB option.  In some cases, older versions of
 these libraries won't work because some routines are missing, and
 configure should avoid such old versions.  If that happens, use the
---without-LIB options to `configure'.  See below for more details.
+--without-LIB options to `configure', if you need to.
 
 * Extra fonts
 
 The Emacs distribution does not include fonts and does not install
-them.  You must do that yourself.
-
-Emacs running on the GNU system supports both X fonts and local fonts
-(i.e. the fonts managed by the fontconfig library).
-
-For `Unicode' (ISO 10646) X fonts, see
-<URL:http://czyborra.com/unifont/> (packaged in Debian),
-<URL:http://openlab.ring.gr.jp/efont/> (packaged in Debian).  (In
-recent Debian versions, there is an extensive `misc-fixed' iso10646-1
-in the default X installation.)  Perhaps also see
-<URL:http://www.cl.cam.ac.uk/%7Emgk25/ucs-fonts.html>.
-
-<URL:http://czyborra.com/charsets/> has basic fonts for Emacs's
-ISO-8859 charsets.
+them.
 
-XFree86 release 4 (from <URL:ftp://ftp.xfree86.org/pub/XFree86/> and mirrors)
-contains font support for most, if not all, of the charsets that Emacs
-currently supports, including iso10646-1 encoded fonts for use with
-the mule-unicode charsets.  The font files should also be usable with
-older X releases.  Note that XFree 4 contains many iso10646-1 fonts
-with minimal character repertoires, which can cause problems -- see
-etc/PROBLEMS.
-
-BDF Unicode fonts etl-unicode.tar.gz are available from
-<URL:ftp://ftp.x.org/contrib/fonts/> and
-<URL:ftp://ftp.xfree86.org/pub/mirror/X.Org/contrib/fonts/>.  These
-fonts can also be used by ps-print and ps-mule to print Unicode
-characters.
-
-Finally, the Web page <URL:http://www.gnu.org/software/freefont/>
-lists a large number of free Unicode fonts.
+On the GNU system, Emacs supports both X fonts and local fonts
+(i.e. fonts managed by the fontconfig library).  If you need more
+fonts than your distribution normally provides, you must install them
+yourself.  See <URL:http://www.gnu.org/software/freefont/> for a large
+number of free Unicode fonts.
 
 * GNU/Linux development packages
 
-Many GNU/Linux systems do not come with development packages by
-default; they just include the files that you need to run Emacs, but
-not those you need to compile it.  For example, to compile Emacs with
-X11 support, you may need to install the special `X11 development'
-package.  For example, in April 2003, the package names to install
-were `XFree86-devel' and `Xaw3d-devel' on Red Hat.  On Debian, the
-packages necessary to build the installed version should be
-sufficient; they can be installed using `apt-get build-dep emacs21' in
-Debian 3 and above.
+Many GNU/Linux systems do not come with development packages by default;
+they include the files that you need to run Emacs, but not those you
+need to compile it.  For example, to compile Emacs with support for X
+and graphics libraries, you may need to install the `X development'
+package(s), and development versions of the jpeg, png, etc. packages.
+
+The names of the packages that you need varies according to the
+GNU/Linux distribution that you use, and the options that you want to
+configure Emacs with.  On Debian-based systems, you can install all the
+packages needed to build the installed version of Emacs with a command
+like `apt-get build-dep emacs23'.
 
 
 DETAILED BUILDING AND INSTALLATION:
 
-(This is for a Unix or Unix-like system.  For MS-DOS and Windows 3.X,
-see msdos/INSTALL.  For Windows 9X, Windows ME, Windows NT, Windows
-2000, Windows XP/2003, and Windows Vista/2008, see the file
+(This is for a Unix or Unix-like system.  For MS-DOS and MS Windows 3.X,
+see msdos/INSTALL.  For later versions of MS Windows, see the file
 nt/INSTALL.  For GNUstep and Mac OS X, see nextstep/INSTALL.)
 
 1) Make sure your system has enough swapping space allocated to handle
@@ -240,21 +224,20 @@
 least 2.8 MB and can reach 100 MB or more.  If the swapping space is
 insufficient, you will get an error in the command `temacs -batch -l
 loadup dump', found in `./src/Makefile.in', or possibly when
-running the final dumped Emacs.
+running the final dumped Emacs.  (This should not be an issue
+on any recent system.)
 
-Building Emacs requires about 140 MB of disk space (including the
-Emacs sources) Once installed, Emacs occupies about 77 MB in the file
+Building Emacs requires about 230 MB of disk space (including the
+Emacs sources).  Once installed, Emacs occupies about 120 MB in the file
 system where it is installed; this includes the executable files, Lisp
 libraries, miscellaneous data files, and on-line documentation.  If
 the building and installation take place in different directories,
-then the installation procedure momentarily requires 140+77 MB.
+then the installation procedure momentarily requires 230+120 MB.
 
-2) Consult `./etc/MACHINES' to see what configuration name you should
-give to the `configure' program.  That file offers hints for
-getting around some possible installation problems.  The file lists
-many different configurations, but only the part for your machine and
-operating system is relevant.  (The list is arranged in alphabetical
-order by the vendor name.)
+2) In the unlikely event that `configure' does not detect your system
+type correctly, consult `./etc/MACHINES' to see what --host, --build
+options you should pass to `configure'.  That file also offers hints
+for getting around some possible installation problems.
 
 3) You can build Emacs in the top-level Emacs source directory
 or in a separate directory.
@@ -262,15 +245,10 @@
 3a) To build in the top-level Emacs source directory, go to that
 directory and run the program `configure' as follows:
 
-    ./configure [CONFIGURATION-NAME] [--OPTION[=VALUE]] ...
-
-The CONFIGURATION-NAME argument should be a configuration name given
-in `./etc/MACHINES', with the system version number added at the end.
+    ./configure [--OPTION[=VALUE]] ...
 
-You should try first omitting CONFIGURATION-NAME.  This way,
-`configure' will try to guess your system type.  If it cannot guess,
-or if something goes wrong in building or installing Emacs this way,
-try again specifying the proper CONFIGURATION-NAME explicitly.
+If `configure' cannot determine your system type, try again
+specifying the proper --build, --host options explicitly.
 
 If you don't want X support, specify `--with-x=no'.  If you omit this
 option, `configure' will try to figure out for itself whether your
@@ -285,20 +263,19 @@
 
 To get more attractive menus, you can specify an X toolkit when you
 configure Emacs; use the option `--with-x-toolkit=TOOLKIT', where
-TOOLKIT is `athena', `motif' or `gtk' (`yes' and `lucid' are synonyms
-for `athena').  On some systems, it does not work to use a toolkit
-with shared libraries.  A free implementation of Motif, called
-LessTif, is available from <http://www.lesstif.org>.  Compiling with
-LessTif or Motif causes a standard File Selection Dialog to pop up
-when you invoke file commands with the mouse.  You can get fancy
-3D-style scroll bars, even without LessTif/Motif, if you have the
-Xaw3d library installed (see "Image support libraries" above for Xaw3d
-availability).
+TOOLKIT is `gtk' (the default), `athena', or `motif' (`yes' and
+`lucid' are synonyms for `athena').  On some systems, it does not work
+to use a toolkit with shared libraries.  A free implementation of
+Motif, called LessTif, is available from <http://www.lesstif.org>.
+Compiling with LessTif or Motif causes a standard File Selection
+Dialog to pop up when you invoke file commands with the mouse.  You
+can get fancy 3D-style scroll bars, even without Gtk or LessTif/Motif,
+if you have the Xaw3d library installed (see "Image support libraries"
+above for Xaw3d availability).
 
-If `--with-x-toolkit=gtk' is specified, you can tell configure where
-to search for GTK by specifying `--with-pkg-config-prog=PATH' where
-PATH is the pathname to pkg-config.  Note that GTK version 2.4 or
-newer is required for Emacs.
+You can tell configure where to search for GTK by specifying
+`--with-pkg-config-prog=PATH' where PATH is the pathname to
+pkg-config.  Note that GTK version 2.6 or newer is required for Emacs.
 
 The Emacs mail reader RMAIL is configured to be able to read mail from
 a POP3 server by default.  Versions of the POP protocol older than
@@ -325,10 +302,10 @@
 Use --without-toolkit-scroll-bars to disable LessTif/Motif or Xaw3d
 scroll bars.
 
-Use --without-xim to inhibit the default use of X Input Methods.  In
-this case, the X resource useXIM can be used to turn on use of XIM.
+Use --without-xim to inhibit the default use of X Input Methods.
+In this case, the X resource useXIM can be used to turn on use of XIM.
 
-Use --disable-largefile omits support for files larger than 2GB on
+Use --disable-largefile to omit support for files larger than 2GB on
 systems which support that.
 
 Use --without-sound to disable sound support.
@@ -338,11 +315,11 @@
 - Emacs (and the other utilities users run) go in PREFIXDIR/bin
   (unless the `--exec-prefix' option says otherwise).
 - The architecture-independent files go in PREFIXDIR/share/emacs/VERSION
-  (where VERSION is the version number of Emacs, like `19.27').
+  (where VERSION is the version number of Emacs, like `23.2').
 - The architecture-dependent files go in
   PREFIXDIR/libexec/emacs/VERSION/CONFIGURATION
-  (where CONFIGURATION is the configuration name, like mips-dec-ultrix4.2),
-  unless the `--exec-prefix' option says otherwise.
+  (where CONFIGURATION is the configuration name, like
+  i686-pc-linux-gnu), unless the `--exec-prefix' option says otherwise.
 
 The `--exec-prefix=EXECDIR' option allows you to specify a separate
 portion of the directory tree for installing architecture-specific
@@ -354,17 +331,16 @@
 
 For example, the command
 
-    ./configure mips-dec-ultrix --with-x11
+    ./configure --build=i386-linux-gnu --without-sound
 
-configures Emacs to build for a DECstation running Ultrix, with
-support for the X11 window system.
+configures Emacs to build for a 32-bit GNU/Linux distribution,
+without sound support.
 
-`configure' doesn't do any compilation or installation
-itself.  It just creates the files that influence those things:
-`./Makefile', `lib-src/Makefile', `oldXMenu/Makefile',
-`lwlib/Makefile', `src/Makefile', and `./src/config.h'.  For details
-on exactly what it does, see the section called `CONFIGURATION BY
-HAND', below.
+`configure' doesn't do any compilation or installation itself.
+It just creates the files that influence those things:
+`./Makefile' in the top-level directory and several subdirectories;
+and `./src/config.h'.  For details on exactly what it does, see the
+section called `CONFIGURATION BY HAND', below.
 
 When it is done, `configure' prints a description of what it did and
 creates a shell script `config.status' which, when run, recreates the
@@ -406,7 +382,7 @@
 preprocessor to look in the `/foo/myinclude' directory for header
 files (in addition to the standard directories), instruct the linker
 to look in `/bar/mylib' for libraries, pass the -O3 optimization
-switch to the compiler, and link against libfoo.a and libbar.a
+switch to the compiler, and link against libfoo and libbar
 libraries in addition to the standard ones.
 
 For some libraries, like Gtk+, fontconfig and ALSA, `configure' uses
@@ -436,14 +412,9 @@
 To build in a separate directory, you must use a version of `make'
 that supports the `VPATH' variable, such as GNU `make'.
 
-3c) Some people try to build in a separate directory by filling
-it full of symlinks to the files in the real source directory.
-If you do that, `make all' does work, but `make install' fails:
-it copies the symbolic links rather than the actual files.
-
-As far as is known, there is no particular reason to use
-a directory full of links rather than use the standard GNU
-facilities to build in a separate directory (see 3b above).
+(Do not try to build in a separate directory by creating many links
+to the real source directory--there is no need, and installation will
+fail.)
 
 4) Look at `./lisp/paths.el'; if some of those values are not right
 for your system, set up the file `./lisp/site-init.el' with Emacs
@@ -454,7 +425,7 @@
      (setq news-inews-program "/usr/bin/inews")
 
 is how you would override the default value of the variable
-news-inews-program (which is "/usr/local/inews").
+news-inews-program.
 
 Before you override a variable this way, *look at the value* that the
 variable gets by default!  Make sure you know what kind of value the
@@ -473,18 +444,11 @@
 site-load.el, Emacs will use *precisely* that value when it starts up
 again.  If you do this, you are on your own!
 
-Note that, on some systems, the code you place in site-init.el must
-not use expand-file-name or any other function which may look
-something up in the system's password and user information database.
-See `./etc/PROBLEMS' for more details on which systems this affects.
-
 The `site-*.el' files are nonexistent in the distribution.  You do not
 need to create them if you have nothing to put in them.
 
 6) Refer to the file `./etc/TERMS' for information on fields you may
-wish to add to various termcap entries.  The files `./etc/termcap.ucb'
-and `./etc/termcap.dat' may already contain appropriately-modified
-entries.
+wish to add to various termcap entries.  (This is unlikely to be necessary.)
 
 7) Run `make' in the top directory of the Emacs distribution to finish
 building Emacs in the standard way.  The final executable file is
@@ -498,11 +462,11 @@
 
 `/usr/local/bin' holds the executable programs users normally run -
 		`emacs', `etags', `ctags', `b2m', `emacsclient',
-		and `rcs-checkin'.
+		`grep-changelog', and `rcs-checkin'.
 
 `/usr/local/share/emacs/VERSION/lisp' holds the Emacs Lisp library;
 		`VERSION' stands for the number of the Emacs version
-		you are installing, like `18.59' or `19.27'.  Since the
+		you are installing, like `23.1' or `23.2'.  Since the
 		Lisp library changes from one version of Emacs to
 		another, including the version number in the path
 		allows you to have several versions of Emacs installed
@@ -510,18 +474,17 @@
 		make Emacs unavailable while installing a new version.
 
 `/usr/local/share/emacs/VERSION/etc' holds the Emacs tutorial, the DOC
-		file, the `yow' database, and other
-		architecture-independent files Emacs might need while
-		running.  VERSION is as specified for `.../lisp'.
+		file, and other architecture-independent files Emacs
+		might need while running.
 
 `/usr/local/libexec/emacs/VERSION/CONFIGURATION-NAME' contains executable
 		programs used by Emacs that users are not expected to
 		run themselves.
 		`VERSION' is the number of the Emacs version you are
-		installing, and `CONFIGURATION-NAME' is the argument
-		you gave to the `configure' program to identify the
+		installing, and `CONFIGURATION-NAME' is the value
+		deduced by the `configure' program to identify the
 		architecture and operating system of your machine,
-		like `mips-dec-ultrix' or `sparc-sun-sunos'.  Since
+		like `i686-pc-linux-gnu' or `sparc-sun-sunos'.  Since
 		these files are specific to the version of Emacs,
 		operating system, and architecture in use, including
 		the configuration name in the path allows you to have
@@ -533,10 +496,9 @@
 `/usr/local/share/info' holds the on-line documentation for Emacs,
 		known as "info files".  Many other GNU programs are
 		documented using info files as well, so this directory
-		stands apart from the other, Emacs-specific
-		directories.
+		stands apart from the other, Emacs-specific directories.
 
-`/usr/local/man/man1' holds the man pages for the programs installed
+`/usr/local/share/man/man1' holds the man pages for the programs installed
 		in `/usr/local/bin'.
 
 Any version of Emacs, whether installed or not, also looks for Lisp
@@ -599,10 +561,9 @@
 	defaults to /usr/local/share.  We create the following
 	subdirectories under `datadir':
 	- `emacs/VERSION/lisp', containing the Emacs Lisp library, and
-	- `emacs/VERSION/etc', containing the Emacs tutorial, the DOC
-		file, and the `yow' database.
+	- `emacs/VERSION/etc', containing the tutorials, DOC file, etc.
 	`VERSION' is the number of the Emacs version you are installing,
-	like `18.59' or `19.0'.  Since these files vary from one version
+	like `23.1' or `23.2'.  Since these files vary from one version
 	of Emacs to another, including the version number in the path
 	allows you to have several versions of Emacs installed at the
 	same time; this means that you don't have to make Emacs
@@ -615,29 +576,23 @@
 		programs used by Emacs that users are not expected to run
 		themselves.
 	`VERSION' is the number of the Emacs version you are installing,
-	and `CONFIGURATION-NAME' is the argument you gave to the
+	and `CONFIGURATION-NAME' is the value deduced by the
 	`configure' program to identify the architecture and operating
-	system of your machine, like `mips-dec-ultrix' or
-	`sparc-sun-sunos'.  Since these files are specific to the version
-	of Emacs, operating system, and architecture in use, including
-	the configuration name in the path allows you to have several
-	versions of Emacs for any mix of machines and operating systems
-	installed at the same time; this is useful for sites at which
-	different kinds of machines share the file system Emacs is
-	installed on.
+	system of your machine, like `i686-pc-linux-gnu' or `sparc-sun-sunos'.
+	Since these files are specific to the version of Emacs,
+	operating system, and architecture in use, including the
+	configuration name in the path allows you to have several
+	versions of Emacs for any mix of machines and operating
+	systems installed at the same time; this is useful for sites
+	at which different kinds of machines share the file system
+	Emacs is installed on.
 
 `infodir' indicates where to put the info files distributed with
 	Emacs; it defaults to `/usr/local/share/info'.
 
 `mandir' indicates where to put the man pages for Emacs and its
 	utilities (like `etags'); it defaults to
-	`/usr/local/man/man1'.
-
-`manext' gives the extension the man pages should be installed with.
-	It should contain a period, followed by the appropriate
-	digit.  It defaults to `.1'.  For example given the default
-	values for `mandir' and `manext', the Emacs man page would be
-	installed as `/usr/local/man/man1/emacs.1'.
+	`/usr/local/share/man/man1'.
 
 `prefix' doesn't give a path for any specific part of Emacs; instead,
 	its value is used to determine the defaults for all the
@@ -659,7 +614,7 @@
 	path variables - `bindir' and `libexecdir'.
 
 The above variables serve analogous purposes in the makefiles for all
-GNU software; this variable is specific to Emacs.
+GNU software; the following variable is specific to Emacs.
 
 `archlibdir' indicates where Emacs installs and expects the executable
 	files and other architecture-dependent data it uses while
@@ -675,7 +630,7 @@
 directory, but be aware that running the `configure' program erases
 `Makefile' and rebuilds it from `Makefile.in'.
 
-The path for finding Lisp files is specified in src/paths.h,
+The path for finding Lisp files is specified in src/epaths.h,
 a file which is generated by running configure.  To change the path,
 you can edit the definition of PATH_LOADSEARCH in that file
 before you run `make'.
@@ -717,15 +672,15 @@
 Once Emacs is configured, running `make' in the top directory performs
 the following steps.
 
-1) Run `make src/paths.h' in the top directory.  This produces
-`./src/paths.h' from the template file `./src/paths.in', changing
+1) Run `make epaths-force' in the top directory.  This produces
+`./src/epaths.h' from the template file `./src/epaths.in', changing
 the paths to the values specified in `./Makefile'.
 
 2) Go to directory `./lib-src' and run `make'.  This creates
 executables named `ctags' and `etags' and `make-docfile' and
 `digest-doc' and `test-distrib'.  And others.
 
-3) Go to directory `./src' and Run `make'.  This refers to files in
+3) Go to directory `./src' and run `make'.  This refers to files in
 the `./lisp' and `./lib-src' subdirectories using names `../lisp' and
 `../lib-src'.
 
@@ -737,8 +692,7 @@
 current Emacs version.  This file contains documentation strings for
 all the functions in Emacs.  Each time you run make to make a new
 emacs, a new DOC file with a new name is made.  You must keep the DOC
-file for an Emacs version as long as you keep using that Emacs
-version.
+file for an Emacs version as long as you keep using that Emacs version.
 
 
 INSTALLATION BY HAND
@@ -747,7 +701,7 @@
 directory of the Emacs distribution.
 
 1) Copy `./lisp' and its subdirectories, `./etc', and the executables
-in `./lib-src' to their final destinations, as selected in `./src/paths.h'.
+in `./lib-src' to their final destinations, as selected in `./src/epaths.h'.
 
 Strictly speaking, not all of the executables in `./lib-src' need be copied.
 - The programs `fakemail', `hexl', `movemail', `profile', `rcs2log',
@@ -778,8 +732,7 @@
 `rcs-checkin' from `./lib-src' to `/usr/local/bin'.  These programs are
 intended for users to run.
 
-5) Copy the man pages in `./etc' for emacs, ctags, and etags into the
-appropriate man directories.
+5) Copy the man pages in `./doc/man' into the appropriate man directory.
 
 6) The files in the `./src' subdirectory, except for `emacs', are not
 used by Emacs once it is built.  However, it is very desirable to keep
@@ -788,8 +741,8 @@
 
 PROBLEMS
 
-See the file PROBLEMS in etc subdirectory for a list of various
-problems sometimes encountered, and what to do about them.
+See the file `./etc/PROBLEMS' for a list of various problems sometimes
+encountered, and what to do about them.
 
 This file is part of GNU Emacs.
 
--- a/doc/emacs/ChangeLog	Tue Jun 15 11:40:23 2010 +0000
+++ b/doc/emacs/ChangeLog	Sat Jun 19 12:15:25 2010 +0000
@@ -1,3 +1,9 @@
+2010-06-10  Glenn Morris  <rgm@gnu.org>
+
+	* basic.texi (Inserting Text): Minor clarification.  (Bug#6374)
+
+	* basic.texi (Inserting Text): Fix typo.
+
 2010-06-10  Glenn Morris  <rgm@gnu.org>
 
 	* ack.texi (Acknowledgments):
--- a/doc/emacs/basic.texi	Tue Jun 15 11:40:23 2010 +0000
+++ b/doc/emacs/basic.texi	Sat Jun 19 12:15:25 2010 +0000
@@ -1,6 +1,7 @@
 @c This is part of the Emacs manual.
 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
-@c   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+@c   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+@c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Basic, Minibuffer, Exiting, Top
 @chapter Basic Editing Commands
@@ -92,9 +93,9 @@
 @vindex read-quoted-char-radix
 @noindent
 To use decimal or hexadecimal instead of octal, set the variable
-@code{read-quoted-char-radix} to 10 or 16.  If the radix is greater
-than 10, some letters starting with @kbd{a} serve as part of a
-character code, just like digits.
+@code{read-quoted-char-radix} to 10 or 16.  If the radix is 16,
+the letters @kbd{a} to @kbd{f} serve as part of a character code,
+just like digits.  Case is ignored.
 
   A numeric argument tells @kbd{C-q} how many copies of the quoted
 character to insert (@pxref{Arguments}).
@@ -104,7 +105,7 @@
 @cindex Unicode
   Instead of @kbd{C-q}, you can use @kbd{C-x 8 @key{RET}}
 (@code{ucs-insert}) to insert a character based on its Unicode name or
-code-point.  This commands prompts for a character to insert, using
+code-point.  This command prompts for a character to insert, using
 the minibuffer; you can specify the character using either (i) the
 character's name in the Unicode standard, or (ii) the character's
 code-point in the Unicode standard.  If you specify the character's
--- a/doc/misc/ChangeLog	Tue Jun 15 11:40:23 2010 +0000
+++ b/doc/misc/ChangeLog	Sat Jun 19 12:15:25 2010 +0000
@@ -1,3 +1,8 @@
+2010-06-10  Glenn Morris  <rgm@gnu.org>
+
+	* idlwave.texi (Load-Path Shadows):
+	* org.texi (Handling links): Fix typos.
+
 2010-06-07  Teodor Zlatanov  <tzz@lifelogs.com>
 
 	* gnus.texi (Interactive): Explain effect of gnus-expert-user better.
--- a/doc/misc/idlwave.texi	Tue Jun 15 11:40:23 2010 +0000
+++ b/doc/misc/idlwave.texi	Sat Jun 19 12:15:25 2010 +0000
@@ -3717,7 +3717,7 @@
 
 @table @asis
 @item @kbd{M-x idlwave-list-buffer-load-path-shadows}
-This commands checks the names of all routines defined in the current
+This command checks the names of all routines defined in the current
 buffer for shadowing conflicts with other routines accessible to
 IDLWAVE.  The command also has a key binding: @kbd{C-c C-b}
 @item @kbd{M-x idlwave-list-shell-load-path-shadows}.
--- a/doc/misc/org.texi	Tue Jun 15 11:40:23 2010 +0000
+++ b/doc/misc/org.texi	Sat Jun 19 12:15:25 2010 +0000
@@ -2978,7 +2978,7 @@
 Open link at point.  This will launch a web browser for URLs (using
 @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for
 the corresponding links, and execute the command in a shell link.  When the
-cursor is on an internal link, this commands runs the corresponding search.
+cursor is on an internal link, this command runs the corresponding search.
 When the cursor is on a TAG list in a headline, it creates the corresponding
 TAGS view.  If the cursor is on a timestamp, it compiles the agenda for that
 date.  Furthermore, it will visit text and remote files in @samp{file:} links
--- a/etc/ChangeLog	Tue Jun 15 11:40:23 2010 +0000
+++ b/etc/ChangeLog	Sat Jun 19 12:15:25 2010 +0000
@@ -1,3 +1,7 @@
+2010-06-12  Glenn Morris  <rgm@gnu.org>
+
+	* tutorials/TUTORIAL.bg, tutorials/TUTORIAL.es: Fix typos.
+
 2010-06-09  Michael Albinus  <michael.albinus@gmx.de>
 
 	* NEWS: Add notifications.el.
--- a/etc/NEWS	Tue Jun 15 11:40:23 2010 +0000
+++ b/etc/NEWS	Sat Jun 19 12:15:25 2010 +0000
@@ -128,6 +128,16 @@
 ** New option `list-colors-sort' defines the color sort order
 for `list-colors-display'.
 
+** An Emacs Lisp package manager is now included.
+This is a convenient way to download and install additional packages,
+from elpa.gnu.org.  `M-x package-list-packages' shows a list of
+packages, which can be selected for installation.
+
+*** By default, all installed packages are loaded and activated
+automatically when Emacs starts up.  To disable this, set
+`package-enable-at-startup' to nil.  To change which packages are
+loaded, customize `package-load-list'.
+
 
 * Editing Changes in Emacs 24.1
 
@@ -257,7 +267,11 @@
 
 * Incompatible Lisp Changes in Emacs 24.1
 
+** A backquote not followed by a space is now always treated as new-style.
+
 ** Test for special mode-class was moved from view-file to view-buffer.
+FIXME: This only says what was changed, but not what are the
+programmer-visible consequences.
 
 ** Passing a nil argument to a minor mode function now turns the mode
    ON unconditionally.
--- a/etc/NEWS.1-17	Tue Jun 15 11:40:23 2010 +0000
+++ b/etc/NEWS.1-17	Sat Jun 19 12:15:25 2010 +0000
@@ -760,7 +760,7 @@
 * New function `switch-to-buffer-other-window'.
 
 This is the new primitive to select a specified buffer (the
-argument)  in another window.  It is not quite the same as
+argument) in another window.  It is not quite the same as
 `pop-to-buffer', because it is guaranteed to create another
 window (assuming there is room on the screen) so that it can
 leave the current window's old buffer displayed as well.
@@ -971,7 +971,7 @@
 This command creates an inferior Lisp process whose input and output
 appear in the Emacs buffer named `*lisp*'.  That buffer uses a major mode
 called inferior-lisp-mode, which has many of the commands of lisp-mode
-and those of shell-mode.   Calls the value of shell-mode-hook and
+and those of shell-mode.  Calls the value of shell-mode-hook and
 lisp-mode-hook, in that order, if non-nil.
 
 Meanwhile, in lisp-mode, the command C-M-x is defined to
@@ -1421,7 +1421,7 @@
  of the executing emacs, for use in run-time conditionalization.
 
  The function  featurep  of one argument may be used to test for the
- presence of a feature. It is just the same as
+ presence of a feature.  It is just the same as
  (not (null (memq FEATURE features))) where FEATURE is its argument.
  For example, (if (featurep 'magic-window-hack)
 		  (transmogrify-window 'vertical)
@@ -1541,13 +1541,13 @@
 
  This function returns a cons cell whose car is the object produced
  by reading from the string and whose cdr is a number giving the
- index in the string of the first character not read. That index may
+ index in the string of the first character not read.  That index may
  be passed as the second argument to a later call to  read-from-string
  to read the next form represented by the string.
 
  In addition, the function  read  now accepts a string as its argument.
  In this case, it calls  read-from-string  on the whole string, and
- returns the car of the result. (ie the actual object read.)
+ returns the car of the result (ie the actual object read.)
 
 
 
--- a/etc/NEWS.23	Tue Jun 15 11:40:23 2010 +0000
+++ b/etc/NEWS.23	Sat Jun 19 12:15:25 2010 +0000
@@ -27,6 +27,10 @@
 
 * Changes in Specialized Modes and Packages in Emacs 23.3
 
+---
+** The appt-add command takes an optional argument for the warning time.
+This can be used in place of the default appt-message-warning-time.
+
 
 * New Modes and Packages in Emacs 23.3
 
--- a/etc/tutorials/TUTORIAL.bg	Tue Jun 15 11:40:23 2010 +0000
+++ b/etc/tutorials/TUTORIAL.bg	Sat Jun 19 12:15:25 2010 +0000
@@ -625,7 +625,7 @@
 Åìàêñ ñåñèÿòà.
 
 >> Âúâåäåòå C-x b *Messages* <Return>, çà äà âèäèòå áóôåðà ñúñ
-   ñúîáùåíèÿòà.  Ñëåä òîâà âúâåäåòå C-x C-b TUTORIAL <Return>, çà äà
+   ñúîáùåíèÿòà.  Ñëåä òîâà âúâåäåòå C-x b TUTORIAL <Return>, çà äà
    ñå âúðíåòå êúì òîâà âúâåäåíèå.
 
 Àêî íàïðàâèòå ïðîìåíè â òåêñòà íà åäèí ôàéë è òîãàâà íàìåðèòå äðóã
--- a/etc/tutorials/TUTORIAL.es	Tue Jun 15 11:40:23 2010 +0000
+++ b/etc/tutorials/TUTORIAL.es	Sat Jun 19 12:15:25 2010 +0000
@@ -630,7 +630,7 @@
 su sesión de Emacs.
 
 >> Teclee C-x b *Messages* <Return> para ver el buffer de mensajes.
-   Luego teclee C-b TUTORIAL <Return> para regresar a este tutorial.
+   Luego teclee C-x b TUTORIAL <Return> para regresar a este tutorial.
 
 Si hace cambios al texto de un archivo, y luego encuentra otro
 archivo, esto no guarda el primer archivo.  Sus cambios permanecerán
--- a/lisp/ChangeLog	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/ChangeLog	Sat Jun 19 12:15:25 2010 +0000
@@ -1,3 +1,131 @@
+2010-06-19  Gustav HÃ¥llberg  <gustav@gmail.com>  (tiny change)
+
+	* descr-text.el (describe-char): Avoid trailing whitespace.  (Bug#6423)
+
+2010-06-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/edebug.el (edebug-read-list):
+	Phase out old-style backquotes.
+
+2010-06-17  Juri Linkov  <juri@jurta.org>
+
+	* help-mode.el (help-mode): Set buffer-local variable
+	revert-buffer-function to help-mode-revert-buffer.
+	(help-mode-revert-buffer): New function.
+
+	* info.el (Info-revert-find-node): Check for major-mode Info-mode
+	before popping to "*info*" (like in other Info functions).
+	Keep buffer-name in old-buffer-name.  Keep Info-history-forward in
+	old-history-forward.  Pop to old-buffer-name or "*info*" to
+	recreate the killed buffer.  Set Info-history-forward from
+	old-history-forward.
+	(Info-breadcrumbs-depth): Add :group and :version.
+
+2010-06-17  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* emacs-lisp/package.el (package-menu-mode-map): Add a menu.
+
+2010-06-17  Agustín Martín  <agustin.martin@hispalinux.es>
+
+	* ispell.el (ispell-aspell-find-dictionary): Fix regexp for
+	languages like Portuguese with pt_{BR,PT} and no plain pt.
+
+2010-06-17  Juanma Barranquero  <lekktu@gmail.com>
+
+	* emacs-lisp/package.el (package-menu-mode-map):
+	Move initialization into declaration.
+
+	* menu-bar.el (menu-bar-options-menu): Fix typo in menu entry.
+
+2010-06-17  Chong Yidong  <cyd@stupidchicken.com>
+
+	* emacs-lisp/package.el (package-archive-base): Point to
+	elpa.gnu.org.
+	(package-enable, package-load-list): New defcustoms.
+	(package-user-dir, package-directory-list): Turn into defcustoms.
+	Don't include package-user-dir in package-directory-list.
+	(package--builtins-base): Don't include Emacs as a "package".
+	(package-subdirectory-regexp): New var.
+	(package-load-all-descriptors, package-compute-transaction)
+	(package-download-transaction): Obey package-load-list.
+	(package-activate-1): Rename from package-do-activate.
+	(package-list-packages-internal): Check package-load-list.
+	(package-load-descriptor, package-generate-autoloads)
+	(package-unpack, package-unpack-single)
+	(package--read-archive-file, package-delete): Use
+	expand-file-name.
+
+	* emacs-lisp/package-x.el: New file.  Package uploading
+	functionality split out from package.el.
+
+	* startup.el (command-line): Load packages after reading init
+	file.
+
+2010-06-17  Tom Tromey  <tromey@redhat.com>
+
+	* emacs-lisp/package.el: New file.
+
+2010-06-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/macroexp.el (macroexpand-all-1): Put back special
+	handling for `lambda' (misunderstanding).
+
+2010-06-16  Jay Belanger  <jay.p.belanger@gmail.com>
+
+	* calc/calc-poly.el: (math-accum-factors):  Make sure that
+	constants aren't distributed after they are factored out.
+
+2010-06-16  Juri Linkov  <juri@jurta.org>
+
+	* facemenu.el (list-colors-display): Call `pop-to-buffer' before
+	`list-colors-print'.  (Bug#6332)
+
+2010-06-16  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/macroexp.el (macroexpand-all-1): Don't handle `lambda'
+	specially, since it's a macro.  Fix up wrong hint passed to maybe-cons.
+
+	* font-lock.el (font-lock-major-mode): Rename from
+	font-lock-mode-major-mode to distinguish it from
+	global-font-lock-mode's own font-lock-mode-major-mode (bug#6135).
+	(font-lock-set-defaults):
+	* font-core.el (font-lock-default-function): Adjust users.
+	(font-lock-mode): Don't set it at all.
+
+2010-06-16  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc-annotate.el (vc-annotate): Use vc-read-revision.
+
+2010-06-16  Glenn Morris  <rgm@gnu.org>
+
+	* calendar/appt.el (appt-time-msg-list): Doc fix.
+	(appt-check): Let-bind appt-warn-time.
+	(appt-add): Make the 3rd argument optional.
+	Simplify argument names.  Doc fix.  Check for integer WARNTIME.
+	Only add WARNTIME to the output list if non-nil.
+
+2010-06-16  Ivan Kanis  <apple@kanis.eu>
+
+	* calendar/appt.el (appt-check): Let the 3rd element of
+	appt-time-msg-list specify the warning time.
+	(appt-add): Add new argument with the warning time.  (Bug#5176)
+
+2010-06-16  Bob Rogers  <rogers-emacs@rgrjr.dyndns.org>  (tiny change)
+
+	* vc-svn.el (vc-svn-after-dir-status): Fix regexp for Subversions
+	older than version 1.6.  (Bug#6361)
+
+2010-06-16  Helmut Eller  <eller.helmut@gmail.com>
+
+	* emacs-lisp/cl-macs.el (destructuring-bind): Bind `bind-enquote',
+	used by cl-do-arglist.  (Bug#6408)
+
+2010-06-16  Agustín Martín  <agustin.martin@hispalinux.es>
+
+	* ispell.el (ispell-dictionary-base-alist): Fix
+	portuguese casechars/not-casechars for missing 'çÇ'.
+	Suggested by Rolando Pereira (bug#6434).
+
 2010-06-15  Juanma Barranquero  <lekktu@gmail.com>
 
 	* facemenu.el (list-colors-sort): Doc fix.
--- a/lisp/calc/calc-poly.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/calc/calc-poly.el	Sat Jun 19 12:15:25 2010 +0000
@@ -663,7 +663,7 @@
 		  (cons 'vec (cons (nth 1 facs) (cons (list 'vec fac pow)
 						      (cdr (cdr facs)))))
 		(cons 'vec (cons (list 'vec fac pow) (cdr facs))))))))
-    (math-mul (math-pow fac pow) facs)))
+    (math-mul (math-pow fac pow) (math-factor-protect facs))))
 
 (defun math-factor-poly-coefs (p &optional square-free)    ; uses "x"
   (let (t1 t2 temp)
--- a/lisp/calendar/appt.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/calendar/appt.el	Sat Jun 19 12:15:25 2010 +0000
@@ -183,16 +183,25 @@
 (defconst appt-buffer-name "*appt-buf*"
   "Name of the appointments buffer.")
 
+;; TODO Turn this into an alist?  It would be easier to add more
+;; optional elements.
+;; TODO There should be a way to set WARNTIME (and other properties)
+;; from the diary-file.  Implementing that would be a good reason
+;; to change this to an alist.
 (defvar appt-time-msg-list nil
   "The list of appointments for today.
 Use `appt-add' and `appt-delete' to add and delete appointments.
 The original list is generated from today's `diary-entries-list', and
 can be regenerated using the function `appt-check'.
-Each element of the generated list has the form (MINUTES STRING [FLAG]); where
-MINUTES is the time in minutes of the appointment after midnight, and
-STRING is the description of the appointment.
-FLAG, if non-nil, says that the element was made with `appt-add'
-so calling `appt-make-list' again should preserve it.")
+Each element of the generated list has the form
+\(MINUTES STRING [FLAG] [WARNTIME])
+where MINUTES is the time in minutes of the appointment after midnight,
+and STRING is the description of the appointment.
+FLAG and WARNTIME can only be present if the element was made
+with `appt-add'.  A non-nil FLAG indicates that the element was made
+with `appt-add', so calling `appt-make-list' again should preserve it.
+If WARNTIME is non-nil, it is an integer to use in place
+of `appt-message-warning-time'.")
 
 (defconst appt-max-time (1- (* 24 60))
   "11:59pm in minutes - number of minutes in a day minus 1.")
@@ -313,7 +322,7 @@
               (zerop (mod prev-appt-display-count appt-display-interval))))
          ;; Non-nil means only update the interval displayed in the mode line.
          (mode-line-only (unless full-check appt-now-displayed))
-         now cur-comp-time appt-comp-time)
+         now cur-comp-time appt-comp-time appt-warn-time)
     (when (or full-check mode-line-only)
       (save-excursion
         ;; Convert current time to minutes after midnight (12.01am = 1).
@@ -353,6 +362,8 @@
         ;; calculate the number of minutes until the appointment.
         (when (and appt-issue-message appt-time-msg-list)
           (setq appt-comp-time (caar (car appt-time-msg-list))
+                appt-warn-time (or (nth 3 (car appt-time-msg-list))
+                                   appt-message-warning-time)
                 min-to-app (- appt-comp-time cur-comp-time))
           (while (and appt-time-msg-list
                       (< appt-comp-time cur-comp-time))
@@ -360,21 +371,21 @@
             (if appt-time-msg-list
                 (setq appt-comp-time (caar (car appt-time-msg-list)))))
           ;; If we have an appointment between midnight and
-          ;; `appt-message-warning-time' minutes after midnight, we
+          ;; `appt-warn-time' minutes after midnight, we
           ;; must begin to issue a message before midnight.  Midnight
           ;; is considered 0 minutes and 11:59pm is 1439
           ;; minutes.  Therefore we must recalculate the minutes to
           ;; appointment variable.  It is equal to the number of
           ;; minutes before midnight plus the number of minutes after
           ;; midnight our appointment is.
-          (if (and (< appt-comp-time appt-message-warning-time)
-                   (> (+ cur-comp-time appt-message-warning-time)
+          (if (and (< appt-comp-time appt-warn-time)
+                   (> (+ cur-comp-time appt-warn-time)
                       appt-max-time))
               (setq min-to-app (+ (- (1+ appt-max-time) cur-comp-time)
                                   appt-comp-time)))
           ;; Issue warning if the appointment time is within
           ;; appt-message-warning time.
-          (when (and (<= min-to-app appt-message-warning-time)
+          (when (and (<= min-to-app appt-warn-time)
                      (>= min-to-app 0))
             (setq appt-now-displayed t
                   appt-display-count (1+ prev-appt-display-count))
@@ -470,14 +481,28 @@
   "[0-9]?[0-9]\\(h\\([0-9][0-9]\\)?\\|[:.][0-9][0-9]\\)\\(am\\|pm\\)?")
 
 ;;;###autoload
-(defun appt-add (new-appt-time new-appt-msg)
-  "Add an appointment for today at NEW-APPT-TIME with message NEW-APPT-MSG.
-The time should be in either 24 hour format or am/pm format."
-  (interactive "sTime (hh:mm[am/pm]): \nsMessage: ")
-  (unless (string-match appt-time-regexp new-appt-time)
+(defun appt-add (time msg &optional warntime)
+  "Add an appointment for today at TIME with message MSG.
+The time should be in either 24 hour format or am/pm format.
+Optional argument WARNTIME is an integer (or string) giving the number
+of minutes before the appointment at which to start warning.
+The default is `appt-message-warning-time'."
+  (interactive "sTime (hh:mm[am/pm]): \nsMessage: 
+sMinutes before the appointment to start warning: ")
+  (unless (string-match appt-time-regexp time)
     (error "Unacceptable time-string"))
-  (let ((time-msg (list (list (appt-convert-time new-appt-time))
-                        (concat new-appt-time " " new-appt-msg) t)))
+  (and (stringp warntime)
+       (setq warntime (unless (string-equal warntime "")
+                        (string-to-number warntime))))
+  (and warntime
+       (not (integerp warntime))
+       (error "Argument WARNTIME must be an integer, or nil"))
+  (let ((time-msg (list (list (appt-convert-time time))
+                        (concat time " " msg) t)))
+    ;; It is presently non-sensical to have multiple warnings about
+    ;; the same appointment with just different delays, but it might
+    ;; not always be so.  TODO
+    (if warntime (setq time-msg (append time-msg (list warntime))))
     (unless (member time-msg appt-time-msg-list)
       (setq appt-time-msg-list
             (appt-sort-list (nconc appt-time-msg-list (list time-msg)))))))
--- a/lisp/descr-text.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/descr-text.el	Sat Jun 19 12:15:25 2010 +0000
@@ -618,7 +618,7 @@
               ,@(if (not eight-bit-p)
                     (let ((unicodedata (describe-char-unicode-data char)))
                       (if unicodedata
-                          (cons (list "Unicode data" " ") unicodedata))))))
+                          (cons (list "Unicode data" "") unicodedata))))))
       (setq max-width (apply 'max (mapcar (lambda (x)
                                             (if (cadr x) (length (car x)) 0))
                                           item-list)))
@@ -642,7 +642,8 @@
                               (window-width))
                       (insert "\n")
                       (indent-to (1+ max-width)))
-                    (insert " " clm)))
+                    (unless (zerop (length clm))
+                      (insert " " clm))))
                 (insert "\n"))))
 
           (when overlays
--- a/lisp/emacs-lisp/cl-loaddefs.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/emacs-lisp/cl-loaddefs.el	Sat Jun 19 12:15:25 2010 +0000
@@ -282,7 +282,7 @@
 ;;;;;;  flet progv psetq do-all-symbols do-symbols dotimes dolist
 ;;;;;;  do* do loop return-from return block etypecase typecase ecase
 ;;;;;;  case load-time-value eval-when destructuring-bind function*
-;;;;;;  defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "fbeedbf769c72fee9b4e0671957c1077")
+;;;;;;  defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "36cafd5054969b5bb0b1ce6a21605fed")
 ;;; Generated autoloads from cl-macs.el
 
 (autoload 'gensym "cl-macs" "\
--- a/lisp/emacs-lisp/cl-macs.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/emacs-lisp/cl-macs.el	Sat Jun 19 12:15:25 2010 +0000
@@ -438,7 +438,7 @@
 ;;;###autoload
 (defmacro destructuring-bind (args expr &rest body)
   (let* ((bind-lets nil) (bind-forms nil) (bind-inits nil)
-	 (bind-defs nil) (bind-block 'cl-none))
+	 (bind-defs nil) (bind-block 'cl-none) (bind-enquote nil))
     (cl-do-arglist (or args '(&aux)) expr)
     (append '(progn) bind-inits
 	    (list (nconc (list 'let* (nreverse bind-lets))
--- a/lisp/emacs-lisp/edebug.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/emacs-lisp/edebug.el	Sat Jun 19 12:15:25 2010 +0000
@@ -885,17 +885,12 @@
    (edebug-storing-offsets (1- (point)) 'quote)
    (edebug-read-storing-offsets stream)))
 
-(defvar edebug-read-backquote-level 0
-  "If non-zero, we're in a new-style backquote.
-It should never be negative.  This controls how we read comma constructs.")
-
 (defun edebug-read-backquote (stream)
   ;; Turn `thing into (\` thing)
   (forward-char 1)
   (list
    (edebug-storing-offsets (1- (point)) '\`)
-   (let ((edebug-read-backquote-level (1+ edebug-read-backquote-level)))
-     (edebug-read-storing-offsets stream))))
+   (edebug-read-storing-offsets stream)))
 
 (defun edebug-read-comma (stream)
   ;; Turn ,thing into (\, thing).  Handle ,@ and ,. also.
@@ -910,12 +905,9 @@
 	     (forward-char 1)))
       ;; Generate the same structure of offsets we would have
       ;; if the resulting list appeared verbatim in the input text.
-      (if (zerop edebug-read-backquote-level)
-	  (edebug-storing-offsets opoint symbol)
-	(list
-	 (edebug-storing-offsets opoint symbol)
-	 (let ((edebug-read-backquote-level (1- edebug-read-backquote-level)))
-	   (edebug-read-storing-offsets stream)))))))
+      (list
+       (edebug-storing-offsets opoint symbol)
+       (edebug-read-storing-offsets stream)))))
 
 (defun edebug-read-function (stream)
   ;; Turn #'thing into (function thing)
@@ -937,17 +929,7 @@
   (prog1
       (let ((elements))
 	(while (not (memq (edebug-next-token-class) '(rparen dot)))
-	  (if (and (eq (edebug-next-token-class) 'backquote)
-		   (null elements)
-		   (zerop edebug-read-backquote-level))
-	      (progn
-		;; Old style backquote.
-		(forward-char 1)	; Skip backquote.
-		;; Call edebug-storing-offsets here so that we
-		;; produce the same offsets we would have had
-		;; if the backquote were an ordinary symbol.
-		(push (edebug-storing-offsets (1- (point)) '\`) elements))
-	    (push (edebug-read-storing-offsets stream) elements)))
+          (push (edebug-read-storing-offsets stream) elements))
 	(setq elements (nreverse elements))
 	(if (eq 'dot (edebug-next-token-class))
 	    (let (dotted-form)
@@ -4455,7 +4437,7 @@
   (add-hook 'cl-load-hook
 	    (function (lambda () (require 'cl-specs)))))
 
-;;; edebug-cl-read and cl-read are available from liberte@cs.uiuc.edu
+;; edebug-cl-read and cl-read are available from liberte@cs.uiuc.edu
 (if (featurep 'cl-read)
     (add-hook 'edebug-setup-hook
 	      (function (lambda () (require 'edebug-cl-read))))
@@ -4466,8 +4448,8 @@
 
 ;;; Finalize Loading
 
-;;; Finally, hook edebug into the rest of Emacs.
-;;; There are probably some other things that could go here.
+;; Finally, hook edebug into the rest of Emacs.
+;; There are probably some other things that could go here.
 
 ;; Install edebug read and eval functions.
 (edebug-install-read-eval-functions)
--- a/lisp/emacs-lisp/macroexp.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/emacs-lisp/macroexp.el	Sat Jun 19 12:15:25 2010 +0000
@@ -134,7 +134,7 @@
 		(maybe-cons fun
 			    (maybe-cons (macroexpand-all-forms (cadr form) 2)
 					nil
-					(cadr form))
+					(cdr form))
 			    form)
 	      form))
 	   ((memq fun '(let let*))
@@ -146,7 +146,7 @@
 	   ((eq fun 'quote)
 	    form)
 	   ((and (consp fun) (eq (car fun) 'lambda))
-	    ;; embedded lambda
+	    ;; Embedded lambda in function position.
 	    (maybe-cons (macroexpand-all-forms fun 2)
 			(macroexpand-all-forms (cdr form))
 			form))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/emacs-lisp/package-x.el	Sat Jun 19 12:15:25 2010 +0000
@@ -0,0 +1,217 @@
+;;; package-x.el --- Package extras
+
+;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+;; Author: Tom Tromey <tromey@redhat.com>
+;; Created: 10 Mar 2007
+;; Version: 0.9
+;; Keywords: tools
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, 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., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file currently contains parts of the package system most
+;; people won't need, such as package uploading.
+
+;;; Code:
+
+;; Note that this only works if you have the password, which you
+;; probably don't :-).
+(defvar package-archive-upload-base nil
+  "Base location for uploading to package archive.")
+
+(defun package--encode (string)
+  "Encode a string by replacing some characters with XML entities."
+  ;; We need a special case for translating "&" to "&amp;".
+  (let ((index))
+    (while (setq index (string-match "[&]" string index))
+      (setq string (replace-match "&amp;" t nil string))
+      (setq index (1+ index))))
+  (while (string-match "[<]" string)
+    (setq string (replace-match "&lt;" t nil string)))
+  (while (string-match "[>]" string)
+    (setq string (replace-match "&gt;" t nil string)))
+  (while (string-match "[']" string)
+    (setq string (replace-match "&apos;" t nil string)))
+  (while (string-match "[\"]" string)
+    (setq string (replace-match "&quot;" t nil string)))
+  string)
+
+(defun package--make-rss-entry (title text)
+  (let ((date-string (format-time-string "%a, %d %B %Y %T %z")))
+    (concat "<item>\n"
+	    "<title>" (package--encode title) "</title>\n"
+	    ;; FIXME: should have a link in the web page.
+	    "<link>" package-archive-base "news.html</link>\n"
+	    "<description>" (package--encode text) "</description>\n"
+	    "<pubDate>" date-string "</pubDate>\n"
+	    "</item>\n")))
+
+(defun package--make-html-entry (title text)
+  (concat "<li> " (format-time-string "%B %e") " - "
+	  title " - " (package--encode text)
+	  " </li>\n"))
+
+(defun package--update-file (file location text)
+  (save-excursion
+    (let ((old-buffer (find-buffer-visiting file)))
+      (with-current-buffer (let ((find-file-visit-truename t))
+			     (or old-buffer (find-file-noselect file)))
+	(goto-char (point-min))
+	(search-forward location)
+	(forward-line)
+	(insert text)
+	(let ((file-precious-flag t))
+	  (save-buffer))
+	(unless old-buffer
+	  (kill-buffer (current-buffer)))))))
+
+(defun package-maint-add-news-item (title description)
+  "Add a news item to the ELPA web pages.
+TITLE is the title of the news item.
+DESCRIPTION is the text of the news item.
+You need administrative access to ELPA to use this."
+  (interactive "sTitle: \nsText: ")
+  (package--update-file (concat package-archive-upload-base "elpa.rss")
+			"<description>"
+			(package--make-rss-entry title description))
+  (package--update-file (concat package-archive-upload-base "news.html")
+			"New entries go here"
+			(package--make-html-entry title description)))
+
+(defun package--update-news (package version description)
+  "Update the ELPA web pages when a package is uploaded."
+  (package-maint-add-news-item (concat package " version " version)
+			       description))
+
+(defun package-upload-buffer-internal (pkg-info extension)
+  "Upload a package whose contents are in the current buffer.
+PKG-INFO is the package info, see `package-buffer-info'.
+EXTENSION is the file extension, a string.  It can be either
+\"el\" or \"tar\"."
+  (save-excursion
+    (save-restriction
+      (let* ((file-type (cond
+			 ((equal extension "el") 'single)
+			 ((equal extension "tar") 'tar)
+			 (t (error "Unknown extension `%s'" extension))))
+	     (file-name (aref pkg-info 0))
+	     (pkg-name (intern file-name))
+	     (requires (aref pkg-info 1))
+	     (desc (if (string= (aref pkg-info 2) "")
+		       (read-string "Description of package: ")
+		     (aref pkg-info 2)))
+	     (pkg-version (aref pkg-info 3))
+	     (commentary (aref pkg-info 4))
+	     (split-version (package-version-split pkg-version))
+	     (pkg-buffer (current-buffer))
+
+	     ;; Download latest archive-contents.
+	     (buffer (url-retrieve-synchronously
+		      (concat package-archive-base "archive-contents"))))
+
+	;; Parse archive-contents.
+	(set-buffer buffer)
+	(package-handle-response)
+	(re-search-forward "^$" nil 'move)
+	(forward-char)
+	(delete-region (point-min) (point))
+	(let ((contents (package-read-from-string
+			 (buffer-substring-no-properties (point-min)
+							 (point-max))))
+	      (new-desc (vector split-version requires desc file-type)))
+	  (if (> (car contents) package-archive-version)
+	      (error "Unrecognized archive version %d" (car contents)))
+	  (let ((elt (assq pkg-name (cdr contents))))
+	    (if elt
+		(if (package-version-compare split-version
+					     (package-desc-vers (cdr elt))
+					     '<=)
+		    (error "New package has smaller version: %s" pkg-version)
+		  (setcdr elt new-desc))
+	      (setq contents (cons (car contents)
+				   (cons (cons pkg-name new-desc)
+					 (cdr contents))))))
+
+	  ;; Now CONTENTS is the updated archive contents.  Upload
+	  ;; this and the package itself.  For now we assume ELPA is
+	  ;; writable via file primitives.
+	  (let ((print-level nil)
+		(print-length nil))
+	    (write-region (concat (pp-to-string contents) "\n")
+			  nil
+			  (concat package-archive-upload-base
+				  "archive-contents")))
+
+	  ;; If there is a commentary section, write it.
+	  (when commentary
+	    (write-region commentary nil
+			  (concat package-archive-upload-base
+				  (symbol-name pkg-name) "-readme.txt")))
+
+	  (set-buffer pkg-buffer)
+	  (kill-buffer buffer)
+	  (write-region (point-min) (point-max)
+			(concat package-archive-upload-base
+				file-name "-" pkg-version
+				"." extension)
+			nil nil nil 'excl)
+
+	  ;; Write a news entry.
+	  (package--update-news (concat file-name "." extension)
+				pkg-version desc)
+
+	  ;; special-case "package": write a second copy so that the
+	  ;; installer can easily find the latest version.
+	  (if (string= file-name "package")
+	      (write-region (point-min) (point-max)
+			    (concat package-archive-upload-base
+				    file-name "." extension)
+			    nil nil nil 'ask)))))))
+
+(defun package-upload-buffer ()
+  "Upload a single .el file to ELPA from the current buffer."
+  (interactive)
+  (save-excursion
+    (save-restriction
+      ;; Find the package in this buffer.
+      (let ((pkg-info (package-buffer-info)))
+	(package-upload-buffer-internal pkg-info "el")))))
+
+(defun package-upload-file (file)
+  (interactive "fPackage file name: ")
+  (with-temp-buffer
+    (insert-file-contents-literally file)
+    (let ((info (cond
+		 ((string-match "\\.tar$" file) (package-tar-file-info file))
+		 ((string-match "\\.el$" file) (package-buffer-info))
+		 (t (error "Unrecognized extension `%s'"
+			   (file-name-extension file))))))
+      (package-upload-buffer-internal info (file-name-extension file)))))
+
+(defun package-gnus-summary-upload ()
+  "Upload a package contained in the current *Article* buffer.
+This should be invoked from the gnus *Summary* buffer."
+  (interactive)
+  (with-current-buffer gnus-article-buffer
+    (package-upload-buffer)))
+
+(provide 'package-x)
+
+;;; package.el ends here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/emacs-lisp/package.el	Sat Jun 19 12:15:25 2010 +0000
@@ -0,0 +1,1453 @@
+;;; package.el --- Simple package system for Emacs
+
+;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+;; Author: Tom Tromey <tromey@redhat.com>
+;; Created: 10 Mar 2007
+;; Version: 0.9
+;; Keywords: tools
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, 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., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Change Log:
+
+;;  2 Apr 2007 - now using ChangeLog file
+;; 15 Mar 2007 - updated documentation
+;; 14 Mar 2007 - Changed how obsolete packages are handled
+;; 13 Mar 2007 - Wrote package-install-from-buffer
+;; 12 Mar 2007 - Wrote package-menu mode
+
+;;; Commentary:
+
+;; The idea behind package.el is to be able to download packages and
+;; install them.  Packages are versioned and have versioned
+;; dependencies.  Furthermore, this supports built-in packages which
+;; may or may not be newer than user-specified packages.  This makes
+;; it possible to upgrade Emacs and automatically disable packages
+;; which have moved from external to core.  (Note though that we don't
+;; currently register any of these, so this feature does not actually
+;; work.)
+
+;; This code supports a single package repository, ELPA.  All packages
+;; must be registered there.
+
+;; A package is described by its name and version.  The distribution
+;; format is either  a tar file or a single .el file.
+
+;; A tar file should be named "NAME-VERSION.tar".  The tar file must
+;; unpack into a directory named after the package and version:
+;; "NAME-VERSION".  It must contain a file named "PACKAGE-pkg.el"
+;; which consists of a call to define-package.  It may also contain a
+;; "dir" file and the info files it references.
+
+;; A .el file will be named "NAME-VERSION.el" in ELPA, but will be
+;; installed as simply "NAME.el" in a directory named "NAME-VERSION".
+
+;; The downloader will download all dependent packages.  It will also
+;; byte-compile the package's lisp at install time.
+
+;; At activation time we will set up the load-path and the info path,
+;; and we will load the package's autoloads.  If a package's
+;; dependencies are not available, we will not activate that package.
+
+;; Conceptually a package has multiple state transitions:
+;;
+;; * Download.  Fetching the package from ELPA.
+;; * Install.  Untar the package, or write the .el file, into
+;;   ~/.emacs.d/elpa/ directory.
+;; * Byte compile.  Currently this phase is done during install,
+;;   but we may change this.
+;; * Activate.  Evaluate the autoloads for the package to make it
+;;   available to the user.
+;; * Load.  Actually load the package and run some code from it.
+
+;; Other external functions you may want to use:
+;;
+;; M-x package-list-packages
+;;    Enters a mode similar to buffer-menu which lets you manage
+;;    packages.  You can choose packages for install (mark with "i",
+;;    then "x" to execute) or deletion (not implemented yet), and you
+;;    can see what packages are available.  This will automatically
+;;    fetch the latest list of packages from ELPA.
+;;
+;; M-x package-list-packages-no-fetch
+;;    Like package-list-packages, but does not automatically fetch the
+;;    new list of packages.
+;;
+;; M-x package-install-from-buffer
+;;    Install a package consisting of a single .el file that appears
+;;    in the current buffer.  This only works for packages which
+;;    define a Version header properly; package.el also supports the
+;;    extension headers Package-Version (in case Version is an RCS id
+;;    or similar), and Package-Requires (if the package requires other
+;;    packages).
+;;
+;; M-x package-install-file
+;;    Install a package from the indicated file.  The package can be
+;;    either a tar file or a .el file.  A tar file must contain an
+;;    appropriately-named "-pkg.el" file; a .el file must be properly
+;;    formatted as with package-install-from-buffer.
+
+;;; Thanks:
+;;; (sorted by sort-lines):
+
+;; Jim Blandy <jimb@red-bean.com>
+;; Karl Fogel <kfogel@red-bean.com>
+;; Kevin Ryde <user42@zip.com.au>
+;; Lawrence Mitchell
+;; Michael Olson <mwolson@member.fsf.org>
+;; Sebastian Tennant <sebyte@smolny.plus.com>
+;; Stefan Monnier <monnier@iro.umontreal.ca>
+;; Vinicius Jose Latorre <viniciusjl@ig.com.br>
+;; Phil Hagelberg <phil@hagelb.org>
+
+;;; ToDo:
+
+;; - putting info dirs at the start of the info path means
+;;   users see a weird ordering of categories.  OTOH we want to
+;;   override later entries.  maybe emacs needs to enforce
+;;   the standard layout?
+;; - put bytecode in a separate directory tree
+;; - perhaps give users a way to recompile their bytecode
+;;   or do it automatically when emacs changes
+;; - give users a way to know whether a package is installed ok
+;; - give users a way to view a package's documentation when it
+;;   only appears in the .el
+;; - use/extend checkdoc so people can tell if their package will work
+;; - "installed" instead of a blank in the status column
+;; - tramp needs its files to be compiled in a certain order.
+;;   how to handle this?  fix tramp?
+;; - on emacs 21 we don't kill the -autoloads.el buffer.  what about 22?
+;; - maybe we need separate .elc directories for various emacs versions
+;;   and also emacs-vs-xemacs.  That way conditional compilation can
+;;   work.  But would this break anything?
+;; - should store the package's keywords in archive-contents, then
+;;   let the users filter the package-menu by keyword.  See
+;;   finder-by-keyword.  (We could also let people view the
+;;   Commentary, but it isn't clear how useful this is.)
+;; - William Xu suggests being able to open a package file without
+;;   installing it
+;; - Interface with desktop.el so that restarting after an install
+;;   works properly
+;; - Implement M-x package-upgrade, to upgrade any/all existing packages
+;; - Use hierarchical layout.  PKG/etc PKG/lisp PKG/info
+;;   ... except maybe lisp?
+;; - It may be nice to have a macro that expands to the package's
+;;   private data dir, aka ".../etc".  Or, maybe data-directory
+;;   needs to be a list (though this would be less nice)
+;;   a few packages want this, eg sokoban
+;; - package menu needs:
+;;     ability to know which packages are built-in & thus not deletable
+;;     it can sometimes print odd results, like 0.3 available but 0.4 active
+;;        why is that?
+;; - Allow multiple versions on the server...?
+;;   [ why bother? ]
+;; - Don't install a package which will invalidate dependencies overall
+;; - Allow something like (or (>= emacs 21.0) (>= xemacs 21.5))
+;;   [ currently thinking, why bother.. KISS ]
+;; - Allow optional package dependencies
+;;   then if we require 'bbdb', bbdb-specific lisp in lisp/bbdb
+;;   and just don't compile to add to load path ...?
+;; - Have a list of archive URLs?  [ maybe there's no point ]
+;; - David Kastrup pointed out on the xemacs list that for GPL it
+;;   is friendlier to ship the source tree.  We could "support" that
+;;   by just having a "src" subdir in the package.  This isn't ideal
+;;   but it probably is not worth trying to support random source
+;;   tree layouts, build schemes, etc.
+;; - Our treatment of the info path is somewhat bogus
+;; - perhaps have an "unstable" tree in ELPA as well as a stable one
+
+;;; Code:
+
+(defgroup package nil
+  "Manager for Emacs Lisp packages."
+  :group 'applications
+  :version "24.1")
+
+;;;###autoload
+(defcustom package-enable-at-startup t
+  "Whether to activate installed packages when Emacs starts.
+If non-nil, packages are activated after reading the init file
+and before `after-init-hook'.  Activation is not done if
+`user-init-file' is nil (e.g. Emacs was started with \"-q\").
+
+Even if the value is nil, you can type \\[package-initialize] to
+activate the package system at any time."
+  :type 'boolean
+  :group 'package
+  :version "24.1")
+
+(defcustom package-load-list '(all)
+  "List of packages for `package-initialize' to load.
+Each element in this list should be a list (NAME VERSION), or the
+symbol `all'.  The symbol `all' says to load the latest installed
+versions of all packages not specified by other elements.
+
+For an element (NAME VERSION), NAME is a package name (a symbol).
+VERSION should be t, a string, or nil.
+If VERSION is t, all versions are loaded, though obsolete ones
+ will be put in `package-obsolete-alist' and not activated.
+If VERSION is a string, only that version is ever loaded.
+ Any other version, even if newer, is silently ignored.
+ Hence, the package is \"held\" at that version.
+If VERSION is nil, the package is not loaded (it is \"disabled\")."
+  :type '(repeat symbol)
+  :group 'package
+  :version "24.1")
+
+(defvar Info-directory-list)
+(defvar gnus-article-buffer)
+(declare-function info-initialize "info" ())
+(declare-function url-http-parse-response "url-http" ())
+(declare-function lm-header "lisp-mnt" (header))
+(declare-function lm-commentary "lisp-mnt" (&optional file))
+(declare-function dired-delete-file "dired" (file &optional recursive trash))
+
+(defconst package-archive-base "http://elpa.gnu.org/packages/"
+  "Base URL for the Emacs Lisp Package Archive (ELPA).
+Ordinarily you should not need to change this.
+Note that some code in package.el assumes that this is an http: URL.")
+
+(defconst package-archive-version 1
+  "Version number of the package archive understood by this file.
+Lower version numbers than this will probably be understood as well.")
+
+(defconst package-el-version "1.0"
+  "Version of package.el.")
+
+;; We don't prime the cache since it tends to get out of date.
+(defvar package-archive-contents nil
+  "Cache of the contents of the Emacs Lisp Package Archive.
+This is an alist mapping package names (symbols) to package
+descriptor vectors.  These are like the vectors for `package-alist'
+but have an extra entry which is 'tar for tar packages and
+'single for single-file packages.")
+
+(defcustom package-user-dir (locate-user-emacs-file "elpa")
+  "Directory containing the user's Emacs Lisp packages.
+The directory name should be absolute.
+Apart from this directory, Emacs also looks for system-wide
+packages in `package-directory-list'."
+  :type 'directory
+  :group 'package
+  :version "24.1")
+
+(defcustom package-directory-list
+  ;; Defaults are subdirs named "elpa" in the site-lisp dirs.
+  (let (result)
+    (dolist (f load-path)
+      (if (equal (file-name-nondirectory f) "site-lisp")
+	  (push (expand-file-name "elpa" f) result)))
+    (nreverse result))
+  "List of additional directories containing Emacs Lisp packages.
+Each directory name should be absolute.
+
+These directories contain packages intended for system-wide; in
+contrast, `package-user-dir' contains packages for personal use."
+  :type '(repeat directory)
+  :group 'package
+  :version "24.1")
+
+(defun package-version-split (string)
+  "Split a package string into a version list."
+  (mapcar 'string-to-int (split-string string "[.]")))
+
+(defconst package--builtins-base
+  ;; We use package-version split here to make sure to pick up the
+  ;; minor version.
+  `((emacs . [,(package-version-split emacs-version) nil
+	      "GNU Emacs"])
+    (package . [,(package-version-split package-el-version)
+		nil "Simple package system for GNU Emacs"]))
+  "Packages which are always built-in.")
+
+(defvar package--builtins
+  (delq nil
+	(append
+	 package--builtins-base
+	 (if (>= emacs-major-version 22)
+	     ;; FIXME: emacs 22 includes tramp, rcirc, maybe
+	     ;; other things...
+	     '((erc . [(5 2) nil "An Emacs Internet Relay Chat client"])
+	       ;; The external URL is version 1.15, so make sure the
+	       ;; built-in one looks newer.
+	       (url . [(1 16) nil "URL handling libary"])))
+	 (if (>= emacs-major-version 23)
+	     '(;; Strangely, nxml-version is missing in Emacs 23.
+	       ;; We pick the merge date as the version.
+	       (nxml . [(20071123) nil "Major mode for editing XML documents."])
+	       (bubbles . [(0 5) nil "Puzzle game for Emacs."])))))
+  "Alist of all built-in packages.
+Maps the package name to a vector [VERSION REQS DOCSTRING].")
+
+(defvar package-alist package--builtins
+  "Alist of all packages available for activation.
+This maps the package name to a vector [VERSION REQS DOCSTRING].
+
+The value is generated by `package-load-descriptor', usually
+called via `package-initialize'.  For user customizations of
+which packages to load/activate, see `package-load-list'.")
+
+(defvar package-activated-list
+  (mapcar #'car package-alist)
+  "List of the names of currently activated packages.")
+
+(defvar package-obsolete-alist nil
+  "Representation of obsolete packages.
+Like `package-alist', but maps package name to a second alist.
+The inner alist is keyed by version.")
+
+(defconst package-subdirectory-regexp
+  "^\\([^.].*\\)-\\([0-9]+\\(?:[.][0-9]+\\)*\\)$"
+  "Regular expression matching the name of a package subdirectory.
+The first subexpression is the package name.
+The second subexpression is the version string.")
+
+(defun package-version-join (l)
+  "Turn a list of version numbers into a version string."
+  (mapconcat 'int-to-string l "."))
+
+(defun package--version-first-nonzero (l)
+  (while (and l (= (car l) 0))
+    (setq l (cdr l)))
+  (if l (car l) 0))
+
+(defun package-version-compare (v1 v2 fun)
+  "Compare two version lists according to FUN.
+FUN can be <, <=, =, >, >=, or /=."
+  (while (and v1 v2 (= (car v1) (car v2)))
+    (setq v1 (cdr v1)
+	  v2 (cdr v2)))
+  (if v1
+      (if v2
+	  ;; Both not null; we know the cars are not =.
+	  (funcall fun (car v1) (car v2))
+	;; V1 not null, V2 null.
+	(funcall fun (package--version-first-nonzero v1) 0))
+    (if v2
+	;; V1 null, V2 not null.
+	(funcall fun 0 (package--version-first-nonzero v2))
+      ;; Both null.
+      (funcall fun 0 0))))
+
+(defun package--test-version-compare ()
+  "Test suite for `package-version-compare'."
+  (unless (and (package-version-compare '(0) '(0) '=)
+	       (not (package-version-compare '(1) '(0) '=))
+	       (package-version-compare '(1 0 1) '(1) '>=)
+	       (package-version-compare '(1 0 1) '(1) '>)
+	       (not (package-version-compare '(0 9 1) '(1 0 2) '>=)))
+    (error "Failed"))
+  t)
+
+(defun package-strip-version (dirname)
+  "Strip the version from a combined package name and version.
+E.g., if given \"quux-23.0\", will return \"quux\""
+  (if (string-match package-subdirectory-regexp dirname)
+      (match-string 1 dirname)))
+
+(defun package-load-descriptor (dir package)
+  "Load the description file for a package.
+DIR is the directory in which to find the package subdirectory,
+and PACKAGE is the name of the package subdirectory.
+Return nil if the package could not be found."
+  (let ((pkg-dir (expand-file-name package dir)))
+    (if (file-directory-p pkg-dir)
+	(load (expand-file-name (concat (package-strip-version package)
+					"-pkg")
+				pkg-dir)
+	      nil t))))
+
+(defun package-load-all-descriptors ()
+  "Load descriptors for installed Emacs Lisp packages.
+This looks for package subdirectories in `package-user-dir' and
+`package-directory-list'.  The variable `package-load-list'
+controls which package subdirectories may be loaded.
+
+In each valid package subdirectory, this function loads the
+description file containing a call to `define-package', which
+updates `package-alist' and `package-obsolete-alist'."
+  (let ((all (memq 'all package-load-list))
+	name version force)
+    (dolist (dir (cons package-user-dir package-directory-list))
+      (when (file-directory-p dir)
+	(dolist (subdir (directory-files dir))
+	  (when (and (file-directory-p (expand-file-name subdir dir))
+		     (string-match package-subdirectory-regexp subdir))
+	    (setq name    (intern (match-string 1 subdir))
+		  version (match-string 2 subdir)
+		  force   (assq name package-load-list))
+	    (when (cond
+		   ((null force)
+		    all) ; not in package-load-list
+		   ((null (setq force (cadr force)))
+		    nil) ; disabled
+		   ((eq force t)
+		    t)
+		   ((stringp force) ; held
+		    (package-version-compare (package-version-split version)
+					     (package-version-split force)
+					     '=))
+		   (t
+		    (error "Invalid element in `package-load-list'")))
+	      (package-load-descriptor dir subdir))))))))
+
+(defsubst package-desc-vers (desc)
+  "Extract version from a package description vector."
+  (aref desc 0))
+
+(defsubst package-desc-reqs (desc)
+  "Extract requirements from a package description vector."
+  (aref desc 1))
+
+(defsubst package-desc-doc (desc)
+  "Extract doc string from a package description vector."
+  (aref desc 2))
+
+(defsubst package-desc-kind (desc)
+  "Extract the kind of download from an archive package description vector."
+  (aref desc 3))
+
+(defun package-activate-1 (package pkg-vec)
+  (let* ((pkg-name (symbol-name package))
+	 (pkg-ver-str (package-version-join (package-desc-vers pkg-vec)))
+	 (dir-list (cons package-user-dir package-directory-list))
+	 (pkg-dir))
+    (while dir-list
+      (let ((subdir (expand-file-name (concat pkg-name "-" pkg-ver-str)
+				      (car dir-list))))
+	(if (file-directory-p subdir)
+	    (progn
+	      (setq pkg-dir subdir)
+	      (setq dir-list nil))
+	  (setq dir-list (cdr dir-list)))))
+    (unless pkg-dir
+      (error "Internal error: could not find directory for %s-%s"
+	     pkg-name pkg-ver-str))
+    (if (file-exists-p (expand-file-name "dir" pkg-dir))
+	(progn
+	  ;; FIXME: not the friendliest, but simple.
+	  (require 'info)
+	  (info-initialize)
+	  (setq Info-directory-list (cons pkg-dir Info-directory-list))))
+    (setq load-path (cons pkg-dir load-path))
+    ;; Load the autoloads and activate the package.
+    (load (expand-file-name (concat (symbol-name package) "-autoloads")
+			    pkg-dir)
+	  nil t)
+    (setq package-activated-list (cons package package-activated-list))
+    ;; Don't return nil.
+    t))
+
+(defun package--built-in (package version)
+  "Return true if the package is built-in to Emacs."
+  (let ((elt (assq package package--builtins)))
+    (and elt
+	 (package-version-compare (package-desc-vers (cdr elt)) version '=))))
+
+;; FIXME: return a reason instead?
+(defun package-activate (package version)
+  "Activate a package, and recursively activate its dependencies.
+Return nil if the package could not be activated."
+  ;; Assume the user knows what he is doing -- go ahead and activate a
+  ;; newer version of a package if an older one has already been
+  ;; activated.  This is not ideal; we'd at least need to check to see
+  ;; if the package has actually been loaded, and not merely
+  ;; activated.  However, don't try to activate 'emacs', as that makes
+  ;; no sense.
+  (unless (eq package 'emacs)
+    (let* ((pkg-desc (assq package package-alist))
+	   (this-version (package-desc-vers (cdr pkg-desc)))
+	   (req-list (package-desc-reqs (cdr pkg-desc)))
+	   ;; If the package was never activated, we want to do it
+	   ;; now.
+	   (keep-going (or (not (memq package package-activated-list))
+			   (package-version-compare this-version version '>))))
+      (while (and req-list keep-going)
+	(let* ((req (car req-list))
+	       (req-name (car req))
+	       (req-version (cadr req)))
+	  (or (package-activate req-name req-version)
+	      (setq keep-going nil)))
+	(setq req-list (cdr req-list)))
+      (if keep-going
+	  (package-activate-1 package (cdr pkg-desc))
+	;; We get here if a dependency failed to activate -- but we
+	;; can also get here if the requested package was already
+	;; activated.  Return non-nil in the latter case.
+	(and (memq package package-activated-list)
+	     (package-version-compare this-version version '>=))))))
+
+(defun package-mark-obsolete (package pkg-vec)
+  "Put package on the obsolete list, if not already there."
+  (let ((elt (assq package package-obsolete-alist)))
+    (if elt
+	;; If this obsolete version does not exist in the list, update
+	;; it the list.
+	(unless (assoc (package-desc-vers pkg-vec) (cdr elt))
+	  (setcdr elt (cons (cons (package-desc-vers pkg-vec) pkg-vec)
+			    (cdr elt))))
+      ;; Make a new association.
+      (setq package-obsolete-alist
+	    (cons (cons package (list (cons (package-desc-vers pkg-vec)
+					    pkg-vec)))
+		  package-obsolete-alist)))))
+
+;; (define-package "emacs" "21.4.1" "GNU Emacs core package.")
+;; (define-package "erc" "5.1" "ERC - irc client" '((emacs "21.0")))
+(defun define-package (name-str version-string
+				&optional docstring requirements)
+  "Define a new package.
+NAME is the name of the package, a string.
+VERSION-STRING is the version of the package, a dotted sequence
+of integers.
+DOCSTRING is the optional description.
+REQUIREMENTS is a list of requirements on other packages.
+Each requirement is of the form (OTHER-PACKAGE \"VERSION\")."
+  (let* ((name (intern name-str))
+	 (pkg-desc (assq name package-alist))
+	 (new-version (package-version-split version-string))
+	 (new-pkg-desc
+	  (cons name
+		(vector new-version
+			(mapcar
+			 (lambda (elt)
+			   (list (car elt)
+				 (package-version-split (car (cdr elt)))))
+			 requirements)
+			docstring))))
+    ;; Only redefine a package if the redefinition is newer.
+    (if (or (not pkg-desc)
+	    (package-version-compare new-version
+				     (package-desc-vers (cdr pkg-desc))
+				     '>))
+	(progn
+	  (when pkg-desc
+	    ;; Remove old package and declare it obsolete.
+	    (setq package-alist (delq pkg-desc package-alist))
+	    (package-mark-obsolete (car pkg-desc) (cdr pkg-desc)))
+	  ;; Add package to the alist.
+	  (setq package-alist (cons new-pkg-desc package-alist)))
+      ;; You can have two packages with the same version, for instance
+      ;; one in the system package directory and one in your private
+      ;; directory.  We just let the first one win.
+      (unless (package-version-compare new-version
+				       (package-desc-vers (cdr pkg-desc))
+				       '=)
+	;; The package is born obsolete.
+	(package-mark-obsolete (car new-pkg-desc) (cdr new-pkg-desc))))))
+
+;; From Emacs 22.
+(defun package-autoload-ensure-default-file (file)
+  "Make sure that the autoload file FILE exists and if not create it."
+  (unless (file-exists-p file)
+    (write-region
+     (concat ";;; " (file-name-nondirectory file)
+	     " --- automatically extracted autoloads\n"
+	     ";;\n"
+	     ";;; Code:\n\n"
+	     "\n;; Local Variables:\n"
+	     ";; version-control: never\n"
+	     ";; no-byte-compile: t\n"
+	     ";; no-update-autoloads: t\n"
+	     ";; End:\n"
+	     ";;; " (file-name-nondirectory file)
+	     " ends here\n")
+     nil file))
+  file)
+
+(defun package-generate-autoloads (name pkg-dir)
+  (let* ((auto-name (concat name "-autoloads.el"))
+	 (ignore-name (concat name "-pkg.el"))
+	 (generated-autoload-file (expand-file-name auto-name pkg-dir))
+	 (version-control 'never))
+    (require 'autoload)
+    (unless (fboundp 'autoload-ensure-default-file)
+      (package-autoload-ensure-default-file generated-autoload-file))
+    (update-directory-autoloads pkg-dir)))
+
+(defun package-untar-buffer ()
+  "Untar the current buffer.
+This uses `tar-untar-buffer' if it is available.
+Otherwise it uses an external `tar' program.
+`default-directory' should be set by the caller."
+  (require 'tar-mode)
+  (if (fboundp 'tar-untar-buffer)
+      (progn
+	;; tar-mode messes with narrowing, so we just let it have the
+	;; whole buffer to play with.
+	(delete-region (point-min) (point))
+	(tar-mode)
+	(tar-untar-buffer))
+    ;; FIXME: check the result.
+    (call-process-region (point) (point-max) "tar" nil '(nil nil) nil
+			 "xf" "-")))
+
+(defun package-unpack (name version)
+  (let ((pkg-dir (expand-file-name (concat (symbol-name name) "-" version)
+				   package-user-dir)))
+    ;; Be careful!!
+    (make-directory package-user-dir t)
+    (if (file-directory-p pkg-dir)
+	(mapc (lambda (file) nil) ; 'delete-file -- FIXME: when we're
+				  ; more confident
+	      (directory-files pkg-dir t "^[^.]")))
+    (let* ((default-directory (file-name-as-directory package-user-dir)))
+      (package-untar-buffer)
+      (package-generate-autoloads (symbol-name name) pkg-dir)
+      (let ((load-path (cons pkg-dir load-path)))
+	(byte-recompile-directory pkg-dir 0 t)))))
+
+(defun package-unpack-single (file-name version desc requires)
+  "Install the contents of the current buffer as a package."
+  ;; Special case "package".
+  (if (string= file-name "package")
+      (write-region (point-min) (point-max)
+		    (expand-file-name (concat file-name ".el")
+				      package-user-dir)
+		    nil nil nil nil)
+    (let* ((pkg-dir  (expand-file-name (concat file-name "-" version)
+				       package-user-dir))
+	   (el-file  (expand-file-name (concat file-name ".el") pkg-dir))
+	   (pkg-file (expand-file-name (concat file-name "-pkg.el") pkg-dir)))
+      (make-directory pkg-dir t)
+      (write-region (point-min) (point-max) el-file nil nil nil 'excl)
+      (let ((print-level nil)
+	    (print-length nil))
+	(write-region
+	 (concat
+	  (prin1-to-string
+	   (list 'define-package
+		 file-name
+		 version
+		 desc
+		 (list 'quote
+		       ;; Turn version lists into string form.
+		       (mapcar
+			(lambda (elt)
+			  (list (car elt)
+				(package-version-join (car (cdr elt)))))
+			requires))))
+	  "\n")
+	 nil
+	 pkg-file
+	 nil nil nil 'excl))
+      (package-generate-autoloads file-name pkg-dir)
+      (let ((load-path (cons pkg-dir load-path)))
+	(byte-recompile-directory pkg-dir 0 t)))))
+
+(defun package-handle-response ()
+  "Handle the response from the server.
+Parse the HTTP response and throw if an error occurred.
+The url package seems to require extra processing for this.
+This should be called in a `save-excursion', in the download buffer.
+It will move point to somewhere in the headers."
+  ;; We assume HTTP here.
+  (require 'url-http)
+  (let ((response (url-http-parse-response)))
+    (when (or (< response 200) (>= response 300))
+      (display-buffer (current-buffer))
+      (error "Error during download request:%s"
+	     (buffer-substring-no-properties (point) (progn
+						       (end-of-line)
+						       (point)))))))
+
+(defun package-download-single (name version desc requires)
+  "Download and install a single-file package."
+  (let ((buffer (url-retrieve-synchronously
+		 (concat package-archive-base
+			 (symbol-name name) "-" version ".el"))))
+    (with-current-buffer buffer
+      (package-handle-response)
+      (re-search-forward "^$" nil 'move)
+      (forward-char)
+      (delete-region (point-min) (point))
+      (package-unpack-single (symbol-name name) version desc requires)
+      (kill-buffer buffer))))
+
+(defun package-download-tar (name version)
+  "Download and install a tar package."
+  (let ((tar-buffer (url-retrieve-synchronously
+		     (concat package-archive-base
+			     (symbol-name name) "-" version ".tar"))))
+    (with-current-buffer tar-buffer
+      (package-handle-response)
+      (re-search-forward "^$" nil 'move)
+      (forward-char)
+      (package-unpack name version)
+      (kill-buffer tar-buffer))))
+
+(defun package-installed-p (package version)
+  (let ((pkg-desc (assq package package-alist)))
+    (and pkg-desc
+	 (package-version-compare version
+				  (package-desc-vers (cdr pkg-desc))
+				  '>=))))
+
+(defun package-compute-transaction (result requirements)
+  (dolist (elt requirements)
+    (let* ((next-pkg (car elt))
+	   (next-version (cadr elt)))
+      (unless (package-installed-p next-pkg next-version)
+	;; A package is required, but not installed.  It might also be
+	;; blocked via `package-load-list'.
+	(let ((pkg-desc (assq next-pkg package-archive-contents))
+	      hold)
+	  (when (setq hold (assq next-pkg package-load-list))
+	    (setq hold (cadr hold))
+	    (cond ((eq hold nil)
+		   (error "Required package '%s' is disabled"
+			  (symbol-name next-pkg)))
+		  ((null (stringp hold))
+		   (error "Invalid element in `package-load-list'"))
+		  ((package-version-compare next-version
+					    (package-version-split hold)
+					    '>)
+		   (error "Package '%s' held at version %s, \
+but version %s required"
+			  (symbol-name next-pkg) hold
+			  (package-version-join next-version)))))
+	  (unless pkg-desc
+	    (error "Package '%s' is not available for installation"
+		   (symbol-name next-pkg)))
+	  (unless (package-version-compare (package-desc-vers (cdr pkg-desc))
+					   next-version
+					   '>=)
+	    (error
+	     "Need package '%s' with version %s, but only %s is available"
+	     (symbol-name next-pkg) (package-version-join next-version)
+	     (package-version-join (package-desc-vers (cdr pkg-desc)))))
+	  ;; Only add to the transaction if we don't already have it.
+	  (unless (memq next-pkg result)
+	    (setq result (cons next-pkg result)))
+	  (setq result
+		(package-compute-transaction result
+					     (package-desc-reqs
+					      (cdr pkg-desc))))))))
+  result)
+
+(defun package-read-from-string (str)
+  "Read a Lisp expression from STR.
+Signal an error if the entire string was not used."
+  (let* ((read-data (read-from-string str))
+          (more-left
+             (condition-case nil
+                       ;; The call to `ignore' suppresses a compiler warning.
+                       (progn (ignore (read-from-string
+                                       (substring str (cdr read-data))))
+                                   t)
+                   (end-of-file nil))))
+    (if more-left
+        (error "Can't read whole string")
+      (car read-data))))
+
+(defun package--read-archive-file (file)
+  "Re-read archive file FILE, if it exists.
+Will return the data from the file, or nil if the file does not exist.
+Will throw an error if the archive version is too new."
+  (let ((filename (expand-file-name file package-user-dir)))
+    (if (file-exists-p filename)
+	(with-temp-buffer
+	  (insert-file-contents-literally filename)
+	  (let ((contents (package-read-from-string
+			   (buffer-substring-no-properties (point-min)
+							   (point-max)))))
+	    (if (> (car contents) package-archive-version)
+		(error "Package archive version %d is greater than %d - upgrade package.el"
+		       (car contents) package-archive-version))
+	    (cdr contents))))))
+
+(defun package-read-archive-contents ()
+  "Re-read `archive-contents' and `builtin-packages', if they exist.
+Set `package-archive-contents' and `package--builtins' if successful.
+Throw an error if the archive version is too new."
+  (let ((archive-contents (package--read-archive-file "archive-contents"))
+	(builtins (package--read-archive-file "builtin-packages")))
+    (if archive-contents
+	;; Version 1 of 'archive-contents' is identical to our
+	;; internal representation.
+	(setq package-archive-contents archive-contents))
+    (if builtins
+	;; Version 1 of 'builtin-packages' is a list where the car is
+	;; a split emacs version and the cdr is an alist suitable for
+	;; package--builtins.
+	(let ((our-version (package-version-split emacs-version))
+	      (result package--builtins-base))
+	  (setq package--builtins
+		(dolist (elt builtins result)
+		  (if (package-version-compare our-version (car elt) '>=)
+		      (setq result (append (cdr elt) result)))))))))
+
+(defun package-download-transaction (transaction)
+  "Download and install all the packages in the given transaction."
+  (dolist (elt transaction)
+    (let* ((desc (cdr (assq elt package-archive-contents)))
+	   ;; As an exception, if package is "held" in
+	   ;; `package-load-list', download the held version.
+	   (hold (cadr (assq elt package-load-list)))
+	   (v-string (or (and (stringp hold) hold)
+			 (package-version-join (package-desc-vers desc))))
+	   (kind (package-desc-kind desc)))
+      (cond
+       ((eq kind 'tar)
+	(package-download-tar elt v-string))
+       ((eq kind 'single)
+	(package-download-single elt v-string
+				 (package-desc-doc desc)
+				 (package-desc-reqs desc)))
+       (t
+	(error "Unknown package kind: %s" (symbol-name kind)))))))
+
+;;;###autoload
+(defun package-install (name)
+  "Install the package named NAME.
+Interactively, prompt for the package name.
+The package is found on the archive site, see `package-archive-base'."
+  (interactive
+   (list (progn
+	   ;; Make sure we're using the most recent download of the
+	   ;; archive.  Maybe we should be updating the archive first?
+	   (package-read-archive-contents)
+	   (intern (completing-read "Install package: "
+				    (mapcar (lambda (elt)
+					      (cons (symbol-name (car elt))
+						    nil))
+					    package-archive-contents)
+				    nil t)))))
+  (let ((pkg-desc (assq name package-archive-contents)))
+    (unless pkg-desc
+      (error "Package '%s' not available for installation"
+	     (symbol-name name)))
+    (let ((transaction
+	   (package-compute-transaction (list name)
+					(package-desc-reqs (cdr pkg-desc)))))
+      (package-download-transaction transaction)))
+  ;; Try to activate it.
+  (package-initialize))
+
+(defun package-strip-rcs-id (v-str)
+  "Strip RCS version ID from the version string.
+If the result looks like a dotted numeric version, return it.
+Otherwise return nil."
+  (if v-str
+      (if (string-match "^[ \t]*[$]Revision:[ \t]\([0-9.]+\)[ \t]*[$]$" v-str)
+	  (match-string 1 v-str)
+	(if (string-match "^[0-9.]*$" v-str)
+	    v-str))))
+
+(defun package-buffer-info ()
+  "Return a vector of information about the package in the current buffer.
+The vector looks like [FILENAME REQUIRES DESCRIPTION VERSION COMMENTARY]
+FILENAME is the file name, a string.  It does not have the \".el\" extension.
+REQUIRES is a requires list, or nil.
+DESCRIPTION is the package description (a string).
+VERSION is the version, a string.
+COMMENTARY is the commentary section, a string, or nil if none.
+Throws an exception if the buffer does not contain a conforming package.
+If there is a package, narrows the buffer to the file's boundaries.
+May narrow buffer or move point even on failure."
+  (goto-char (point-min))
+  (if (re-search-forward "^;;; \\([^ ]*\\)\\.el --- \\(.*\\)$" nil t)
+      (let ((file-name (match-string 1))
+	    (desc (match-string 2))
+	    (start (progn (beginning-of-line) (point))))
+	(if (search-forward (concat ";;; " file-name ".el ends here"))
+	    (progn
+	      ;; Try to include a trailing newline.
+	      (forward-line)
+	      (narrow-to-region start (point))
+	      (require 'lisp-mnt)
+	      ;; Use some headers we've invented to drive the process.
+	      (let* ((requires-str (lm-header "package-requires"))
+		     (requires (if requires-str
+				   (package-read-from-string requires-str)))
+		     ;; Prefer Package-Version, because if it is
+		     ;; defined the package author probably wants us
+		     ;; to use it.  Otherwise try Version.
+		     (pkg-version
+		      (or (package-strip-rcs-id (lm-header "package-version"))
+			  (package-strip-rcs-id (lm-header "version"))))
+		     (commentary (lm-commentary)))
+		(unless pkg-version
+		  (error
+		   "Package does not define a usable \"Version\" or \"Package-Version\" header"))
+		;; Turn string version numbers into list form.
+		(setq requires
+		      (mapcar
+		       (lambda (elt)
+			 (list (car elt)
+			       (package-version-split (car (cdr elt)))))
+		       requires))
+		(set-text-properties 0 (length file-name) nil file-name)
+		(set-text-properties 0 (length pkg-version) nil pkg-version)
+		(set-text-properties 0 (length desc) nil desc)
+		(vector file-name requires desc pkg-version commentary)))
+	  (error "Package missing a terminating comment")))
+    (error "No starting comment for package")))
+
+(defun package-tar-file-info (file)
+  "Find package information for a tar file.
+FILE is the name of the tar file to examine.
+The return result is a vector like `package-buffer-info'."
+  (unless (string-match "^\\(.+\\)-\\([0-9.]+\\)\\.tar$" file)
+    (error "`%s' doesn't have a package-ish name" file))
+  (let* ((pkg-name (file-name-nondirectory (match-string-no-properties 1 file)))
+	 (pkg-version (match-string-no-properties 2 file))
+	 ;; Extract the package descriptor.
+	 (pkg-def-contents (shell-command-to-string
+			    ;; Requires GNU tar.
+			    (concat "tar -xOf " file " "
+				    pkg-name "-" pkg-version "/"
+				    pkg-name "-pkg.el")))
+	 (pkg-def-parsed (package-read-from-string pkg-def-contents)))
+    (unless (eq (car pkg-def-parsed) 'define-package)
+      (error "%s-pkg.el doesn't contain `define-package' sexp" pkg-name))
+    (let ((name-str (nth 1 pkg-def-parsed))
+	  (version-string (nth 2 pkg-def-parsed))
+	  (docstring (nth 3 pkg-def-parsed))
+	  (requires (nth 4 pkg-def-parsed))
+
+	  (readme (shell-command-to-string
+		   ;; Requires GNU tar.
+		   (concat "tar -xOf " file " "
+			   pkg-name "-" pkg-version "/README"))))
+      (unless (equal pkg-version version-string)
+	(error "Inconsistent versions!"))
+      (unless (equal pkg-name name-str)
+	(error "Inconsistent names!"))
+      ;; Kind of a hack.
+      (if (string-match ": Not found in archive" readme)
+	  (setq readme nil))
+      ;; Turn string version numbers into list form.
+      (if (eq (car requires) 'quote)
+	  (setq requires (car (cdr requires))))
+      (setq requires
+	    (mapcar
+	     (lambda (elt)
+	       (list (car elt)
+		     (package-version-split (car (cdr elt)))))
+	     requires))
+      (vector pkg-name requires docstring version-string readme))))
+
+(defun package-install-buffer-internal (pkg-info type)
+  (save-excursion
+    (save-restriction
+      (let* ((file-name (aref pkg-info 0))
+	     (requires (aref pkg-info 1))
+	     (desc (if (string= (aref pkg-info 2) "")
+		       "No description available."
+		     (aref pkg-info 2)))
+	     (pkg-version (aref pkg-info 3)))
+	;; Download and install the dependencies.
+	(let ((transaction (package-compute-transaction nil requires)))
+	  (package-download-transaction transaction))
+	;; Install the package itself.
+	(cond
+	 ((eq type 'single)
+	  (package-unpack-single file-name pkg-version desc requires))
+	 ((eq type 'tar)
+	  (package-unpack (intern file-name) pkg-version))
+	 (t
+	  (error "Unknown type: %s" (symbol-name type))))
+	;; Try to activate it.
+	(package-initialize)))))
+
+;;;###autoload
+(defun package-install-from-buffer ()
+  "Install a package from the current buffer.
+The package is assumed to be a single .el file which
+follows the elisp comment guidelines; see
+info node `(elisp)Library Headers'."
+  (interactive)
+  (package-install-buffer-internal (package-buffer-info) 'single))
+
+;;;###autoload
+(defun package-install-file (file)
+  "Install a package from a file.
+The file can either be a tar file or an Emacs Lisp file."
+  (interactive "fPackage file name: ")
+  (with-temp-buffer
+    (insert-file-contents-literally file)
+    (cond
+     ((string-match "\\.el$" file) (package-install-from-buffer))
+     ((string-match "\\.tar$" file)
+      (package-install-buffer-internal (package-tar-file-info file) 'tar))
+     (t (error "Unrecognized extension `%s'" (file-name-extension file))))))
+
+(defun package-delete (name version)
+  (require 'dired)			; for dired-delete-file
+  (dired-delete-file (expand-file-name (concat name "-" version)
+				       package-user-dir)
+		     ;; FIXME: query user?
+		     'always))
+
+(defun package--download-one-archive (file)
+  "Download a single archive file and cache it locally."
+  (let ((buffer (url-retrieve-synchronously
+		 (concat package-archive-base file))))
+    (with-current-buffer buffer
+      (package-handle-response)
+      (re-search-forward "^$" nil 'move)
+      (forward-char)
+      (delete-region (point-min) (point))
+      (setq buffer-file-name (concat (file-name-as-directory package-user-dir)
+				     file))
+      (let ((version-control 'never))
+	(save-buffer))
+      (kill-buffer buffer))))
+
+(defun package-refresh-contents ()
+  "Download the ELPA archive description if needed.
+Invoking this will ensure that Emacs knows about the latest versions
+of all packages.  This will let Emacs make them available for
+download."
+  (interactive)
+  (unless (file-exists-p package-user-dir)
+    (make-directory package-user-dir t))
+  (package--download-one-archive "archive-contents")
+  (package--download-one-archive "builtin-packages")
+  (package-read-archive-contents))
+
+;;;###autoload
+(defun package-initialize ()
+  "Load Emacs Lisp packages, and activate them.
+The variable `package-load-list' controls which packages to load."
+  (interactive)
+  (setq package-obsolete-alist nil)
+  (package-load-all-descriptors)
+  (package-read-archive-contents)
+  ;; Try to activate all our packages.
+  (mapc (lambda (elt)
+	  (package-activate (car elt) (package-desc-vers (cdr elt))))
+	package-alist))
+
+
+
+;;;; Package menu mode.
+
+(defvar package-menu-mode-map
+  (let ((map (make-keymap))
+	(menu-map (make-sparse-keymap "Package")))
+    (suppress-keymap map)
+    (define-key map "q" 'quit-window)
+    (define-key map "n" 'next-line)
+    (define-key map "p" 'previous-line)
+    (define-key map "u" 'package-menu-mark-unmark)
+    (define-key map "\177" 'package-menu-backup-unmark)
+    (define-key map "d" 'package-menu-mark-delete)
+    (define-key map "i" 'package-menu-mark-install)
+    (define-key map "g" 'package-menu-revert)
+    (define-key map "r" 'package-menu-refresh)
+    (define-key map "~" 'package-menu-mark-obsolete-for-deletion)
+    (define-key map "x" 'package-menu-execute)
+    (define-key map "h" 'package-menu-quick-help)
+    (define-key map "?" 'package-menu-view-commentary)
+    (define-key map [menu-bar package-menu] (cons "Package" menu-map))
+    (define-key menu-map [mq]
+      '(menu-item "Quit" quit-window
+		  :help "Quit package selection"))
+    (define-key menu-map [s1] '("--"))
+    (define-key menu-map [mn]
+      '(menu-item "Next" next-line
+		  :help "Next Line"))
+    (define-key menu-map [mp]
+      '(menu-item "Previous" previous-line
+		  :help "Previous Line"))
+    (define-key menu-map [s2] '("--"))
+    (define-key menu-map [mu]
+      '(menu-item "Unmark" package-menu-mark-unmark
+		  :help "Clear any marks on a package and move to the next line"))
+    (define-key menu-map [munm]
+      '(menu-item "Unmark backwards" package-menu-backup-unmark
+		  :help "Back up one line and clear any marks on that package"))
+    (define-key menu-map [md]
+      '(menu-item "Mark for deletion" package-menu-mark-delete
+		  :help "Mark a package for deletion and move to the next line"))
+    (define-key menu-map [mi]
+      '(menu-item "Mark for install" package-menu-mark-install
+		  :help "Mark a package for installation and move to the next line"))
+    (define-key menu-map [s3] '("--"))
+    (define-key menu-map [mg]
+      '(menu-item "Update package list" package-menu-revert
+		  :help "Update the list of packages"))
+    (define-key menu-map [mr]
+      '(menu-item "Refresh package list" package-menu-refresh
+		  :help "Download the ELPA archive"))
+    (define-key menu-map [s4] '("--"))
+    (define-key menu-map [mt]
+      '(menu-item "Mark obsolete packages" package-menu-mark-obsolete-for-deletion
+		  :help "Mark all obsolete packages for deletion"))
+    (define-key menu-map [mx]
+      '(menu-item "Execute actions" package-menu-execute
+		  :help "Perform all the marked actions"))
+    (define-key menu-map [s5] '("--"))
+    (define-key menu-map [mh]
+      '(menu-item "Help" package-menu-quick-help
+		  :help "Show short key binding help for package-menu-mode"))
+    (define-key menu-map [mc]
+      '(menu-item "View Commentary" package-menu-view-commentary
+		  :help "Display information about this package"))
+    map)
+  "Local keymap for `package-menu-mode' buffers.")
+
+(defvar package-menu-sort-button-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [header-line mouse-1] 'package-menu-sort-by-column)
+    (define-key map [follow-link] 'mouse-face)
+    map)
+  "Local keymap for package menu sort buttons.")
+
+(put 'package-menu-mode 'mode-class 'special)
+
+(defun package-menu-mode ()
+  "Major mode for browsing a list of packages.
+Letters do not insert themselves; instead, they are commands.
+\\<package-menu-mode-map>
+\\{package-menu-mode-map}"
+  (kill-all-local-variables)
+  (use-local-map package-menu-mode-map)
+  (setq major-mode 'package-menu-mode)
+  (setq mode-name "Package Menu")
+  (setq truncate-lines t)
+  (setq buffer-read-only t)
+  ;; Support Emacs 21.
+  (if (fboundp 'run-mode-hooks)
+      (run-mode-hooks 'package-menu-mode-hook)
+    (run-hooks 'package-menu-mode-hook)))
+
+(defun package-menu-refresh ()
+  "Download the ELPA archive.
+This fetches the file describing the current contents of
+the Emacs Lisp Package Archive, and then refreshes the
+package menu.  This lets you see what new packages are
+available for download."
+  (interactive)
+  (package-refresh-contents)
+  (package-list-packages-internal))
+
+(defun package-menu-revert ()
+  "Update the list of packages."
+  (interactive)
+  (package-list-packages-internal))
+
+(defun package-menu-mark-internal (what)
+  (unless (eobp)
+    (let ((buffer-read-only nil))
+      (beginning-of-line)
+      (delete-char 1)
+      (insert what)
+      (forward-line))))
+
+;; fixme numeric argument
+(defun package-menu-mark-delete (num)
+  "Mark a package for deletion and move to the next line."
+  (interactive "p")
+  (package-menu-mark-internal "D"))
+
+(defun package-menu-mark-install (num)
+  "Mark a package for installation and move to the next line."
+  (interactive "p")
+  (package-menu-mark-internal "I"))
+
+(defun package-menu-mark-unmark (num)
+  "Clear any marks on a package and move to the next line."
+  (interactive "p")
+  (package-menu-mark-internal " "))
+
+(defun package-menu-backup-unmark ()
+  "Back up one line and clear any marks on that package."
+  (interactive)
+  (forward-line -1)
+  (package-menu-mark-internal " ")
+  (forward-line -1))
+
+(defun package-menu-mark-obsolete-for-deletion ()
+  "Mark all obsolete packages for deletion."
+  (interactive)
+  (save-excursion
+    (goto-char (point-min))
+    (forward-line 2)
+    (while (not (eobp))
+      (if (looking-at ".*\\s obsolete\\s ")
+	  (package-menu-mark-internal "D")
+	(forward-line 1)))))
+
+(defun package-menu-quick-help ()
+  "Show short key binding help for package-menu-mode."
+  (interactive)
+  (message "n-ext, i-nstall, d-elete, u-nmark, x-ecute, r-efresh, h-elp"))
+
+(defun package-menu-view-commentary ()
+  "Display information about this package.
+For single-file packages, shows the commentary section from the header.
+For larger packages, shows the README file."
+  (interactive)
+  (let* (start-point ok
+	 (pkg-name (package-menu-get-package))
+	 (buffer (url-retrieve-synchronously (concat package-archive-base
+						     pkg-name
+						     "-readme.txt"))))
+    (with-current-buffer buffer
+      ;; FIXME: it would be nice to work with any URL type.
+      (setq start-point url-http-end-of-headers)
+      (setq ok (eq (url-http-parse-response) 200)))
+    (let ((new-buffer (get-buffer-create "*Package Info*")))
+      (with-current-buffer new-buffer
+	(let ((buffer-read-only nil))
+	  (erase-buffer)
+	  (insert "Package information for " pkg-name "\n\n")
+	  (if ok
+	      (insert-buffer-substring buffer start-point)
+	    (insert "This package does not have a README file or commentary comment.\n"))
+	  (goto-char (point-min))
+	  (view-mode)))
+      (display-buffer new-buffer t))))
+
+;; Return the name of the package on the current line.
+(defun package-menu-get-package ()
+  (save-excursion
+    (beginning-of-line)
+    (if (looking-at ". \\([^ \t]*\\)")
+	(match-string 1))))
+
+;; Return the version of the package on the current line.
+(defun package-menu-get-version ()
+  (save-excursion
+    (beginning-of-line)
+    (if (looking-at ". [^ \t]*[ \t]*\\([0-9.]*\\)")
+	(match-string 1))))
+
+(defun package-menu-get-status ()
+  (save-excursion
+    (if (looking-at ". [^ \t]*[ \t]*[^ \t]*[ \t]*\\([^ \t]*\\)")
+	(match-string 1)
+      "")))
+
+(defun package-menu-execute ()
+  "Perform all the marked actions.
+Packages marked for installation will be downloaded and
+installed.  Packages marked for deletion will be removed.
+Note that after installing packages you will want to restart
+Emacs."
+  (interactive)
+  (goto-char (point-min))
+  (forward-line 2)
+  (while (not (eobp))
+    (let ((cmd (char-after))
+	  (pkg-name (package-menu-get-package))
+	  (pkg-vers (package-menu-get-version))
+	  (pkg-status (package-menu-get-status)))
+      (cond
+       ((eq cmd ?D)
+	(when (and (string= pkg-status "installed")
+		   (string= pkg-name "package"))
+	  ;; FIXME: actually, we could be tricky and remove all info.
+	  ;; But that is drastic and the user can do that instead.
+	  (error "Can't delete most recent version of `package'"))
+	;; Ask for confirmation here?  Maybe if package status is ""?
+	;; Or if any lisp from package is actually loaded?
+	(message "Deleting %s-%s..." pkg-name pkg-vers)
+	(package-delete pkg-name pkg-vers)
+	(message "Deleting %s-%s... done" pkg-name pkg-vers))
+       ((eq cmd ?I)
+	(package-install (intern pkg-name)))))
+    (forward-line))
+  (package-menu-revert))
+
+(defun package-print-package (package version key desc)
+  (let ((face
+	 (cond ((eq package 'emacs) 'font-lock-builtin-face)
+	       ((string= key "available") 'default)
+	       ((string= key "held") 'font-lock-constant-face)
+	       ((string= key "disabled") 'font-lock-warning-face)
+	       ((string= key "installed") 'font-lock-comment-face)
+	       (t ; obsolete, but also the default.
+		'font-lock-warning-face))))
+    (insert (propertize "  " 'font-lock-face face))
+    (insert (propertize (symbol-name package) 'font-lock-face face))
+    (indent-to 20 1)
+    (insert (propertize (package-version-join version) 'font-lock-face face))
+    (indent-to 30 1)
+    (insert (propertize key 'font-lock-face face))
+    ;; FIXME: this 'when' is bogus...
+    (when desc
+      (indent-to 41 1)
+      (insert (propertize desc 'font-lock-face face)))
+    (insert "\n")))
+
+(defun package-list-maybe-add (package version status description result)
+  (unless (assoc (cons package version) result)
+    (setq result (cons (list (cons package version) status description)
+		       result)))
+  result)
+
+;; This decides how we should sort; nil means by package name.
+(defvar package-menu-sort-key nil)
+
+(defun package-list-packages-internal ()
+  (package-initialize)			; FIXME: do this here?
+  (with-current-buffer (get-buffer-create "*Packages*")
+    (setq buffer-read-only nil)
+    (erase-buffer)
+    (let ((info-list)
+	  name desc hold)
+      ;; List installed packages
+      (dolist (elt package-alist)
+	(setq name (car elt)
+	      desc (cdr elt)
+	      hold (assq name package-load-list))
+	(setq info-list
+	      (package-list-maybe-add name (package-desc-vers desc)
+				      ;; FIXME: it turns out to be
+				      ;; tricky to see if this package
+				      ;; is presently activated.
+				      (if (stringp (cadr hold))
+					  "held"
+					"installed")
+				      (package-desc-doc desc)
+				      info-list)))
+      ;; List available packages
+      (dolist (elt package-archive-contents)
+	(setq name (car elt)
+	      desc (cdr elt)
+	      hold (assq name package-load-list))
+	(unless (and hold (stringp (cadr hold))
+		     (package-installed-p
+		      name (package-version-split (cadr hold))))
+	  (setq info-list
+		(package-list-maybe-add name
+					(package-desc-vers desc)
+					(if (and hold (null (cadr hold)))
+					    "disabled"
+					  "available")
+					(package-desc-doc (cdr elt))
+					info-list))))
+      ;; List obsolete packages
+      (mapc (lambda (elt)
+	      (mapc (lambda (inner-elt)
+		      (setq info-list
+			    (package-list-maybe-add (car elt)
+						    (package-desc-vers
+						     (cdr inner-elt))
+						    "obsolete"
+						    (package-desc-doc
+						     (cdr inner-elt))
+						    info-list)))
+		    (cdr elt)))
+	    package-obsolete-alist)
+      (let ((selector (cond
+		       ((string= package-menu-sort-key "Version")
+			;; FIXME this doesn't work.
+			#'(lambda (e) (cdr (car e))))
+		       ((string= package-menu-sort-key "Status")
+			#'(lambda (e) (car (cdr e))))
+		       ((string= package-menu-sort-key "Description")
+			#'(lambda (e) (car (cdr (cdr e)))))
+		       (t ; "Package" is default.
+			#'(lambda (e) (symbol-name (car (car e))))))))
+	(setq info-list
+	      (sort info-list
+		    (lambda (left right)
+		      (let ((vleft (funcall selector left))
+			    (vright (funcall selector right)))
+			(string< vleft vright))))))
+      (mapc (lambda (elt)
+	      (package-print-package (car (car elt))
+				     (cdr (car elt))
+				     (car (cdr elt))
+				     (car (cdr (cdr elt)))))
+	    info-list))
+    (goto-char (point-min))
+    (current-buffer)))
+
+(defun package-menu-sort-by-column (&optional e)
+  "Sort the package menu by the last column clicked on."
+  (interactive (list last-input-event))
+  (if e (mouse-select-window e))
+  (let* ((pos (event-start e))
+	 (obj (posn-object pos))
+	 (col (if obj
+		  (get-text-property (cdr obj) 'column-name (car obj))
+		(get-text-property (posn-point pos) 'column-name))))
+    (setq package-menu-sort-key col))
+  (package-list-packages-internal))
+
+(defun package--list-packages ()
+  "Display a list of packages.
+Helper function that does all the work for the user-facing functions."
+  (with-current-buffer (package-list-packages-internal)
+    (package-menu-mode)
+    ;; Set up the header line.
+    (setq header-line-format
+	  (mapconcat
+	   (lambda (pair)
+	     (let ((column (car pair))
+		   (name (cdr pair)))
+	       (concat
+		;; Insert a space that aligns the button properly.
+		(propertize " " 'display (list 'space :align-to column)
+			    'face 'fixed-pitch)
+		;; Set up the column button.
+		(if (string= name "Version")
+		    name
+		  (propertize name
+			      'column-name name
+			      'help-echo "mouse-1: sort by column"
+			      'mouse-face 'highlight
+			      'keymap package-menu-sort-button-map)))))
+	   ;; We take a trick from buff-menu and have a dummy leading
+	   ;; space to align the header line with the beginning of the
+	   ;; text.  This doesn't really work properly on Emacs 21,
+	   ;; but it is close enough.
+	   '((0 . "")
+	     (2 . "Package")
+	     (20 . "Version")
+	     (30 . "Status")
+	     (41 . "Description"))
+	   ""))
+
+    ;; It's okay to use pop-to-buffer here.  The package menu buffer
+    ;; has keybindings, and the user just typed 'M-x
+    ;; package-list-packages', suggesting that they might want to use
+    ;; them.
+    (pop-to-buffer (current-buffer))))
+
+;;;###autoload
+(defun package-list-packages ()
+  "Display a list of packages.
+Fetches the updated list of packages before displaying.
+The list is displayed in a buffer named `*Packages*'."
+  (interactive)
+  (package-refresh-contents)
+  (package--list-packages))
+
+(defun package-list-packages-no-fetch ()
+  "Display a list of packages.
+Does not fetch the updated list of packages before displaying.
+The list is displayed in a buffer named `*Packages*'."
+  (interactive)
+  (package--list-packages))
+
+;; Make it appear on the menu.
+(define-key-after menu-bar-options-menu [package]
+  '(menu-item "Manage Packages" package-list-packages
+	      :help "Install or uninstall additional Emacs packages"))
+
+(provide 'package)
+
+;;; package.el ends here
--- a/lisp/facemenu.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/facemenu.el	Sat Jun 19 12:15:25 2010 +0000
@@ -600,9 +600,11 @@
     (with-current-buffer buf
       (erase-buffer)
       (setq truncate-lines t)
+      ;; Display buffer before generating content to allow
+      ;; `list-colors-print' to get the right window-width.
+      (pop-to-buffer buf)
       (list-colors-print list callback)
-      (set-buffer-modified-p nil))
-    (pop-to-buffer buf))
+      (set-buffer-modified-p nil)))
   (if callback
       (message "Click on a color to select it.")))
 
--- a/lisp/font-core.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/font-core.el	Sat Jun 19 12:15:25 2010 +0000
@@ -97,7 +97,7 @@
 `font-lock-mode'.")
 
 ;; The mode for which font-lock was initialized, or nil if none.
-(defvar font-lock-mode-major-mode)
+(defvar font-lock-major-mode)
 (define-minor-mode font-lock-mode
   "Toggle Font Lock mode.
 With arg, turn Font Lock mode off if and only if arg is a non-positive
@@ -159,9 +159,7 @@
   ;; Arrange to unfontify this buffer if we change major mode later.
   (if font-lock-mode
       (add-hook 'change-major-mode-hook 'font-lock-change-mode nil t)
-    (remove-hook 'change-major-mode-hook 'font-lock-change-mode t))
-  (when font-lock-mode
-    (setq font-lock-mode-major-mode major-mode)))
+    (remove-hook 'change-major-mode-hook 'font-lock-change-mode t)))
 
 ;; Get rid of fontification for the old major mode.
 ;; We do this when changing major modes.
@@ -213,8 +211,8 @@
 	    (and mode
 		 (boundp 'font-lock-set-defaults)
 		 font-lock-set-defaults
-		 font-lock-mode-major-mode
-		 (not (eq font-lock-mode-major-mode major-mode))))
+		 font-lock-major-mode
+		 (not (eq font-lock-major-mode major-mode))))
     (font-lock-mode-internal mode)))
 
 (defun turn-on-font-lock ()
--- a/lisp/font-lock.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/font-lock.el	Sat Jun 19 12:15:25 2010 +0000
@@ -1783,15 +1783,18 @@
   (kill-local-variable 'font-lock-set-defaults)
   (font-lock-mode 1))
 
-(defvar font-lock-mode-major-mode)
+(defvar font-lock-major-mode nil
+  "Major mode for which the font-lock settings have been setup.")
+(make-variable-buffer-local 'font-lock-major-mode)
+
 (defun font-lock-set-defaults ()
   "Set fontification defaults appropriately for this mode.
 Sets various variables using `font-lock-defaults' (or, if nil, using
 `font-lock-defaults-alist') and `font-lock-maximum-decoration'."
   ;; Set fontification defaults if not previously set for correct major mode.
   (unless (and font-lock-set-defaults
-	       (eq font-lock-mode-major-mode major-mode))
-    (setq font-lock-mode-major-mode major-mode)
+	       (eq font-lock-major-mode major-mode))
+    (setq font-lock-major-mode major-mode)
     (set (make-local-variable 'font-lock-set-defaults) t)
     (make-local-variable 'font-lock-fontified)
     (make-local-variable 'font-lock-multiline)
--- a/lisp/gnus/ChangeLog	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/gnus/ChangeLog	Sat Jun 19 12:15:25 2010 +0000
@@ -1,3 +1,8 @@
+2010-06-15  Michael Albinus  <michael.albinus@gmx.de>
+
+	* auth-source.el (auth-source-pick): If choice does not contain a
+	questioned keyword, set the check to t.
+
 2010-06-12  Romain Francoise  <romain@orebokech.com>
 
 	* gnus-util.el (gnus-date-get-time): Move up before first use.
--- a/lisp/gnus/auth-source.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/gnus/auth-source.el	Sat Jun 19 12:15:25 2010 +0000
@@ -229,7 +229,8 @@
 	     ;; Check keywords.
 	     (dolist (k keys match)
 	       (let* ((v (plist-get spec k))
-		      (choicev (plist-get choice k)))
+		      (choicev (if (plist-member choice k)
+				   (plist-get choice k) t)))
 		 (setq match
 		       (and match
 			    (or
--- a/lisp/help-mode.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/help-mode.el	Sat Jun 19 12:15:25 2010 +0000
@@ -272,6 +272,9 @@
 	  (with-current-buffer buffer
 	    (bury-buffer))))
 
+  (set (make-local-variable 'revert-buffer-function)
+       'help-mode-revert-buffer)
+
   (run-mode-hooks 'help-mode-hook))
 
 ;;;###autoload
@@ -783,6 +786,17 @@
 	      (fboundp sym) (facep sym))
       (help-do-xref pos #'help-xref-interned (list sym)))))
 
+(defun help-mode-revert-buffer (ignore-auto noconfirm)
+  (when (or noconfirm (yes-or-no-p "Revert help buffer? "))
+    (let ((pos (point))
+	  (item help-xref-stack-item)
+	  ;; Pretend there is no current item to add to the history.
+	  (help-xref-stack-item nil)
+	  ;; Use the current buffer.
+	  (help-xref-following t))
+      (apply (car item) (cdr item))
+      (goto-char pos))))
+
 (defun help-insert-string (string)
   "Insert STRING to the help buffer and install xref info for it.
 This function can be used to restore the old contents of the help buffer
--- a/lisp/info.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/info.el	Sat Jun 19 12:15:25 2010 +0000
@@ -238,7 +238,9 @@
 (defcustom Info-breadcrumbs-depth 4
   "Depth of breadcrumbs to display.
 0 means do not display breadcrumbs."
-  :type 'integer)
+  :version "23.1"
+  :type 'integer
+  :group 'info)
 
 (defcustom Info-search-whitespace-regexp "\\s-+"
   "If non-nil, regular expression to match a sequence of whitespace chars.
@@ -800,17 +802,22 @@
   "Go to an Info node FILENAME and NODENAME, re-reading disk contents.
 When *info* is already displaying FILENAME and NODENAME, the window position
 is preserved, if possible."
-  (pop-to-buffer "*info*")
+  (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
   (let ((old-filename Info-current-file)
 	(old-nodename Info-current-node)
+	(old-buffer-name (buffer-name))
 	(pcolumn      (current-column))
 	(pline        (count-lines (point-min) (line-beginning-position)))
 	(wline        (count-lines (point-min) (window-start)))
+	(old-history-forward Info-history-forward)
 	(old-history  Info-history)
 	(new-history  (and Info-current-file
 			   (list Info-current-file Info-current-node (point)))))
     (kill-buffer (current-buffer))
+    (pop-to-buffer (or old-buffer-name "*info*"))
+    (Info-mode)
     (Info-find-node filename nodename)
+    (setq Info-history-forward old-history-forward)
     (setq Info-history old-history)
     (if (and (equal old-filename Info-current-file)
 	     (equal old-nodename Info-current-node))
--- a/lisp/menu-bar.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/menu-bar.el	Sat Jun 19 12:15:25 2010 +0000
@@ -1055,7 +1055,7 @@
 (define-key menu-bar-options-menu [cua-emulation-mode]
   (menu-bar-make-mm-toggle cua-mode
 			   "Shift movement mark region (CUA)"
-			   "Use shifted movement keys to set and extend the region."
+			   "Use shifted movement keys to set and extend the region"
 			   (:visible (and (boundp 'cua-enable-cua-keys)
 					  (not cua-enable-cua-keys)))))
 
--- a/lisp/startup.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/startup.el	Sat Jun 19 12:15:25 2010 +0000
@@ -1166,6 +1166,9 @@
 		 (eq face-ignored-fonts old-face-ignored-fonts))
       (clear-face-cache)))
 
+  ;; Load ELPA packages.
+  (and user-init-file package-enable-at-startup (package-initialize))
+
   (setq after-init-time (current-time))
   (run-hooks 'after-init-hook)
 
--- a/lisp/textmodes/ispell.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/textmodes/ispell.el	Sat Jun 19 12:15:25 2010 +0000
@@ -660,8 +660,8 @@
      "[^A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]"
      "[.]" nil nil nil iso-8859-2)
     ("portugues"                        ; Portuguese mode
-     "[a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]"
-     "[^a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]"
+     "[a-zA-Z\301\302\307\311\323\340\341\342\351\352\355\363\343\347\372]"
+     "[^a-zA-Z\301\302\307\311\323\340\341\342\351\352\355\363\343\347\372]"
      "[']" t ("-C") "~latin1" iso-8859-1)
     ("russian"				; Russian.aff (KOI8-R charset)
      "[\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]"
@@ -982,8 +982,8 @@
   ;; This returns nil if the data file does not exist.
   ;; Can someone please explain the return value format when the
   ;; file does exist -- rms?
-  (let* ((lang ;; Strip out region, variant, etc.
-	  (and (string-match "^[[:alpha:]]+" dict-name)
+  (let* ((lang ;; Strip out variant, etc.
+	  (and (string-match "^[[:alpha:]_]+" dict-name)
 	       (match-string 0 dict-name)))
 	 (data-file
 	  (concat (or ispell-aspell-data-dir
--- a/lisp/url/ChangeLog	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/url/ChangeLog	Sat Jun 19 12:15:25 2010 +0000
@@ -1,3 +1,7 @@
+2010-06-12  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
+
+	* url-vars.el (url-privacy-level): Fix doc typo.  (Bug#6406)
+
 2010-05-19  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* url-util.el (url-unhex-string): Don't accidentally decode as latin-1.
--- a/lisp/url/url-vars.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/url/url-vars.el	Sat Jun 19 12:15:25 2010 +0000
@@ -128,7 +128,7 @@
 os       -- the operating system info
 lastloc  -- the last location
 agent    -- do not send the User-Agent string
-cookie   -- never accept HTTP cookies
+cookies  -- never accept HTTP cookies
 
 Samples:
 
--- a/lisp/vc/vc-annotate.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/vc/vc-annotate.el	Sat Jun 19 12:15:25 2010 +0000
@@ -316,7 +316,7 @@
 
 ;;;###autoload
 (defun vc-annotate (file rev &optional display-mode buf move-point-to)
-  "Display the edit history of the current file using colors.
+  "Display the edit history of the current FILE using colors.
 
 This command creates a buffer that shows, for each line of the current
 file, when it was last edited and by whom.  Additionally, colors are
@@ -326,7 +326,7 @@
 everything that is older than that is shown in blue.
 
 With a prefix argument, this command asks two questions in the
-minibuffer.  First, you may enter a revision number; then the buffer
+minibuffer.  First, you may enter a revision number REV; then the buffer
 displays and annotates that revision instead of the working revision
 \(type RET in the minibuffer to leave that default unchanged).  Then,
 you are prompted for the time span in days which the color range
@@ -348,9 +348,9 @@
      (list buffer-file-name
 	   (let ((def (vc-working-revision buffer-file-name)))
 	     (if (null current-prefix-arg) def
-	       (read-string
+	       (vc-read-revision
 		(format "Annotate from revision (default %s): " def)
-		nil nil def)))
+		(list buffer-file-name) nil def)))
 	   (if (null current-prefix-arg)
 	       vc-annotate-display-mode
 	     (float (string-to-number
--- a/lisp/vc/vc-svn.el	Tue Jun 15 11:40:23 2010 +0000
+++ b/lisp/vc/vc-svn.el	Sat Jun 19 12:15:25 2010 +0000
@@ -170,7 +170,7 @@
                      (?? . unregistered)
                      ;; This is what vc-svn-parse-status does.
                      (?~ . edited)))
-	(re (if remote "^\\(.\\)...... \\([ *]\\) +\\(?:[-0-9]+\\)?   \\(.*\\)$"
+	(re (if remote "^\\(.\\)......? \\([ *]\\) +\\(?:[-0-9]+\\)?   \\(.*\\)$"
 	      ;; Subexp 2 is a dummy in this case, so the numbers match.
 	      "^\\(.\\)....\\(.\\) \\(.*\\)$"))
        result)
--- a/src/ChangeLog	Tue Jun 15 11:40:23 2010 +0000
+++ b/src/ChangeLog	Sat Jun 19 12:15:25 2010 +0000
@@ -1,3 +1,21 @@
+2010-06-19  Eli Zaretskii  <eliz@gnu.org>
+
+	* xdisp.c (try_scrolling): Compute the limit for searching point
+	in forward scroll from scroll_max, instead of an arbitrary limit
+	of 10 screen lines.  See
+	http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00766.html
+	and
+	http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00773.html
+	for details.
+
+2010-06-16  Glenn Morris  <rgm@gnu.org>
+
+	* editfns.c (Fbyte_to_string): Pacify compiler.
+
+2010-06-16  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* lread.c (read1): Phase out old-style backquotes a bit more.
+
 2010-06-12  Eli Zaretskii  <eliz@gnu.org>
 
 	* makefile.w32-in ($(BLD)/bidi.$(O)): Depend on biditype.h and
@@ -7,8 +25,7 @@
 
 	* bidi.c (bidi_initialize): Remove explicit initialization of
 	bidi_type_table; include biditype.h instead.  Don't support
-	entries whose second codepoint is zero.  Initialize
-	bidi_mirror_table.
+	entries whose second codepoint is zero.  Initialize bidi_mirror_table.
 	(bidi_mirror_char): Use bidi_mirror_table.
 
 	* biditype.h: New file.
--- a/src/lread.c	Tue Jun 15 11:40:23 2010 +0000
+++ b/src/lread.c	Sat Jun 19 12:15:25 2010 +0000
@@ -2683,7 +2683,17 @@
       }
 
     case '`':
-      if (first_in_list)
+      /* Transition from old-style to new-style:
+	 If we see "(`" it used to mean old-style, which usually works
+	 fine because ` should almost never appear in such a position
+	 for new-style.  But occasionally we need "(`" to mean new
+	 style, so we try to distinguish the two by the fact that we
+	 can either write "( `foo" or "(` foo", where the first
+	 intends to use new-style whereas the second intends to use
+	 old-style.  For Emacs-25, we should completely remove this
+	 first_in_list exception (old-style can still be obtained via
+	 "(\`" anyway).  */
+      if (first_in_list && (c = READCHAR, UNREAD (c), c == ' '))
 	{
 	  Vold_style_backquotes = Qt;
 	  goto default_label;
--- a/src/xdisp.c	Tue Jun 15 11:40:23 2010 +0000
+++ b/src/xdisp.c	Sat Jun 19 12:15:25 2010 +0000
@@ -13431,14 +13431,22 @@
       if (PT > CHARPOS (it.current.pos))
 	{
 	  int y0 = line_bottom_y (&it);
-
-	  /* Compute the distance from the scroll margin to PT
-	     (including the height of the cursor line).  Moving the
-	     iterator unconditionally to PT can be slow if PT is far
-	     away, so stop 10 lines past the window bottom (is there a
-	     way to do the right thing quickly?).  */
-	  move_it_to (&it, PT, -1,
-	  	      it.last_visible_y + 10 * FRAME_LINE_HEIGHT (f),
+	  /* Compute how many pixels below window bottom to stop searching
+	     for PT.  This avoids costly search for PT that is far away if
+	     the user limited scrolling by a small number of lines, but
+	     always finds PT if scroll_conservatively is set to a large
+	     number, such as most-positive-fixnum.  */
+	  int slack = max (scroll_max, 10 * FRAME_LINE_HEIGHT (f));
+	  int y_to_move =
+	    slack >= INT_MAX - it.last_visible_y
+	    ? INT_MAX
+	    : it.last_visible_y + slack;
+
+	  /* Compute the distance from the scroll margin to PT or to
+	     the scroll limit, whichever comes first.  This should
+	     include the height of the cursor line, to make that line
+	     fully visible.  */
+	  move_it_to (&it, PT, -1, y_to_move,
 	  	      -1, MOVE_TO_POS | MOVE_TO_Y);
 	  dy = line_bottom_y (&it) - y0;