changeset 111413:d53ee71e7e89

Unify mouse-highlight code for all GUI and TTY sessions. term.c: Remove static mouse_face_* variables. All users changed. (term_show_mouse_face, term_clear_mouse_face) (fast_find_position, term_mouse_highlight): Functions deleted. (tty_draw_row_with_mouse_face): New function. (term_mouse_movement): Call note_mouse_highlight instead of term_mouse_highlight. nsterm.m (ns_update_window_begin, ns_update_window_end) (ns_update_end, x_destroy_window, ns_frame_up_to_date) (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background) (ns_dumpglyphs_image, ns_dumpglyphs_stretch) (ns_initialize_display_info, keyDown, mouseMoved, mouseExited): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. xterm.c (x_update_window_begin, x_update_window_end) (x_update_end, XTframe_up_to_date, x_set_mouse_face_gc) (handle_one_xevent, x_free_frame_resources, x_term_init): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. w32term.c (x_update_window_begin, x_update_window_end) (x_update_end, w32_read_socket, x_free_frame_resources) (w32_initialize_display_info): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. xdisp.c (show_mouse_face, note_mode_line_or_margin_highlight) (note_mouse_highlight) [HAVE_WINDOW_SYSTEM]: Don't run GUI code unless the frame is on a window-system. (get_tool_bar_item, handle_tool_bar_click) (note_tool_bar_highlight, draw_glyphs, erase_phys_cursor) (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) (note_mode_line_or_margin_highlight, note_mouse_highlight) (x_clear_window_mouse_face, cancel_mouse_face, expose_frame): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. (coords_in_mouse_face_p): Move prototype out of the HAVE_WINDOW_SYSTEM conditional. (x_y_to_hpos_vpos, frame_to_window_pixel_xy): Move out of the HAVE_WINDOW_SYSTEM block. (try_window_id) [HAVE_GPM || MSDOS]: Call x_clear_window_mouse_face. (draw_row_with_mouse_face): Implementation for HAVE_WINDOW_SYSTEM systems. Call tty_draw_row_with_mouse_face for TTY systems. (show_mouse_face): Call draw_row_with_mouse_face, instead of calling draw_glyphs directly. (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) (cursor_in_mouse_face_p, rows_from_pos_range) (mouse_face_from_buffer_pos, mouse_face_from_string_pos) (note_mode_line_or_margin_highlight, note_mouse_highlight) (x_clear_window_mouse_face, cancel_mouse_face): Move out of the HAVE_WINDOW_SYSTEM block. Ifdef away window-system specific fragments. (note_mouse_highlight): Call popup_activated for MSDOS as well. Clear mouse highlight if pointer is over glyphs whose OBJECT is an integer. (mouse_face_from_buffer_pos): Add parentheses around && within ||. (x_consider_frame_title, tool_bar_lines_needed): Move prototypes to HAVE_WINDOW_SYSTEM-only part. (get_window_cursor_type): Move inside a HAVE_WINDOW_SYSTEM-only part. Remove "#ifdef HAVE_WINDOW_SYSTEM" from body of function. (null_glyph_slice): Move declaration into HAVE_WINDOW_SYSTEM-only part. dispnew.c (mirror_make_current): Set Y coordinate of the mode-line and header-line rows. (init_display): Setup initial frame's output_data for text terminal frames. xmenu.c (popup_activated): Don't define on MSDOS, which now has its own definition on msdos.c. msdos.c (show_mouse_face, clear_mouse_face) (fast_find_position, IT_note_mode_line_highlight) (IT_note_mouse_highlight): Functions deleted. (IT_frame_up_to_date, dos_rawgetc): Call note_mouse_highlight instead of IT_note_mouse_highlight. (draw_row_with_mouse_face, popup_activated): New functions. (dos_set_window_size, draw_row_with_mouse_face, IT_update_begin) (IT_update_end, IT_frame_up_to_date, internal_terminal_init) (dos_rawgetc): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. msdos.h (initialize_msdos_display): Add prototype. frame.h (MOUSE_HL_INFO): New macro. lisp.h (Mouse_HLInfo): New data type. xterm.h (struct x_display_info): w32term.h (struct w32_display_info): nsterm.h (struct ns_display_info): termchar.h (struct tty_display_info): Use it instead of mouse_face_* members. dispextern.h (show_mouse_face, clear_mouse_face): Update type of 1st argument. (frame_to_window_pixel_xy, note_mouse_highlight) (x_clear_window_mouse_face, cancel_mouse_face, clear_mouse_face) (show_mouse_face, cursor_in_mouse_face_p): Move prototypes out of HAVE_WINDOW_SYSTEM conditional. (draw_row_with_mouse_face): Declare prototype. (tty_draw_row_with_mouse_face): Declare prototype.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 06 Nov 2010 10:28:31 +0200
parents cc7702f421a0 (diff) 9a687477468c (current diff)
children d291fc8615a3
files src/ChangeLog src/dispextern.h src/nsterm.m src/term.c src/w32term.c src/xdisp.c src/xterm.c
diffstat 131 files changed, 5052 insertions(+), 3253 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Nov 05 23:47:58 2010 +0200
+++ b/ChangeLog	Sat Nov 06 10:28:31 2010 +0200
@@ -1,3 +1,8 @@
+2010-10-31  Ken Brown  <kbrown@cornell.edu>
+
+	* configure.in (checking whether localtime caches TZ): Use
+	unsetenv instead of modifying environment directly.
+
 2010-10-25  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* configure.in (checking for -znocombreloc): Use AC_LANG_PROGRAM
--- a/admin/notes/bugtracker	Fri Nov 05 23:47:58 2010 +0200
+++ b/admin/notes/bugtracker	Sat Nov 06 10:28:31 2010 +0200
@@ -384,6 +384,14 @@
 *** To remove a "fixed" mark:
 notfixed 123 23.0.60
 
+*** To make a bug as present in a particular version:
+found 123 23.2
+NB if there is no specified "fixed" version, or if there is one and it
+is earlier than the found version, this reopens a closed bug.
+
+The leading "23.1;" that M-x report-emacs-bug adds to bug subjects
+automatically sets a found version (if none is explicitly specified).
+
 *** To assign or reassign a bug to a package or list of packages:
 reassign 1234 emacs
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/admin/notes/elpa	Sat Nov 06 10:28:31 2010 +0200
@@ -0,0 +1,42 @@
+NOTES ON THE EMACS PACKAGE ARCHIVE
+
+Here are instructions on uploading files to the package archive at
+elpa.gnu.org, for Emacs maintainers.  (If you are not a maintainer,
+contact us if you want to submit a package.)
+
+1. You will need login access to elpa.gnu.org.  You will also need to
+   get the FSF sysadmins to allow ssh access through the FSF firewall
+   for your local machine.  Ensure that your uid, USER, is in the
+   `elpa' group on elpa.gnu.org; this gives you write access to the
+   bzr repository from which the packages are managed.
+
+2. Go to your bzr repository on your local machine.  Of, if you don't
+   have one (you should, if you're tracking Emacs bzr), make one:
+
+     cd $DEVHOME
+     bzr init-repo elpa/
+     cd elpa
+
+   Create a branch for elpa:
+
+     bzr branch bzr+ssh://USER@elpa.gnu.org/home/elpa/package-repo package-repo
+
+   Bind the branch:
+
+     cd package-repo/
+     echo "public_branch = bzr+ssh://USER@elpa.gnu.org/home/elpa/package-repo" >> .bzr/branch/branch.conf
+     bzr bind bzr+ssh://USER@elpa.gnu.org/home/elpa/package-repo
+
+   Now you should be able to do `bzr up' and `bzr commit'.
+
+3. Changes in bzr do not immediately propagate to the user-facing tree
+   (i.e., what users see when they do `M-x list-packages').  That tree
+   is created by a (daily) cron job that does "bzr export".  If for
+   some reason you need to refresh the user-facing tree immediately,
+   run /home/elpa/bin/package-update.sh as the "elpa" user.
+
+   The Org mode dailies are not part of the repository.  After the
+   package-update.sh script creates the user-facing tree, it copies
+   the daily tarfile hosted on orgmode.org directly into that tree.
+
+4. FIXME: How to actually upload a package file.
--- a/configure	Fri Nov 05 23:47:58 2010 +0200
+++ b/configure	Sat Nov 06 10:28:31 2010 +0200
@@ -13982,14 +13982,6 @@
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <time.h>
-extern char **environ;
-unset_TZ ()
-{
-  char **from, **to;
-  for (to = from = environ; (*to = *from); from++)
-    if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
-      to++;
-}
 char TZ_GMT0[] = "TZ=GMT0";
 char TZ_PST8[] = "TZ=PST8";
 main()
@@ -13999,13 +13991,13 @@
   if (putenv (TZ_GMT0) != 0)
     exit (1);
   hour_GMT0 = localtime (&now)->tm_hour;
-  unset_TZ ();
+  unsetenv("TZ");
   hour_unset = localtime (&now)->tm_hour;
   if (putenv (TZ_PST8) != 0)
     exit (1);
   if (localtime (&now)->tm_hour == hour_GMT0)
     exit (1);
-  unset_TZ ();
+  unsetenv("TZ");
   if (localtime (&now)->tm_hour != hour_unset)
     exit (1);
   exit (0);
--- a/configure.in	Fri Nov 05 23:47:58 2010 +0200
+++ b/configure.in	Sat Nov 06 10:28:31 2010 +0200
@@ -2952,14 +2952,6 @@
 AC_CACHE_VAL(emacs_cv_localtime_cache,
 [if test x$ac_cv_func_tzset = xyes; then
 AC_TRY_RUN([#include <time.h>
-extern char **environ;
-unset_TZ ()
-{
-  char **from, **to;
-  for (to = from = environ; (*to = *from); from++)
-    if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
-      to++;
-}
 char TZ_GMT0[] = "TZ=GMT0";
 char TZ_PST8[] = "TZ=PST8";
 main()
@@ -2969,13 +2961,13 @@
   if (putenv (TZ_GMT0) != 0)
     exit (1);
   hour_GMT0 = localtime (&now)->tm_hour;
-  unset_TZ ();
+  unsetenv("TZ");
   hour_unset = localtime (&now)->tm_hour;
   if (putenv (TZ_PST8) != 0)
     exit (1);
   if (localtime (&now)->tm_hour == hour_GMT0)
     exit (1);
-  unset_TZ ();
+  unsetenv("TZ");
   if (localtime (&now)->tm_hour != hour_unset)
     exit (1);
   exit (0);
--- a/doc/lispref/ChangeLog	Fri Nov 05 23:47:58 2010 +0200
+++ b/doc/lispref/ChangeLog	Sat Nov 06 10:28:31 2010 +0200
@@ -1,3 +1,7 @@
+2010-10-31  Glenn Morris  <rgm@gnu.org>
+
+	* maps.texi (Standard Keymaps): Update File menu description.
+
 2010-10-28  Glenn Morris  <rgm@gnu.org>
 
 	* Makefile.in (elisp.dvi, elisp.pdf): Also include $emacsdir.
--- a/doc/lispref/maps.texi	Fri Nov 05 23:47:58 2010 +0200
+++ b/doc/lispref/maps.texi	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,8 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990, 1991, 1992, 1993, 1999, 2001, 2002, 2003, 2004,
-@c   2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+@c   2005, 2006, 2007, 2008, 2009, 2010
+@c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../../info/maps
 @node Standard Keymaps, Standard Hooks, Standard Buffer-Local Variables, Top
@@ -183,9 +184,9 @@
 @vindex menu-bar-edit-menu
 The keymap which displays the Edit menu in the menu bar.
 
-@item menu-bar-files-menu
-@vindex menu-bar-files-menu
-The keymap which displays the Files menu in the menu bar.
+@item menu-bar-file-menu
+@vindex menu-bar-file-menu
+The keymap which displays the File menu in the menu bar.
 
 @item menu-bar-help-menu
 @vindex menu-bar-help-menu
@@ -239,6 +240,3 @@
 A full keymap used by View mode.
 @end table
 
-@ignore
-   arch-tag: b741253c-7e23-4a02-b3fa-cffd9e4d72b9
-@end ignore
--- a/doc/misc/ChangeLog	Fri Nov 05 23:47:58 2010 +0200
+++ b/doc/misc/ChangeLog	Sat Nov 06 10:28:31 2010 +0200
@@ -1,3 +1,47 @@
+2010-11-04  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus.texi (Customizing the IMAP Connection): Remove nnir mention,
+	since that works by default.
+
+2010-11-03  Kan-Ru Chen  <kanru@kanru.info>  (tiny change)
+
+	* gnus.texi (Customizing the IMAP Connection): Document
+	`nnimap-expunge' and remove `nnimap-expunge-inbox' from example.
+
+2010-11-04  Michael Albinus  <michael.albinus@gmx.de>
+
+	* tramp.texi (Remote shell setup): New item "Interactive shell
+	prompt".  Reported by Christian Millour <cm@abtela.com>.
+	(Remote shell setup, Remote processes): Use @code{} for
+	environment variables.
+
+2010-11-03  Glenn Morris  <rgm@gnu.org>
+
+	* ediff.texi (Quick Help Commands, Miscellaneous):
+	* gnus.texi (Agent Variables, Configuring nnmairix): Spelling fix.
+
+2010-10-31  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus.texi (Paging the Article): Document C-u g/C-u C-u g.
+
+2010-10-31  Glenn Morris  <rgm@gnu.org>
+
+	* mh-e.texi (Preface, From Bill Wohler): Change 23 to past tense.
+
+2010-10-31  Glenn Morris  <rgm@gnu.org>
+
+	* cc-mode.texi: Remove reference to defunct viewcvs URL.
+
+2010-10-29  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus.texi (Client-Side IMAP Splitting): Mention
+	nnimap-unsplittable-articles.
+
+2010-10-29  Julien Danjou  <julien@danjou.info>
+
+	* gnus.texi (Finding the News): Remove references to obsoletes
+	variables `gnus-nntp-server' and `gnus-secondary-servers'.
+
 2010-10-29  Eli Zaretskii  <eliz@gnu.org>
 
 	* makefile.w32-in (MAKEINFO): Add -I$(emacsdir).
@@ -19,7 +63,7 @@
 
 2010-10-24  Jay Belanger  <jay.p.belanger@gmail.com>
 
-	* calc.texi:  Use emacsver.texi to determine Emacs version.
+	* calc.texi: Use emacsver.texi to determine Emacs version.
 
 2010-10-24  Juanma Barranquero  <lekktu@gmail.com>
 
--- a/doc/misc/cc-mode.texi	Fri Nov 05 23:47:58 2010 +0200
+++ b/doc/misc/cc-mode.texi	Sat Nov 06 10:28:31 2010 +0200
@@ -160,7 +160,8 @@
 This manual is for CC Mode in Emacs.
 
 Copyright @copyright{} 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -201,9 +202,8 @@
 @vskip 0pt plus 1filll
 @insertcopying
 
-This manual was generated from cc-mode.texi, which can be downloaded
-from
-@url{http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/doc/misc/cc-mode.texi}.
+This manual was generated from cc-mode.texi, which is distributed with Emacs,
+or can be downloaded from @url{http://savannah.gnu.org/projects/emacs/}.
 @end titlepage
 
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -7015,6 +7015,3 @@
 
 @bye
 
-@ignore
-   arch-tag: c4cab162-5e57-4366-bdce-4a9db2fc97f0
-@end ignore
--- a/doc/misc/ediff.texi	Fri Nov 05 23:47:58 2010 +0200
+++ b/doc/misc/ediff.texi	Sat Nov 06 10:28:31 2010 +0200
@@ -759,7 +759,7 @@
 You can then restart any of these sessions by either clicking on a session
 record or by putting the cursor over it and then typing the return key.
 
-(Some poor souls leave so many active Ediff sessions around that they loose
+(Some poor souls leave so many active Ediff sessions around that they lose
 track of them completely...  The `R' command is designed to save these
 people from the recently discovered Ediff Proficiency Syndrome.)
 
@@ -2315,7 +2315,7 @@
 
 However, Ediff temporarily resets this variable to @code{t} if it is
 invoked via one of the "buffer" jobs, such as @code{ediff-buffers}.
-This is because it is all too easy to loose day's work otherwise.
+This is because it is all too easy to lose a day's work otherwise.
 Besides, in a "buffer" job, the variant buffers have already been loaded
 prior to starting Ediff, so Ediff just preserves status quo here.
 
@@ -2542,6 +2542,3 @@
 
 @bye
 
-@ignore
-   arch-tag: 165ecb88-d03c-44b1-a921-b93f50b05b46
-@end ignore
--- a/doc/misc/gnus.texi	Fri Nov 05 23:47:58 2010 +0200
+++ b/doc/misc/gnus.texi	Sat Nov 06 10:28:31 2010 +0200
@@ -1020,22 +1020,6 @@
 If that fails as well, Gnus will try to use the machine running Emacs
 as an @acronym{NNTP} server.  That's a long shot, though.
 
-@vindex gnus-nntp-server
-If @code{gnus-nntp-server} is set, this variable will override
-@code{gnus-select-method}.  You should therefore set
-@code{gnus-nntp-server} to @code{nil}, which is what it is by default.
-
-@vindex gnus-secondary-servers
-@vindex gnus-nntp-server
-You can also make Gnus prompt you interactively for the name of an
-@acronym{NNTP} server.  If you give a non-numerical prefix to @code{gnus}
-(i.e., @kbd{C-u M-x gnus}), Gnus will let you choose between the servers
-in the @code{gnus-secondary-servers} list (if any).  You can also just
-type in the name of any server you feel like visiting.  (Note that this
-will set @code{gnus-nntp-server}, which means that if you then @kbd{M-x
-gnus} later in the same Emacs session, Gnus will contact the same
-server.)
-
 @findex gnus-group-browse-foreign-server
 @kindex B (Group)
 However, if you use one @acronym{NNTP} server regularly and are just
@@ -4572,7 +4556,7 @@
 server exclusively for @code{nnmairix} in your secondary select methods
 (@pxref{Finding the News}).  If you use a secondary @code{nnml} server
 just for mairix, make sure that you explicitly set the server variable
-@code{nnml-get-new-mail} to @code{nil}, or you might loose mail
+@code{nnml-get-new-mail} to @code{nil}, or you might lose mail
 (@pxref{nnmairix caveats}).  If you want to use mairix remotely on an
 @acronym{IMAP} server, you have to choose the corresponding
 @code{nnimap} server here.
@@ -5204,24 +5188,6 @@
 If fetching from the first site is unsuccessful, Gnus will attempt to go
 through @code{gnus-group-faq-directory} and try to open them one by one.
 
-@item H C
-@kindex H C (Group)
-@findex gnus-group-fetch-control
-@vindex gnus-group-fetch-control-use-browse-url
-@cindex control message
-Fetch the control messages for the group from the archive at
-@code{ftp.isc.org} (@code{gnus-group-fetch-control}).  Query for a
-group if given a prefix argument.
-
-If @code{gnus-group-fetch-control-use-browse-url} is non-@code{nil},
-Gnus will open the control messages in a browser using
-@code{browse-url}.  Otherwise they are fetched using @code{ange-ftp}
-and displayed in an ephemeral group.
-
-Note that the control messages are compressed.  To use this command
-you need to turn on @code{auto-compression-mode} (@pxref{Compressed
-Files, ,Compressed Files, emacs, The Emacs Manual}).
-
 @item H d
 @itemx C-c C-d
 @c @icon{gnus-group-describe-group}
@@ -6187,8 +6153,9 @@
 @vindex gnus-summary-show-article-charset-alist
 (Re)fetch the current article (@code{gnus-summary-show-article}).  If
 given a prefix, fetch the current article, but don't run any of the
-article treatment functions.  This will give you a ``raw'' article, just
-the way it came from the server.
+article treatment functions.  If given a prefix twice (i.e., @kbd{C-u
+C-u g'}), show a completely ``raw'' article, just the way it came from
+the server.
 
 @cindex charset, view article with different charset
 If given a numerical prefix, you can do semi-manual charset stuff.
@@ -13462,14 +13429,20 @@
 name will be removed.  If the attribute name is @code{eval}, the form
 is evaluated, and the result is thrown away.
 
-The attribute value can be a string (used verbatim), a function with
-zero arguments (the return value will be used), a variable (its value
-will be used) or a list (it will be @code{eval}ed and the return value
-will be used).  The functions and sexps are called/@code{eval}ed in the
-message buffer that is being set up.  The headers of the current article
-are available through the @code{message-reply-headers} variable, which
-is a vector of the following headers: number subject from date id
-references chars lines xref extra.
+The attribute value can be a string, a function with zero arguments
+(the return value will be used), a variable (its value will be used)
+or a list (it will be @code{eval}ed and the return value will be
+used).  The functions and sexps are called/@code{eval}ed in the
+message buffer that is being set up.  The headers of the current
+article are available through the @code{message-reply-headers}
+variable, which is a vector of the following headers: number subject
+from date id references chars lines xref extra.
+
+In the case of a string value, if the @code{match} is a regular
+expression, a @samp{gnus-match-substitute-replacement} is proceed on
+the value to replace the positional parameters @samp{\@var{n}} by the
+corresponding parenthetical matches (see @xref{Replacing the Text that
+Matched, , Text Replacement, elisp, The Emacs Lisp Reference Manual}.)
 
 @vindex message-reply-headers
 
@@ -14872,9 +14845,7 @@
         (nnimap-inbox "INBOX")
         (nnimap-split-methods default)
         (nnimap-expunge t)
-        (nnimap-stream ssl)
-        (nnir-search-engine imap)
-        (nnimap-expunge-inbox t))
+        (nnimap-stream ssl))
 @end example
 
 @table @code
@@ -14910,6 +14881,11 @@
 Some @acronym{IMAP} servers allow anonymous logins.  In that case,
 this should be set to @code{anonymous}.
 
+@item nnimap-expunge
+If non-@code{nil}, expunge articles after deleting them.  This is always done
+if the server supports UID EXPUNGE, but it's not done by default on
+servers that doesn't support that command.
+
 @item nnimap-streaming
 Virtually all @code{IMAP} server support fast streaming of data.  If
 you have problems connecting to the server, try setting this to @code{nil}.
@@ -14945,6 +14921,11 @@
 @item nnimap-split-fancy
 Uses the same syntax as @code{nnmail-split-fancy}.
 
+@item nnimap-unsplittable-articles
+List of flag symbols to ignore when doing splitting.  That is,
+articles that have these flags won't be considered when splitting.
+The default is @samp{(%Deleted %Seen)}.
+
 @end table
 
 
@@ -19862,7 +19843,7 @@
 performance.  A small value minimizes the time lost should the
 connection be lost while fetching (You may need to run
 @code{gnus-agent-regenerate-group} to update the group's state.
-However, all articles parsed prior to loosing the connection will be
+However, all articles parsed prior to losing the connection will be
 available while unplugged).  The default is 10M so it is unusual to
 see any cycling.
 
@@ -30102,11 +30083,11 @@
 (setq gnus-read-active-file 'some)
 @end lisp
 
-On the other hand, if the manual says ``set @code{gnus-nntp-server} to
-@samp{nntp.ifi.uio.no}'', that means:
-
-@lisp
-(setq gnus-nntp-server "nntp.ifi.uio.no")
+On the other hand, if the manual says ``set @code{gnus-nntp-server-file} to
+@samp{/etc/nntpserver}'', that means:
+
+@lisp
+(setq gnus-nntp-server-file "/etc/nntpserver")
 @end lisp
 
 So be careful not to mix up strings (the latter) with symbols (the
--- a/doc/misc/mh-e.texi	Fri Nov 05 23:47:58 2010 +0200
+++ b/doc/misc/mh-e.texi	Sat Nov 06 10:28:31 2010 +0200
@@ -213,7 +213,7 @@
 them.
 
 The MH-E package is distributed with GNU Emacs@footnote{Version
-@value{VERSION} of MH-E will appear in GNU Emacs 23.1. It is supported
+@value{VERSION} of MH-E appeared in GNU Emacs 23.1. It is supported
 in GNU Emacs 21 and 22, as well as XEmacs 21 (except for versions
 21.5.9-21.5.16). It is compatible with MH versions 6.8.4 and higher,
 all versions of nmh, and GNU mailutils 1.0 and higher.}, so you
@@ -8951,8 +8951,8 @@
 reorganized to push back two decades of entropy. Version 8 appeared in
 Emacs 22.1 in 2006.
 
-Development was then quiet for a couple of years. Emacs 23.1, which is
-due out in 2009, will contain version 8.1. This version includes a few
+Development was then quiet for a couple of years. Emacs 23.1, released
+in June 2009, contains version 8.2.  This version includes a few
 new features and several bug fixes.
 
 Bill Wohler, August 2008
@@ -9061,6 +9061,4 @@
 @c sentence-end-double-space: nil
 @c End:
 
-@ignore
-   arch-tag: b778477d-1a10-4a99-84de-f877a2ea6bef
-@end ignore
+
Binary file doc/misc/tramp.texi has changed
--- a/etc/MH-E-NEWS	Fri Nov 05 23:47:58 2010 +0200
+++ b/etc/MH-E-NEWS	Sat Nov 06 10:28:31 2010 +0200
@@ -1,13 +1,13 @@
 * COPYRIGHT
 
-Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-  Free Software Foundation, Inc.
+Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+  2010  Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
 * Changes in MH-E 8.2
 
-Version 8.2 of MH-E will appear in GNU Emacs 23.1. This is a small
+Version 8.2 of MH-E appeared in GNU Emacs 23.1.  This is a small
 release that includes internal changes from the Emacs team. A new
 hook, `mh-pack-folder-hook', has been added.
 
@@ -231,7 +231,7 @@
 If you want to see the release notes for the alpha and beta releases
 leading up this release, please see:
 
-  http://cvs.savannah.gnu.org/viewcvs/emacs/etc/MH-E-NEWS?rev=1.25&root=emacs&view=markup
+  http://cvs.savannah.gnu.org/viewvc/emacs/emacs/etc/MH-E-NEWS?revision=1.25&view=markup
 
 
 
--- a/etc/NEWS	Fri Nov 05 23:47:58 2010 +0200
+++ b/etc/NEWS	Sat Nov 06 10:28:31 2010 +0200
@@ -38,10 +38,6 @@
 lib-src/Makefile by hand in order to use the associated features.
 
 ---
-** There is a new configure option --with-crt-dir.
-This is only useful if your crt*.o files are in a non-standard location.
-
----
 ** Emacs can be compiled against Gtk+ 3.0 if you pass --with-x-toolkit=gtk3
 to configure.  Note that other libraries used by Emacs, RSVG and GConf,
 also depend on Gtk+.  You can disable them with --without-rsvg and
@@ -187,7 +183,7 @@
 
 ** An Emacs Lisp package manager is now included.
 This is a convenient way to download and install additional packages,
-from elpa.gnu.org.
+from a package repository at elpa.gnu.org.
 
 *** `M-x list-packages' shows a list of packages, which can be
 selected for installation.
@@ -227,8 +223,8 @@
 kill instead.
 
 *** New command `delete-forward-char', bound to C-d and [delete].
-This is meant for interactive use, and obeys `delete-active-region';
-delete-char, meant for Lisp, does not obey `delete-active-region'.
+This is meant for interactive use, and obeys `delete-active-region'.
+The command `delete-char' does not obey `delete-active-region'.
 
 *** `delete-backward-char' is now a Lisp function.
 Apart from obeying `delete-active-region', its behavior is unchanged.
@@ -240,65 +236,53 @@
 ** Selection changes.
 
 The default handling of clipboard and primary selections has been
-changed to conform with other X applications.
+changed to conform with other X applications.  The exact changes are
+described below; in short, mouse commands to select and paste text now
+use the primary selection, while all other commands for killing and
+yanking text now use the clipboard.
 
-The new behavior is that by default Emacs does not put selected text
-into the clipboard, and does not add it to kill-ring, merely because
-the text was selected.  Only commands that kill text or copy it to the
-kill-ring (C-w, M-w, C-k, etc.) put the killed text into the
-clipboard.  Selected text is put into the primary selection (on
-systems, such as X, that support the primary selection separately from
-the clipboard).
-
-Similarly, Emacs by default does not retrieve text from the clipboard
-when the mouse (e.g., mouse-2) is used for pasting text selected in
-another application.  Mouse commands that paste text retrieve text
-from the primary selection, on systems that support it separately from
-the clipboard.  Text from the clipboard is retrieved only by C-y, M-y
-and other commands that yank text from the kill-ring.
+*** Merely selecting text (e.g. with drag-mouse-1) does not add it to
+the kill-ring.  On systems with a primary selection separate from the
+clipboard (such as X), the selected text is put in the primary
+selection.
 
-In other words, the default behavior is that mouse gestures that
-select and paste text work with the primary selection (on X), while
-keyboard commands that kill/copy and paste text work with the
-clipboard.
-
-This change also means that the "Copy", "Cut", and "Paste" items of
-the menu-bar "Edit" menu are now exactly equivalent to, respectively
-M-w, C-w, and C-y.
+*** mouse-2 is now bound to `mouse-yank-primary', which pastes from
+the primary selection regardless of the contents of the kill-ring.
 
-To get back the previous behavior, whereby mouse gestures set the
-clipboard and retrieve text from there, customize the variables
-`mouse-drag-copy-region' and (on X only) `x-select-enable-primary' to
-non-nil values.  If you don't want Emacs to put the text into the
-clipboard, only to the primary selection, additionally customize
-`x-select-enable-clipboard' to nil.
+*** Commands that kill text or copy it to the kill-ring (M-w, C-w,
+C-k, etc.) also put the killed text into the clipboard.  This change
+also means that the "Copy", "Cut", and "Paste" items in the "Edit"
+menu are now exactly equivalent to, respectively M-w, C-w, and C-y.
 
-These changes in the default behavior are reflected in the default
-values of several variables:
+*** Yank commands, such as C-y and M-y, retrieve text from the
+clipboard if it is available.
 
-*** `select-active-regions' now defaults to t, so active regions set
-the primary selection.  It was nil in previous versions.
+*** The above changes are reflected in the following new defaults:
 
+**** `select-active-regions' now defaults to t.
 It also accepts a new value, `only', which means to only set the
 primary selection for temporarily active regions (usually made by
 mouse-dragging or shift-selection).
 
-*** `mouse-2' is now bound to `mouse-yank-primary'.
+**** `mouse-2' is now bound to `mouse-yank-primary'.
 Previously, it was bound to `mouse-yank-at-click' (which is now
 unbound by default).
 
-*** `x-select-enable-clipboard' now defaults to t on all platforms.
-Thus, killing and yanking now use the clipboard (in addition to the
-kill ring).  Note that this variable was already non-nil by default on
-MS-Windows, which does not support the primary selection between
-applications.
+**** `x-select-enable-clipboard' now defaults to t on all platforms.
+Note that this variable was already non-nil by default on MS-Windows,
+which does not support the primary selection between applications.
 
-*** `x-select-enable-primary' now defaults to nil.
+**** `x-select-enable-primary' now defaults to nil.
 This variable exists only on X; its default value was t in previous
 versions.
 
-*** `mouse-drag-copy-region' now defaults to nil.
-Its previous default value was t.
+**** `mouse-drag-copy-region' now defaults to nil.
+
+*** To return to the previous behavior, where mouse commands use the
+clipboard, change `mouse-drag-copy-region' and (on X only)
+`x-select-enable-primary' to t.  If you don't want Emacs to put the
+text into the clipboard, only to the primary selection, additionally
+set `x-select-enable-clipboard' to nil.
 
 *** Support for X cut buffers has been removed.
 
@@ -319,6 +303,11 @@
 seconds.  The default value, 'ident, means to autojoin immediately
 after connecting.
 
+*** New variable `erc-coding-system-precedence': If we use `undecided'
+as the server coding system, this variable will then be consulted.
+The default is to decode strings that can be decoded as utf-8 as
+utf-8, and do the normal `undecided' decoding for the rest.
+
 ** In ido-mode, C-v is no longer bound to ido-toggle-vc.
 The reason is that this interferes with cua-mode.
 
@@ -350,7 +339,7 @@
 
 *** Customize buffers now contain a search field.
 The search is performed using `customize-apropos'.
-To turn off the search field, set custom-search-field to nil .
+To turn off the search field, set custom-search-field to nil.
 
 *** Custom options now start out hidden if at their default values.
 Use the arrow to the left of the option name to toggle visibility.
@@ -365,41 +354,6 @@
 *** dired-jump and dired-jump-other-window called with a prefix argument
 read a file name from the minibuffer instead of using buffer-file-name.
 
-** VC and related modes
-
-*** New VC commands: vc-log-incoming, vc-log-outgoing, vc-find-conflicted-file.
-
-**** vc-log-incoming for Git runs "git fetch" so that the necessary
-data is available locally.
-
-**** vc-log-incoming and vc-log-outgoing for Git require version 1.7 (or newer).
-
-*** New key bindings: C-x v I and C-x v O bound to vc-log-incoming and
-vc-log-outgoing, respectively.
-
-*** The 'g' key in VC diff, log, log-incoming and log-outgoing buffers
-reruns the corresponding VC command to compute an up to date version
-of the buffer.
-
-*** vc-dir for Bzr supports viewing shelve contents and shelving snapshots.
-
-*** Special markup can be added to log-edit buffers.
-The log-edit buffers are expected to have a format similar to email messages
-with headers of the form:
-  Author: <author of this change>
-  Summary: <one line summary of this change>
-  Fixes: <reference to the bug fixed by this change>
-Some backends handle some of those headers specially, but any unknown header
-is just left as is in the message, so it is not lost.
-
-**** vc-git handles Author: and Date:
-**** vc-hg handles  Author: and Date:
-**** vc-bzr handles Author:, Date: and Fixes:
-**** vc-mtn handles Author: and Date:
-
-*** Pressing g in a *vc-diff* buffer reruns vc-diff, so it will
-produce an up to date diff.
-
 ** Directory local variables can apply to file-less buffers.
 For example, adding "(diff-mode . ((mode . whitespace)))" to your
 .dir-locals.el file, will turn on `whitespace-mode' for *vc-diff* buffers.
@@ -587,6 +541,8 @@
 
 * Incompatible Lisp Changes in Emacs 24.1
 
+** Remove obsolete name `e' (use `float-e' instead).
+
 ** 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.
@@ -630,6 +586,8 @@
 ** The following files, obsolete since at least Emacs 21.1, have been removed:
 sc.el, x-menu.el, rnews.el, rnewspost.el
 
+** FIXME finder-inf.el changes.
+
 
 * Lisp changes in Emacs 24.1
 
--- a/etc/schema/schemas.xml	Fri Nov 05 23:47:58 2010 +0200
+++ b/etc/schema/schemas.xml	Sat Nov 06 10:28:31 2010 +0200
@@ -22,7 +22,7 @@
   <uri pattern="*.html" typeId="XHTML"/>
   <uri pattern="*.rng" typeId="RELAX NG"/>
   <uri pattern="*.rdf" typeId="RDF"/>
-  
+
   <namespace ns="http://www.w3.org/1999/XSL/Transform" typeId="XSLT"/>
   <namespace ns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" typeId="RDF"/>
   <namespace ns="http://www.w3.org/1999/xhtml" typeId="XHTML"/>
@@ -39,10 +39,14 @@
 
   <documentElement prefix="" localName="article" typeId="DocBook"/>
   <documentElement prefix="" localName="book" typeId="DocBook"/>
+  <documentElement prefix="" localName="chapter" typeId="DocBook"/>
+  <documentElement prefix="" localName="part" typeId="DocBook"/>
+  <documentElement prefix="" localName="refentry" typeId="DocBook"/>
+  <documentElement prefix="" localName="section" typeId="DocBook"/>
 
   <documentElement localName="RDF" typeId="RDF"/>
   <documentElement prefix="rdf" typeId="RDF"/>
-  
+
   <documentElement localName="locatingRules" uri="locate.rnc"/>
 
   <typeId id="XSLT" uri="xslt.rnc"/>
--- a/lisp/ChangeLog	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/ChangeLog	Sat Nov 06 10:28:31 2010 +0200
@@ -1,3 +1,286 @@
+2010-11-05  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* mouse.el (mouse-yank-primary): Update comment (Bug#6802).
+
+2010-11-05  Glenn Morris  <rgm@gnu.org>
+
+	* woman.el (woman0-roff-buffer, woman1-roff-buffer)
+	(woman2-roff-buffer): Give local variable `request' a prefix.
+	(woman0-macro): Rename argument `request' in the same way.
+	(woman-request): New name for `request' dynamic variable.
+	(woman-unquote, woman-forward-arg): Update for above name change.
+	(woman1-roff-buffer): Give local variable `unquote' a prefix.
+	(woman1-unquote): New name for `unquote' dynamic variable.
+	(woman1-B-or-I, woman1-alt-fonts): Update for above name change.
+	(woman-translations): Rename from `translations'.  No longer global.
+	(woman2-tr, woman-translate): Update for above name change.
+	(woman-translate): Check for bound variable.
+	(woman2-roff-buffer): Give local variable `translations' a prefix.
+
+	* play/doctor.el: Give all local variables a prefix.  Update callers.
+	(doc$, doctor-put-meaning): Use backquote.
+
+	* emacs-lisp/cl-macs.el (loop): Give local variable args a prefix.
+	(cl-parse-loop-clause, cl-loop-handle-accum): Update for above change.
+
+	* emacs-lisp/byte-opt.el (byte-decompile-bytecode-1): Give local
+	variables bytes, ptr, op a prefix.
+	(disassemble-offset): Update for above change.
+
+2010-11-03  Chong Yidong  <cyd@stupidchicken.com>
+
+	* emacs-lisp/package.el (package-unpack): Remove no-op.
+	(package--builtins, package--dir): Doc fix.
+	(package-activate-1, package-activate, package-install)
+	(package-compute-transaction): Fix error message.
+	(package-delete): Use delete-directory.  Omit system packages.
+	(package-initialize): Set package-alist to nil first.
+	(package-menu-mark-delete, package-menu-mark-install): Don't add
+	symbols that are inconsistent with the package state.
+	(package-menu-execute): Perform deletions and installations as
+	single batch operations.
+
+2010-11-03  Glenn Morris  <rgm@gnu.org>
+
+	* progmodes/idlwave.el (idlwave-pset): Only used on XEmacs.
+	(props): Remove unnecessary declaration.
+
+	* textmodes/ispell.el (ispell-init-process): On Emacs, always use
+	set-process-query-on-exit-flag.
+
+	* textmodes/reftex-toc.el (name1, dummy, dummy2): Remove unused decs.
+	(reftex-toc-do-promote): Remove unused local `mpos'.
+	(reftex-toc-restore-region): Make `mpos' local to this function.
+
+	* net/dbus.el (dbus-name-owner-changed-handler): Doc fix.
+
+	* play/landmark.el (lm-losing-threshold): Correct spelling.
+	(lm-human-plays): Use new name.
+
+	* play/gomoku.el (gomoku-loosing-threshold): Correct spelling.
+	(gomoku-human-plays): Use new name.
+
+	* play/gomoku.el (nil-score, Xscore, XXscore, XXXscore, XXXXscore)
+	(Oscore, OOscore, OOOscore, OOOOscore): Rename with gomoku- prefix.
+	(gomoku-score-trans-table, gomoku-winning-threshold)
+	(gomoku-loosing-threshold, gomoku-init-score-table): Use new names.
+
+2010-11-03  Chong Yidong  <cyd@stupidchicken.com>
+
+	* emacs-lisp/package.el: Don't put built-in packages in
+	package-alist, to avoid loading inefficiencies.
+	(package-built-in-p): Make VERSION optional, and treat it as a
+	minimum acceptable version.
+	(package-activate): Search separately for built-in packages.  Emit
+	a warning if a dependency fails.
+	(define-package): Handle most common case, where there is no
+	obsolete package, first.
+	(package-compute-transaction): Print required version in error.
+	(package--initialized): New variable.
+	(list-packages): Use it.
+	(package-initialize): Optional arg NO-ACTIVATE.  Don't put
+	built-in packages in packages-alist; keep it separate.  Set
+	package--initialized.
+	(describe-package): Avoid activating packages as a side-effect.
+	Search separately for built-in packages.
+	(describe-package-1): Handle the case where an elpa package is
+	simultaneously built-in and available/installed.
+	(package-installed-p, package--generate-package-list): Search
+	separately for built-in packages.
+	(package-load-descriptor): Doc fix.
+
+2010-11-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/perl-mode.el (perl-syntax-propertize-function):
+	Handle __DATA__ and __END__.
+
+2010-11-02  Noah Friedman  <friedman@splode.com>
+
+	* emacs-lisp/bytecomp.el (byte-recompile-file): If bytecomp-arg is
+	nil, do not ask to recompile files that are not already compiled,
+	and do not recompile them.
+
+2010-11-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* emacs-lisp/package.el (package-initialize): Ensure that
+	obsoleted built-in packages are not in package-activated-list
+	during activation.
+	(describe-package-1): Make the "installed" status override
+	"built-in".
+
+2010-11-01  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
+
+	* subr.el (version-separator, version-regexp-alist): Remove '*'
+	from docstring.
+	(version-list-<=, version<=, version=): Doc fix.
+
+2010-11-01  Kenichi Handa  <handa@m17n.org>
+
+	* faces.el (glyphless-char): Inherit underline for tty.
+
+2010-11-01  Kenichi Handa  <handa@m17n.org>
+
+	Implement various display methods for glyphless characters.
+
+	* international/characters.el (char-acronym-table): New variable.
+	(glyphless-char-control): New variable.
+	(update-glyphless-char-display): New funciton.
+
+	* faces.el (glyphless-char): New face.
+
+2010-11-01  Glenn Morris  <rgm@gnu.org>
+
+	* calendar/holidays.el (general-holidays, oriental-holidays)
+	(local-holidays, other-holidays, hebrew-holidays, christian-holidays)
+	(islamic-holidays, bahai-holidays, solar-holidays): Move aliases before
+	the definitions of their targets.
+
+	* emacs-lisp/smie.el (smie): New custom group.
+	(smie-blink-matching-inners, smie-indent-basic): Add :group.
+
+	* faces.el (xw-defined-colors, x-setup-function-keys):
+	* mouse-sel.el (x-select-text):
+	* term/w32console.el (x-setup-function-keys): Update declarations.
+
+	* progmodes/ruby-mode.el (ruby-syntax-propertize-heredoc): Declare.
+
+	* textmodes/ispell.el (comment-add): Declare.
+
+	* net/gnutls.el (gnutls-boot, gnutls-errorp, gnutls-error-string):
+	Declare.
+
+	* info.el (finder-keywords-hash, package-alist): Declare.
+
+2010-11-01  Chong Yidong  <cyd@stupidchicken.com>
+
+	* finder.el (finder-compile-keywords): Don't use intern-soft,
+	since package names may not yet exist in the obarray.
+
+2010-11-01  Chong Yidong  <cyd@stupidchicken.com>
+
+	* vc/vc-arch.el (vc-arch-checkin):
+	* vc/vc-cvs.el (vc-cvs-checkin):
+	* vc/vc-mtn.el (vc-mtn-checkin):
+	* vc/vc-rcs.el (vc-rcs-checkin):
+	* vc/vc-sccs.el (vc-sccs-checkin):
+	* vc/vc-svn.el (vc-svn-checkin): Remove optional extra arg, unused
+	since 2010-04-21 commit by Stefan Monnier.
+
+2010-11-01  Glenn Morris  <rgm@gnu.org>
+
+	* emacs-lisp/bytecomp.el (byte-recompile-file): Fix previous change.
+
+	* startup.el (package-enable-at-startup, package-initialize):
+	Silence compiler.
+
+	* progmodes/ada-mode.el (ada-font-lock-syntactic-keywords):
+	Silence compiler.
+
+2010-10-31  Julien Danjou  <julien@danjou.info>
+
+	* emacs-lisp/bytecomp.el (byte-recompile-file): New fun (bug#7297).
+	(byte-recompile-directory):
+	* emacs-lisp/lisp-mode.el (emacs-lisp-byte-compile-and-load):
+	Use `byte-recompile-file'.
+
+2010-10-31  Glenn Morris  <rgm@gnu.org>
+
+	* cus-start.el: Handle standard values via a keyword.
+	Only set version property if specified.
+	(cursor-in-non-selected-windows, menu-bar-mode)
+	(tool-bar-mode, show-trailing-whitespace):
+	Do not specify standard values.
+	(transient-mark-mode, temporary-file-directory): Use :standard.
+
+2010-10-31  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* term/x-win.el (x-get-selection-value): New function that gets
+	PRIMARY with type as specified in x-select-request-type. (Bug#6802).
+
+2010-10-31  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-handle-insert-file-contents): For root,
+	preserve owner and group when editing files.  (Bug#7289)
+
+2010-10-31  Glenn Morris  <rgm@gnu.org>
+
+	* speedbar.el (speedbar-mode):
+	* play/fortune.el (fortune-in-buffer, fortune):
+	* play/gomoku.el (gomoku-mode):
+	* play/landmark.el (lm-mode):
+	* textmodes/bibtex.el (bibtex-validate, bibtex-validate-globally):
+	Replace inappropriate uses of toggle-read-only.  (Bug#7292)
+
+	* select.el (x-selection): Mark it as an obsolete alias.
+
+2010-10-31  Aaron S. Hawley  <aaron.s.hawley@gmail.com>
+
+	* vc/add-log.el (find-change-log): Use derived-mode-p rather than
+	major-mode (bug#7284).
+
+2010-10-31  Glenn Morris  <rgm@gnu.org>
+
+	* menu-bar.el (menu-bar-files-menu): Make it into an actual alias,
+	rather than just an unused variable that inherits from the real one.
+
+2010-10-31  Alan Mackenzie  <acm@muc.de>
+
+	* progmodes/cc-cmds.el (c-mask-paragraph): Fix an off-by-1 error.
+	This fixes bug #7185.
+
+2010-10-30  Chong Yidong  <cyd@stupidchicken.com>
+
+	* startup.el (command-line): Search for package directories, and
+	don't load package.el if none are found.
+
+	* emacs-lisp/package.el (describe-package, list-packages): Call
+	package-initialize if it has not been called yet.
+
+2010-10-30  Alan Mackenzie  <acm@muc.de>
+
+	* progmodes/cc-fonts.el (c-font-lock-enum-tail): New function
+	which fontifies the tail of an enum.
+	(c-basic-matchers-after): Insert a call to the above new function.
+	This fixes bug #7264.
+
+2010-10-30  Glenn Morris  <rgm@gnu.org>
+
+	* cus-start.el: Add :set properties for minor modes menu-bar-mode,
+	tool-bar-mode, transient-mark-mode.  (Bug#7306)
+	Include the :set property in the dumped Emacs.
+
+2010-10-29  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	SMIE: change indent rules format, improve smie-setup.
+	* emacs-lisp/smie.el (smie-precs-precedence-table)
+	(smie-merge-prec2s, smie-bnf-precedence-table, smie-prec2-levels):
+	Mark them pure so the tables gets built at compile time.
+	(smie-bnf-precedence-table): Store the closer-alist in the table.
+	(smie-prec2-levels): Preserve the closer-alist.
+	(smie-blink-matching-open): Be more forgiving in case of indentation.
+	(smie-hanging-p): Rename from smie-indent--hanging-p.
+	(smie-bolp): Rename from smie-indent--bolp.
+	(smie--parent, smie--after): New dynamic vars.
+	(smie-parent-p, smie-next-p, smie-prev-p): New funs.
+	(smie-indent-rules): Remove.
+	(smie-indent--offset-rule): Remove fun.
+	(smie-rules-function): New var.
+	(smie-indent--rule): New fun.
+	(smie-indent--offset, smie-indent-keyword, smie-indent-after-keyword)
+	(smie-indent-exps): Use it.
+	(smie-setup): Setup paren blinking; add keyword args for token
+	functions; extract closer-alist from op-levels.
+	(smie-indent-debug-log): Remove var.
+	(smie-indent-debug): Remove fun.
+	* progmodes/prolog.el (prolog-smie-indent-rules): Remove.
+	(prolog-smie-rules): New fun to replace it.
+	(prolog-mode-variables): Simplify.
+	* progmodes/octave-mod.el (octave-smie-closer-alist): Remove, now that
+	it's setup automatically.
+	(octave-smie-indent-rules): Remove.
+	(octave-smie-rules): New fun to replace it.
+	(octave-mode): Simplify.
+
 2010-10-29  Glenn Morris  <rgm@gnu.org>
 
 	* files.el (temporary-file-directory): Remove (already defined in C).
@@ -188,13 +471,13 @@
 	auto-built for efficiency of execution and updating.
 	(verilog-extended-complete-re): Support 'pure' fucntion & task
 	declarations (these have no bodies).
-	(verilog-beg-of-statement): general cleanup to enable support of
-	'pure' fucntion & task declarations (these have no bodies).  These
-	efforts together fix Verilog bug210 from veripool; which was also
+	(verilog-beg-of-statement): General cleanup to enable support of
+	'pure' fucntion & task declarations (these have no bodies).
+	These efforts together fix Verilog bug210 from veripool; which was also
 	noticed by Steve Pearlmutter.
 	(verilog-directive-re, verilog-directive-begin, verilog-indent-re)
-	(verilog-directive-nest-re, verilog-set-auto-endcomments): Support
-	`elsif.  Reported by Shankar Giri.
+	(verilog-directive-nest-re, verilog-set-auto-endcomments):
+	Support `elsif.  Reported by Shankar Giri.
 	(verilog-forward-ws&directives, verilog-in-attribute-p): Fixes for
 	attribute handling for lining up declarations and assignments.
 	(verilog-beg-of-statement-1): Fix issue where continued declaration
@@ -202,8 +485,7 @@
 	(verilog-in-attribute-p, verilog-skip-backward-comments)
 	(verilog-skip-forward-comment-p): Support proper treatment of
 	attributes by indent code. Reported by Jeff Steele.
-	(verilog-in-directive-p): Fix comment to correctly describe
-	function.
+	(verilog-in-directive-p): Fix comment to correctly describe function.
 	(verilog-backward-up-list, verilog-in-struct-region-p)
 	(verilog-backward-token, verilog-in-struct-p)
 	(verilog-in-coverage-p, verilog-do-indent)
@@ -230,7 +512,7 @@
 	parameter in AUTOINSTPARAM.
 	(verilog-read-always-signals-recurse, verilog-read-decls): Fix not
 	treating `elsif similar to `endif inside AUTOSENSE.
-        (verilog-do-indent): Implement correct automatic or static task or
+	(verilog-do-indent): Implement correct automatic or static task or
 	function end comment highlight. Reported by Steve Pearlmutter.
 	(verilog-font-lock-keywords-2): Fix highlighting of single
 	character pins, bug264.  Reported by Michael Laajanen.
@@ -238,15 +520,15 @@
 	(verilog-read-sub-decls-in-interfaced, verilog-read-sub-decls-sig)
 	(verilog-subdecls-get-interfaced, verilog-subdecls-new): Support
 	interfaces with AUTOINST, bug270.  Reported by Luis Gutierrez.
-	(verilog-pretty-expr): Fix interactive arguments, bug272. Reported
-	by Mark Johnson.
-	(verilog-auto-tieoff, verilog-auto-tieoff-ignore-regexp): Add
-	'verilog-auto-tieoff-ignore-regexp' for AUTOTIEOFF,
+	(verilog-pretty-expr): Fix interactive arguments, bug272.
+	Reported by Mark Johnson.
+	(verilog-auto-tieoff, verilog-auto-tieoff-ignore-regexp):
+	Add 'verilog-auto-tieoff-ignore-regexp' for AUTOTIEOFF,
 	bug269. Suggested by Gary Delp.
 	(verilog-mode-map, verilog-preprocess, verilog-preprocess-history)
-	(verilog-preprocessor, verilog-set-compile-command): Create
-	verilog-preprocess and verilog-preprocessor to show preprocessed
-	output.
+	(verilog-preprocessor, verilog-set-compile-command):
+	Create verilog-preprocess and verilog-preprocessor to show
+	preprocessed output.
 	(verilog-get-beg-of-line, verilog-get-end-of-line)
 	(verilog-modi-file-or-buffer, verilog-modi-name)
 	(verilog-modi-point, verilog-within-string): Move defmacro's
@@ -294,8 +576,8 @@
 	(verilog-modi-lookup-last-current, verilog-modi-lookup-last-mod)
 	(verilog-modi-lookup-last-modi, verilog-modi-lookup-last-tick):
 	Fix slow verilog-auto expansion on very large files.
-	(verilog-read-sub-decls-expr, verilog-read-sub-decls-line): Fix
-	AUTOOUTPUT treating "1*2" as a signal name in submodule connection
+	(verilog-read-sub-decls-expr, verilog-read-sub-decls-line):
+	Fix AUTOOUTPUT treating "1*2" as a signal name in submodule connection
 	"{1*2{...".  Broke in last revision.
 	(verilog-read-sub-decls-expr): Fix AUTOOUTPUT not detecting
 	submodule connections with replications "{#{a},#{b}}".
--- a/lisp/calendar/holidays.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/calendar/holidays.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,8 @@
 ;;; holidays.el --- holiday functions for the calendar package
 
 ;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1997, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
@@ -43,6 +44,9 @@
 ;; explicitly load this file.
 
 ;;;###autoload
+(define-obsolete-variable-alias 'general-holidays
+  'holiday-general-holidays "23.1")
+;;;###autoload
 (defcustom holiday-general-holidays
   (mapcar 'purecopy
   '((holiday-fixed 1 1 "New Year's Day")
@@ -68,10 +72,10 @@
   :group 'holidays)
 ;;;###autoload
 (put 'holiday-general-holidays 'risky-local-variable t)
+
 ;;;###autoload
-(define-obsolete-variable-alias 'general-holidays
-  'holiday-general-holidays "23.1")
-
+(define-obsolete-variable-alias 'oriental-holidays
+  'holiday-oriental-holidays "23.1")
 ;;;###autoload
 (defcustom holiday-oriental-holidays
   (mapcar 'purecopy
@@ -93,10 +97,9 @@
   :group 'holidays)
 ;;;###autoload
 (put 'holiday-oriental-holidays 'risky-local-variable t)
+
 ;;;###autoload
-(define-obsolete-variable-alias 'oriental-holidays
-  'holiday-oriental-holidays "23.1")
-
+(define-obsolete-variable-alias 'local-holidays 'holiday-local-holidays "23.1")
 ;;;###autoload
 (defcustom holiday-local-holidays nil
   "Local holidays.
@@ -105,9 +108,9 @@
   :group 'holidays)
 ;;;###autoload
 (put 'holiday-local-holidays 'risky-local-variable t)
+
 ;;;###autoload
-(define-obsolete-variable-alias 'local-holidays 'holiday-local-holidays "23.1")
-
+(define-obsolete-variable-alias 'other-holidays 'holiday-other-holidays "23.1")
 ;;;###autoload
 (defcustom holiday-other-holidays nil
   "User defined holidays.
@@ -116,8 +119,6 @@
   :group 'holidays)
 ;;;###autoload
 (put 'holiday-other-holidays 'risky-local-variable t)
-;;;###autoload
-(define-obsolete-variable-alias 'other-holidays 'holiday-other-holidays "23.1")
 
 ;;;###autoload
 (defvar hebrew-holidays-1
@@ -219,6 +220,9 @@
 (make-obsolete-variable 'hebrew-holidays-4 'hebrew-holidays "23.1")
 
 ;;;###autoload
+(define-obsolete-variable-alias 'hebrew-holidays
+  'holiday-hebrew-holidays "23.1")
+;;;###autoload
 (defcustom holiday-hebrew-holidays
   (mapcar 'purecopy
   '((holiday-hebrew-passover)
@@ -235,10 +239,10 @@
   :group 'holidays)
 ;;;###autoload
 (put 'holiday-hebrew-holidays 'risky-local-variable t)
+
 ;;;###autoload
-(define-obsolete-variable-alias 'hebrew-holidays
-  'holiday-hebrew-holidays "23.1")
-
+(define-obsolete-variable-alias 'christian-holidays
+  'holiday-christian-holidays "23.1")
 ;;;###autoload
 (defcustom holiday-christian-holidays
   (mapcar 'purecopy
@@ -257,10 +261,10 @@
   :group 'holidays)
 ;;;###autoload
 (put 'holiday-christian-holidays 'risky-local-variable t)
+
 ;;;###autoload
-(define-obsolete-variable-alias 'christian-holidays
-  'holiday-christian-holidays "23.1")
-
+(define-obsolete-variable-alias 'islamic-holidays
+  'holiday-islamic-holidays "23.1")
 ;;;###autoload
 (defcustom holiday-islamic-holidays
   (mapcar 'purecopy
@@ -281,10 +285,9 @@
   :group 'holidays)
 ;;;###autoload
 (put 'holiday-islamic-holidays 'risky-local-variable t)
+
 ;;;###autoload
-(define-obsolete-variable-alias 'islamic-holidays
-  'holiday-islamic-holidays "23.1")
-
+(define-obsolete-variable-alias 'bahai-holidays 'holiday-bahai-holidays "23.1")
 ;;;###autoload
 (defcustom holiday-bahai-holidays
   (mapcar 'purecopy
@@ -305,9 +308,9 @@
   :group 'holidays)
 ;;;###autoload
 (put 'holiday-bahai-holidays 'risky-local-variable t)
+
 ;;;###autoload
-(define-obsolete-variable-alias 'bahai-holidays 'holiday-bahai-holidays "23.1")
-
+(define-obsolete-variable-alias 'solar-holidays 'holiday-solar-holidays "23.1")
 ;;;###autoload
 (defcustom holiday-solar-holidays
   (mapcar 'purecopy
@@ -328,8 +331,6 @@
   :group 'holidays)
 ;;;###autoload
 (put 'holiday-solar-holidays 'risky-local-variable t)
-;;;###autoload
-(define-obsolete-variable-alias 'solar-holidays 'holiday-solar-holidays "23.1")
 
 ;; This one should not be autoloaded, else .emacs changes of
 ;; holiday-general-holidays etc have no effect.
@@ -919,5 +920,4 @@
 
 (provide 'holidays)
 
-;; arch-tag: 48eb3117-75a7-4dbe-8fd9-873c3cbb0d37
 ;;; holidays.el ends here
--- a/lisp/cedet/ChangeLog	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/cedet/ChangeLog	Sat Nov 06 10:28:31 2010 +0200
@@ -1,3 +1,31 @@
+2010-11-01  Glenn Morris  <rgm@gnu.org>
+
+	* semantic/bovine/c.el (semantic-analyze-split-name): Move before use.
+
+	* semantic/symref/cscope.el (ede-toplevel):
+	* semantic/symref.el (ede-toplevel):
+	* semantic/tag-file.el (ede-toplevel):
+	* ede.el (ede-toplevel): Fix declarations.
+
+2010-10-31  Glenn Morris  <rgm@gnu.org>
+
+	* ede/proj-elisp.el (project-compile-target): Fix previous change.
+	* semantic/ede-grammar.el (project-compile-target): Fix previous change.
+
+2010-10-31  Julien Danjou  <julien@danjou.info>
+
+	* ede/proj-elisp.el (project-compile-target):
+	* semantic/ede-grammar.el (project-compile-target):
+	Use `byte-recompile-file'.
+
+2010-10-31  Glenn Morris  <rgm@gnu.org>
+
+	* mode-local.el (mode-local-augment-function-help):
+	* semantic/analyze/debug.el (semantic-analyzer-debug-add-buttons):
+	* semantic/symref/list.el (semantic-symref-results-dump)
+	(semantic-symref-rb-toggle-expand-tag): Replace inappropriate uses
+	of toggle-read-only.
+
 2010-09-30  Chong Yidong  <cyd@stupidchicken.com>
 
 	* semantic/bovine/el.el:
--- a/lisp/cedet/ede.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/cedet/ede.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,7 @@
 ;;; ede.el --- Emacs Development Environment gloss
 
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-;;   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007,
+;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
@@ -56,7 +56,7 @@
 (declare-function ede-directory-project-p "ede/files")
 (declare-function ede-find-subproject-for-directory "ede/files")
 (declare-function ede-project-directory-remove-hash "ede/files")
-(declare-function ede-toplevel "ede/files")
+(declare-function ede-toplevel "ede/base")
 (declare-function ede-toplevel-project "ede/files")
 (declare-function ede-up-directory "ede/files")
 (declare-function semantic-lex-make-spp-table "semantic/lex-spp")
@@ -1278,5 +1278,4 @@
     (ede-speedbar-file-setup)
   (add-hook 'speedbar-load-hook 'ede-speedbar-file-setup))
 
-;; arch-tag: 0e1e0eba-484f-4119-abdb-30951f725705
 ;;; ede.el ends here
--- a/lisp/cedet/ede/proj-elisp.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/cedet/ede/proj-elisp.el	Sat Nov 06 10:28:31 2010 +0200
@@ -129,18 +129,13 @@
 	 (utd 0))
     (mapc (lambda (src)
 	    (let* ((fsrc (expand-file-name src dir))
-		   (elc (concat (file-name-sans-extension fsrc) ".elc"))
-		   )
-	      (if (or (not (file-exists-p elc))
-		      (file-newer-than-file-p fsrc elc))
-		  (progn
-		    (setq comp (1+ comp))
-		    (byte-compile-file fsrc))
+		   (elc (concat (file-name-sans-extension fsrc) ".elc")))
+	      (if (eq (byte-recompile-file fsrc nil 0) t)
+                  (setq comp (1+ comp))
 		(setq utd (1+ utd)))))
 	    (oref obj source))
     (message "All Emacs Lisp sources are up to date in %s" (object-name obj))
-    (cons comp utd)
-    ))
+    (cons comp utd)))
 
 (defmethod ede-update-version-in-source ((this ede-proj-target-elisp) version)
   "In a Lisp file, updated a version string for THIS to VERSION.
@@ -390,5 +385,4 @@
 
 (provide 'ede/proj-elisp)
 
-;; arch-tag: 3802c94b-d04d-4ecf-9bab-b29ed6e77588
 ;;; ede/proj-elisp.el ends here
--- a/lisp/cedet/mode-local.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/cedet/mode-local.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,6 +1,7 @@
 ;;; mode-local.el --- Support for mode local facilities
 ;;
-;; Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 ;;
 ;; Author: David Ponce <david@dponce.com>
 ;; Maintainer: David Ponce <david@dponce.com>
@@ -610,19 +611,16 @@
 SYMBOL is a function that can be overridden."
   (with-current-buffer "*Help*"
     (pop-to-buffer (current-buffer))
-    (unwind-protect
-	(progn
-	  (toggle-read-only -1)
-          (goto-char (point-min))
-          (unless (re-search-forward "^$" nil t)
-            (goto-char (point-max))
-            (beginning-of-line)
-            (forward-line -1))
-          (insert (overload-docstring-extension symbol) "\n")
-	  ;; NOTE TO SELF:
-	  ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE
-	  )
-      (toggle-read-only 1))))
+    (goto-char (point-min))
+    (unless (re-search-forward "^$" nil t)
+      (goto-char (point-max))
+      (beginning-of-line)
+      (forward-line -1))
+    (let ((inhibit-read-only t))
+      (insert (overload-docstring-extension symbol) "\n")
+      ;; NOTE TO SELF:
+      ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE
+      )))
 
 ;; Help for mode-local bindings.
 (defun mode-local-print-binding (symbol)
@@ -782,5 +780,4 @@
 
 (provide 'mode-local)
 
-;; arch-tag: 14b77823-f93c-4b3d-9116-495f69a6ec07
 ;;; mode-local.el ends here
--- a/lisp/cedet/semantic/analyze/debug.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/cedet/semantic/analyze/debug.el	Sat Nov 06 10:28:31 2010 +0200
@@ -586,34 +586,28 @@
     (set-marker orig-buffer (point) (current-buffer))
     ;; Get a buffer ready.
     (with-current-buffer "*Help*"
-      (toggle-read-only -1)
-      (goto-char (point-min))
-      (set (make-local-variable 'semantic-analyzer-debug-orig) orig-buffer)
-      ;; First, add do-in buttons to recommendations.
-      (while (re-search-forward "^\\s-*M-x \\(\\(\\w\\|\\s_\\)+\\) " nil t)
-	(let ((fcn (match-string 1)))
-	  (when (not (fboundp (intern-soft fcn)))
-	    (error "Help Err: Can't find %s" fcn))
-	  (end-of-line)
-	  (insert "   ")
-	  (insert-button "[ Do It ]"
-			 'mouse-face 'custom-button-pressed-face
-			 'do-fcn fcn
-			 'action `(lambda (arg)
-				    (let ((M semantic-analyzer-debug-orig))
-				      (set-buffer (marker-buffer M))
-				      (goto-char M))
-				    (call-interactively (quote ,(intern-soft fcn))))
-			 )
-	  ))
+      (let ((inhibit-read-only t))
+	(goto-char (point-min))
+	(set (make-local-variable 'semantic-analyzer-debug-orig) orig-buffer)
+	;; First, add do-in buttons to recommendations.
+	(while (re-search-forward "^\\s-*M-x \\(\\(\\w\\|\\s_\\)+\\) " nil t)
+	  (let ((fcn (match-string 1)))
+	    (when (not (fboundp (intern-soft fcn)))
+	      (error "Help Err: Can't find %s" fcn))
+	    (end-of-line)
+	    (insert "   ")
+	    (insert-button "[ Do It ]"
+			   'mouse-face 'custom-button-pressed-face
+			   'do-fcn fcn
+			   'action `(lambda (arg)
+				      (let ((M semantic-analyzer-debug-orig))
+					(set-buffer (marker-buffer M))
+					(goto-char M))
+				      (call-interactively (quote ,(intern-soft fcn))))))))
       ;; Do something else?
-
       ;; Clean up the mess
-      (toggle-read-only 1)
-      (set-buffer-modified-p nil)
-      )))
+      (set-buffer-modified-p nil))))
 
 (provide 'semantic/analyze/debug)
 
-;; arch-tag: 943db1e5-47e6-4bec-9989-78ebfadf0358
 ;;; semantic/analyze/debug.el ends here
--- a/lisp/cedet/semantic/bovine/c.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/cedet/semantic/bovine/c.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1002,6 +1002,13 @@
 where typename is the name of the type, and typeoftype is \"class\"
 or \"struct\".")
 
+(define-mode-local-override semantic-analyze-split-name c-mode (name)
+  "Split up tag names on colon (:) boundaries."
+  (let ((ans (split-string name ":")))
+    (if (= (length ans) 1)
+	name
+      (delete "" ans))))
+
 (defun semantic-c-reconstitute-token (tokenpart declmods typedecl)
   "Reconstitute a token TOKENPART with DECLMODS and TYPEDECL.
 This is so we don't have to match the same starting text several times.
@@ -1559,13 +1566,6 @@
 	   (string= (semantic-tag-type type) "enum"))
       (semantic-tag-type-members type)))
 
-(define-mode-local-override semantic-analyze-split-name c-mode (name)
-  "Split up tag names on colon (:) boundaries."
-  (let ((ans (split-string name ":")))
-    (if (= (length ans) 1)
-	name
-      (delete "" ans))))
-
 (define-mode-local-override semantic-analyze-unsplit-name c-mode (namelist)
   "Assemble the list of names NAMELIST into a namespace name."
   (mapconcat 'identity namelist "::"))
@@ -1871,5 +1871,4 @@
 ;; generated-autoload-load-name: "semantic/bovine/c"
 ;; End:
 
-;; arch-tag: 263951a8-0f18-445d-8e73-eb8f9ac8e2a3
 ;;; semantic/bovine/c.el ends here
--- a/lisp/cedet/semantic/ede-grammar.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/cedet/semantic/ede-grammar.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,6 +1,7 @@
 ;;; semantic/ede-grammar.el --- EDE support for Semantic Grammar Files
 
-;;;  Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
@@ -133,11 +134,8 @@
 	      (save-excursion
 		(semantic-grammar-create-package))
 	      (save-buffer)
-	      (let ((cf (concat (semantic-grammar-package) ".el")))
-		(if (or (not (file-exists-p cf))
-			(file-newer-than-file-p src cf))
-		    (byte-compile-file cf)))))
-	    (oref obj source)))
+              (byte-recompile-file (concat (semantic-grammar-package) ".el") nil 0)))
+	  (oref obj source)))
   (message "All Semantic Grammar sources are up to date in %s" (object-name obj)))
 
 ;;; Makefile generation functions
@@ -197,5 +195,4 @@
 
 (provide 'semantic/ede-grammar)
 
-;; arch-tag: 37a06a8d-957a-4fa2-a931-38482d28c24a
 ;;; semantic/ede-grammar.el ends here
--- a/lisp/cedet/semantic/symref.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/cedet/semantic/symref.el	Sat Nov 06 10:28:31 2010 +0200
@@ -69,7 +69,7 @@
 (defvar ede-minor-mode)
 (declare-function data-debug-new-buffer "data-debug")
 (declare-function data-debug-insert-object-slots "eieio-datadebug")
-(declare-function ede-toplevel "ede/files")
+(declare-function ede-toplevel "ede/base")
 (declare-function ede-project-root-directory "ede/files")
 (declare-function ede-up-directory "ede/files")
 
@@ -508,5 +508,4 @@
 ;; generated-autoload-load-name: "semantic/symref"
 ;; End:
 
-;; arch-tag: 928394b7-19ef-4f76-8cb3-37e9a9891984
 ;;; semantic/symref.el ends here
--- a/lisp/cedet/semantic/symref/cscope.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/cedet/semantic/symref/cscope.el	Sat Nov 06 10:28:31 2010 +0200
@@ -27,7 +27,7 @@
 (require 'semantic/symref)
 
 (defvar ede-minor-mode)
-(declare-function ede-toplevel "ede/files")
+(declare-function ede-toplevel "ede/base")
 (declare-function ede-project-root-directory "ede/files")
 
 ;;; Code:
@@ -91,5 +91,4 @@
 ;; generated-autoload-load-name: "semantic/symref/cscope"
 ;; End:
 
-;; arch-tag: 7c0a4e02-ade4-407a-9df7-4f948bd61a19
 ;;; semantic/symref/cscope.el ends here
--- a/lisp/cedet/semantic/symref/list.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/cedet/semantic/symref/list.el	Sat Nov 06 10:28:31 2010 +0200
@@ -221,49 +221,38 @@
 (defun semantic-symref-results-dump (results)
   "Dump the RESULTS into the current buffer."
   ;; Get ready for the insert.
-  (toggle-read-only -1)
-  (erase-buffer)
-
-  ;; Insert the contents.
-  (let ((lastfile nil)
-	)
-    (dolist (T (oref results :hit-tags))
-
-      (when (not (equal lastfile (semantic-tag-file-name T)))
-	(setq lastfile (semantic-tag-file-name T))
-	(insert-button lastfile
-		       'mouse-face 'custom-button-pressed-face
-		       'action 'semantic-symref-rb-goto-file
+  (let ((inhibit-read-only t))
+    (erase-buffer)
+    ;; Insert the contents.
+    (let ((lastfile nil))
+      (dolist (T (oref results :hit-tags))
+	(unless (equal lastfile (semantic-tag-file-name T))
+	  (setq lastfile (semantic-tag-file-name T))
+	  (insert-button lastfile
+			 'mouse-face 'custom-button-pressed-face
+			 'action 'semantic-symref-rb-goto-file
+			 'tag T)
+	  (insert "\n"))
+	(insert "  ")
+	(insert-button "[+]"
+		       'mouse-face 'highlight
+		       'face nil
+		       'action 'semantic-symref-rb-toggle-expand-tag
 		       'tag T
-		       )
-	(insert "\n"))
-
-      (insert "  ")
-      (insert-button "[+]"
-		     'mouse-face 'highlight
-		     'face nil
-		     'action 'semantic-symref-rb-toggle-expand-tag
-		     'tag T
-		     'state 'closed)
-      (insert " ")
-      (insert-button (funcall semantic-symref-results-summary-function
-			      T nil t)
-		     'mouse-face 'custom-button-pressed-face
-		     'face nil
-		     'action 'semantic-symref-rb-goto-tag
-		     'tag T)
-      (insert "\n")
-
-      ))
-
-  ;; Auto expand
-  (when semantic-symref-auto-expand-results
-    (semantic-symref-list-expand-all))
-
-  ;; Clean up the mess
-  (toggle-read-only 1)
-  (set-buffer-modified-p nil)
-  )
+		       'state 'closed)
+	(insert " ")
+	(insert-button (funcall semantic-symref-results-summary-function
+				T nil t)
+		       'mouse-face 'custom-button-pressed-face
+		       'face nil
+		       'action 'semantic-symref-rb-goto-tag
+		       'tag T)
+	(insert "\n")))
+    ;; Auto expand
+    (when semantic-symref-auto-expand-results
+      (semantic-symref-list-expand-all)))
+    ;; Clean up the mess
+  (set-buffer-modified-p nil))
 
 ;;; Commands for semantic-symref-results
 ;;
@@ -283,11 +272,9 @@
 	 (buff (semantic-tag-buffer tag))
 	 (hits (semantic--tag-get-property tag :hit))
 	 (state (button-get button 'state))
-	 (text nil)
-	 )
+	 (text nil))
     (cond
      ((eq state 'closed)
-      (toggle-read-only -1)
       (with-current-buffer buff
 	(dolist (H hits)
 	  (goto-char (point-min))
@@ -295,48 +282,42 @@
 	  (beginning-of-line)
 	  (back-to-indentation)
 	  (setq text (cons (buffer-substring (point) (point-at-eol)) text)))
-	(setq text (nreverse text))
-	)
+	(setq text (nreverse text)))
       (goto-char (button-start button))
       (forward-char 1)
-      (delete-char 1)
-      (insert "-")
-      (button-put button 'state 'open)
-      (save-excursion
-	(end-of-line)
-	(while text
-	(insert "\n")
-	  (insert "    ")
-	  (insert-button (car text)
-			 'mouse-face 'highlight
-			 'face nil
-			 'action 'semantic-symref-rb-goto-match
-			 'tag tag
-			 'line (car hits))
-	  (setq text (cdr text)
-		hits (cdr hits))))
-      (toggle-read-only 1)
-      )
+      (let ((inhibit-read-only t))
+	(delete-char 1)
+	(insert "-")
+	(button-put button 'state 'open)
+	(save-excursion
+	  (end-of-line)
+	  (while text
+	    (insert "\n")
+	    (insert "    ")
+	    (insert-button (car text)
+			   'mouse-face 'highlight
+			   'face nil
+			   'action 'semantic-symref-rb-goto-match
+			   'tag tag
+			   'line (car hits))
+	    (setq text (cdr text)
+		  hits (cdr hits))))))
      ((eq state 'open)
-      (toggle-read-only -1)
-      (button-put button 'state 'closed)
-      ;; Delete the various bits.
-      (goto-char (button-start button))
-      (forward-char 1)
-      (delete-char 1)
-      (insert "+")
-      (save-excursion
-	(end-of-line)
+      (let ((inhibit-read-only t))
+	(button-put button 'state 'closed)
+	;; Delete the various bits.
+	(goto-char (button-start button))
 	(forward-char 1)
-	(delete-region (point)
-		       (save-excursion
-			 (forward-char 1)
-			 (forward-line (length hits))
-			 (point))))
-      (toggle-read-only 1)
-      )
-     ))
-  )
+	(delete-char 1)
+	(insert "+")
+	(save-excursion
+	  (end-of-line)
+	  (forward-char 1)
+	  (delete-region (point)
+			 (save-excursion
+			   (forward-char 1)
+			   (forward-line (length hits))
+			   (point)))))))))
 
 (defun semantic-symref-rb-goto-file (&optional button)
   "Go to the file specified in the symref results buffer.
@@ -554,5 +535,4 @@
 ;; generated-autoload-load-name: "semantic/symref/list"
 ;; End:
 
-;; arch-tag: e355d9c6-26e0-42d1-9bf1-f4801a54fffa
 ;;; semantic/symref/list.el ends here
--- a/lisp/cedet/semantic/tag-file.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/cedet/semantic/tag-file.el	Sat Nov 06 10:28:31 2010 +0200
@@ -32,7 +32,7 @@
 (declare-function semanticdb-table-child-p "semantic/db" t t)
 (declare-function semanticdb-get-buffer "semantic/db")
 (declare-function semantic-dependency-find-file-on-path "semantic/dep")
-(declare-function ede-toplevel "ede/files")
+(declare-function ede-toplevel "ede/base")
 
 ;;; Code:
 
@@ -214,5 +214,4 @@
 ;; generated-autoload-load-name: "semantic/tag-file"
 ;; End:
 
-;; arch-tag: 71d4cf18-c1ec-414c-bb0a-c2ed914c1361
 ;;; semantic/tag-file.el ends here
--- a/lisp/cus-start.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/cus-start.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,7 @@
 ;;; cus-start.el --- define customization properties of builtins
 ;;
-;; Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+;;   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: internal
@@ -34,6 +34,19 @@
 
 ;;; Code:
 
+;; Elements of this list have the form:
+;; SYMBOL GROUP TYPE VERSION REST...
+;; SYMBOL is the name of the variable.
+;; GROUP is the custom group to which it belongs (may also be a list
+;; of groups)
+;; TYPE is the defcustom :type.
+;; VERSION is the defcustom :version (or nil).
+;; REST is a set of :KEYWORD VALUE pairs.  Accepted :KEYWORDs are:
+;; :standard - standard value for SYMBOL (else use current value)
+;; :set - custom-set property
+;; :risky - risky-local-variable property
+;; :safe - safe-local-variable property
+;; :tag - custom-tag property
 (let ((all '(;; alloc.c
 	     (gc-cons-threshold alloc integer)
 	     (garbage-collection-messages alloc boolean)
@@ -97,13 +110,15 @@
 	     (line-spacing display (choice (const :tag "none" nil) integer)
 			   "22.1")
 	     (cursor-in-non-selected-windows
-	      cursor boolean nil t :tag "Cursor In Non-selected Windows"
+	      cursor boolean nil
+	      :tag "Cursor In Non-selected Windows"
 	      :set #'(lambda (symbol value)
 		       (set-default symbol value)
 		       (force-mode-line-update t)))
 	     (transient-mark-mode editing-basics boolean nil
-				  (not noninteractive)
-				  :initialize custom-initialize-delay)
+				  :standard (not noninteractive)
+				  :initialize custom-initialize-delay
+				  :set custom-set-minor-mode)
 	     ;; callint.c
 	     (mark-even-if-inactive editing-basics boolean)
 	     ;; callproc.c
@@ -178,6 +193,7 @@
 	     (temporary-file-directory
 	      ;; Darwin section added 24.1, does not seem worth :version bump.
 	      files directory nil
+	      :standard
 	      (file-name-as-directory
 	       ;; FIXME ? Should there be Ftemporary_file_directory to do this
 	       ;; more robustly (cf set_local_socket in emacsclient.c).
@@ -217,8 +233,13 @@
 					    (other :tag "hidden by keypress" 1))
 			      "22.1")
 	     (make-pointer-invisible mouse boolean "23.2")
-	     (menu-bar-mode frames boolean)
-	     (tool-bar-mode (frames mouse) boolean)
+	     (menu-bar-mode frames boolean nil
+			    ;; FIXME?
+;			    :initialize custom-initialize-default
+			    :set custom-set-minor-mode)
+	     (tool-bar-mode (frames mouse) boolean nil
+;			    :initialize custom-initialize-default
+			    :set custom-set-minor-mode)
 	     ;; fringe.c
 	     (overflow-newline-into-fringe fringe boolean)
 	     ;; indent.c
@@ -366,7 +387,7 @@
 				  (other :tag "Always" t))
 				 "23.1")
 	     ;; xdisp.c
-	     (show-trailing-whitespace whitespace-faces boolean nil nil
+	     (show-trailing-whitespace whitespace-faces boolean nil
 				       :safe booleanp)
 	     (scroll-step windows integer)
 	     (scroll-conservatively windows integer)
@@ -442,13 +463,13 @@
 	  group (nth 1 this)
 	  type (nth 2 this)
 	  version (nth 3 this)
+	  rest (nthcdr 4 this)
 	  ;; If we did not specify any standard value expression above,
 	  ;; use the current value as the standard value.
-	  standard (if (nthcdr 4 this)
-		       (nth 4 this)
-		     (when (default-boundp symbol)
-		       (funcall quoter (default-value symbol))))
-	  rest (nthcdr 5 this)
+	  standard (if (setq prop (memq :standard rest))
+		       (cadr prop)
+		     (if (default-boundp symbol)
+			 (funcall quoter (default-value symbol))))
 	  ;; Don't complain about missing variables which are
 	  ;; irrelevant to this platform.
 	  native-p (save-match-data
@@ -486,11 +507,14 @@
 	  (put symbol 'safe-local-variable (cadr prop)))
       (if (setq prop (memq :risky rest))
 	  (put symbol 'risky-local-variable (cadr prop)))
+      (if (setq prop (memq :set rest))
+	  (put symbol 'custom-set (cadr prop)))
       ;; Note this is the _only_ initialize property we handle.
       (if (eq (cadr (memq :initialize rest)) 'custom-initialize-delay)
 	  (push symbol custom-delayed-init-variables))
-      ;; If this is NOT while dumping Emacs,
-      ;; set up the rest of the customization info.
+      ;; If this is NOT while dumping Emacs, set up the rest of the
+      ;; customization info.  This is the stuff that is not needed
+      ;; until someone does M-x customize etc.
       (unless purify-flag
 	;; Add it to the right group(s).
 	(if (listp group)
@@ -499,14 +523,12 @@
 	  (custom-add-to-group group symbol 'custom-variable))
 	;; Set the type.
 	(put symbol 'custom-type type)
-	(put symbol 'custom-version version)
+	(if version (put symbol 'custom-version version))
 	(while rest
 	  (setq prop (car rest)
 		propval (cadr rest)
 		rest (nthcdr 2 rest))
-	  (cond ((memq prop '(:risky :safe))) ; handled above
-		((eq prop :set)
-		 (put symbol 'custom-set propval))
+	  (cond ((memq prop '(:standard :risky :safe :set))) ; handled above
 		((eq prop :tag)
 		 (put symbol 'custom-tag propval))))))))
 
--- a/lisp/emacs-lisp/byte-opt.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/emacs-lisp/byte-opt.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1316,35 +1316,38 @@
   "Don't call this!"
   ;; fetch and return the offset for the current opcode.
   ;; return nil if this opcode has no offset
-  ;; OP, PTR and BYTES are used and set dynamically
-  (defvar op)
-  (defvar ptr)
-  (defvar bytes)
-  (cond ((< op byte-nth)
-	 (let ((tem (logand op 7)))
-	   (setq op (logand op 248))
+  ;; Used and set dynamically in byte-decompile-bytecode-1.
+  (defvar bytedecomp-op)
+  (defvar bytedecomp-ptr)
+  (defvar bytedecomp-bytes)
+  (cond ((< bytedecomp-op byte-nth)
+	 (let ((tem (logand bytedecomp-op 7)))
+	   (setq bytedecomp-op (logand bytedecomp-op 248))
 	   (cond ((eq tem 6)
-		  (setq ptr (1+ ptr))	;offset in next byte
-		  (aref bytes ptr))
+		  ;; Offset in next byte.
+		  (setq bytedecomp-ptr (1+ bytedecomp-ptr))
+		  (aref bytedecomp-bytes bytedecomp-ptr))
 		 ((eq tem 7)
-		  (setq ptr (1+ ptr))	;offset in next 2 bytes
-		  (+ (aref bytes ptr)
-		     (progn (setq ptr (1+ ptr))
-			    (lsh (aref bytes ptr) 8))))
+		  ;; Offset in next 2 bytes.
+		  (setq bytedecomp-ptr (1+ bytedecomp-ptr))
+		  (+ (aref bytedecomp-bytes bytedecomp-ptr)
+		     (progn (setq bytedecomp-ptr (1+ bytedecomp-ptr))
+			    (lsh (aref bytedecomp-bytes bytedecomp-ptr) 8))))
 		 (t tem))))		;offset was in opcode
-	((>= op byte-constant)
-	 (prog1 (- op byte-constant)	;offset in opcode
-	   (setq op byte-constant)))
-	((and (>= op byte-constant2)
-	      (<= op byte-goto-if-not-nil-else-pop))
-	 (setq ptr (1+ ptr))		;offset in next 2 bytes
-	 (+ (aref bytes ptr)
-	    (progn (setq ptr (1+ ptr))
-		   (lsh (aref bytes ptr) 8))))
-	((and (>= op byte-listN)
-	      (<= op byte-insertN))
-	 (setq ptr (1+ ptr))		;offset in next byte
-	 (aref bytes ptr))))
+	((>= bytedecomp-op byte-constant)
+	 (prog1 (- bytedecomp-op byte-constant)	;offset in opcode
+	   (setq bytedecomp-op byte-constant)))
+	((and (>= bytedecomp-op byte-constant2)
+	      (<= bytedecomp-op byte-goto-if-not-nil-else-pop))
+	 ;; Offset in next 2 bytes.
+	 (setq bytedecomp-ptr (1+ bytedecomp-ptr))
+	 (+ (aref bytedecomp-bytes bytedecomp-ptr)
+	    (progn (setq bytedecomp-ptr (1+ bytedecomp-ptr))
+		   (lsh (aref bytedecomp-bytes bytedecomp-ptr) 8))))
+	((and (>= bytedecomp-op byte-listN)
+	      (<= bytedecomp-op byte-insertN))
+	 (setq bytedecomp-ptr (1+ bytedecomp-ptr)) ;offset in next byte
+	 (aref bytedecomp-bytes bytedecomp-ptr))))
 
 
 ;; This de-compiler is used for inline expansion of compiled functions,
@@ -1367,19 +1370,20 @@
 ;; If MAKE-SPLICEABLE is nil, we are being called for the disassembler.
 ;; In that case, we put a pc value into the list
 ;; before each insn (or its label).
-(defun byte-decompile-bytecode-1 (bytes constvec &optional make-spliceable)
-  (let ((length (length bytes))
-	(ptr 0) optr tags op offset
+(defun byte-decompile-bytecode-1 (bytedecomp-bytes constvec
+						   &optional make-spliceable)
+  (let ((length (length bytedecomp-bytes))
+	(bytedecomp-ptr 0) optr tags bytedecomp-op offset
 	lap tmp
 	endtag)
-    (while (not (= ptr length))
+    (while (not (= bytedecomp-ptr length))
       (or make-spliceable
-	  (setq lap (cons ptr lap)))
-      (setq op (aref bytes ptr)
-	    optr ptr
+	  (setq lap (cons bytedecomp-ptr lap)))
+      (setq bytedecomp-op (aref bytedecomp-bytes bytedecomp-ptr)
+	    optr bytedecomp-ptr
 	    offset (disassemble-offset)) ; this does dynamic-scope magic
-      (setq op (aref byte-code-vector op))
-      (cond ((memq op byte-goto-ops)
+      (setq bytedecomp-op (aref byte-code-vector bytedecomp-op))
+      (cond ((memq bytedecomp-op byte-goto-ops)
 	     ;; it's a pc
 	     (setq offset
 		   (cdr (or (assq offset tags)
@@ -1387,27 +1391,28 @@
 				       (cons (cons offset
 						   (byte-compile-make-tag))
 					     tags)))))))
-	    ((cond ((eq op 'byte-constant2) (setq op 'byte-constant) t)
-		   ((memq op byte-constref-ops)))
+	    ((cond ((eq bytedecomp-op 'byte-constant2)
+		    (setq bytedecomp-op 'byte-constant) t)
+		   ((memq bytedecomp-op byte-constref-ops)))
 	     (setq tmp (if (>= offset (length constvec))
 			   (list 'out-of-range offset)
 			 (aref constvec offset))
-		   offset (if (eq op 'byte-constant)
+		   offset (if (eq bytedecomp-op 'byte-constant)
 			      (byte-compile-get-constant tmp)
 			    (or (assq tmp byte-compile-variables)
 				(car (setq byte-compile-variables
 					   (cons (list tmp)
 						 byte-compile-variables)))))))
 	    ((and make-spliceable
-		  (eq op 'byte-return))
-	     (if (= ptr (1- length))
-		 (setq op nil)
+		  (eq bytedecomp-op 'byte-return))
+	     (if (= bytedecomp-ptr (1- length))
+		 (setq bytedecomp-op nil)
 	       (setq offset (or endtag (setq endtag (byte-compile-make-tag)))
-		     op 'byte-goto))))
+		     bytedecomp-op 'byte-goto))))
       ;; lap = ( [ (pc . (op . arg)) ]* )
-      (setq lap (cons (cons optr (cons op (or offset 0)))
+      (setq lap (cons (cons optr (cons bytedecomp-op (or offset 0)))
 		      lap))
-      (setq ptr (1+ ptr)))
+      (setq bytedecomp-ptr (1+ bytedecomp-ptr)))
     ;; take off the dummy nil op that we replaced a trailing "return" with.
     (let ((rest lap))
       (while rest
@@ -2036,5 +2041,4 @@
 	       byte-optimize-lapcode))))
  nil)
 
-;; arch-tag: 0f14076b-737e-4bef-aae6-908826ec1ff1
 ;;; byte-opt.el ends here
--- a/lisp/emacs-lisp/bytecomp.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/emacs-lisp/bytecomp.el	Sat Nov 06 10:28:31 2010 +0200
@@ -37,6 +37,7 @@
 ;; ========================================================================
 ;; Entry points:
 ;;	byte-recompile-directory, byte-compile-file,
+;;      byte-recompile-file,
 ;;     batch-byte-compile, batch-byte-recompile-directory,
 ;;	byte-compile, compile-defun,
 ;;	display-call-tree
@@ -1551,23 +1552,10 @@
 			(not (auto-save-file-name-p bytecomp-source))
 			(not (string-equal dir-locals-file
 					   (file-name-nondirectory
-					    bytecomp-source)))
-			(setq bytecomp-dest
-                              (byte-compile-dest-file bytecomp-source))
-			(if (file-exists-p bytecomp-dest)
-			    ;; File was already compiled.
-			    (or bytecomp-force
-                                (file-newer-than-file-p bytecomp-source
-                                                        bytecomp-dest))
-			  ;; No compiled file exists yet.
-			  (and bytecomp-arg
-			       (or (eq 0 bytecomp-arg)
-				   (y-or-n-p (concat "Compile "
-                                                     bytecomp-source "? "))))))
-		   (progn (if (and noninteractive (not byte-compile-verbose))
-			      (message "Compiling %s..." bytecomp-source))
-			  (let ((bytecomp-res (byte-compile-file
-                                               bytecomp-source)))
+					    bytecomp-source))))
+		   (progn (let ((bytecomp-res (byte-recompile-file
+                                               bytecomp-source
+                                               bytecomp-force bytecomp-arg)))
 			    (cond ((eq bytecomp-res 'no-byte-compile)
 				   (setq skip-count (1+ skip-count)))
 				  ((eq bytecomp-res t)
@@ -1595,6 +1583,60 @@
 ;; Local Variables:\n;; no-byte-compile: t\n;; End: ")
 ;;;###autoload(put 'no-byte-compile 'safe-local-variable 'booleanp)
 
+(defun byte-recompile-file (bytecomp-filename &optional bytecomp-force bytecomp-arg load)
+  "Recompile BYTECOMP-FILENAME file if it needs recompilation.
+This happens when its `.elc' file is older than itself.
+
+If the `.elc' file exists and is up-to-date, normally this
+function *does not* compile BYTECOMP-FILENAME. However, if the
+prefix argument BYTECOMP-FORCE is set, that means do compile
+BYTECOMP-FILENAME even if the destination already exists and is
+up-to-date.
+
+If the `.elc' file does not exist, normally this function *does
+not* compile BYTECOMP-FILENAME. If BYTECOMP-ARG is 0, that means
+compile the file even if it has never been compiled before.
+A nonzero BYTECOMP-ARG means ask the user.
+
+If LOAD is set, `load' the file after compiling.
+
+The value returned is the value returned by `byte-compile-file',
+or 'no-byte-compile if the file did not need recompilation."
+  (interactive
+      (let ((bytecomp-file buffer-file-name)
+	 (bytecomp-file-name nil)
+	 (bytecomp-file-dir nil))
+     (and bytecomp-file
+	  (eq (cdr (assq 'major-mode (buffer-local-variables)))
+	      'emacs-lisp-mode)
+	  (setq bytecomp-file-name (file-name-nondirectory bytecomp-file)
+		bytecomp-file-dir (file-name-directory bytecomp-file)))
+     (list (read-file-name (if current-prefix-arg
+			       "Byte compile file: "
+			     "Byte recompile file: ")
+			   bytecomp-file-dir bytecomp-file-name nil)
+	   current-prefix-arg)))
+  (let ((bytecomp-dest
+         (byte-compile-dest-file bytecomp-filename))
+        ;; Expand now so we get the current buffer's defaults
+        (bytecomp-filename (expand-file-name bytecomp-filename)))
+    (if (if (file-exists-p bytecomp-dest)
+            ;; File was already compiled
+            ;; Compile if forced to, or filename newer
+            (or bytecomp-force
+                (file-newer-than-file-p bytecomp-filename
+                                         bytecomp-dest))
+          (and bytecomp-arg
+               (or (eq 0 bytecomp-arg)
+                   (y-or-n-p (concat "Compile "
+                                     bytecomp-filename "? ")))))
+        (progn
+          (if (and noninteractive (not byte-compile-verbose))
+              (message "Compiling %s..." bytecomp-filename))
+          (byte-compile-file bytecomp-filename load))
+      (when load (load bytecomp-filename))
+      'no-byte-compile)))
+
 ;;;###autoload
 (defun byte-compile-file (bytecomp-filename &optional load)
   "Compile a file of Lisp code named BYTECOMP-FILENAME into a file of byte code.
@@ -4308,5 +4350,4 @@
 
 (run-hooks 'bytecomp-load-hook)
 
-;; arch-tag: 9c97b0f0-8745-4571-bfc3-8dceb677292a
 ;;; bytecomp.el ends here
--- a/lisp/emacs-lisp/checkdoc.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/emacs-lisp/checkdoc.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1388,7 +1388,7 @@
 regexp short cuts work.  FP is the function defun information."
   (let ((case-fold-search nil)
 	;; Use a marker so if an early check modifies the text,
-	;; we won't accidentally loose our place.  This could cause
+	;; we won't accidentally lose our place.  This could cause
 	;; end-of doc string whitespace to also delete the " char.
 	(s (point))
 	(e (if (looking-at "\"")
@@ -2676,5 +2676,4 @@
 
 (provide 'checkdoc)
 
-;; arch-tag: c49a7ec8-3bb7-46f2-bfbc-d5f26e033b26
 ;;; checkdoc.el ends here
--- a/lisp/emacs-lisp/cl-macs.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/emacs-lisp/cl-macs.el	Sat Nov 06 10:28:31 2010 +0200
@@ -639,7 +639,7 @@
 
 ;;; The "loop" macro.
 
-(defvar args) (defvar loop-accum-var) (defvar loop-accum-vars)
+(defvar loop-args) (defvar loop-accum-var) (defvar loop-accum-vars)
 (defvar loop-bindings) (defvar loop-body) (defvar loop-destr-temps)
 (defvar loop-finally) (defvar loop-finish-flag) (defvar loop-first-flag)
 (defvar loop-initially) (defvar loop-map-form) (defvar loop-name)
@@ -647,7 +647,7 @@
 (defvar loop-result-var) (defvar loop-steps) (defvar loop-symbol-macs)
 
 ;;;###autoload
-(defmacro loop (&rest args)
+(defmacro loop (&rest loop-args)
   "The Common Lisp `loop' macro.
 Valid clauses are:
   for VAR from/upfrom/downfrom NUM to/upto/downto/above/below NUM by NUM,
@@ -662,8 +662,8 @@
   finally return EXPR, named NAME.
 
 \(fn CLAUSE...)"
-  (if (not (memq t (mapcar 'symbolp (delq nil (delq t (copy-list args))))))
-      (list 'block nil (list* 'while t args))
+  (if (not (memq t (mapcar 'symbolp (delq nil (delq t (copy-list loop-args))))))
+      (list 'block nil (list* 'while t loop-args))
     (let ((loop-name nil)	(loop-bindings nil)
 	  (loop-body nil)	(loop-steps nil)
 	  (loop-result nil)	(loop-result-explicit nil)
@@ -672,8 +672,8 @@
 	  (loop-initially nil)	(loop-finally nil)
 	  (loop-map-form nil)   (loop-first-flag nil)
 	  (loop-destr-temps nil) (loop-symbol-macs nil))
-      (setq args (append args '(cl-end-loop)))
-      (while (not (eq (car args) 'cl-end-loop)) (cl-parse-loop-clause))
+      (setq loop-args (append loop-args '(cl-end-loop)))
+      (while (not (eq (car loop-args) 'cl-end-loop)) (cl-parse-loop-clause))
       (if loop-finish-flag
 	  (push `((,loop-finish-flag t)) loop-bindings))
       (if loop-first-flag
@@ -713,34 +713,34 @@
 	    (setq body (list (list* 'symbol-macrolet loop-symbol-macs body))))
 	(list* 'block loop-name body)))))
 
-(defun cl-parse-loop-clause ()		; uses args, loop-*
-  (let ((word (pop args))
+(defun cl-parse-loop-clause ()		; uses loop-*
+  (let ((word (pop loop-args))
 	(hash-types '(hash-key hash-keys hash-value hash-values))
 	(key-types '(key-code key-codes key-seq key-seqs
 		     key-binding key-bindings)))
     (cond
 
-     ((null args)
+     ((null loop-args)
       (error "Malformed `loop' macro"))
 
      ((eq word 'named)
-      (setq loop-name (pop args)))
+      (setq loop-name (pop loop-args)))
 
      ((eq word 'initially)
-      (if (memq (car args) '(do doing)) (pop args))
-      (or (consp (car args)) (error "Syntax error on `initially' clause"))
-      (while (consp (car args))
-	(push (pop args) loop-initially)))
+      (if (memq (car loop-args) '(do doing)) (pop loop-args))
+      (or (consp (car loop-args)) (error "Syntax error on `initially' clause"))
+      (while (consp (car loop-args))
+	(push (pop loop-args) loop-initially)))
 
      ((eq word 'finally)
-      (if (eq (car args) 'return)
-	  (setq loop-result-explicit (or (cl-pop2 args) '(quote nil)))
-	(if (memq (car args) '(do doing)) (pop args))
-	(or (consp (car args)) (error "Syntax error on `finally' clause"))
-	(if (and (eq (caar args) 'return) (null loop-name))
-	    (setq loop-result-explicit (or (nth 1 (pop args)) '(quote nil)))
-	  (while (consp (car args))
-	    (push (pop args) loop-finally)))))
+      (if (eq (car loop-args) 'return)
+	  (setq loop-result-explicit (or (cl-pop2 loop-args) '(quote nil)))
+	(if (memq (car loop-args) '(do doing)) (pop loop-args))
+	(or (consp (car loop-args)) (error "Syntax error on `finally' clause"))
+	(if (and (eq (caar loop-args) 'return) (null loop-name))
+	    (setq loop-result-explicit (or (nth 1 (pop loop-args)) '(quote nil)))
+	  (while (consp (car loop-args))
+	    (push (pop loop-args) loop-finally)))))
 
      ((memq word '(for as))
       (let ((loop-for-bindings nil) (loop-for-sets nil) (loop-for-steps nil)
@@ -749,29 +749,29 @@
 	    ;; Use `gensym' rather than `make-symbol'.  It's important that
 	    ;; (not (eq (symbol-name var1) (symbol-name var2))) because
 	    ;; these vars get added to the cl-macro-environment.
-	    (let ((var (or (pop args) (gensym "--cl-var--"))))
-	      (setq word (pop args))
-	      (if (eq word 'being) (setq word (pop args)))
-	      (if (memq word '(the each)) (setq word (pop args)))
+	    (let ((var (or (pop loop-args) (gensym "--cl-var--"))))
+	      (setq word (pop loop-args))
+	      (if (eq word 'being) (setq word (pop loop-args)))
+	      (if (memq word '(the each)) (setq word (pop loop-args)))
 	      (if (memq word '(buffer buffers))
-		  (setq word 'in args (cons '(buffer-list) args)))
+		  (setq word 'in loop-args (cons '(buffer-list) loop-args)))
 	      (cond
 
 	       ((memq word '(from downfrom upfrom to downto upto
 			     above below by))
-		(push word args)
-		(if (memq (car args) '(downto above))
+		(push word loop-args)
+		(if (memq (car loop-args) '(downto above))
 		    (error "Must specify `from' value for downward loop"))
-		(let* ((down (or (eq (car args) 'downfrom)
-				 (memq (caddr args) '(downto above))))
-		       (excl (or (memq (car args) '(above below))
-				 (memq (caddr args) '(above below))))
-		       (start (and (memq (car args) '(from upfrom downfrom))
-				   (cl-pop2 args)))
-		       (end (and (memq (car args)
+		(let* ((down (or (eq (car loop-args) 'downfrom)
+				 (memq (caddr loop-args) '(downto above))))
+		       (excl (or (memq (car loop-args) '(above below))
+				 (memq (caddr loop-args) '(above below))))
+		       (start (and (memq (car loop-args) '(from upfrom downfrom))
+				   (cl-pop2 loop-args)))
+		       (end (and (memq (car loop-args)
 				       '(to upto downto above below))
-				 (cl-pop2 args)))
-		       (step (and (eq (car args) 'by) (cl-pop2 args)))
+				 (cl-pop2 loop-args)))
+		       (step (and (eq (car loop-args) 'by) (cl-pop2 loop-args)))
 		       (end-var (and (not (cl-const-expr-p end))
 				     (make-symbol "--cl-var--")))
 		       (step-var (and (not (cl-const-expr-p step))
@@ -794,7 +794,7 @@
 		(let* ((on (eq word 'on))
 		       (temp (if (and on (symbolp var))
 				 var (make-symbol "--cl-var--"))))
-		  (push (list temp (pop args)) loop-for-bindings)
+		  (push (list temp (pop loop-args)) loop-for-bindings)
 		  (push (list 'consp temp) loop-body)
 		  (if (eq word 'in-ref)
 		      (push (list var (list 'car temp)) loop-symbol-macs)
@@ -804,8 +804,8 @@
 			  (push (list var (if on temp (list 'car temp)))
 				loop-for-sets))))
 		  (push (list temp
-			      (if (eq (car args) 'by)
-				  (let ((step (cl-pop2 args)))
+			      (if (eq (car loop-args) 'by)
+				  (let ((step (cl-pop2 loop-args)))
 				    (if (and (memq (car-safe step)
 						   '(quote function
 							   function*))
@@ -816,10 +816,10 @@
 			loop-for-steps)))
 
 	       ((eq word '=)
-		(let* ((start (pop args))
-		       (then (if (eq (car args) 'then) (cl-pop2 args) start)))
+		(let* ((start (pop loop-args))
+		       (then (if (eq (car loop-args) 'then) (cl-pop2 loop-args) start)))
 		  (push (list var nil) loop-for-bindings)
-		  (if (or ands (eq (car args) 'and))
+		  (if (or ands (eq (car loop-args) 'and))
 		      (progn
 			(push `(,var
 				(if ,(or loop-first-flag
@@ -839,7 +839,7 @@
 	       ((memq word '(across across-ref))
 		(let ((temp-vec (make-symbol "--cl-vec--"))
 		      (temp-idx (make-symbol "--cl-idx--")))
-		  (push (list temp-vec (pop args)) loop-for-bindings)
+		  (push (list temp-vec (pop loop-args)) loop-for-bindings)
 		  (push (list temp-idx -1) loop-for-bindings)
 		  (push (list '< (list 'setq temp-idx (list '1+ temp-idx))
 			      (list 'length temp-vec)) loop-body)
@@ -851,15 +851,15 @@
 			  loop-for-sets))))
 
 	       ((memq word '(element elements))
-		(let ((ref (or (memq (car args) '(in-ref of-ref))
-			       (and (not (memq (car args) '(in of)))
+		(let ((ref (or (memq (car loop-args) '(in-ref of-ref))
+			       (and (not (memq (car loop-args) '(in of)))
 				    (error "Expected `of'"))))
-		      (seq (cl-pop2 args))
+		      (seq (cl-pop2 loop-args))
 		      (temp-seq (make-symbol "--cl-seq--"))
-		      (temp-idx (if (eq (car args) 'using)
-				    (if (and (= (length (cadr args)) 2)
-					     (eq (caadr args) 'index))
-					(cadr (cl-pop2 args))
+		      (temp-idx (if (eq (car loop-args) 'using)
+				    (if (and (= (length (cadr loop-args)) 2)
+					     (eq (caadr loop-args) 'index))
+					(cadr (cl-pop2 loop-args))
 				      (error "Bad `using' clause"))
 				  (make-symbol "--cl-idx--"))))
 		  (push (list temp-seq seq) loop-for-bindings)
@@ -885,13 +885,13 @@
 			loop-for-steps)))
 
 	       ((memq word hash-types)
-		(or (memq (car args) '(in of)) (error "Expected `of'"))
-		(let* ((table (cl-pop2 args))
-		       (other (if (eq (car args) 'using)
-				  (if (and (= (length (cadr args)) 2)
-					   (memq (caadr args) hash-types)
-					   (not (eq (caadr args) word)))
-				      (cadr (cl-pop2 args))
+		(or (memq (car loop-args) '(in of)) (error "Expected `of'"))
+		(let* ((table (cl-pop2 loop-args))
+		       (other (if (eq (car loop-args) 'using)
+				  (if (and (= (length (cadr loop-args)) 2)
+					   (memq (caadr loop-args) hash-types)
+					   (not (eq (caadr loop-args) word)))
+				      (cadr (cl-pop2 loop-args))
 				    (error "Bad `using' clause"))
 				(make-symbol "--cl-var--"))))
 		  (if (memq word '(hash-value hash-values))
@@ -901,16 +901,16 @@
 
 	       ((memq word '(symbol present-symbol external-symbol
 			     symbols present-symbols external-symbols))
-		(let ((ob (and (memq (car args) '(in of)) (cl-pop2 args))))
+		(let ((ob (and (memq (car loop-args) '(in of)) (cl-pop2 loop-args))))
 		  (setq loop-map-form
 			`(mapatoms (lambda (,var) . --cl-map) ,ob))))
 
 	       ((memq word '(overlay overlays extent extents))
 		(let ((buf nil) (from nil) (to nil))
-		  (while (memq (car args) '(in of from to))
-		    (cond ((eq (car args) 'from) (setq from (cl-pop2 args)))
-			  ((eq (car args) 'to) (setq to (cl-pop2 args)))
-			  (t (setq buf (cl-pop2 args)))))
+		  (while (memq (car loop-args) '(in of from to))
+		    (cond ((eq (car loop-args) 'from) (setq from (cl-pop2 loop-args)))
+			  ((eq (car loop-args) 'to) (setq to (cl-pop2 loop-args)))
+			  (t (setq buf (cl-pop2 loop-args)))))
 		  (setq loop-map-form
 			`(cl-map-extents
 			  (lambda (,var ,(make-symbol "--cl-var--"))
@@ -921,12 +921,12 @@
 		(let ((buf nil) (prop nil) (from nil) (to nil)
 		      (var1 (make-symbol "--cl-var1--"))
 		      (var2 (make-symbol "--cl-var2--")))
-		  (while (memq (car args) '(in of property from to))
-		    (cond ((eq (car args) 'from) (setq from (cl-pop2 args)))
-			  ((eq (car args) 'to) (setq to (cl-pop2 args)))
-			  ((eq (car args) 'property)
-			   (setq prop (cl-pop2 args)))
-			  (t (setq buf (cl-pop2 args)))))
+		  (while (memq (car loop-args) '(in of property from to))
+		    (cond ((eq (car loop-args) 'from) (setq from (cl-pop2 loop-args)))
+			  ((eq (car loop-args) 'to) (setq to (cl-pop2 loop-args)))
+			  ((eq (car loop-args) 'property)
+			   (setq prop (cl-pop2 loop-args)))
+			  (t (setq buf (cl-pop2 loop-args)))))
 		  (if (and (consp var) (symbolp (car var)) (symbolp (cdr var)))
 		      (setq var1 (car var) var2 (cdr var))
 		    (push (list var (list 'cons var1 var2)) loop-for-sets))
@@ -936,13 +936,13 @@
 			  ,buf ,prop ,from ,to))))
 
 	       ((memq word key-types)
-		(or (memq (car args) '(in of)) (error "Expected `of'"))
-		(let ((map (cl-pop2 args))
-		      (other (if (eq (car args) 'using)
-				 (if (and (= (length (cadr args)) 2)
-					  (memq (caadr args) key-types)
-					  (not (eq (caadr args) word)))
-				     (cadr (cl-pop2 args))
+		(or (memq (car loop-args) '(in of)) (error "Expected `of'"))
+		(let ((map (cl-pop2 loop-args))
+		      (other (if (eq (car loop-args) 'using)
+				 (if (and (= (length (cadr loop-args)) 2)
+					  (memq (caadr loop-args) key-types)
+					  (not (eq (caadr loop-args) word)))
+				     (cadr (cl-pop2 loop-args))
 				   (error "Bad `using' clause"))
 			       (make-symbol "--cl-var--"))))
 		  (if (memq word '(key-binding key-bindings))
@@ -964,7 +964,7 @@
 			loop-for-steps)))
 
 	       ((memq word '(window windows))
-		(let ((scr (and (memq (car args) '(in of)) (cl-pop2 args)))
+		(let ((scr (and (memq (car loop-args) '(in of)) (cl-pop2 loop-args)))
 		      (temp (make-symbol "--cl-var--")))
 		  (push (list var (if scr
 				      (list 'frame-selected-window scr)
@@ -982,9 +982,9 @@
 		  (if handler
 		      (funcall handler var)
 		    (error "Expected a `for' preposition, found %s" word)))))
-	      (eq (car args) 'and))
+	      (eq (car loop-args) 'and))
 	  (setq ands t)
-	  (pop args))
+	  (pop loop-args))
 	(if (and ands loop-for-bindings)
 	    (push (nreverse loop-for-bindings) loop-bindings)
 	  (setq loop-bindings (nconc (mapcar 'list loop-for-bindings)
@@ -1000,11 +1000,11 @@
 
      ((eq word 'repeat)
       (let ((temp (make-symbol "--cl-var--")))
-	(push (list (list temp (pop args))) loop-bindings)
+	(push (list (list temp (pop loop-args))) loop-bindings)
 	(push (list '>= (list 'setq temp (list '1- temp)) 0) loop-body)))
 
      ((memq word '(collect collecting))
-      (let ((what (pop args))
+      (let ((what (pop loop-args))
 	    (var (cl-loop-handle-accum nil 'nreverse)))
 	(if (eq var loop-accum-var)
 	    (push (list 'progn (list 'push what var) t) loop-body)
@@ -1013,7 +1013,7 @@
 		      t) loop-body))))
 
      ((memq word '(nconc nconcing append appending))
-      (let ((what (pop args))
+      (let ((what (pop loop-args))
 	    (var (cl-loop-handle-accum nil 'nreverse)))
 	(push (list 'progn
 		    (list 'setq var
@@ -1028,27 +1028,27 @@
 				  var what))) t) loop-body)))
 
      ((memq word '(concat concating))
-      (let ((what (pop args))
+      (let ((what (pop loop-args))
 	    (var (cl-loop-handle-accum "")))
 	(push (list 'progn (list 'callf 'concat var what) t) loop-body)))
 
      ((memq word '(vconcat vconcating))
-      (let ((what (pop args))
+      (let ((what (pop loop-args))
 	    (var (cl-loop-handle-accum [])))
 	(push (list 'progn (list 'callf 'vconcat var what) t) loop-body)))
 
      ((memq word '(sum summing))
-      (let ((what (pop args))
+      (let ((what (pop loop-args))
 	    (var (cl-loop-handle-accum 0)))
 	(push (list 'progn (list 'incf var what) t) loop-body)))
 
      ((memq word '(count counting))
-      (let ((what (pop args))
+      (let ((what (pop loop-args))
 	    (var (cl-loop-handle-accum 0)))
 	(push (list 'progn (list 'if what (list 'incf var)) t) loop-body)))
 
      ((memq word '(minimize minimizing maximize maximizing))
-      (let* ((what (pop args))
+      (let* ((what (pop loop-args))
 	     (temp (if (cl-simple-expr-p what) what (make-symbol "--cl-var--")))
 	     (var (cl-loop-handle-accum nil))
 	     (func (intern (substring (symbol-name word) 0 3)))
@@ -1059,27 +1059,27 @@
 
      ((eq word 'with)
       (let ((bindings nil))
-	(while (progn (push (list (pop args)
-				  (and (eq (car args) '=) (cl-pop2 args)))
+	(while (progn (push (list (pop loop-args)
+				  (and (eq (car loop-args) '=) (cl-pop2 loop-args)))
 			    bindings)
-		      (eq (car args) 'and))
-	  (pop args))
+		      (eq (car loop-args) 'and))
+	  (pop loop-args))
 	(push (nreverse bindings) loop-bindings)))
 
      ((eq word 'while)
-      (push (pop args) loop-body))
+      (push (pop loop-args) loop-body))
 
      ((eq word 'until)
-      (push (list 'not (pop args)) loop-body))
+      (push (list 'not (pop loop-args)) loop-body))
 
      ((eq word 'always)
       (or loop-finish-flag (setq loop-finish-flag (make-symbol "--cl-flag--")))
-      (push (list 'setq loop-finish-flag (pop args)) loop-body)
+      (push (list 'setq loop-finish-flag (pop loop-args)) loop-body)
       (setq loop-result t))
 
      ((eq word 'never)
       (or loop-finish-flag (setq loop-finish-flag (make-symbol "--cl-flag--")))
-      (push (list 'setq loop-finish-flag (list 'not (pop args)))
+      (push (list 'setq loop-finish-flag (list 'not (pop loop-args)))
 	    loop-body)
       (setq loop-result t))
 
@@ -1087,20 +1087,20 @@
       (or loop-finish-flag (setq loop-finish-flag (make-symbol "--cl-flag--")))
       (or loop-result-var (setq loop-result-var (make-symbol "--cl-var--")))
       (push (list 'setq loop-finish-flag
-		  (list 'not (list 'setq loop-result-var (pop args))))
+		  (list 'not (list 'setq loop-result-var (pop loop-args))))
 	    loop-body))
 
      ((memq word '(if when unless))
-      (let* ((cond (pop args))
+      (let* ((cond (pop loop-args))
 	     (then (let ((loop-body nil))
 		     (cl-parse-loop-clause)
 		     (cl-loop-build-ands (nreverse loop-body))))
 	     (else (let ((loop-body nil))
-		     (if (eq (car args) 'else)
-			 (progn (pop args) (cl-parse-loop-clause)))
+		     (if (eq (car loop-args) 'else)
+			 (progn (pop loop-args) (cl-parse-loop-clause)))
 		     (cl-loop-build-ands (nreverse loop-body))))
 	     (simple (and (eq (car then) t) (eq (car else) t))))
-	(if (eq (car args) 'end) (pop args))
+	(if (eq (car loop-args) 'end) (pop loop-args))
 	(if (eq word 'unless) (setq then (prog1 else (setq else then))))
 	(let ((form (cons (if simple (cons 'progn (nth 1 then)) (nth 2 then))
 			  (if simple (nth 1 else) (list (nth 2 else))))))
@@ -1114,22 +1114,22 @@
 
      ((memq word '(do doing))
       (let ((body nil))
-	(or (consp (car args)) (error "Syntax error on `do' clause"))
-	(while (consp (car args)) (push (pop args) body))
+	(or (consp (car loop-args)) (error "Syntax error on `do' clause"))
+	(while (consp (car loop-args)) (push (pop loop-args) body))
 	(push (cons 'progn (nreverse (cons t body))) loop-body)))
 
      ((eq word 'return)
       (or loop-finish-flag (setq loop-finish-flag (make-symbol "--cl-var--")))
       (or loop-result-var (setq loop-result-var (make-symbol "--cl-var--")))
-      (push (list 'setq loop-result-var (pop args)
+      (push (list 'setq loop-result-var (pop loop-args)
 		  loop-finish-flag nil) loop-body))
 
      (t
       (let ((handler (and (symbolp word) (get word 'cl-loop-handler))))
 	(or handler (error "Expected a loop keyword, found %s" word))
 	(funcall handler))))
-    (if (eq (car args) 'and)
-	(progn (pop args) (cl-parse-loop-clause)))))
+    (if (eq (car loop-args) 'and)
+	(progn (pop loop-args) (cl-parse-loop-clause)))))
 
 (defun cl-loop-let (specs body par)   ; uses loop-*
   (let ((p specs) (temps nil) (new nil))
@@ -1165,9 +1165,9 @@
       (list* (if par 'let 'let*)
 	     (nconc (nreverse temps) (nreverse new)) body))))
 
-(defun cl-loop-handle-accum (def &optional func)   ; uses args, loop-*
-  (if (eq (car args) 'into)
-      (let ((var (cl-pop2 args)))
+(defun cl-loop-handle-accum (def &optional func)   ; uses loop-*
+  (if (eq (car loop-args) 'into)
+      (let ((var (cl-pop2 loop-args)))
 	(or (memq var loop-accum-vars)
 	    (progn (push (list (list var def)) loop-bindings)
 		   (push var loop-accum-vars)))
@@ -2791,5 +2791,4 @@
 ;; generated-autoload-file: "cl-loaddefs.el"
 ;; End:
 
-;; arch-tag: afd947a6-b553-4df1-bba5-000be6388f46
 ;;; cl-macs.el ends here
--- a/lisp/emacs-lisp/lisp-mode.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/emacs-lisp/lisp-mode.el	Sat Nov 06 10:28:31 2010 +0200
@@ -407,10 +407,7 @@
   (if (and (buffer-modified-p)
 	   (y-or-n-p (format "Save buffer %s first? " (buffer-name))))
       (save-buffer))
-  (let ((compiled-file-name (byte-compile-dest-file buffer-file-name)))
-    (if (file-newer-than-file-p compiled-file-name buffer-file-name)
-	(load-file compiled-file-name)
-      (byte-compile-file buffer-file-name t))))
+  (byte-recompile-file buffer-file-name nil 0 t))
 
 (defcustom emacs-lisp-mode-hook nil
   "Hook run when entering Emacs Lisp mode."
--- a/lisp/emacs-lisp/package.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/emacs-lisp/package.el	Sat Nov 06 10:28:31 2010 +0200
@@ -77,7 +77,7 @@
 
 ;; Other external functions you may want to use:
 ;;
-;; M-x package-list-packages
+;; M-x 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
@@ -215,7 +215,6 @@
 (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))
 (defvar url-http-end-of-headers)
 
 (defcustom package-archives '(("gnu" . "http://elpa.gnu.org/packages/"))
@@ -278,9 +277,12 @@
 ;; until it's needed (i.e. when `package-intialize' is called).
 (defvar package--builtins nil
   "Alist of built-in packages.
+The actual value is initialized by loading the library
+`finder-inf'; this is not done until it is needed, e.g. by the
+function `package-built-in-p'.
+
 Each element has the form (PKG . DESC), where PKG is a package
 name (a symbol) and DESC is a vector that describes the package.
-
 The vector DESC has the form [VERSION REQS DOCSTRING].
   VERSION is a version list.
   REQS is a list of packages (symbols) required by the package.
@@ -329,7 +331,9 @@
       (match-string 1 dirname)))
 
 (defun package-load-descriptor (dir package)
-  "Load the description file in directory DIR for package PACKAGE."
+  "Load the description file in directory DIR for package PACKAGE.
+Here, PACKAGE is a string of the form NAME-VER, where NAME is the
+package name and VER is its version."
   (let* ((pkg-dir (expand-file-name package dir))
 	 (pkg-file (expand-file-name
 		    (concat (package-strip-version package) "-pkg")
@@ -387,8 +391,10 @@
   "Extract the kind of download from an archive package description vector."
   (aref desc 3))
 
-(defun package--dir (name version-string)
-  (let* ((subdir (concat name "-" version-string))
+(defun package--dir (name version)
+  "Return the directory where a package is installed, or nil if none.
+NAME and VERSION are both strings."
+  (let* ((subdir (concat name "-" version))
 	 (dir-list (cons package-user-dir package-directory-list))
 	 pkg-dir)
     (while dir-list
@@ -404,7 +410,7 @@
 	 (version-str (package-version-join (package-desc-vers pkg-vec)))
 	 (pkg-dir (package--dir name version-str)))
     (unless pkg-dir
-      (error "Internal error: could not find directory for %s-%s"
+      (error "Internal error: unable to find directory for `%s-%s'"
 	     name version-str))
     ;; Add info node.
     (when (file-exists-p (expand-file-name "dir" pkg-dir))
@@ -419,42 +425,46 @@
     ;; Don't return nil.
     t))
 
-(defun package--built-in (package version)
-  "Return true if the package is built-in to Emacs."
+(defun package-built-in-p (package &optional version)
+  "Return true if PACKAGE, of VERSION or newer, is built-in to Emacs."
+  (require 'finder-inf nil t) ; For `package--builtins'.
   (let ((elt (assq package package--builtins)))
-    (and elt (version-list-= (package-desc-vers (cdr elt)) version))))
+    (and elt (version-list-<= version (package-desc-vers (cdr elt))))))
 
-;; FIXME: return a reason instead?
+;; This function goes ahead and activates a newer version of a package
+;; if an older one was already 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.
 (defun package-activate (package version)
-  "Activate a package, and recursively activate its dependencies.
+  "Activate package PACKAGE, of version VERSION or newer.
+If PACKAGE has any dependencies, recursively activate them.
 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, do it now.
-	   (keep-going (or (not (memq package package-activated-list))
-			   (version-list-< version this-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)
-	     (version-list-<= version this-version))))))
+  (let ((pkg-vec (cdr (assq package package-alist)))
+	available-version found)
+    ;; Check if PACKAGE is available in `package-alist'.
+    (when pkg-vec
+      (setq available-version (package-desc-vers pkg-vec)
+	    found (version-list-<= version available-version)))
+    (cond
+     ;; If no such package is found, maybe it's built-in.
+     ((null found)
+      (package-built-in-p package version))
+     ;; If the package is already activated, just return t.
+     ((memq package package-activated-list)
+      t)
+     ;; Otherwise, proceed with activation.
+     (t
+      (let ((fail (catch 'dep-failure
+		    ;; Activate its dependencies recursively.
+		    (dolist (req (package-desc-reqs pkg-vec))
+		      (unless (package-activate (car req) (cadr req))
+			(throw 'dep-failure req))))))
+	(if fail
+	    (warn "Unable to activate package `%s'.
+Required package `%s-%s' is unavailable"
+		  package (car fail) (package-version-join (cadr fail)))
+	  ;; If all goes well, activate the package itself.
+	  (package-activate-1 package pkg-vec)))))))
 
 (defun package-mark-obsolete (package pkg-vec)
   "Put package on the obsolete list, if not already there."
@@ -470,48 +480,45 @@
 				      pkg-vec)))
 	    package-obsolete-alist))))
 
-(defun define-package (name-str version-string
+(defun define-package (name-string version-string
 				&optional docstring requirements
 				&rest extra-properties)
   "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.
+NAME-STRING is the name of the package, as a string.
+VERSION-STRING is the version of the package, as a list of
+integers of the form produced by `version-to-list'.
+DOCSTRING is a short description of the package, a string.
+REQUIREMENTS is a list of dependencies on other packages.
 Each requirement is of the form (OTHER-PACKAGE \"VERSION\").
 
 EXTRA-PROPERTIES is currently unused."
-  (let* ((name (intern name-str))
-	 (pkg-desc (assq name package-alist))
-	 (new-version (version-to-list version-string))
+  (let* ((name (intern name-string))
+	 (version (version-to-list version-string))
 	 (new-pkg-desc
 	  (cons name
-		(vector new-version
+		(vector version
 			(mapcar
 			 (lambda (elt)
 			   (list (car elt)
 				 (version-to-list (car (cdr elt)))))
 			 requirements)
-			docstring))))
-    ;; Only redefine a package if the redefinition is newer.
-    (if (or (not pkg-desc)
-	    (version-list-< (package-desc-vers (cdr pkg-desc))
-			    new-version))
-	(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.
-	  (push 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 (version-list-= new-version
-			      (package-desc-vers (cdr pkg-desc)))
-	;; The package is born obsolete.
-	(package-mark-obsolete (car new-pkg-desc) (cdr new-pkg-desc))))))
+			docstring)))
+	 (old-pkg (assq name package-alist)))
+    (cond
+     ;; If there's no old package, just add this to `package-alist'.
+     ((null old-pkg)
+      (push new-pkg-desc package-alist))
+     ((version-list-< (package-desc-vers (cdr old-pkg)) version)
+      ;; Remove the old package and declare it obsolete.
+      (package-mark-obsolete name (cdr old-pkg))
+      (setq package-alist (cons new-pkg-desc
+				(delq old-pkg package-alist))))
+     ;; You can have two packages with the same version, e.g. one in
+     ;; the system package directory and one in your private
+     ;; directory.  We just let the first one win.
+     ((not (version-list-= (package-desc-vers (cdr old-pkg)) version))
+      ;; The package is born obsolete.
+      (package-mark-obsolete name (cdr new-pkg-desc))))))
 
 ;; From Emacs 22.
 (defun package-autoload-ensure-default-file (file)
@@ -562,12 +569,8 @@
 (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 "^[^.]")))
+    ;; FIXME: should we delete PKG-DIR if it exists?
     (let* ((default-directory (file-name-as-directory package-user-dir)))
       (package-untar-buffer)
       (package-generate-autoloads (symbol-name name) pkg-dir)
@@ -605,7 +608,7 @@
 		       (mapcar
 			(lambda (elt)
 			  (list (car elt)
-				(package-version-join (car (cdr elt)))))
+				(package-version-join (cadr elt))))
 			requires))))
 	  "\n")
 	 nil
@@ -657,10 +660,14 @@
       (kill-buffer tar-buffer))))
 
 (defun package-installed-p (package &optional min-version)
+  "Return true if PACKAGE, of VERSION or newer, is installed.
+Built-in packages also qualify."
   (let ((pkg-desc (assq package package-alist)))
-    (and pkg-desc
-	 (version-list-<= min-version
-			  (package-desc-vers (cdr pkg-desc))))))
+    (if pkg-desc
+	(version-list-<= min-version
+			 (package-desc-vers (cdr pkg-desc)))
+      ;; Also check built-in packages.
+      (package-built-in-p package min-version))))
 
 (defun package-compute-transaction (package-list requirements)
   "Return a list of packages to be installed, including PACKAGE-LIST.
@@ -691,17 +698,18 @@
 		  ((null (stringp hold))
 		   (error "Invalid element in `package-load-list'"))
 		  ((version-list-< (version-to-list hold) next-version)
-		   (error "Package '%s' held at version %s, \
+		   (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)))
+	    (error "Package `%s-%s' is unavailable"
+		   (symbol-name next-pkg)
+		   (package-version-join next-version)))
 	  (unless (version-list-<= next-version
 				   (package-desc-vers (cdr pkg-desc)))
 	    (error
-	     "Need package '%s' with version %s, but only %s is available"
+	     "Need package `%s-%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.
@@ -811,7 +819,7 @@
 				  nil t))))
   (let ((pkg-desc (assq name package-archive-contents)))
     (unless pkg-desc
-      (error "Package '%s' is not available for installation"
+      (error "Package `%s' is not available for installation"
 	     (symbol-name name)))
     (package-download-transaction
      (package-compute-transaction (list name)
@@ -968,11 +976,16 @@
      (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))
+  (let ((dir (package--dir name version)))
+    (if (string-equal (file-name-directory dir)
+		      (file-name-as-directory
+		       (expand-file-name package-user-dir)))
+	(progn
+	  (delete-directory dir t t)
+	  (message "Package `%s-%s' deleted." name version))
+      ;; Don't delete "system" packages
+      (error "Package `%s-%s' is a system package, not deleting"
+	     name version))))
 
 (defun package-archive-url (name)
   "Return the archive containing the package NAME."
@@ -1014,21 +1027,22 @@
 		      (car archive)))))
   (package-read-all-archive-contents))
 
+(defvar package--initialized nil)
+
 ;;;###autoload
-(defun package-initialize ()
+(defun package-initialize (&optional no-activate)
   "Load Emacs Lisp packages, and activate them.
-The variable `package-load-list' controls which packages to load."
+The variable `package-load-list' controls which packages to load.
+If optional arg NO-ACTIVATE is non-nil, don't activate packages."
   (interactive)
-  (require 'finder-inf nil t)
-  (setq package-alist package--builtins)
-  (setq package-activated-list (mapcar #'car package-alist))
-  (setq package-obsolete-alist nil)
+  (setq package-alist nil
+	package-obsolete-alist nil)
   (package-load-all-descriptors)
   (package-read-all-archive-contents)
-  ;; Try to activate all our packages.
-  (mapc (lambda (elt)
-	  (package-activate (car elt) (package-desc-vers (cdr elt))))
-	package-alist))
+  (unless no-activate
+    (dolist (elt package-alist)
+      (package-activate (car elt) (package-desc-vers (cdr elt)))))
+  (setq package--initialized t))
 
 
 ;;;; Package description buffer.
@@ -1037,10 +1051,15 @@
 (defun describe-package (package)
   "Display the full documentation of PACKAGE (a symbol)."
   (interactive
-   (let* ((packages (append (mapcar 'car package-alist)
-			    (mapcar 'car package-archive-contents)))
-	  (guess (function-called-at-point))
-	  val)
+   (let* ((guess (function-called-at-point))
+	  packages val)
+     (require 'finder-inf nil t)
+     ;; Load the package list if necessary (but don't activate them).
+     (unless package--initialized
+       (package-initialize t))
+     (setq packages (append (mapcar 'car package-alist)
+			    (mapcar 'car package-archive-contents)
+			    (mapcar 'car package--builtins)))
      (unless (memq guess packages)
        (setq guess nil))
      (setq packages (mapcar 'symbol-name packages))
@@ -1051,8 +1070,8 @@
 			      "Describe package: ")
 			    packages nil t nil nil guess))
      (list (if (equal val "") guess (intern val)))))
-  (if (or (null package) (null (symbolp package)))
-      (message "You did not specify a package")
+  (if (or (null package) (not (symbolp package)))
+      (message "No package specified")
     (help-setup-xref (list #'describe-package package)
 		     (called-interactively-p 'interactive))
     (with-help-window (help-buffer)
@@ -1066,22 +1085,27 @@
 	desc pkg-dir reqs version installable)
     (prin1 package)
     (princ " is ")
-    (if (setq desc (cdr (assq package package-alist)))
-	;; This package is loaded (i.e. in `package-alist').
-	(progn
-	  (setq version (package-version-join (package-desc-vers desc)))
-	  (cond (built-in
-		 (princ "a built-in package.\n\n"))
-		((setq pkg-dir (package--dir package-name version))
-		 (insert "an installed package.\n\n"))
-		(t ;; This normally does not happen.
-		 (insert "a deleted package.\n\n")
-		 (setq version nil))))
-      ;; This package is not installed.
-      (setq desc    (cdr (assq package package-archive-contents))
-	    version (package-version-join (package-desc-vers desc))
+    (cond
+     ;; Loaded packages are in `package-alist'.
+     ((setq desc (cdr (assq package package-alist)))
+      (setq version (package-version-join (package-desc-vers desc)))
+      (if (setq pkg-dir (package--dir package-name version))
+	  (insert "an installed package.\n\n")
+	;; This normally does not happen.
+	(insert "a deleted package.\n\n")))
+     ;; Available packages are in `package-archive-contents'.
+     ((setq desc (cdr (assq package package-archive-contents)))
+      (setq version (package-version-join (package-desc-vers desc))
 	    installable t)
-      (insert "an uninstalled package.\n\n"))
+      (if built-in
+	  (insert "a built-in package.\n\n")
+	(insert "an uninstalled package.\n\n")))
+     (built-in
+      (setq desc (cdr built-in)
+	    version (package-version-join (package-desc-vers desc)))
+      (insert "a built-in package.\n\n"))
+     (t
+      (insert "an orphan package.\n\n")))
 
     (insert "     " (propertize "Status" 'font-lock-face 'bold) ": ")
     (cond (pkg-dir
@@ -1091,32 +1115,35 @@
 	   ;; Todo: Add button for uninstalling.
 	   (help-insert-xref-button (file-name-as-directory pkg-dir)
 				    'help-package-def pkg-dir)
-	   (insert "'."))
+	   (if built-in
+	       (insert "',\n             shadowing a "
+		       (propertize "built-in package"
+				   'font-lock-face 'font-lock-builtin-face)
+		       ".")
+	     (insert "'.")))
 	  (installable
-	   (insert "Available -- ")
-	   (let ((button-text (if (display-graphic-p)
-				  "Install"
-				"[Install]"))
+	   (if built-in
+	       (insert (propertize "Built-in." 'font-lock-face 'font-lock-builtin-face)
+		       "  Alternate version available -- ")
+	     (insert "Available -- "))
+	   (let ((button-text (if (display-graphic-p) "Install" "[Install]"))
 		 (button-face (if (display-graphic-p)
 				  '(:box (:line-width 2 :color "dark grey")
 					 :background "light grey"
 					 :foreground "black")
 				'link)))
-	     (insert-text-button button-text
-				 'face button-face
-				 'follow-link t
+	     (insert-text-button button-text 'face button-face 'follow-link t
 				 'package-symbol package
 				 'action 'package-install-button-action)))
 	  (built-in
-	   (insert (propertize "Built-in"
-			       'font-lock-face 'font-lock-builtin-face) "."))
+	   (insert (propertize "Built-in." 'font-lock-face 'font-lock-builtin-face)))
 	  (t (insert "Deleted.")))
     (insert "\n")
-    (and version
-	 (> (length version) 0)
+    (and version (> (length version) 0)
 	 (insert "    "
 		 (propertize "Version" 'font-lock-face 'bold) ": " version "\n"))
-    (setq reqs (package-desc-reqs desc))
+
+    (setq reqs (if desc (package-desc-reqs desc)))
     (when reqs
       (insert "   " (propertize "Requires" 'font-lock-face 'bold) ": ")
       (let ((first t)
@@ -1134,9 +1161,9 @@
 	  (help-insert-xref-button text 'help-package name))
 	(insert "\n")))
     (insert "    " (propertize "Summary" 'font-lock-face 'bold)
-	    ": " (package-desc-doc desc) "\n\n")
+	    ": " (if desc (package-desc-doc desc)) "\n\n")
 
-    (if (assq package package--builtins)
+    (if built-in
 	;; For built-in packages, insert the commentary.
 	(let ((fn (locate-file (concat package-name ".el") load-path
 			       load-file-rep-suffixes))
@@ -1340,12 +1367,16 @@
 (defun package-menu-mark-delete (num)
   "Mark a package for deletion and move to the next line."
   (interactive "p")
-  (package-menu-mark-internal "D"))
+  (if (string-equal (package-menu-get-status) "installed")
+      (package-menu-mark-internal "D")
+    (forward-line)))
 
 (defun package-menu-mark-install (num)
   "Mark a package for installation and move to the next line."
   (interactive "p")
-  (package-menu-mark-internal "I"))
+  (if (string-equal (package-menu-get-status) "available")
+      (package-menu-mark-internal "I")
+    (forward-line)))
 
 (defun package-menu-mark-unmark (num)
   "Clear any marks on a package and move to the next line."
@@ -1399,34 +1430,58 @@
       "")))
 
 (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."
+  "Perform marked Package Menu actions.
+Packages marked for installation are downloaded and installed;
+packages marked for deletion are removed."
   (interactive)
-  (goto-char (point-min))
-  (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))
+  (let (install-list delete-list cmd)
+    (save-excursion
+      (goto-char (point-min))
+      (while (not (eobp))
+	(setq cmd (char-after))
+	(cond
+	 ((eq cmd ?\s) t)
+	 ((eq cmd ?D)
+	  (push (cons (package-menu-get-package)
+		      (package-menu-get-version))
+		delete-list))
+	 ((eq cmd ?I)
+	  (push (package-menu-get-package) install-list)))
+	(forward-line)))
+    ;; Delete packages, prompting if necessary.
+    (when delete-list
+      (if (yes-or-no-p
+	   (if (= (length delete-list) 1)
+	       (format "Delete package `%s-%s'? "
+		       (caar delete-list)
+		       (cdr (car delete-list)))
+	     (format "Delete these %d packages (%s)? "
+		     (length delete-list)
+		     (mapconcat (lambda (elt)
+				  (concat (car elt) "-" (cdr elt)))
+				delete-list
+				", "))))
+	  (dolist (elt delete-list)
+	    (condition-case err
+		(package-delete (car elt) (cdr elt))
+	      (error (message (cadr err)))))
+	(error "Aborted")))
+    (when install-list
+      (if (yes-or-no-p
+	   (if (= (length install-list) 1)
+	       (format "Install package `%s'? " (car install-list))
+	     (format "Install these %d packages (%s)? "
+		     (length install-list)
+		     (mapconcat 'identity install-list ", "))))
+	  (dolist (elt install-list)
+	    (package-install (intern elt)))))
+    ;; If we deleted anything, regenerate `package-alist'.  This is done
+    ;; automatically if we installed a package.
+    (and delete-list (null install-list)
+	 (package-initialize))
+    (if (or delete-list install-list)
+	(package-menu-revert)
+      (message "No operations specified."))))
 
 (defun package-print-package (package version key desc)
   (let ((face
@@ -1471,31 +1526,36 @@
 
 (defun package--generate-package-list ()
   "Populate the current Package Menu buffer."
-  (package-initialize)
   (let ((inhibit-read-only t)
 	info-list name desc hold builtin)
     (erase-buffer)
     ;; List installed packages
     (dolist (elt package-alist)
       (setq name (car elt))
-      (when (and (not (eq name 'emacs)) ; Hide the `emacs' package.
-		 (or (null package-menu-package-list)
-		     (memq name package-menu-package-list)))
+      (when (or (null package-menu-package-list)
+		(memq name package-menu-package-list))
 	(setq desc (cdr elt)
-	      hold (cadr (assq name package-load-list))
-	      builtin (cdr (assq name package--builtins)))
+	      hold (cadr (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.
-	       (cond ((stringp hold) "held")
-		     ((and builtin
-			   (version-list-=
-			    (package-desc-vers builtin)
-			    (package-desc-vers desc)))
-		      "built-in")
-		     (t "installed"))
+	       (if (stringp hold) "held" "installed")
+	       (package-desc-doc desc)
+	       info-list))))
+
+    ;; List built-in packages
+    (dolist (elt package--builtins)
+      (setq name (car elt))
+      (when (and (not (eq name 'emacs)) ; Hide the `emacs' package.
+		 (or (null package-menu-package-list)
+		     (memq name package-menu-package-list)))
+	(setq desc (cdr elt))
+	(setq info-list
+	      (package-list-maybe-add
+	       name (package-desc-vers desc)
+	       "built-in"
 	       (package-desc-doc desc)
 	       info-list))))
 
@@ -1601,6 +1661,7 @@
   "Generate and pop to the *Packages* buffer.
 Optional PACKAGES is a list of names of packages (symbols) to
 list; the default is to display everything in `package-alist'."
+  (require 'finder-inf nil t)
   (with-current-buffer (get-buffer-create "*Packages*")
     (package-menu-mode)
     (set (make-local-variable 'package-menu-package-list) packages)
@@ -1617,6 +1678,9 @@
 Fetches the updated list of packages before displaying.
 The list is displayed in a buffer named `*Packages*'."
   (interactive)
+  ;; Initialize the package system if necessary.
+  (unless package--initialized
+    (package-initialize t))
   (package-refresh-contents)
   (package--list-packages))
 
--- a/lisp/emacs-lisp/smie.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/emacs-lisp/smie.el	Sat Nov 06 10:28:31 2010 +0200
@@ -70,6 +70,10 @@
 
 (eval-when-compile (require 'cl))
 
+(defgroup smie nil
+  "Simple Minded Indentation Engine."
+  :group 'languages)
+
 (defvar comment-continue)
 (declare-function comment-string-strip "newcomment" (str beforep afterp))
 
@@ -109,6 +113,7 @@
           (display-warning 'smie (format "Conflict: %s %s/%s %s" x old val y)))
       (puthash key val table))))
 
+(put 'smie-precs-precedence-table 'pure t)
 (defun smie-precs-precedence-table (precs)
   "Compute a 2D precedence table from a list of precedences.
 PRECS should be a list, sorted by precedence (e.g. \"+\" will
@@ -132,6 +137,7 @@
                 (smie-set-prec2tab prec2-table other-op op op1)))))))
     prec2-table))
 
+(put 'smie-merge-prec2s 'pure t)
 (defun smie-merge-prec2s (&rest tables)
   (if (null (cdr tables))
       (car tables)
@@ -147,6 +153,7 @@
                  table))
       prec2)))
 
+(put 'smie-bnf-precedence-table 'pure t)
 (defun smie-bnf-precedence-table (bnf &rest precs)
   (let ((nts (mapcar 'car bnf))         ;Non-terminals
         (first-ops-table ())
@@ -233,6 +240,7 @@
     ;; Keep track of which tokens are openers/closer, so they can get a nil
     ;; precedence in smie-prec2-levels.
     (puthash :smie-open/close-alist (smie-bnf-classify bnf) prec2)
+    (puthash :smie-closer-alist (smie-bnf-closer-alist bnf) prec2)
     prec2))
 
 ;; (defun smie-prec2-closer-alist (prec2 include-inners)
@@ -377,6 +385,7 @@
      (append names (list (car names)))
      " < ")))
 
+(put 'smie-prec2-levels 'pure t)
 (defun smie-prec2-levels (prec2)
   ;; FIXME: Rather than only return an alist of precedence levels, we should
   ;; also extract other useful data from it:
@@ -479,6 +488,8 @@
                       (eq 'closer (cdr (assoc (car x) classification-table))))
             (setf (nth 2 x) i)
             (incf i)))))                ;See other (incf i) above.
+    (let ((ca (gethash :smie-closer-alist prec2)))
+      (when ca (push (cons :smie-closer-alist ca) table)))
     table))
 
 ;;; Parsing using a precedence level table.
@@ -783,7 +794,8 @@
 (defcustom smie-blink-matching-inners t
   "Whether SMIE should blink to matching opener for inner keywords.
 If non-nil, it will blink not only for \"begin..end\" but also for \"if...else\"."
-  :type 'boolean)
+  :type 'boolean
+  :group 'smie)
 
 (defun smie-blink-matching-check (start end)
   (save-excursion
@@ -803,14 +815,22 @@
 (defun smie-blink-matching-open ()
   "Blink the matching opener when applicable.
 This uses SMIE's tables and is expected to be placed on `post-self-insert-hook'."
+  (let ((pos (point))                   ;Position after the close token.
+        token)
   (when (and blink-matching-paren
              smie-closer-alist                     ; Optimization.
-             (eq (char-before) last-command-event) ; Sanity check.
+               (or (eq (char-before) last-command-event) ;; Sanity check.
+                   (save-excursion
+                     (or (progn (skip-chars-backward " \t")
+                                (setq pos (point))
+                                (eq (char-before) last-command-event))
+                         (progn (skip-chars-backward " \n\t")
+                                (setq pos (point))
+                                (eq (char-before) last-command-event)))))
              (memq last-command-event smie-blink-matching-triggers)
              (not (nth 8 (syntax-ppss))))
     (save-excursion
-      (let ((pos (point))
-            (token (funcall smie-backward-token-function)))
+        (setq token (funcall smie-backward-token-function))
         (when (and (eq (point) (1- pos))
                    (= 1 (length token))
                    (not (rassoc token smie-closer-alist)))
@@ -818,17 +838,20 @@
           ;; closers (e.g. ?\; in Octave mode), so go back to the
           ;; previous token.
           (setq pos (point))
-          (setq token (save-excursion
-                        (funcall smie-backward-token-function))))
+          (setq token (funcall smie-backward-token-function)))
         (when (rassoc token smie-closer-alist)
           ;; We're after a close token.  Let's still make sure we
           ;; didn't skip a comment to find that token.
           (funcall smie-forward-token-function)
           (when (and (save-excursion
-                       ;; Trigger can be SPC, or reindent.
-                       (skip-chars-forward " \n\t")
+                       ;; Skip the trigger char, if applicable.
+                       (if (eq (char-after) last-command-event)
+                           (forward-char 1))
+                       (if (eq ?\n last-command-event)
+                           ;; Skip any auto-indentation, if applicable.
+                           (skip-chars-forward " \t"))
                        (>= (point) pos))
-                     ;; If token ends with a trigger char, so don't blink for
+                     ;; If token ends with a trigger char, don't blink for
                      ;; anything else than this trigger char, lest we'd blink
                      ;; both when inserting the trigger char and when
                      ;; inserting a subsequent trigger char like SPC.
@@ -848,36 +871,28 @@
 
 (defcustom smie-indent-basic 4
   "Basic amount of indentation."
-  :type 'integer)
+  :type 'integer
+  :group 'smie)
 
-(defvar smie-indent-rules 'unset
-  ;; TODO: For SML, we need more rule formats, so as to handle
-  ;;   structure Foo =
-  ;;      Bar (toto)
-  ;; and
-  ;;   structure Foo =
-  ;;   struct ... end
-  ;; I.e. the indentation after "=" depends on the parent ("structure")
-  ;; as well as on the following token ("struct").
-  "Rules of the following form.
-\((:before . TOK) . OFFSET-RULES)	how to indent TOK itself.
-\(TOK . OFFSET-RULES)	how to indent right after TOK.
-\(list-intro . TOKENS)	declare TOKENS as being followed by what may look like
-			  a funcall but is just a sequence of expressions.
-\(t . OFFSET)		basic indentation step.
-\(args . OFFSET)		indentation of arguments.
-\((T1 . T2) OFFSET)	like ((:before . T2) (:parent T1 OFFSET)).
+(defvar smie-rules-function 'ignore
+  "Function providing the indentation rules.
+It takes two arguments METHOD and ARG where the meaning of ARG
+and the expected return value depends on METHOD.
+METHOD can be:
+- :after, in which case ARG is a token and the function should return the
+  OFFSET to use for indentation after ARG.
+- :before, in which case ARG is a token and the function should return the
+  OFFSET to use to indent ARG itself.
+- :elem, in which case the function should return either:
+  - the offset to use to indent function arguments (ARG = `arg')
+  - the basic indentation step (ARG = `basic').
+- :list-intro, in which case ARG is a token and the function should return
+  non-nil if TOKEN is followed by a list of expressions (not separated by any
+  token) rather than an expression.
 
-OFFSET-RULES is a list of elements which can each either be:
-
-\(:hanging . OFFSET-RULES)	if TOK is hanging, use OFFSET-RULES.
-\(:parent PARENT . OFFSET-RULES) if TOK's parent is PARENT, use OFFSET-RULES.
-\(:next TOKEN . OFFSET-RULES)	if TOK is followed by TOKEN, use OFFSET-RULES.
-\(:prev TOKEN . OFFSET-RULES)	if TOK is preceded by TOKEN, use
-\(:bolp . OFFSET-RULES)		If TOK is first on a line, use OFFSET-RULES.
-OFFSET				the offset to use.
-
-PARENT can be either the name of the parent or a list of such names.
+When ARG is a token, the function is called with point just before that token.
+A return value of nil always means to fallback on the default behavior, so the
+function should return nil for arguments it does not expect.
 
 OFFSET can be of the form:
 `point'				align with the token.
@@ -886,91 +901,69 @@
 \(+ OFFSETS...)			use the sum of OFFSETS.
 VARIABLE			use the value of VARIABLE as offset.
 
-The precise meaning of `point' depends on various details: it can
-either mean the position of the token we're indenting, or the
-position of its parent, or the position right after its parent.
+This function will often use some of the following functions designed
+specifically for it:
+`smie-bolp', `smie-hanging-p', `smie-parent-p', `smie-next-p', `smie-prev-p'.")
 
-A nil offset for indentation after an opening token defaults
-to `smie-indent-basic'.")
-
-(defun smie-indent--hanging-p ()
-  ;; A hanging keyword is one that's at the end of a line except it's not at
-  ;; the beginning of a line.
-  (and (save-excursion
+(defun smie-hanging-p ()
+  "Return non-nil if the current token is \"hanging\".
+A hanging keyword is one that's at the end of a line except it's not at
+the beginning of a line."
+  (and (not (smie-bolp))
+       (save-excursion
          (when (zerop (length (funcall smie-forward-token-function)))
            ;; Could be an open-paren.
            (forward-char 1))
          (skip-chars-forward " \t")
-         (eolp))
-       (not (smie-indent--bolp))))
+         (eolp))))
 
-(defun smie-indent--bolp ()
+(defun smie-bolp ()
+  "Return non-nil if the current token is the first on the line."
   (save-excursion (skip-chars-backward " \t") (bolp)))
 
+(defvar smie--parent) (defvar smie--after) ;Dynamically scoped.
+
+(defun smie-parent-p (&rest parents)
+  "Return non-nil if the current token's parent is among PARENTS.
+Only meaningful when called from within `smie-rules-function'."
+  (member (nth 2 (or smie--parent
+                     (save-excursion
+                       (let* ((pos (point))
+                              (tok (funcall smie-forward-token-function)))
+                         (unless (cadr (assoc tok smie-op-levels))
+                           (goto-char pos))
+                         (setq smie--parent
+                               (smie-backward-sexp 'halfsexp))))))
+          parents))
+
+(defun smie-next-p (&rest tokens)
+  "Return non-nil if the next token is among TOKENS.
+Only meaningful when called from within `smie-rules-function'."
+  (let ((next
+         (save-excursion
+           (unless smie--after
+             (smie-indent-forward-token) (setq smie--after (point)))
+           (goto-char smie--after)
+           (smie-indent-forward-token))))
+    (member (car next) tokens)))
+
+(defun smie-prev-p (&rest tokens)
+  "Return non-nil if the previous token is among TOKENS."
+  (let ((prev (save-excursion
+                (smie-indent-backward-token))))
+    (member (car prev) tokens)))
+
+
 (defun smie-indent--offset (elem)
-  (or (cdr (assq elem smie-indent-rules))
-      (cdr (assq t smie-indent-rules))
+  (or (funcall smie-rules-function :elem elem)
+      (if (not (eq elem 'basic))
+          (funcall smie-rules-function :elem 'basic))
       smie-indent-basic))
 
-(defvar smie-indent-debug-log)
-
-(defun smie-indent--offset-rule (tokinfo &optional after parent)
-  "Apply the OFFSET-RULES in TOKINFO.
-Point is expected to be right in front of the token corresponding to TOKINFO.
-If computing the indentation after the token, then AFTER is the position
-after the token, otherwise it should be nil.
-PARENT if non-nil should be the parent info returned by `smie-backward-sexp'."
-  (let ((rules (cdr tokinfo))
-        next prev
-        offset)
-    (while (consp rules)
-      (let ((rule (pop rules)))
-        (cond
-         ((not (consp rule)) (setq offset rule))
-         ((eq (car rule) '+) (setq offset rule))
-         ((eq (car rule) :hanging)
-          (when (smie-indent--hanging-p)
-            (setq rules (cdr rule))))
-         ((eq (car rule) :bolp)
-          (when (smie-indent--bolp)
-            (setq rules (cdr rule))))
-         ((eq (car rule) :eolp)
-          (unless after
-            (error "Can't use :eolp in :before indentation rules"))
-          (when (> after (line-end-position))
-            (setq rules (cdr rule))))
-         ((eq (car rule) :prev)
-          (unless prev
-            (save-excursion
-              (setq prev (smie-indent-backward-token))))
-          (when (equal (car prev) (cadr rule))
-            (setq rules (cddr rule))))
-         ((eq (car rule) :next)
-          (unless next
-            (unless after
-              (error "Can't use :next in :before indentation rules"))
-            (save-excursion
-              (goto-char after)
-              (setq next (smie-indent-forward-token))))
-          (when (equal (car next) (cadr rule))
-            (setq rules (cddr rule))))
-         ((eq (car rule) :parent)
-          (unless parent
-            (save-excursion
-              (if after (goto-char after))
-              (setq parent (smie-backward-sexp 'halfsexp))))
-          (when (if (listp (cadr rule))
-                    (member (nth 2 parent) (cadr rule))
-                  (equal (nth 2 parent) (cadr rule)))
-            (setq rules (cddr rule))))
-         (t (error "Unknown rule %s for indentation of %s"
-                   rule (car tokinfo))))))
-    ;; If `offset' is not set yet, use `rules' to handle the case where
-    ;; the tokinfo uses the old-style ((PARENT . TOK). OFFSET).
-    (unless offset (setq offset rules))
-    (when (boundp 'smie-indent-debug-log)
-      (push (list (point) offset tokinfo) smie-indent-debug-log))
-    offset))
+(defun smie-indent--rule (kind token &optional after parent)
+  (let ((smie--parent parent)
+        (smie--after after))
+    (funcall smie-rules-function kind token)))
 
 (defun smie-indent--column (offset &optional base parent virtual-point)
   "Compute the actual column to use for a given OFFSET.
@@ -1012,6 +1005,9 @@
     (if (consp parent) (goto-char (cadr parent)))
     (smie-indent-virtual))
    ((eq offset nil) nil)
+   ;; FIXME: would be good to get rid of this since smie-rules-function
+   ;; can usually do the lookup trivially, but in cases where
+   ;; smie-rules-function returns (+ point VAR) it's not nearly as trivial.
    ((and (symbolp offset) (boundp 'offset))
     (smie-indent--column (symbol-value offset) base parent virtual-point))
    (t (error "Unknown indentation offset %s" offset))))
@@ -1046,11 +1042,11 @@
 need to compute the column at which point should be indented
 in order to figure out the indentation of some other (further down) point."
   ;; Trust pre-existing indentation on other lines.
-  (if (smie-indent--bolp) (current-column) (smie-indent-calculate)))
+  (if (smie-bolp) (current-column) (smie-indent-calculate)))
 
 (defun smie-indent-fixindent ()
   ;; Obey the `fixindent' special comment.
-  (and (smie-indent--bolp)
+  (and (smie-bolp)
        (save-excursion
          (comment-normalize-vars)
          (re-search-forward (concat comment-start-skip
@@ -1090,43 +1086,31 @@
           (save-excursion
             (goto-char pos)
             ;; Different cases:
-            ;; - smie-indent--bolp: "indent according to others".
+            ;; - smie-bolp: "indent according to others".
             ;; - common hanging: "indent according to others".
             ;; - SML-let hanging: "indent like parent".
             ;; - if-after-else: "indent-like parent".
             ;; - middle-of-line: "trust current position".
             (cond
              ((null (cdr toklevels)) nil) ;Not a keyword.
-             ((smie-indent--bolp)
+             ((smie-bolp)
               ;; For an open-paren-like thingy at BOL, always indent only
               ;; based on other rules (typically smie-indent-after-keyword).
               nil)
              (t
               ;; We're only ever here for virtual-indent, which is why
               ;; we can use (current-column) as answer for `point'.
-              (let* ((tokinfo (or (assoc (cons :before token)
-                                         smie-indent-rules)
+              (let* ((offset (or (smie-indent--rule :before token)
                                   ;; By default use point unless we're hanging.
-                                  `((:before . ,token) (:hanging nil) point)))
-                     ;; (after (prog1 (point) (goto-char pos)))
-                     (offset (smie-indent--offset-rule tokinfo)))
+                                 (unless (smie-hanging-p) 'point))))
                 (smie-indent--column offset)))))
 
         ;; FIXME: This still looks too much like black magic!!
-        ;; FIXME: Rather than a bunch of rules like (PARENT . TOKEN), we
-        ;; want a single rule for TOKEN with different cases for each PARENT.
         (let* ((parent (smie-backward-sexp 'halfsexp))
-               (tokinfo
-                (or (assoc (cons (caddr parent) token)
-                           smie-indent-rules)
-                    (assoc (cons :before token) smie-indent-rules)
-                    ;; Default rule.
-                    `((:before . ,token)
-                      ;; (:parent open 0)
-                      point)))
                (offset (save-excursion
                          (goto-char pos)
-                         (smie-indent--offset-rule tokinfo nil parent))))
+                         (or (smie-indent--rule :before token nil parent)
+                             'point))))
           ;; Different behaviors:
           ;; - align with parent.
           ;; - parent + offset.
@@ -1151,10 +1135,10 @@
             nil)
            ((eq (car parent) (car toklevels))
             ;; We bumped into a same-level operator. align with it.
-            (if (and (smie-indent--bolp) (/= (point) pos)
+            (if (and (smie-bolp) (/= (point) pos)
                      (save-excursion
                        (goto-char (goto-char (cadr parent)))
-                       (not (smie-indent--bolp)))
+                       (not (smie-bolp)))
                      ;; Check the offset of `token' rather then its parent
                      ;; because its parent may have used a special rule.  E.g.
                      ;;    function foo;
@@ -1190,8 +1174,8 @@
               ;;    -> d
               ;; So as to align with the earliest appropriate place.
               (smie-indent-virtual)))
-           (tokinfo
-            (if (and (= (point) pos) (smie-indent--bolp)
+           (t
+            (if (and (= (point) pos) (smie-bolp)
                      (or (eq offset 'point)
                          (and (consp offset) (memq 'point offset))))
                 ;; Since we started at BOL, we're not computing a virtual
@@ -1209,7 +1193,7 @@
   ;; Don't do it for virtual indentations.  We should normally never be "in
   ;; front of a comment" when doing virtual-indentation anyway.  And if we are
   ;; (as can happen in octave-mode), moving forward can lead to inf-loops.
-  (and (smie-indent--bolp)
+  (and (smie-bolp)
        (let ((pos (point)))
          (save-excursion
            (beginning-of-line)
@@ -1254,27 +1238,18 @@
   (save-excursion
     (let* ((pos (point))
            (toklevel (smie-indent-backward-token))
-           (tok (car toklevel))
-           (tokinfo (assoc tok smie-indent-rules)))
-      ;; Set some default indent rules.
-      (if (and toklevel (null (cadr toklevel)) (null tokinfo))
-          (setq tokinfo (list (car toklevel))))
-      ;; (if (and tokinfo (null toklevel))
-      ;;     (error "Token %S has indent rule but has no parsing info" tok))
+           (tok (car toklevel)))
       (when toklevel
-        (unless tokinfo
-          ;; The default indentation after a keyword/operator is 0 for
-          ;; infix and t for prefix.
-          ;; Using the BNF syntax, we could come up with better
-          ;; defaults, but we only have the precedence levels here.
-          (setq tokinfo (list tok 'default-rule
-                              (if (cadr toklevel) 0 (smie-indent--offset t)))))
         (let ((offset
-               (or (smie-indent--offset-rule tokinfo pos)
-                   (smie-indent--offset t))))
-          (let ((before (point)))
+               (or (smie-indent--rule :after tok pos)
+                   ;; The default indentation after a keyword/operator is
+                   ;; 0 for infix and t for prefix.
+                   (if (or (null (cadr toklevel))
+                           (rassoc tok smie-closer-alist))
+                       (smie-indent--offset 'basic) 0)))
+              (before (point)))
             (goto-char pos)
-            (smie-indent--column offset before)))))))
+          (smie-indent--column offset before))))))
 
 (defun smie-indent-exps ()
   ;; Indentation of sequences of simple expressions without
@@ -1297,13 +1272,14 @@
           arg)
       (while (and (null (car (smie-backward-sexp)))
                   (push (point) positions)
-                  (not (smie-indent--bolp))))
+                  (not (smie-bolp))))
       (save-excursion
         ;; Figure out if the atom we just skipped is an argument rather
         ;; than a function.
-        (setq arg (or (null (car (smie-backward-sexp)))
-                      (member (funcall smie-backward-token-function)
-                              (cdr (assoc 'list-intro smie-indent-rules))))))
+        (setq arg
+              (or (null (car (smie-backward-sexp)))
+                  (funcall smie-rules-function :list-intro
+                           (funcall smie-backward-token-function)))))
       (cond
        ((null positions)
         ;; We're the first expression of the list.  In that case, the
@@ -1362,18 +1338,51 @@
           (save-excursion (indent-line-to indent))
         (indent-line-to indent)))))
 
-(defun smie-indent-debug ()
-  "Show the rules used to compute indentation of current line."
-  (interactive)
-  (let ((smie-indent-debug-log '()))
-    (smie-indent-calculate)
-    ;; FIXME: please improve!
-    (message "%S" smie-indent-debug-log)))
-
-(defun smie-setup (op-levels indent-rules)
-  (set (make-local-variable 'smie-indent-rules) indent-rules)
+(defun smie-setup (op-levels rules-function &rest keywords)
+  "Setup SMIE navigation and indentation.
+OP-LEVELS is a grammar table generated by `smie-prec2-levels'.
+RULES-FUNCTION is a set of indentation rules for use on `smie-rules-function'.
+KEYWORDS are additional arguments, which can use the following keywords:
+- :forward-token FUN
+- :backward-token FUN"
+  (set (make-local-variable 'smie-rules-function) rules-function)
   (set (make-local-variable 'smie-op-levels) op-levels)
-  (set (make-local-variable 'indent-line-function) 'smie-indent-line))
+  (set (make-local-variable 'indent-line-function) 'smie-indent-line)
+  (set (make-local-variable 'forward-sexp-function)
+       'smie-forward-sexp-command)
+  (while keywords
+    (let ((k (pop keywords))
+          (v (pop keywords)))
+      (case k
+        (:forward-token
+         (set (make-local-variable 'smie-forward-token-function) v))
+        (:backward-token
+         (set (make-local-variable 'smie-backward-token-function) v))
+        (t (message "smie-setup: ignoring unknown keyword %s" k)))))
+  (let ((ca (cdr (assq :smie-closer-alist op-levels))))
+    (when ca
+      (set (make-local-variable 'smie-closer-alist) ca)
+      ;; Only needed for interactive calls to blink-matching-open.
+      (set (make-local-variable 'blink-matching-check-function)
+           #'smie-blink-matching-check)
+      (add-hook 'post-self-insert-hook
+                #'smie-blink-matching-open 'append 'local)
+      (set (make-local-variable 'smie-blink-matching-triggers)
+           (append smie-blink-matching-triggers
+                   ;; Rather than wait for SPC to blink, try to blink as
+                   ;; soon as we type the last char of a block ender.
+                   (let ((closers (sort (mapcar #'cdr smie-closer-alist)
+                                        #'string-lessp))
+                         (triggers ())
+                         closer)
+                     (while (setq closer (pop closers))
+                       (unless (and closers
+                                    ;; FIXME: this eliminates prefixes of other
+                                    ;; closers, but we should probably elimnate
+                                    ;; prefixes of other keywords as well.
+                                    (string-prefix-p closer (car closers)))
+                         (push (aref closer (1- (length closer))) triggers)))
+                     (delete-dups triggers)))))))
 
 
 (provide 'smie)
--- a/lisp/emulation/viper-init.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/emulation/viper-init.el	Sat Nov 06 10:28:31 2010 +0200
@@ -784,7 +784,7 @@
 
 ;; These two vars control the interaction of jumps performed by ' and `.
 ;; In this new version, '' doesn't erase the marks set by ``, so one can
-;; use both kinds of jumps interchangeably and without loosing positions
+;; use both kinds of jumps interchangeably and without losing positions
 ;; inside the lines.
 
 ;; Remembers position of the last jump done using ``'.
--- a/lisp/erc/ChangeLog	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/erc/ChangeLog	Sat Nov 06 10:28:31 2010 +0200
@@ -1,3 +1,8 @@
+2010-11-05  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* erc-backend.el (erc-coding-system-precedence): New variable.
+	(erc-decode-string-from-target): Use it.
+
 2010-10-24  Julien Danjou  <julien@danjou.info>
 
 	* erc-backend.el (erc-server-JOIN): Set the correct target list on join.
--- a/lisp/erc/erc-backend.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/erc/erc-backend.el	Sat Nov 06 10:28:31 2010 +0200
@@ -324,6 +324,13 @@
   :type 'integer
   :group 'erc-server)
 
+(defcustom erc-coding-system-precedence '(utf-8 undecided)
+  "List of coding systems to be preferred when receiving a string from the server.
+This will only be consulted if the coding system in
+`erc-server-coding-system' is `undecided'."
+  :group 'erc-server
+  :type '(repeat coding-system))
+
 (defcustom erc-server-coding-system (if (and (fboundp 'coding-system-p)
                                              (coding-system-p 'undecided)
                                              (coding-system-p 'utf-8))
@@ -334,7 +341,9 @@
 
 If a cons, the encoding system for outgoing text is in the car
 and the decoding system for incoming text is in the cdr. The most
-interesting use for this is to put `undecided' in the cdr.
+interesting use for this is to put `undecided' in the cdr. This
+means that `erc-coding-system-precedence' will be consulted, and the
+first match there will be used.
 
 If a function, it is called with the argument `target' and should
 return a coding system or a cons as described above.
@@ -705,6 +714,14 @@
   (let ((coding (erc-coding-system-for-target target)))
     (when (consp coding)
       (setq coding (cdr coding)))
+    (when (eq coding 'undecided)
+      (let ((codings (detect-coding-string str))
+            (precedence erc-coding-system-precedence))
+        (while (and precedence
+                    (not (memq (car precedence) codings)))
+          (pop precedence))
+        (when precedence
+          (setq coding (car precedence)))))
     (erc-decode-coding-string str coding)))
 
 ;; proposed name, not used by anything yet
--- a/lisp/faces.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/faces.el	Sat Nov 06 10:28:31 2010 +0200
@@ -30,7 +30,7 @@
 (eval-when-compile
   (require 'cl))
 
-(declare-function xw-defined-colors "term/x-win" (&optional frame))
+(declare-function xw-defined-colors "term/common-win" (&optional frame))
 
 (defvar help-xref-stack-item)
 
@@ -1957,7 +1957,7 @@
 				     (list (cons 'cursor-color fg)))))))
 
 (declare-function x-create-frame "xfns.c" (parms))
-(declare-function x-setup-function-keys "term/x-win" (frame))
+(declare-function x-setup-function-keys "term/common-win" (frame))
 
 (defun x-create-frame-with-faces (&optional parameters)
   "Create and return a frame with frame parameters PARAMETERS.
@@ -2482,6 +2482,14 @@
 (defface help-argument-name '((((supports :slant italic)) :inherit italic))
   "Face to highlight argument names in *Help* buffers."
   :group 'help)
+
+(defface glyphless-char
+  '((((type tty)) :inherit underline)
+    (t :height 0.6))
+  "Face for displaying non-graphic characters (e.g. U+202A (LRE)).
+It is used for characters of no fonts too."
+  :version "24.1"
+  :group 'basic-faces)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Manipulating font names.
@@ -2570,5 +2578,4 @@
 
 (provide 'faces)
 
-;; arch-tag: 19a4759f-2963-445f-b004-425b9aadd7d6
 ;;; faces.el ends here
--- a/lisp/finder.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/finder.el	Sat Nov 06 10:28:31 2010 +0200
@@ -198,7 +198,8 @@
 	      (setq summary  (lm-synopsis)
 		    keywords (mapcar 'intern (lm-keywords-list))
 		    package  (or package-override
-				 (intern-soft (lm-header "package"))
+				 (let ((str (lm-header "package")))
+				   (if str (intern str)))
 				 base-name)
 		    version  (lm-header "version")))
 	    (when summary
--- a/lisp/gnus/ChangeLog	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/ChangeLog	Sat Nov 06 10:28:31 2010 +0200
@@ -1,3 +1,347 @@
+2010-11-04  Andrew Cohen  <cohen@andy.bu.edu>
+
+	* nnir.el (gnus-summary-nnir-goto-thread): limiting work done by
+	gnus-summary-refer-thread.
+
+	* gnus-sum.el (gnus-build-all-threads): force updating of dependency
+	headers.
+	(gnus-summary-limit-include-thread): prevent articles in thread from
+	being cut in gnus-cut-threads.
+	(gnus-summary-refer-thread): limit retrieved headers to those in
+	thread.
+
+2010-11-04  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* message.el (message-send-mail): Use the value of
+	message-courtesy-message from the message buffer.
+
+	* gnus-html.el (gnus-html-browse-url): Implement mailto: URLs.
+
+	* shr.el (shr-browse-url): Implement mailto: URLs.
+
+	* gnus-sum.el (gnus-summary-show-article): Take `t' as the arg to mean
+	"raw".
+
+	* nnimap.el (nnimap-find-article-by-message-id): Don't EXAMINE a group
+	if it's already selected.
+
+	* mm-decode.el (mm-save-part): Put the entire path in the `M-n' slot.
+
+2010-11-04  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* shr.el (shr-tag-img): Use string-width and truncate-string-to-width
+	to measure the length and truncate alt text.
+
+2010-11-03  Glenn Morris  <rgm@gnu.org>
+
+	* nndiary.el (nndiary-generate-nov-databases-1)
+	(nndiary-generate-active-info): Rename dynamic variable `files' to
+	something less generic.
+
+2010-11-03  Andrew Cohen  <cohen@andy.bu.edu>
+
+	* nnir.el (nnir-request-move-article): Call the underlying backend to
+	move articles from nnir.
+
+2010-11-02  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus-cite.el (gnus-article-natural-long-line-p): Remove.
+
+2010-11-02  Julien Danjou  <julien@danjou.info>
+
+	* nnir.el: Remove wais support.
+
+2010-11-02  Glenn Morris  <rgm@gnu.org>
+
+	* gnus-html.el: Reorder requirements to quieten compiler.
+
+2010-11-02  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-cite.el (gnus-article-fill-cited-article): Make fill work
+	properly for XEmacs as well.
+	(gnus-article-fill-cited-article, gnus-article-foldable-buffer)
+	(gnus-article-natural-long-line-p): Use window-width rather than
+	frame-width.
+
+2010-11-01  Andrew Cohen  <cohen@andy.bu.edu>
+
+	* nnir.el (nnir-run-gmane): Inhibit demon.  Return nil if no messages.
+	(nnir-read-parms): Don't modify query.
+	(nnir-run-query): Add ability to search topic on current line.
+	(nnir-get-active): Clean up.
+
+2010-11-01  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus-cite.el (gnus-article-foldable-buffer): Protect against
+	degenerate articles.
+
+	* gnus-sum.el (gnus-print-buffer): Rewrite to use with-temp-buffer.
+	(gnus-print-buffer): Just print the buffer as is, without any copying
+	to a buffer and then re-highlighting.
+
+	* nnimap.el (nnimap-request-group): Store the new updated info.
+	(nnimap-request-group): Select the group when we don't know whether it
+	exists or not.
+
+	* gnus-start.el (gnus-ask-server-for-new-groups): Return the new
+	groups.
+
+	* gnus-group.el (gnus-group-find-new-groups): Display all the new
+	groups.
+
+	* gnus-start.el (gnus-find-new-newsgroups): Return the list of new
+	groups.
+
+	* gnus-cite.el (gnus-article-fill-cited-article): Minimize the
+	long-lines case by only filling the long lines.
+
+	* nnimap.el (nnimap-parse-line): Don't bug out oddly formed replies
+	(bug #7311).
+
+2010-11-01  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* shr.el: No need to declare `declare-function' since shr.el is for
+	only Emacsen that provide `libxml-parse-html-region'.
+
+2010-11-01  Glenn Morris  <rgm@gnu.org>
+
+	* mm-util.el (gnus-completing-read): Autoload.
+	(mm-read-coding-system): Simplify Emacs definition.
+
+	* nnmail.el (gnus-activate-group):
+	* nnimap.el (gnutls-negotiate):
+	* nntp.el (netrc-parse): Fix declarations.
+
+2010-11-01  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-util.el (gnus-string-match-p): New function, that is an alias to
+	string-match-p in Emacs >=23.
+
+	* gnus-msg.el (gnus-configure-posting-styles)
+	* nnir.el (nnir-run-gmane): Use gnus-string-match-p.
+
+2010-11-01  Glenn Morris  <rgm@gnu.org>
+
+	* nnir.el (declare-function): Add compat stub.
+	(mm-url-insert, mm-url-encode-www-form-urlencoded): Declare.
+	(nnir-run-gmane): Require 'mm-url.
+
+	* mm-util.el (mm-string-to-multibyte): Simplify.
+
+	* shr.el (declare-function): Add compat stub.
+	(url-cache-create-filename): Declare.
+	(mm-disable-multibyte, widget-convert-button): Autoload.
+
+	* smime.el (ldap-search): Declare.
+	(smime-cert-by-ldap-1): Require ldap on Emacs.
+
+	* nnimap.el: Require nnmail, and gnus-sum when compiling.
+	(nnimap-keepalive): Use gnus-float-time.
+
+	* mail-source.el (nnheader-message, gnus-float-time): Autoload.
+	(mail-source-delete-crash-box): Use gnus-float-time.
+
+	* gnus-dired.el (gnus-completing-read): Autoload.
+
+	* mm-view.el (gnus-rescale-image): Autoload.
+
+	* mm-decode.el (gnus-completing-read, gnus-blocked-images): Autoload.
+
+	* gnus.el (gnus-sloppily-equal-method-parameters): Move defn before use.
+
+	* sieve-manage.el: Require 'cl when compiling.
+
+	* gnus-util.el (iswitchb-read-buffer): Declare rather than autoload.
+	(gnus-iswitchb-completing-read): Require iswitchb.
+	(gnus-select-frame-set-input-focus): Silence compiler.
+
+2010-10-31  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* message.el (message-subject-trailing-was-query): Change default to t,
+	since I think that's what most people want.
+
+	* nnimap.el (nnimap-request-accept-article): Erase buffer before
+	appending for easier debugging.
+	(nnimap-wait-for-connection): Take a regexp.
+	(nnimap-request-accept-article): Wait for the continuation line before
+	sending anything unless we're streaming.
+
+	* gnus-art.el (gnus-treat-article): Only inhibit body washing, and
+	leave the header washing to take place.
+
+2010-10-31  Daniel Dehennin  <daniel.dehennin@baby-gnu.org>
+
+	* gnus-msg.el (gnus-configure-posting-styles): Permit the use of
+	regular expression match and replace in posting styles.
+
+2010-10-31  Andrew Cohen  <cohen@andy.bu.edu>
+
+	* nnir.el (gnus-group-make-nnir-group,nnir-run-query): Allow searching
+	an entire server.
+	(nnir-get-active): New function.
+	(nnir-run-imap): Use it.
+	(nnir-run-gmane): Who knew, gmane search returns an article score!
+
+	* gnus-srvr.el (gnus-server-mode-map): add binding "G" to search the
+	server on the current line with nnir.
+
+2010-10-31  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus-cite.el (gnus-article-foldable-buffer): Refactor out.
+	(gnus-article-foldable-buffer): Don't fold regions that have a ragged
+	left edge.
+	(gnus-article-foldable-buffer): Skip past the prefix when determining
+	raggedness.
+
+	* gnus-sum.el (gnus-summary-show-article): Add `C-u C-u g' for showing
+	the raw article, and change `C-u g' to show the article without doing
+	treatments.
+
+	* gnus-art.el (gnus-mime-display-alternative): Actually pass the type
+	on to `gnus-treat-article'.
+	(gnus-inhibit-article-treatments): New variable.
+
+	* gnus.el: Autoload gnus-article-fill-cited-long-lines.
+
+	* gnus-art.el (gnus-treatment-function-alist): Have
+	gnus-treat-fill-long-lines point to gnus-article-fill-cited-long-lines.
+	(gnus-treat-fill-long-lines): Change default to fill all text/plain
+	sections.
+
+	* gnus-cite.el (gnus-article-fill-cited-article): Remove unused `force'
+	parameter.
+	(gnus-article-fill-cited-long-lines): New function.
+	(gnus-article-fill-cited-article): Allow filling only long sections.
+
+	* shr.el (shr-find-fill-point): Don't break lines between punctuation
+	and non-punctuation (like after the apostrophe in "'We").
+
+	* gnus-sum.el (gnus-summary-select-article): Make sure
+	gnus-original-article-buffer is alive.
+
+	* nndoc.el (nndoc-dissect-buffer): Reverse the order of the articles to
+	reflect the order they're in in the digest.
+
+	* gnus.el (gnus-group-startup-message): Move point to the start of the
+	buffer.
+
+	* nnimap.el (nnimap-capability): New function.
+	(nnimap-open-connection): Only send AUTHENTICATE PLAIN if LOGINDISABLED
+	is set.
+
+2010-10-31  David Engster  <dengste@eml.cc>
+
+	* nnmairix.el (nnmairix-get-valid-servers): Return list of strings to
+	conform with changes to gnus-completing-read.
+
+2010-10-30  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* shr.el (shr-tag-img): Output "*" instead of "[img]".
+
+2010-10-30  Andrew Cohen  <cohen@andy.bu.edu>
+
+	* nnir.el move defvar, defcustom around to keep file organized and keep
+	byte-compiler quiet.
+	(nnir-read-parms): accept search-engine as arg.
+	(nnir-run-query): pass search-engine as arg.
+	(nnir-search-engine): remove.
+
+2010-10-30  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* shr.el (shr-generic): The text nodes should be text, not :text.
+
+	* nnir.el (nnir-search-engine): Ressurect variable, since it's used
+	later in the file.
+
+2010-10-30  Andrew Cohen  <cohen@andy.bu.edu>
+
+	* nnir.el: general clean up. allow searching with multiple
+	engines. allow separate extra-parameters for each engine. batch queries
+	when possible.
+	(nnir-imap-default-search-key,nnir-method-default-engines): add
+	customize interface.
+	(nnir-run-gmane): new engine.
+	(nnir-engines): use it. qualify all prompts with engine name.
+	(nnir-search-engine): remove global variable.
+	(nnir-run-hyrex): restore for now.
+	(nnir-extra-parms,nnir-search-history): new variables.
+	(gnus-group-make-nnir-group): use them.
+	(nnir-group-server): remove in favor of gnus-group-server.
+	(nnir-request-group): avoid searching twice.
+	(nnir-sort-groups-by-server): new function.
+
+2010-10-30  Julien Danjou  <julien@danjou.info>
+
+	* gnus-group.el: Remove gnus-group-fetch-control.
+
+	* gnus-start.el (gnus-find-new-newsgroups): Remove
+	gnus-check-first-time-used.
+
+	* gnus.el: Remove gnus-backup-default-subscribed-newsgroups.
+
+2010-10-30  Knut Anders Hatlen  <kahatlen@gmail.com>  (tiny change)
+
+	* nnimap.el (nnimap-update-info): Allow 'ticked and other flags to be
+	set on groups that don't have \* permanentflags.
+
+2010-10-30  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* shr.el (shr-tag-span): Drop colorisation of regions since we don't
+	control the background color.
+	(shr-tag-img): Ignore very small web bug type images.
+	(shr-put-image): Add help-echo alt texts to the images.
+	(shr-tag-video): Show the video poster image.
+
+2010-10-29  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* shr.el (shr-table-depth): New variable.
+	(shr-tag-table-1): Only insert the images after the top-level table.
+
+	* nnimap.el (nnimap-split-incoming-mail): Fix typo.
+
+	* gnus-util.el (gnus-list-memq-of-list): New function.
+
+	* nnimap.el (nnimap-split-incoming-mail): Note that the INBOX has been
+	selected.
+	(nnimap-unsplittable-articles): New slot.
+	(nnimap-new-articles): Use it.
+
+2010-10-29  Stephen Berman  <stephen.berman@gmx.net>  (tiny change)
+
+	* gnus-group.el (gnus-group-get-new-news-this-group): Don't have point
+	move to the previous line on `M-g'.
+
+2010-10-29  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus-msg.el (gnus-inews-do-gcc): Don't have the backends do the slow
+	*-request-group, which seems unnecessary.
+
+	* nnimap.el (nnimap-quote-specials): Function copied over from
+	imap.el.
+	(nnimap-open-connection): Use AUTHENTICATE PLAIN on servers that say
+	they support that.  Suggested by Tom Regner.
+
+2010-10-29  Julien Danjou  <julien@danjou.info>
+
+	* gnus-sum.el (gnus-summary-delete-marked-as-read): Remove obsolete
+	defalias.
+	(gnus-summary-delete-marked-with): Remove obsolete defalias.
+
+	* gnus.el: Remove `gnus-nntp-service' variable.
+	(gnus-secondary-servers): Make obsolete.
+	(gnus-nntp-server): Make obsolete.
+
+	* gnus-start.el (gnus-1): Remove x-splash calls.
+
+	* gnus-ems.el (gnus-x-splash): Remove.
+
+	* gnus.el (gnus-group-startup-message): Simplify/update code.
+
+	* gnus-group.el (gnus-group-make-tool-bar): Check for display graphic
+	capability before doing anything.
+	(gnus-group-insert-group-line): Remove useless
+	gnus-group-remove-excess-properties.
+
 2010-10-29  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* gnus-art.el (gnus-article-goto-part): Work for article narrowed by ^L.
@@ -446,12 +790,12 @@
 
 	* nnimap.el (gnutls-negotiate): Silence the byte compiler.
 
-	* gnus-art.el, gnus-cache.el, gnus-fun.el, gnus-group.el,
-	gnus-picon.el, gnus-spec.el, gnus-sum.el, gnus-util.el, gnus.el,
-	mail-source.el, message.el, mm-bodies.el, mm-decode.el, mm-extern.el,
-	mm-util.el, mm-view.el, mml-smime.el, mml.el, mml1991.el, mml2015.el,
-	nnfolder.el, nnheader.el, nnmail.el, nnmaildir.el, nnrss.el, nntp.el,
-	rfc1843.el, sieve-manage.el, smime.el, spam.el:
+	* gnus-art.el, gnus-cache.el, gnus-fun.el, gnus-group.el:
+	* gnus-picon.el, gnus-spec.el, gnus-sum.el, gnus-util.el, gnus.el:
+	* mail-source.el, message.el, mm-bodies.el, mm-decode.el, mm-extern.el:
+	* mm-util.el, mm-view.el, mml-smime.el, mml.el, mml1991.el, mml2015.el:
+	* nnfolder.el, nnheader.el, nnmail.el, nnmaildir.el, nnrss.el, nntp.el:
+	* rfc1843.el, sieve-manage.el, smime.el, spam.el:
 	Fix comment for declare-function.
 
 2010-10-11  Lars Magne Ingebrigtsen  <larsi@gnus.org>
@@ -1351,7 +1695,7 @@
 
 2010-09-27  David Engster  <dengste@eml.cc>
 
-	* nnmairix.el: (nnmairix-replace-group-and-numbers): Deal with NOV as
+	* nnmairix.el (nnmairix-replace-group-and-numbers): Deal with NOV as
 	well as HEADERS.
 	(nnmairix-retrieve-headers): Provide new argument for the above.
 
@@ -1729,7 +2073,7 @@
 	(nnimap-make-process-buffer): Store all the process buffers.
 	(nnimap-keepalive): New function.
 
-	* starttls.el: (starttls-open-stream): Add autoload cookie.
+	* starttls.el (starttls-open-stream): Add autoload cookie.
 
 2010-09-24  Michael Welsh Duggan  <md5i@md5i.com>  (tiny change)
 
--- a/lisp/gnus/ChangeLog.2	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/ChangeLog.2	Sat Nov 06 10:28:31 2010 +0200
@@ -16433,7 +16433,7 @@
 2001-01-09  Didier Verna  <didier@xemacs.org>
 
 	* gnus-agent.el: Moved some XEmacs specific hook add-ons from
-	`gnus-xmas-[re]define' to avoid loosing user custom settings.
+	`gnus-xmas-[re]define' to avoid losing user custom settings.
 	* gnus-art.el: Ditto.
 	* gnus-group.el: Ditto.
 	* gnus-salt.el: Ditto.
--- a/lisp/gnus/gnus-art.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus-art.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1590,7 +1590,7 @@
   :link '(custom-manual "(gnus)Customizing Articles")
   :type gnus-article-treat-custom)
 
-(defcustom gnus-treat-fill-long-lines nil
+(defcustom gnus-treat-fill-long-lines '(typep "text/plain")
   "Fill long lines.
 Valid values are nil, t, `head', `first', `last', an integer or a
 predicate.  See Info node `(gnus)Customizing Articles'."
@@ -1664,7 +1664,7 @@
     (gnus-treat-highlight-signature gnus-article-highlight-signature)
     (gnus-treat-buttonize gnus-article-add-buttons)
     (gnus-treat-fill-article gnus-article-fill-cited-article)
-    (gnus-treat-fill-long-lines gnus-article-fill-long-lines)
+    (gnus-treat-fill-long-lines gnus-article-fill-cited-long-lines)
     (gnus-treat-strip-cr gnus-article-remove-cr)
     (gnus-treat-unsplit-urls gnus-article-unsplit-urls)
     (gnus-treat-date-ut gnus-article-date-ut)
@@ -5704,7 +5704,7 @@
 	  (save-restriction
 	    (article-goto-body)
 	    (narrow-to-region (point) (point-max))
-	    (gnus-treat-article nil 1 1)
+	    (gnus-treat-article nil 1 1 "text/plain")
 	    (widen)))
 	(unless ihandles
 	  ;; Highlight the headers.
@@ -5992,7 +5992,7 @@
 		  (gnus-treat-article
 		   nil (length gnus-article-mime-handle-alist)
 		   (gnus-article-mime-total-parts)
-		   (mm-handle-media-type handle))))))
+		   (mm-handle-media-type preferred))))))
 	  (goto-char (point-max))
 	  (setcdr begend (point-marker)))))
     (when ibegend
@@ -8255,6 +8255,8 @@
 ;;; Treatment top-level handling.
 ;;;
 
+(defvar gnus-inhibit-article-treatments nil)
+
 (defun gnus-treat-article (condition &optional part-number total-parts type)
   (let ((length (- (point-max) (point-min)))
 	(alist gnus-treatment-function-alist)
@@ -8277,6 +8279,8 @@
 	      (symbol-value (car elem))))
       (when (and (or (consp val)
 		     treated-type)
+		 (or (not gnus-inhibit-article-treatments)
+		     (eq condition 'head))
 		 (gnus-treat-predicate val)
 		 (or (not (get (car elem) 'highlight))
 		     highlightp))
--- a/lisp/gnus/gnus-cite.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus-cite.el	Sat Nov 06 10:28:31 2010 +0200
@@ -516,10 +516,15 @@
 	    (setq m (cdr m))))
 	marks))))
 
-(defun gnus-article-fill-cited-article (&optional force width)
+(defun gnus-article-fill-cited-long-lines ()
+  (gnus-article-fill-cited-article nil t))
+
+(defun gnus-article-fill-cited-article (&optional width long-lines)
   "Do word wrapping in the current article.
-If WIDTH (the numerical prefix), use that text width when filling."
-  (interactive (list t current-prefix-arg))
+If WIDTH (the numerical prefix), use that text width when
+filling.  If LONG-LINES, only fill sections that have lines
+longer than the frame width."
+  (interactive "P")
   (with-current-buffer gnus-article-buffer
     (let ((buffer-read-only nil)
 	  (inhibit-point-motion-hooks t)
@@ -535,8 +540,24 @@
 		(fill-prefix
 		 (if (string= (cdar marks) "") ""
 		   (concat (cdar marks) " ")))
+		(do-fill (not long-lines))
 		use-hard-newlines)
-	    (fill-region (point-min) (point-max)))
+	    (unless do-fill
+	      (setq do-fill (gnus-article-foldable-buffer (cdar marks))))
+	    ;; Note: the XEmacs version of `fill-region' inserts a newline
+	    ;; unless the region ends with a newline.
+	    (when do-fill
+	      (if (not long-lines)
+		  (fill-region (point-min) (point-max))
+		(goto-char (point-min))
+		(while (not (eobp))
+		  (end-of-line)
+		  (when (prog1
+			    (> (current-column) (window-width))
+			  (forward-line 1))
+		    (save-restriction
+		      (narrow-to-region (line-beginning-position 0) (point))
+		      (fill-region (point-min) (point-max))))))))
 	  (set-marker (caar marks) nil)
 	  (setq marks (cdr marks)))
 	(when marks
@@ -548,23 +569,28 @@
 	      gnus-cite-loose-attribution-alist nil
 	      gnus-cite-article nil)))))
 
-(defun gnus-article-natural-long-line-p ()
-  "Return true if the current line is long, and it's natural text."
-  (save-excursion
-    (beginning-of-line)
-    (and
-     ;; The line is long.
-     (> (- (line-end-position) (line-beginning-position))
-	(frame-width))
-     ;; It doesn't start with spaces.
-     (not (looking-at "    "))
-     ;; Not cited text.
-     (let ((line-number (1+ (count-lines (point-min) (point))))
-	   citep)
-       (dolist (elem gnus-cite-prefix-alist)
-	 (when (member line-number (cdr elem))
-	   (setq citep t)))
-       (not citep)))))
+(defun gnus-article-foldable-buffer (prefix)
+  (let ((do-fill nil)
+	columns)
+    (goto-char (point-min))
+    (while (not (eobp))
+      (unless (> (length prefix) (- (point-max) (point)))
+	(forward-char (length prefix)))
+      (skip-chars-forward " \t")
+      (unless (eolp)
+	(let ((elem (assq (current-column) columns)))
+	  (unless elem
+	    (setq elem (cons (current-column) 0))
+	    (push elem columns))
+	  (setcdr elem (1+ (cdr elem)))))
+      (end-of-line)
+      (when (> (current-column) (window-width))
+	(setq do-fill t))
+      (forward-line 1))
+    (and do-fill
+	 ;; We know know that there are long lines here, but does this look
+	 ;; like code?  Check for ragged edges on the left.
+	 (< (length columns) 3))))
 
 (defun gnus-article-hide-citation (&optional arg force)
   "Toggle hiding of all cited text except attribution lines.
--- a/lisp/gnus/gnus-dired.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus-dired.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,7 @@
 ;;; gnus-dired.el --- utility functions where gnus and dired meet
 
-;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
+;;   2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Authors: Benjamin Rutt <brutt@bloomington.in.us>,
 ;;          Shenghuo Zhu <zsh@cs.rochester.edu>
@@ -122,6 +122,8 @@
 	    (push (buffer-name buffer) buffers))))
       (nreverse buffers))))
 
+(autoload 'gnus-completing-read "gnus-util")
+
 ;; Method to attach files to a mail composition.
 (defun gnus-dired-attach (files-to-attach)
   "Attach dired's marked files to a gnus message composition.
--- a/lisp/gnus/gnus-ems.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus-ems.el	Sat Nov 06 10:28:31 2010 +0200
@@ -162,102 +162,6 @@
 (autoload 'gnus-alive-p "gnus-util")
 (autoload 'mm-disable-multibyte "mm-util")
 
-(defun gnus-x-splash ()
-  "Show a splash screen using a pixmap in the current buffer."
-  (interactive)
-  (unless window-system
-    (error "`gnus-x-splash' requires running on the window system"))
-  (switch-to-buffer (gnus-get-buffer-create (if (or (gnus-alive-p)
-						    (interactive-p))
-						"*gnus-x-splash*"
-					      gnus-group-buffer)))
-  (let ((inhibit-read-only t)
-	(file (nnheader-find-etc-directory "images/gnus/x-splash" t))
-	pixmap fcw fch width height fringes sbars left yoffset top ls)
-    (erase-buffer)
-    (sit-for 0) ;; Necessary for measuring the window size correctly.
-    (when (and file
-	       (ignore-errors
-		(let ((coding-system-for-read 'raw-text))
-		  (with-temp-buffer
-                    (mm-disable-multibyte)
-		    (insert-file-contents file)
-		    (goto-char (point-min))
-		    (setq pixmap (read (current-buffer)))))))
-      (setq fcw (float (frame-char-width))
-	    fch (float (frame-char-height))
-	    width (/ (car pixmap) fcw)
-	    height (/ (cadr pixmap) fch)
-	    fringes (if (fboundp 'window-fringes)
-			(eval '(window-fringes))
-		      '(10 11 nil))
-	    sbars (frame-parameter nil 'vertical-scroll-bars))
-      (cond ((eq sbars 'right)
-	     (setq sbars
-		   (cons 0 (/ (or (frame-parameter nil 'scroll-bar-width) 14)
-			      fcw))))
-	    (sbars
-	     (setq sbars
-		   (cons (/ (or (frame-parameter nil 'scroll-bar-width) 14)
-			    fcw)
-			 0)))
-	    (t
-	     (setq sbars '(0 . 0))))
-      (setq left (- (* (round (/ (1- (/ (+ (window-width)
-					   (car sbars) (cdr sbars)
-					   (/ (+ (or (car fringes) 0)
-						 (or (cadr fringes) 0))
-					      fcw))
-					width))
-				 2))
-		       width)
-		    (car sbars)
-		    (/ (or (car fringes) 0) fcw))
-	    yoffset (cadr (window-edges))
-	    top (max 0 (- (* (max (if (and (boundp 'tool-bar-mode)
-					   tool-bar-mode
-					   (not (featurep 'gtk))
-					   (eq (frame-first-window)
-					       (selected-window)))
-				      1 0)
-				  (round (/ (1- (/ (+ (1- (window-height))
-						      (* 2 yoffset))
-						   height))
-					    2)))
-			     height)
-			  yoffset))
-	    ls (/ (or line-spacing 0) fch)
-	    height (max 0 (- height ls)))
-      (cond ((>= (- top ls) 1)
-	     (insert
-	      (propertize
-	       " "
-	       'display `(space :width 0 :ascent 100))
-	      "\n"
-	      (propertize
-	       " "
-	       'display `(space :width 0 :height ,(- top ls 1) :ascent 100))
-	      "\n"))
-	    ((> (- top ls) 0)
-	     (insert
-	      (propertize
-	       " "
-	       'display `(space :width 0 :height ,(- top ls) :ascent 100))
-	      "\n")))
-      (if (and (> width 0) (> left 0))
-	  (insert (propertize
-		   " "
-		   'display `(space :width ,left :height ,height :ascent 0)))
-	(setq width (+ width left)))
-      (when (> width 0)
-	(insert (propertize
-		 " "
-		 'display `(space :width ,width :height ,height :ascent 0)
-		 'face `(gnus-splash :stipple ,pixmap))))
-      (goto-char (if (<= (- top ls) 0) (1- (point)) (point-min)))
-      (redraw-frame (selected-frame))
-      (sit-for 0))))
-
 ;;; Image functions.
 
 (defun gnus-image-type-available-p (type)
--- a/lisp/gnus/gnus-group.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus-group.el	Sat Nov 06 10:28:31 2010 +0200
@@ -741,7 +741,6 @@
   "e" gnus-score-edit-all-score)
 
 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map)
-  "C" gnus-group-fetch-control
   "d" gnus-group-describe-group
   "v" gnus-version)
 
@@ -807,10 +806,6 @@
        ["Describe" gnus-group-describe-group :active (gnus-group-group-name)
 	,@(if (featurep 'xemacs) nil
 	    '(:help "Display description of the current group"))]
-       ["Fetch control message" gnus-group-fetch-control
-	:active (gnus-group-group-name)
-	,@(if (featurep 'xemacs) nil
-	    '(:help "Display the archived control message for the current group"))]
        ;; Actually one should check, if any of the marked groups gives t for
        ;; (gnus-check-backend-function 'request-expire-articles ...)
        ["Expire articles" gnus-group-expire-articles
@@ -1090,8 +1085,7 @@
   (when (and (not (featurep 'xemacs))
 	     (boundp 'tool-bar-mode)
 	     tool-bar-mode
-	     ;; The Gnus 5.10.6 code checked (default-value 'tool-bar-mode).
-	     ;; Why?  --rsteib
+             (display-graphic-p)
 	     (or (not gnus-group-tool-bar-map) force))
     (let* ((load-path
 	    (gmm-image-load-path-for-library "gnus"
@@ -1607,9 +1601,7 @@
     (when (inline (gnus-visual-p 'group-highlight 'highlight))
       (gnus-group-highlight-line gnus-tmp-group beg end))
     (gnus-run-hooks 'gnus-group-update-hook)
-    (forward-line)
-    ;; Allow XEmacs to remove front-sticky text properties.
-    (gnus-group-remove-excess-properties)))
+    (forward-line)))
 
 (defun gnus-group-update-eval-form (group list)
   "Eval `car' of each element of LIST, and return the first that return t.
@@ -3991,7 +3983,7 @@
   (let* ((groups (gnus-group-process-prefix n))
 	 (ret (if (numberp n) (- n (length groups)) 0))
 	 (beg (unless n
-		(point)))
+		(point-marker)))
 	 group method
 	 (gnus-inhibit-demon t)
 	 ;; Binding this variable will inhibit multiple fetchings
@@ -4025,32 +4017,6 @@
     (gnus-group-position-point)
     ret))
 
-(defun gnus-group-fetch-control (group)
-  "Fetch the archived control messages for the current group.
-If given a prefix argument, prompt for a group."
-  (interactive
-   (list (or (when current-prefix-arg
-	       (gnus-group-completing-read))
-	     (gnus-group-group-name)
-	     gnus-newsgroup-name)))
-  (unless group
-    (error "No group name given"))
-  (let ((name (gnus-group-real-name group))
-	hierarchy)
-    (when (string-match "\\(^[^\\.]+\\)\\..*" name)
-      (setq hierarchy (match-string 1 name))
-      (if gnus-group-fetch-control-use-browse-url
-	  (browse-url (concat "ftp://ftp.isc.org/usenet/control/"
-			      hierarchy "/" name ".gz"))
-	(let ((enable-local-variables nil))
-	  (gnus-group-read-ephemeral-group
-	   group
-	   `(nndoc ,group (nndoc-address
-			   ,(find-file-noselect
-			     (concat "/ftp@ftp.isc.org:/usenet/control/"
-				     hierarchy "/" name ".gz")))
-		   (nndoc-article-type mbox)) t nil nil))))))
-
 (defun gnus-group-describe-group (force &optional group)
   "Display a description of the current newsgroup."
   (interactive (list current-prefix-arg (gnus-group-group-name)))
@@ -4220,8 +4186,14 @@
 With 2 C-u's, use most complete method possible to query the server
 for new groups, and subscribe the new groups as zombies."
   (interactive "p")
-  (gnus-find-new-newsgroups (or arg 1))
-  (gnus-group-list-groups))
+  (let ((new-groups (gnus-find-new-newsgroups (or arg 1)))
+	current-group)
+    (gnus-group-list-groups)
+    (setq current-group (gnus-group-group-name))
+    (dolist (group new-groups)
+      (gnus-group-jump-to-group group))
+    (when current-group
+      (gnus-group-jump-to-group current-group))))
 
 (defun gnus-group-edit-global-kill (&optional article group)
   "Edit the global kill file.
--- a/lisp/gnus/gnus-html.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus-html.el	Sat Nov 06 10:28:31 2010 +0200
@@ -29,9 +29,10 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
+
+(require 'gnus-art)
 (eval-when-compile (require 'mm-decode))
 
-(require 'gnus-art)
 (require 'mm-url)
 (require 'url)
 (require 'url-cache)
@@ -349,9 +350,13 @@
   "Browse the image under point."
   (interactive)
   (let ((url (get-text-property (point) 'gnus-string)))
-    (if (not url)
-	(message "No URL at point")
-      (browse-url url))))
+    (cond
+     ((not url)
+      (message "No link under point"))
+     ((string-match "^mailto:" url)
+      (gnus-url-mailto url))
+     (t
+      (browse-url url)))))
 
 (defun gnus-html-schedule-image-fetching (buffer image)
   "Retrieve IMAGE, and place it into BUFFER on arrival."
--- a/lisp/gnus/gnus-int.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus-int.el	Sat Nov 06 10:28:31 2010 +0200
@@ -100,8 +100,6 @@
 	;; Stream is already opened.
 	nil
       ;; Open NNTP server.
-      (unless gnus-nntp-service
-	(setq gnus-nntp-server nil))
       (when confirm
 	;; Read server name with completion.
 	(setq gnus-nntp-server
--- a/lisp/gnus/gnus-msg.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus-msg.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1628,7 +1628,7 @@
 	    (unless (gnus-check-server method)
 	      (error "Can't open server %s" (if (stringp method) method
 					      (car method))))
-	    (unless (gnus-request-group group nil method)
+	    (unless (gnus-request-group group t method)
 	      (gnus-request-create-group group method))
 	    (setq mml-externalize-attachments
 		  (if (stringp gnus-gcc-externalize-attachments)
@@ -1891,7 +1891,11 @@
 	    (setq v
 		  (cond
 		   ((stringp value)
-		    value)
+		    (if (and (stringp match)
+			     (gnus-string-match-p "\\\\[&[:digit:]]" value)
+			     (match-beginning 1))
+			(gnus-match-substitute-replacement value nil nil group)
+		      value))
 		   ((or (symbolp value)
 			(functionp value))
 		    (cond ((functionp value)
--- a/lisp/gnus/gnus-srvr.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus-srvr.el	Sat Nov 06 10:28:31 2010 +0200
@@ -34,6 +34,8 @@
 (require 'gnus-int)
 (require 'gnus-range)
 
+(autoload 'gnus-group-make-nnir-group "nnir")
+
 (defcustom gnus-server-mode-hook nil
   "Hook run in `gnus-server-mode' buffers."
   :group 'gnus-server
@@ -165,6 +167,8 @@
 
     "g" gnus-server-regenerate-server
 
+    "G" gnus-group-make-nnir-group
+
     "z" gnus-server-compact-server
 
     "\C-c\C-i" gnus-info-find-node
--- a/lisp/gnus/gnus-start.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus-start.el	Sat Nov 06 10:28:31 2010 +0200
@@ -775,14 +775,6 @@
     (if gnus-agent
 	(gnus-agentize))
 
-    (when gnus-simple-splash
-      (setq gnus-simple-splash nil)
-      (cond
-       ((featurep 'xemacs)
-	(gnus-xmas-splash))
-       (window-system
-	(gnus-x-splash))))
-
     (let ((level (and (numberp arg) (> arg 0) arg))
 	  did-connect)
       (unwind-protect
@@ -1108,53 +1100,53 @@
 			'gnus-subscribe-zombies)
 		  t)
 		 (t gnus-check-new-newsgroups))))
-    (unless (gnus-check-first-time-used)
-      (if (or (consp check)
-	      (eq check 'ask-server))
-	  ;; Ask the server for new groups.
-	  (gnus-ask-server-for-new-groups)
-	;; Go through the active hashtb and look for new groups.
-	(let ((groups 0)
-	      group new-newsgroups)
-	  (gnus-message 5 "Looking for new newsgroups...")
-	  (unless gnus-have-read-active-file
-	    (gnus-read-active-file))
-	  (setq gnus-newsrc-last-checked-date (message-make-date))
-	  (unless gnus-killed-hashtb
-	    (gnus-make-hashtable-from-killed))
-	  ;; Go though every newsgroup in `gnus-active-hashtb' and compare
-	  ;; with `gnus-newsrc-hashtb' and `gnus-killed-hashtb'.
-	  (mapatoms
-	   (lambda (sym)
-	     (if (or (null (setq group (symbol-name sym)))
-		     (not (boundp sym))
-		     (null (symbol-value sym))
-		     (gnus-gethash group gnus-killed-hashtb)
-		     (gnus-gethash group gnus-newsrc-hashtb))
-		 ()
-	       (let ((do-sub (gnus-matches-options-n group)))
-		 (cond
-		  ((eq do-sub 'subscribe)
-		   (setq groups (1+ groups))
-		   (gnus-sethash group group gnus-killed-hashtb)
-		   (gnus-call-subscribe-functions
-		    gnus-subscribe-options-newsgroup-method group))
-		  ((eq do-sub 'ignore)
-		   nil)
-		  (t
-		   (setq groups (1+ groups))
-		   (gnus-sethash group group gnus-killed-hashtb)
-		   (if gnus-subscribe-hierarchical-interactive
-		       (push group new-newsgroups)
-		     (gnus-call-subscribe-functions
-		      gnus-subscribe-newsgroup-method group)))))))
-	   gnus-active-hashtb)
-	  (when new-newsgroups
-	    (gnus-subscribe-hierarchical-interactive new-newsgroups))
-	  (if (> groups 0)
-	      (gnus-message 5 "%d new newsgroup%s arrived."
-			    groups (if (> groups 1) "s have" " has"))
-	    (gnus-message 5 "No new newsgroups.")))))))
+    (if (or (consp check)
+            (eq check 'ask-server))
+        ;; Ask the server for new groups.
+        (gnus-ask-server-for-new-groups)
+      ;; Go through the active hashtb and look for new groups.
+      (let ((groups 0)
+            group new-newsgroups)
+        (gnus-message 5 "Looking for new newsgroups...")
+        (unless gnus-have-read-active-file
+          (gnus-read-active-file))
+        (setq gnus-newsrc-last-checked-date (message-make-date))
+        (unless gnus-killed-hashtb
+          (gnus-make-hashtable-from-killed))
+        ;; Go though every newsgroup in `gnus-active-hashtb' and compare
+        ;; with `gnus-newsrc-hashtb' and `gnus-killed-hashtb'.
+        (mapatoms
+         (lambda (sym)
+           (if (or (null (setq group (symbol-name sym)))
+                   (not (boundp sym))
+                   (null (symbol-value sym))
+                   (gnus-gethash group gnus-killed-hashtb)
+                   (gnus-gethash group gnus-newsrc-hashtb))
+               ()
+             (let ((do-sub (gnus-matches-options-n group)))
+               (cond
+                ((eq do-sub 'subscribe)
+                 (setq groups (1+ groups))
+                 (gnus-sethash group group gnus-killed-hashtb)
+                 (gnus-call-subscribe-functions
+                  gnus-subscribe-options-newsgroup-method group))
+                ((eq do-sub 'ignore)
+                 nil)
+                (t
+                 (setq groups (1+ groups))
+                 (gnus-sethash group group gnus-killed-hashtb)
+                 (if gnus-subscribe-hierarchical-interactive
+                     (push group new-newsgroups)
+                   (gnus-call-subscribe-functions
+                    gnus-subscribe-newsgroup-method group)))))))
+         gnus-active-hashtb)
+        (when new-newsgroups
+          (gnus-subscribe-hierarchical-interactive new-newsgroups))
+        (if (> groups 0)
+            (gnus-message 5 "%d new newsgroup%s arrived."
+                          groups (if (> groups 1) "s have" " has"))
+          (gnus-message 5 "No new newsgroups."))
+	groups))))
 
 (defun gnus-matches-options-n (group)
   ;; Returns `subscribe' if the group is to be unconditionally
@@ -1252,54 +1244,7 @@
       (gnus-message 5 "No new newsgroups"))
     (when got-new
       (setq gnus-newsrc-last-checked-date new-date))
-    got-new))
-
-(defun gnus-check-first-time-used ()
-  (catch 'ended
-    ;; First check if any of the following files exist.  If they do,
-    ;; it's not the first time the user has used Gnus.
-    (dolist (file (list (concat gnus-current-startup-file ".el")
-			(concat gnus-current-startup-file ".eld")
-			(concat gnus-startup-file ".el")
-			(concat gnus-startup-file ".eld")))
-      (when (file-exists-p file)
-	(throw 'ended nil)))
-    (gnus-message 6 "First time user; subscribing you to default groups")
-    (unless (gnus-read-active-file-p)
-      (let ((gnus-read-active-file t))
-	(gnus-read-active-file)))
-    (setq gnus-newsrc-last-checked-date (message-make-date))
-    ;; Subscribe to the default newsgroups.
-    (let ((groups (or gnus-default-subscribed-newsgroups
-		      gnus-backup-default-subscribed-newsgroups))
-	  group)
-      (if (eq groups t)
-	  ;; If t, we subscribe (or not) all groups as if they were new.
-	  (mapatoms
-	   (lambda (sym)
-	     (when (setq group (symbol-name sym))
-	       (let ((do-sub (gnus-matches-options-n group)))
-		 (cond
-		  ((eq do-sub 'subscribe)
-		   (gnus-sethash group group gnus-killed-hashtb)
-		   (gnus-call-subscribe-functions
-		    gnus-subscribe-options-newsgroup-method group))
-		  ((eq do-sub 'ignore)
-		   nil)
-		  (t
-		   (push group gnus-killed-list))))))
-	   gnus-active-hashtb)
-	(dolist (group groups)
-	  ;; Only subscribe the default groups that are activated.
-	  (when (gnus-active group)
-	    (gnus-group-change-level
-	     group gnus-level-default-subscribed gnus-level-killed)))
-	(with-current-buffer gnus-group-buffer
-	  ;; Don't error if the group already exists. This happens when a
-	  ;; first-time user types 'F'. -- didier
-	  (gnus-group-make-help-group t))
-	(when gnus-novice-user
-	  (gnus-message 7 "`A k' to list killed groups"))))))
+    new-newsgroups))
 
 (defun gnus-subscribe-group (group &optional previous method)
   "Subscribe GROUP and put it after PREVIOUS."
--- a/lisp/gnus/gnus-sum.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus-sum.el	Sat Nov 06 10:28:31 2010 +0200
@@ -2169,8 +2169,7 @@
   "v" gnus-version
   "d" gnus-summary-describe-group
   "h" gnus-summary-describe-briefly
-  "i" gnus-info-find-node
-  "C" gnus-group-fetch-control)
+  "i" gnus-info-find-node)
 
 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
   "e" gnus-summary-expire-articles
@@ -2747,9 +2746,6 @@
 	 ["Original sort" gnus-summary-sort-by-original t])
 	("Help"
 	 ["Describe group" gnus-summary-describe-group t]
-	 ["Fetch control message" gnus-group-fetch-control
-	  ,@(if (featurep 'xemacs) nil
-	      '(:help "Display the archived control message for the current group"))]
 	 ["Read manual" gnus-info-find-node t])
 	("Modes"
 	 ["Pick and read" gnus-pick-mode t]
@@ -4510,7 +4506,7 @@
 	(while (not (eobp))
 	  (ignore-errors
 	    (setq article (read (current-buffer))
-		  header (gnus-nov-parse-line article dependencies)))
+		  header (gnus-nov-parse-line article dependencies t)))
 	  (when header
 	    (with-current-buffer gnus-summary-buffer
 	      (push header gnus-newsgroup-headers)
@@ -7600,6 +7596,7 @@
 		       (not (get-buffer gnus-original-article-buffer))))
 	      (and (not gnus-single-article-buffer)
 		   (or (null gnus-current-article)
+		       (not (get-buffer gnus-original-article-buffer))
 		       (not (eq gnus-current-article article))))
 	      force)
 	  ;; The requested article is different from the current article.
@@ -8303,10 +8300,6 @@
     (gnus-summary-limit articles))
   (gnus-summary-position-point))
 
-(defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
-(make-obsolete
- 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread "Emacs 20.4")
-
 (defun gnus-summary-limit-to-unread (&optional all)
   "Limit the summary buffer to articles that are not marked as read.
 If ALL is non-nil, limit strictly to unread articles."
@@ -8397,10 +8390,6 @@
     (gnus-summary-limit gnus-newsgroup-replied))
   (gnus-summary-position-point))
 
-(defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
-(make-obsolete 'gnus-summary-delete-marked-with
-	       'gnus-summary-limit-exclude-marks "Emacs 20.4")
-
 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
   "Exclude articles that are marked with MARKS (e.g. \"DK\").
 If REVERSE, limit the summary buffer to articles that are marked
@@ -8456,7 +8445,11 @@
 article."
   (interactive (list (mail-header-id (gnus-summary-article-header))))
   (let ((articles (gnus-articles-in-thread
-		   (gnus-id-to-thread (gnus-root-id id)))))
+		   (gnus-id-to-thread (gnus-root-id id))))
+	;;we REALLY want the whole thread---this prevents cut-threads
+	;;from removing the thread we want to include.
+	(gnus-fetch-old-headers nil)
+	(gnus-build-sparse-threads nil))
     (prog1
 	(gnus-summary-limit (nconc articles gnus-newsgroup-limit))
       (gnus-summary-limit-include-matching-articles
@@ -8843,7 +8836,13 @@
 variable."
   (interactive "P")
   (let ((id (mail-header-id (gnus-summary-article-header)))
+	(subject (gnus-simplify-subject
+		  (mail-header-subject (gnus-summary-article-header))))
+	(refs (split-string (or (mail-header-references
+				 (gnus-summary-article-header)) "")))
 	(gnus-summary-ignore-duplicates t)
+	(gnus-inhibit-demon t)
+	(gnus-read-all-available-headers t)
 	(limit (if limit (prefix-numeric-value limit)
 		 gnus-refer-thread-limit)))
     (if  (gnus-check-backend-function 'request-thread gnus-newsgroup-name)
@@ -8870,6 +8869,11 @@
 	  (gnus-message 5 "Fetching headers for %s...done"
 			gnus-newsgroup-name))))
     (when (eq gnus-headers-retrieved-by 'nov)
+      ;; might as well restrict the headers to the relevant ones. this
+      ;; should save time when building threads.
+      (with-current-buffer nntp-server-buffer
+	(goto-char (point-min))
+	(keep-lines (regexp-opt (append refs (list id subject)))))
       (gnus-build-all-threads))
     (gnus-summary-limit-include-thread id)))
 
@@ -9341,41 +9345,26 @@
   (ps-despool filename))
 
 (defun gnus-print-buffer ()
-  (let ((buffer (generate-new-buffer " *print*")))
-    (unwind-protect
-	(progn
-	  (copy-to-buffer buffer (point-min) (point-max))
-	  (set-buffer buffer)
-	  (gnus-remove-text-with-property 'gnus-decoration)
-	  (when (gnus-visual-p 'article-highlight 'highlight)
-	    ;; Copy-to-buffer doesn't copy overlay.  So redo
-	    ;; highlight.
-	    (let ((gnus-article-buffer buffer))
-	      (gnus-article-highlight-citation t)
-	      (gnus-article-highlight-signature)
-	      (gnus-article-emphasize)
-	      (gnus-article-delete-invisible-text)))
-	  (let ((ps-left-header
-		 (list
-		  (concat "("
-			  (gnus-summary-print-truncate-and-quote
-			   (mail-header-subject gnus-current-headers)
-			   66) ")")
-		  (concat "("
-			  (gnus-summary-print-truncate-and-quote
-			   (mail-header-from gnus-current-headers)
-			   45) ")")))
-		(ps-right-header
-		 (list
-		  "/pagenumberstring load"
-		  (concat "("
-			  (mail-header-date gnus-current-headers) ")"))))
-	    (gnus-run-hooks 'gnus-ps-print-hook)
-	    (save-excursion
-	      (if ps-print-color-p
-		  (ps-spool-buffer-with-faces)
-		(ps-spool-buffer)))))
-      (kill-buffer buffer))))
+  (let ((ps-left-header
+	 (list
+	  (concat "("
+		  (gnus-summary-print-truncate-and-quote
+		   (mail-header-subject gnus-current-headers)
+		   66) ")")
+	  (concat "("
+		  (gnus-summary-print-truncate-and-quote
+		   (mail-header-from gnus-current-headers)
+		   45) ")")))
+	(ps-right-header
+	 (list
+	  "/pagenumberstring load"
+	  (concat "("
+		  (mail-header-date gnus-current-headers) ")"))))
+    (gnus-run-hooks 'gnus-ps-print-hook)
+    (save-excursion
+      (if ps-print-color-p
+	  (ps-spool-buffer-with-faces)
+	(ps-spool-buffer)))))
 
 (defun gnus-summary-show-complete-article ()
   "Show a complete version of the current article.
@@ -9404,9 +9393,10 @@
 If ARG (the prefix) is a number, show the article with the charset
 defined in `gnus-summary-show-article-charset-alist', or the charset
 input.
-If ARG (the prefix) is non-nil and not a number, show the raw article
-without any article massaging functions being run.  Normally, the key
-strokes are `C-u g'."
+If ARG (the prefix) is non-nil and not a number, show the article,
+but without running any of the article treatment functions
+article.  Normally, the keystroke is `C-u g'.  When using `C-u
+C-u g', show the raw article."
   (interactive "P")
   (cond
    ((numberp arg)
@@ -9448,7 +9438,9 @@
    ((not arg)
     ;; Select the article the normal way.
     (gnus-summary-select-article nil 'force))
-   (t
+   ((or (equal arg '(16))
+	(eq arg t))
+    ;; C-u C-u g
     ;; We have to require this here to make sure that the following
     ;; dynamic binding isn't shadowed by autoloading.
     (require 'gnus-async)
@@ -9466,6 +9458,9 @@
 	  ;; Set it to nil for safety reason.
 	  (setq gnus-article-mime-handle-alist nil)
 	  (setq gnus-article-mime-handles nil)))
+      (gnus-summary-select-article nil 'force)))
+   (t
+    (let ((gnus-inhibit-article-treatments t))
       (gnus-summary-select-article nil 'force))))
   (gnus-summary-goto-subject gnus-current-article)
   (gnus-summary-position-point))
--- a/lisp/gnus/gnus-util.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus-util.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1651,10 +1651,16 @@
 		       initial-input history def))
 
 
-(autoload 'iswitchb-read-buffer "iswitchb")
+(declare-function iswitchb-read-buffer "iswitchb"
+		  (prompt &optional default require-match start matches-set))
+(defvar iswitchb-temp-buflist)
+
 (defun gnus-iswitchb-completing-read (prompt collection &optional require-match
                                             initial-input history def)
   "`iswitchb' based completing-read function."
+  ;; Make sure iswitchb is loaded before we let-bind its variables.
+  ;; If it is loaded inside the let, variables can become unbound afterwards.
+  (require 'iswitchb)
   (let ((iswitchb-make-buflist-hook
          (lambda ()
            (setq iswitchb-temp-buflist
@@ -1667,11 +1673,11 @@
                    (nreverse filtered-choices))))))
     (unwind-protect
         (progn
-          (when (not iswitchb-mode)
-            (add-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup))
+          (or iswitchb-mode
+	      (add-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup))
           (iswitchb-read-buffer prompt def require-match))
-      (when (not iswitchb-mode)
-        (remove-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup)))))
+      (or iswitchb-mode
+	  (remove-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup)))))
 
 (defun gnus-graphic-display-p ()
   (if (featurep 'xemacs)
@@ -1758,14 +1764,16 @@
 	(kill-buffer buf))
     tchar))
 
-(if (fboundp 'select-frame-set-input-focus)
+(if (featurep 'emacs)
     (defalias 'gnus-select-frame-set-input-focus 'select-frame-set-input-focus)
-  ;; XEmacs 21.4, SXEmacs
-  (defun gnus-select-frame-set-input-focus (frame)
-    "Select FRAME, raise it, and set input focus, if possible."
-    (raise-frame frame)
-    (select-frame frame)
-    (focus-frame frame)))
+  (if (fboundp 'select-frame-set-input-focus)
+      (defalias 'gnus-select-frame-set-input-focus 'select-frame-set-input-focus)
+    ;; XEmacs 21.4, SXEmacs
+    (defun gnus-select-frame-set-input-focus (frame)
+      "Select FRAME, raise it, and set input focus, if possible."
+      (raise-frame frame)
+      (select-frame frame)
+      (focus-frame frame))))
 
 (defun gnus-frame-or-window-display-name (object)
   "Given a frame or window, return the associated display name.
@@ -1974,6 +1982,44 @@
                    image)))
       image)))
 
+(defun gnus-list-memq-of-list (elements list)
+  "Return non-nil if any of the members of ELEMENTS are in LIST."
+  (let ((found nil))
+    (dolist (elem elements)
+      (setq found (or found
+		      (memq elem list))))
+    found))
+
+(eval-and-compile
+  (cond
+   ((fboundp 'match-substitute-replacement)
+    (defalias 'gnus-match-substitute-replacement 'match-substitute-replacement))
+   (t
+    (defun gnus-match-substitute-replacement (replacement &optional fixedcase literal string subexp)
+      "Return REPLACEMENT as it will be inserted by `replace-match'.
+In other words, all back-references in the form `\\&' and `\\N'
+are substituted with actual strings matched by the last search.
+Optional FIXEDCASE, LITERAL, STRING and SUBEXP have the same
+meaning as for `replace-match'.
+
+This is the definition of match-substitute-replacement in subr.el from GNU Emacs."
+      (let ((match (match-string 0 string)))
+	(save-match-data
+	  (set-match-data (mapcar (lambda (x)
+				    (if (numberp x)
+					(- x (match-beginning 0))
+				      x))
+				  (match-data t)))
+	  (replace-match replacement fixedcase literal match subexp)))))))
+
+(if (fboundp 'string-match-p)
+    (defalias 'gnus-string-match-p 'string-match-p)
+  (defsubst gnus-string-match-p (regexp string &optional start)
+    "\
+Same as `string-match' except this function does not change the match data."
+    (save-match-data
+      (string-match regexp string start))))
+
 (provide 'gnus-util)
 
 ;;; gnus-util.el ends here
--- a/lisp/gnus/gnus.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/gnus.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,8 +1,8 @@
 ;;; gnus.el --- a newsreader for GNU Emacs
 
-;; Copyright (C) 1987, 1988, 1989, 1990, 1993, 1994, 1995, 1996, 1997, 1998,
-;;   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1987, 1988, 1989, 1990, 1993, 1994, 1995, 1996, 1997,
+;;   1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+;;   2010  Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;;	Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -308,9 +308,6 @@
   :group 'gnus-start
   :type 'boolean)
 
-(unless (fboundp 'gnus-group-remove-excess-properties)
-  (defalias 'gnus-group-remove-excess-properties 'ignore))
-
 (unless (featurep 'gnus-xmas)
   (defalias 'gnus-make-overlay 'make-overlay)
   (defalias 'gnus-delete-overlay 'delete-overlay)
@@ -353,7 +350,6 @@
 		     (list str))
 	    line)))
     (defalias 'gnus-mode-line-buffer-identification 'identity))
-  (defalias 'gnus-characterp 'numberp)
   (defalias 'gnus-deactivate-mark 'deactivate-mark)
   (defalias 'gnus-window-edges 'window-edges)
   (defalias 'gnus-key-press-event-p 'numberp)
@@ -921,7 +917,8 @@
 ;;; Gnus buffers
 ;;;
 
-(defvar gnus-buffers nil)
+(defvar gnus-buffers nil
+  "List of buffers handled by Gnus.")
 
 (defun gnus-get-buffer-create (name)
   "Do the same as `get-buffer-create', but store the created buffer."
@@ -953,7 +950,8 @@
 
 ;;; Splash screen.
 
-(defvar gnus-group-buffer "*Group*")
+(defvar gnus-group-buffer "*Group*"
+  "Name of the Gnus group buffer.")
 
 (defface gnus-splash
   '((((class color)
@@ -992,8 +990,6 @@
 	(while (search-forward "\t" nil t)
 	  (replace-match "        " t t))))))
 
-(defvar gnus-simple-splash nil)
-
 ;;(format "%02x%02x%02x" 114 66 20) "724214"
 
 (defvar gnus-logo-color-alist
@@ -1033,50 +1029,47 @@
   "Insert startup message in current buffer."
   ;; Insert the message.
   (erase-buffer)
-  (cond
-   ((and
-     (fboundp 'find-image)
-     (display-graphic-p)
-     ;; Make sure the library defining `image-load-path' is loaded
-     ;; (`find-image' is autoloaded) (and discard the result).  Else, we may
-     ;; get "defvar ignored because image-load-path is let-bound" when calling
-     ;; `find-image' below.
-     (or (find-image '(nil (:type xpm :file "gnus.xpm"))) t)
-     (let* ((data-directory (nnheader-find-etc-directory "images/gnus"))
-	    (image-load-path (cond (data-directory
-				    (list data-directory))
-				   ((boundp 'image-load-path)
-				    (symbol-value 'image-load-path))
-				   (t load-path)))
-	    (image (find-image
-		    `((:type xpm :file "gnus.xpm"
-			     :color-symbols
-			     (("thing" . ,(car gnus-logo-colors))
-			      ("shadow" . ,(cadr gnus-logo-colors))
-			      ("oort" . "#eeeeee")
-			      ("background" . ,(face-background 'default))))
-		      (:type svg :file "gnus.svg")
-		      (:type png :file "gnus.png")
-		      (:type pbm :file "gnus.pbm"
-			     ;; Account for the pbm's blackground.
-			     :background ,(face-foreground 'gnus-splash)
-			     :foreground ,(face-background 'default))
-		      (:type xbm :file "gnus.xbm"
-			     ;; Account for the xbm's blackground.
-			     :background ,(face-foreground 'gnus-splash)
-			     :foreground ,(face-background 'default))))))
-       (when image
-	 (let ((size (image-size image)))
-	   (insert-char ?\n (max 0 (round (- (window-height)
-					     (or y (cdr size)) 1) 2)))
-	   (insert-char ?\  (max 0 (round (- (window-width)
-					     (or x (car size))) 2)))
-	   (insert-image image))
-	 (setq gnus-simple-splash nil)
-	 t))))
-   (t
+  (unless (and
+           (fboundp 'find-image)
+           (display-graphic-p)
+           ;; Make sure the library defining `image-load-path' is
+           ;; loaded (`find-image' is autoloaded) (and discard the
+           ;; result).  Else, we may get "defvar ignored because
+           ;; image-load-path is let-bound" when calling `find-image'
+           ;; below.
+           (or (find-image '(nil (:type xpm :file "gnus.xpm"))) t)
+           (let* ((data-directory (nnheader-find-etc-directory "images/gnus"))
+                  (image-load-path (cond (data-directory
+                                          (list data-directory))
+                                         ((boundp 'image-load-path)
+                                          (symbol-value 'image-load-path))
+                                         (t load-path)))
+                  (image (find-image
+                          `((:type xpm :file "gnus.xpm"
+                                   :color-symbols
+                                   (("thing" . ,(car gnus-logo-colors))
+                                    ("shadow" . ,(cadr gnus-logo-colors))))
+                            (:type svg :file "gnus.svg")
+                            (:type png :file "gnus.png")
+                            (:type pbm :file "gnus.pbm"
+                                   ;; Account for the pbm's background.
+                                   :background ,(face-foreground 'gnus-splash)
+                                   :foreground ,(face-background 'default))
+                            (:type xbm :file "gnus.xbm"
+                                   ;; Account for the xbm's background.
+                                   :background ,(face-foreground 'gnus-splash)
+                                   :foreground ,(face-background 'default))))))
+             (when image
+               (let ((size (image-size image)))
+                 (insert-char ?\n (max 0 (round (- (window-height)
+                                                   (or y (cdr size)) 1) 2)))
+                 (insert-char ?\  (max 0 (round (- (window-width)
+                                                   (or x (car size))) 2)))
+                 (insert-image image))
+	       (goto-char (point-min))
+               t)))
     (insert
-     (format "              %s
+     (format "
 	  _    ___ _             _
 	  _ ___ __ ___  __    _ ___
 	  __   _     ___    __  ___
@@ -1095,8 +1088,7 @@
 	    _
 	  __
 
-"
-	     ""))
+"))
     ;; And then hack it.
     (gnus-indent-rigidly (point-min) (point-max)
 			 (/ (max (- (window-width) (or x 46)) 0) 2))
@@ -1108,10 +1100,9 @@
       (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n)))
     ;; Fontify some.
     (put-text-property (point-min) (point-max) 'face 'gnus-splash)
-    (setq gnus-simple-splash t)))
-  (goto-char (point-min))
-  (setq mode-line-buffer-identification (concat " " gnus-version))
-  (set-buffer-modified-p t))
+    (goto-char (point-min))
+    (setq mode-line-buffer-identification (concat " " gnus-version))
+    (set-buffer-modified-p t)))
 
 (eval-when (load)
   (let ((command (format "%s" this-command)))
@@ -1267,15 +1258,6 @@
 If you want to change servers, you should use `gnus-select-method'.
 See the documentation to that variable.")
 
-;; Don't touch this variable.
-(defvar gnus-nntp-service "nntp"
-  "NNTP service name (\"nntp\" or 119).
-This is an obsolete variable, which is scarcely used.  If you use an
-nntp server for your newsgroup and want to change the port number
-used to 899, you would say something along these lines:
-
- (setq gnus-select-method '(nntp \"my.nntp.server\" (nntp-port-number 899)))")
-
 (defcustom gnus-nntpserver-file "/etc/nntpserver"
   "A file with only the name of the nntp server in it."
   :group 'gnus-files
@@ -1299,20 +1281,11 @@
 ;;;###autoload  (custom-autoload 'gnus-select-method "gnus"))
 
 (defcustom gnus-select-method
-  (condition-case nil
-      (nconc
-       (list 'nntp (or (condition-case nil
-			   (gnus-getenv-nntpserver)
-			 (error nil))
-		       (when (and gnus-default-nntp-server
-				  (not (string= gnus-default-nntp-server "")))
-			 gnus-default-nntp-server)
-		       "news"))
-       (if (or (null gnus-nntp-service)
-	       (equal gnus-nntp-service "nntp"))
-	   nil
-	 (list gnus-nntp-service)))
-    (error nil))
+  (list 'nntp (or (gnus-getenv-nntpserver)
+                  (when (and gnus-default-nntp-server
+                             (not (string= gnus-default-nntp-server "")))
+                    gnus-default-nntp-server)
+                  "news"))
   "Default method for selecting a newsgroup.
 This variable should be a list, where the first element is how the
 news is to be fetched, the second is the address.
@@ -1397,14 +1370,14 @@
 non-numeric prefix - `C-u M-x gnus', in short."
   :group 'gnus-server
   :type '(repeat string))
+(make-obsolete-variable 'gnus-secondary-servers 'gnus-select-method "24.1")
 
 (defcustom gnus-nntp-server nil
-  "*The name of the host running the NNTP server.
-This variable is semi-obsolete.  Use the `gnus-select-method'
-variable instead."
+  "The name of the host running the NNTP server."
   :group 'gnus-server
   :type '(choice (const :tag "disable" nil)
 		 string))
+(make-obsolete-variable 'gnus-nntp-server 'gnus-select-method "24.1")
 
 (defcustom gnus-secondary-select-methods nil
   "A list of secondary methods that will be used for reading news.
@@ -1418,11 +1391,6 @@
   :group 'gnus-server
   :type '(repeat gnus-select-method))
 
-(defvar gnus-backup-default-subscribed-newsgroups
-  '("news.announce.newusers" "news.groups.questions" "gnu.emacs.gnus")
-  "Default default new newsgroups the first time Gnus is run.
-Should be set in paths.el, and shouldn't be touched by the user.")
-
 (defcustom gnus-local-domain nil
   "Local domain name without a host name.
 The DOMAINNAME environment variable is used instead if it is defined.
@@ -1466,14 +1434,6 @@
 					(nnweb "refer" (nnweb-type google)))
 				 gnus-select-method))))
 
-(defcustom gnus-group-fetch-control-use-browse-url nil
-  "*Non-nil means that control messages are displayed using `browse-url'.
-Otherwise they are fetched with ange-ftp and displayed in an ephemeral
-group."
-  :version "22.1"
-  :group 'gnus-group-various
-  :type 'boolean)
-
 (defcustom gnus-use-cross-reference t
   "*Non-nil means that cross referenced articles will be marked as read.
 If nil, ignore cross references.  If t, mark articles as read in
@@ -1503,7 +1463,7 @@
 		 integer))
 
 (defcustom gnus-use-long-file-name (not (memq system-type '(usg-unix-v)))
-  "*Non-nil means that the default name of a file to save articles in is the group name.
+  "Non-nil means that the default name of a file to save articles in is the group name.
 If it's nil, the directory form of the group name is used instead.
 
 If this variable is a list, and the list contains the element
@@ -1513,8 +1473,8 @@
 will not be used for kill files.
 
 Note that the default for this variable varies according to what system
-type you're using.  On `usg-unix-v' and `xenix' this variable defaults
-to nil while on all other systems it defaults to t."
+type you're using.  On `usg-unix-v' this variable defaults to nil while
+on all other systems it defaults to t."
   :group 'gnus-start
   :type '(radio (sexp :format "Non-nil\n"
 		      :match (lambda (widget value)
@@ -2814,7 +2774,8 @@
      ("gnus-cite" :interactive t
       gnus-article-highlight-citation gnus-article-hide-citation-maybe
       gnus-article-hide-citation gnus-article-fill-cited-article
-      gnus-article-hide-citation-in-followups)
+      gnus-article-hide-citation-in-followups
+      gnus-article-fill-cited-long-lines)
      ("gnus-kill" gnus-kill gnus-apply-kill-file-internal
       gnus-kill-file-edit-file gnus-kill-file-raise-followups-to-author
       gnus-execute gnus-expunge gnus-batch-kill gnus-batch-score)
@@ -3585,16 +3546,6 @@
 					    gnus-valid-select-methods)))
 		 (equal (nth 1 m1) (nth 1 m2)))))))
 
-(defun gnus-methods-sloppily-equal (m1 m2)
-  ;; Same method.
-  (or
-   (eq m1 m2)
-   ;; Type and name are equal.
-   (and
-    (eq (car m1) (car m2))
-    (equal (cadr m1) (cadr m2))
-    (gnus-sloppily-equal-method-parameters m1 m2))))
-
 (defsubst gnus-sloppily-equal-method-parameters (m1 m2)
   ;; Check parameters for sloppy equalness.
   (let ((p1 (copy-sequence (cddr m1)))
@@ -3623,6 +3574,16 @@
       ;; If p2 now is empty, they were equal.
       (null p2))))
 
+(defun gnus-methods-sloppily-equal (m1 m2)
+  ;; Same method.
+  (or
+   (eq m1 m2)
+   ;; Type and name are equal.
+   (and
+    (eq (car m1) (car m2))
+    (equal (cadr m1) (cadr m2))
+    (gnus-sloppily-equal-method-parameters m1 m2))))
+
 (defun gnus-server-equal (m1 m2)
   "Say whether two methods are equal."
   (let ((m1 (cond ((null m1) gnus-select-method)
--- a/lisp/gnus/mail-source.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/mail-source.el	Sat Nov 06 10:28:31 2010 +0200
@@ -501,6 +501,8 @@
    (t
     value)))
 
+(autoload 'nnheader-message "nnheader")
+
 (defun mail-source-fetch (source callback &optional method)
   "Fetch mail from SOURCE and call CALLBACK zero or more times.
 CALLBACK will be called with the name of the file where (some of)
@@ -594,6 +596,8 @@
 	0)
     (funcall callback mail-source-crash-box info)))
 
+(autoload 'gnus-float-time "gnus-util")
+
 (defvar mail-source-incoming-last-checked-time nil)
 
 (defun mail-source-delete-crash-box ()
@@ -614,7 +618,7 @@
 	  ;; Don't check for old incoming files more than once per day to
 	  ;; save a lot of file accesses.
 	  (when (or (null mail-source-incoming-last-checked-time)
-		    (> (time-to-seconds
+		    (> (gnus-float-time
 			(time-since mail-source-incoming-last-checked-time))
 		       (* 24 60 60)))
 	    (setq mail-source-incoming-last-checked-time (current-time))
--- a/lisp/gnus/message.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/message.el	Sat Nov 06 10:28:31 2010 +0200
@@ -306,7 +306,7 @@
 
 ;;; Start of variables adopted from `message-utils.el'.
 
-(defcustom message-subject-trailing-was-query 'ask
+(defcustom message-subject-trailing-was-query t
   "*What to do with trailing \"(was: <old subject>)\" in subject lines.
 If nil, leave the subject unchanged.  If it is the symbol `ask', query
 the user what do do.  In this case, the subject is matched against
@@ -314,7 +314,7 @@
 `message-subject-trailing-was-query' is t, always strip the trailing
 old subject.  In this case, `message-subject-trailing-was-regexp' is
 used."
-  :version "22.1"
+  :version "24.1"
   :type '(choice (const :tag "never" nil)
 		 (const :tag "always strip" t)
 		 (const ask))
@@ -4498,7 +4498,9 @@
 			 (string= "base64"
 				  (message-fetch-field
 				   "content-transfer-encoding")))))))
-	    (message-insert-courtesy-copy))
+	    (message-insert-courtesy-copy
+	     (with-current-buffer mailbuf
+	       message-courtesy-message)))
           ;; Let's make sure we encoded all the body.
           (assert (save-excursion
                     (goto-char (point-min))
@@ -5939,7 +5941,7 @@
       ;; Check for IDNA
       (message-idna-to-ascii-rhs))))
 
-(defun message-insert-courtesy-copy ()
+(defun message-insert-courtesy-copy (message)
   "Insert a courtesy message in mail copies of combined messages."
   (let (newsgroups)
     (save-excursion
@@ -5949,12 +5951,12 @@
 	  (goto-char (point-max))
 	  (insert "Posted-To: " newsgroups "\n")))
       (forward-line 1)
-      (when message-courtesy-message
+      (when message
 	(cond
-	 ((string-match "%s" message-courtesy-message)
-	  (insert (format message-courtesy-message newsgroups)))
+	 ((string-match "%s" message)
+	  (insert (format message newsgroups)))
 	 (t
-	  (insert message-courtesy-message)))))))
+	  (insert message)))))))
 
 ;;;
 ;;; Setting up a message buffer
--- a/lisp/gnus/mm-decode.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/mm-decode.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,7 @@
 ;;; mm-decode.el --- Functions for decoding MIME things
 
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+;;   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;	MORIOKA Tomohiko <morioka@jaist.ac.jp>
@@ -1251,11 +1251,13 @@
       (setq filename (gnus-map-function mm-file-name-rewrite-functions
 					(file-name-nondirectory filename))))
     (setq file
-          (read-file-name (or prompt
-			      (format "Save MIME part to (default %s): "
-				      (or filename "")))
-                          (or mm-default-directory default-directory)
-			  (or filename "")))
+          (read-file-name
+	   (or prompt
+	       (format "Save MIME part to (default %s): "
+		       (or filename "")))
+	   (or mm-default-directory default-directory)
+	   (expand-file-name (or filename "")
+			     (or mm-default-directory default-directory))))
     (if (file-directory-p file)
 	(setq file (expand-file-name filename file))
       (setq file (expand-file-name
@@ -1324,6 +1326,8 @@
       (let ((coding-system-for-write 'binary))
 	(shell-command-on-region (point-min) (point-max) command nil)))))
 
+(autoload 'gnus-completing-read "gnus-util")
+
 (defun mm-interactively-view-part (handle)
   "Display HANDLE using METHOD."
   (let* ((type (mm-handle-media-type handle))
@@ -1683,6 +1687,7 @@
 		  (start end &optional base-url))
 (declare-function shr-insert-document "shr" (dom))
 (defvar shr-blocked-images)
+(autoload 'gnus-blocked-images "gnus-art")
 
 (defun mm-shr (handle)
   ;; Require since we bind its variables.
--- a/lisp/gnus/mm-util.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/mm-util.el	Sat Nov 06 10:28:31 2010 +0200
@@ -39,6 +39,10 @@
     (require 'timer)))
 
 (defvar mm-mime-mule-charset-alist )
+;; Note this is not presently used on Emacs >= 23, which is good,
+;; since it means standalone message-mode (which requires mml and
+;; hence mml-util) does not load gnus-util.
+(autoload 'gnus-completing-read "gnus-util")
 
 ;; Emulate functions that are not available in every (X)Emacs version.
 ;; The name of a function is prefixed with mm-, like `mm-char-int' for
@@ -202,19 +206,10 @@
     (defalias 'mm-decode-coding-region 'decode-coding-region)
     (defalias 'mm-encode-coding-region 'encode-coding-region)))
 
-;; `string-to-multibyte' is available only in Emacs 22.1 or greater.
-(defalias 'mm-string-to-multibyte
-  (cond
-   ((featurep 'xemacs)
-    'identity)
-   ((fboundp 'string-to-multibyte)
-    'string-to-multibyte)
-   (t
-    (lambda (string)
-      "Return a multibyte string with the same individual chars as STRING."
-      (mapconcat
-       (lambda (ch) (mm-string-as-multibyte (char-to-string ch)))
-       string "")))))
+;; `string-to-multibyte' is available only in Emacs.
+(defalias 'mm-string-to-multibyte (if (featurep 'xemacs)
+				      'identity
+				    'string-to-multibyte))
 
 ;; `char-or-char-int-p' is an XEmacs function, not available in Emacs.
 (eval-and-compile
@@ -272,18 +267,19 @@
 ;; Actually, there should be an `mm-coding-system-mime-charset'.
 (eval-and-compile
   (defalias 'mm-read-coding-system
-    (cond
-     ((fboundp 'read-coding-system)
-      (if (and (featurep 'xemacs)
-	       (<= (string-to-number emacs-version) 21.1))
-	  (lambda (prompt &optional default-coding-system)
-	    (read-coding-system prompt))
-	'read-coding-system))
-     (t (lambda (prompt &optional default-coding-system)
-	  "Prompt the user for a coding system."
-	  (gnus-completing-read
-	   prompt (mapcar (lambda (s) (symbol-name (car s)))
-			  mm-mime-mule-charset-alist)))))))
+    (if (featurep 'emacs) 'read-coding-system
+      (cond
+       ((fboundp 'read-coding-system)
+	(if (and (featurep 'xemacs)
+		 (<= (string-to-number emacs-version) 21.1))
+	    (lambda (prompt &optional default-coding-system)
+	      (read-coding-system prompt))
+	  'read-coding-system))
+       (t (lambda (prompt &optional default-coding-system)
+	    "Prompt the user for a coding system."
+	    (gnus-completing-read
+	     prompt (mapcar (lambda (s) (symbol-name (car s)))
+			    mm-mime-mule-charset-alist))))))))
 
 (defvar mm-coding-system-list nil)
 (defun mm-get-coding-system-list ()
--- a/lisp/gnus/mm-view.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/mm-view.el	Sat Nov 06 10:28:31 2010 +0200
@@ -82,6 +82,8 @@
 ;;; Functions for displaying various formats inline
 ;;;
 
+(autoload 'gnus-rescale-image "gnus-util")
+
 (defun mm-inline-image-emacs (handle)
   (let ((b (point-marker))
 	(inhibit-read-only t))
--- a/lisp/gnus/nndiary.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/nndiary.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1061,9 +1061,9 @@
 		   (file-directory-p dir))
 	  (nndiary-generate-nov-databases-1 dir seen))))
     ;; Do this directory.
-    (let ((files (sort (nnheader-article-to-file-alist dir)
+    (let ((nndiary-files (sort (nnheader-article-to-file-alist dir)
 		       'car-less-than-car)))
-      (if (not files)
+      (if (not nndiary-files)
 	  (let* ((group (nnheader-file-to-group
 			 (directory-file-name dir) nndiary-directory))
 		 (info (cadr (assoc group nndiary-group-alist))))
@@ -1071,11 +1071,11 @@
 	      (setcar info (1+ (cdr info)))))
 	(funcall nndiary-generate-active-function dir)
 	;; Generate the nov file.
-	(nndiary-generate-nov-file dir files)
+	(nndiary-generate-nov-file dir nndiary-files)
 	(unless no-active
 	  (nnmail-save-active nndiary-group-alist nndiary-active-file))))))
 
-(defvar files)
+(defvar nndiary-files) ; dynamically bound in nndiary-generate-nov-databases-1
 (defun nndiary-generate-active-info (dir)
   ;; Update the active info for this group.
   (let* ((group (nnheader-file-to-group
@@ -1084,9 +1084,9 @@
 	 (last (or (caadr entry) 0)))
     (setq nndiary-group-alist (delq entry nndiary-group-alist))
     (push (list group
-		(cons (or (caar files) (1+ last))
+		(cons (or (caar nndiary-files) (1+ last))
 		      (max last
-			   (or (caar (last files))
+			   (or (caar (last nndiary-files))
 			       0))))
 	  nndiary-group-alist)))
 
--- a/lisp/gnus/nndoc.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/nndoc.el	Sat Nov 06 10:28:31 2010 +0200
@@ -918,7 +918,8 @@
 	    (setq body-end (point))
 	    (push (list (incf i) head-begin head-end body-begin body-end
 			(count-lines body-begin body-end))
-		  nndoc-dissection-alist)))))))
+		  nndoc-dissection-alist)))))
+    (setq nndoc-dissection-alist (nreverse nndoc-dissection-alist))))
 
 (defun nndoc-article-begin ()
   (if nndoc-article-begin-function
--- a/lisp/gnus/nnimap.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/nnimap.el	Sat Nov 06 10:28:31 2010 +0200
@@ -44,6 +44,10 @@
 (require 'utf7)
 (require 'tls)
 (require 'parse-time)
+(require 'nnmail)
+
+(eval-when-compile
+  (require 'gnus-sum))
 
 (autoload 'auth-source-forget-user-or-password "auth-source")
 (autoload 'auth-source-user-or-password "auth-source")
@@ -78,6 +82,9 @@
 (defvoo nnimap-split-fancy nil
   "Uses the same syntax as nnmail-split-fancy.")
 
+(defvoo nnimap-unsplittable-articles '(%Deleted %Seen)
+  "Articles with the flags in the list will not be considered when splitting.")
+
 (make-obsolete-variable 'nnimap-split-rule "see `nnimap-split-methods'"
 			"Emacs 24.1")
 
@@ -284,7 +291,7 @@
 	(with-current-buffer buffer
 	  (when (and nnimap-object
 		     (nnimap-last-command-time nnimap-object)
-		     (> (time-to-seconds
+		     (> (gnus-float-time
 			 (time-subtract
 			  now
 			  (nnimap-last-command-time nnimap-object)))
@@ -292,7 +299,8 @@
 			(* 5 60)))
 	    (nnimap-send-command "NOOP")))))))
 
-(declare-function gnutls-negotiate "subr" (fn file &optional arglist fileonly))
+(declare-function gnutls-negotiate "gnutls"
+		  (proc type &optional priority-string trustfiles keyfiles))
 
 (defun nnimap-open-connection (buffer)
   (unless nnimap-keepalive-timer
@@ -379,14 +387,13 @@
 	    ;; connection and start a STARTTLS connection instead.
 	    (cond
 	     ((and (or (and (eq nnimap-stream 'network)
-			    (member "STARTTLS"
-				    (nnimap-capabilities nnimap-object)))
+			    (nnimap-capability "STARTTLS"))
 		       (eq nnimap-stream 'starttls))
 		   (fboundp 'open-gnutls-stream))
 	      (nnimap-command "STARTTLS")
 	      (gnutls-negotiate (nnimap-process nnimap-object) nil))
 	     ((and (eq nnimap-stream 'network)
-		   (member "STARTTLS" (nnimap-capabilities nnimap-object)))
+		   (nnimap-capability "STARTTLS"))
 	      (let ((nnimap-stream 'starttls))
 		(let ((tls-process
 		       (nnimap-open-connection buffer)))
@@ -412,9 +419,18 @@
 				;; physical address.
 				(nnimap-credentials nnimap-address ports)))))
 		  (setq nnimap-object nil)
-		(setq login-result (nnimap-command "LOGIN %S %S"
-						   (car credentials)
-						   (cadr credentials)))
+		(setq login-result
+		      (if (and (nnimap-capability "AUTH=PLAIN")
+			       (nnimap-capability "LOGINDISABLED"))
+			  (nnimap-command
+			   "AUTHENTICATE PLAIN %s"
+			   (base64-encode-string
+			    (format "\000%s\000%s"
+				    (nnimap-quote-specials (car credentials))
+				    (nnimap-quote-specials (cadr credentials)))))
+			(nnimap-command "LOGIN %S %S"
+					(car credentials)
+					(cadr credentials))))
 		(unless (car login-result)
 		  ;; If the login failed, then forget the credentials
 		  ;; that are now possibly cached.
@@ -427,10 +443,20 @@
 		  (delete-process (nnimap-process nnimap-object))
 		  (setq nnimap-object nil))))
 	    (when nnimap-object
-	      (when (member "QRESYNC" (nnimap-capabilities nnimap-object))
+	      (when (nnimap-capability "QRESYNC")
 		(nnimap-command "ENABLE QRESYNC"))
 	      (nnimap-process nnimap-object))))))))
 
+(defun nnimap-quote-specials (string)
+  (with-temp-buffer
+    (insert string)
+    (goto-char (point-min))
+    (while (re-search-forward "[\\\"]" nil t)
+      (forward-char -1)
+      (insert "\\")
+      (forward-char 1))
+    (buffer-string)))
+
 (defun nnimap-find-parameter (parameter elems)
   (let (result)
     (dolist (elem elems)
@@ -533,8 +559,11 @@
 	(delete-region (point) (point-max)))
       t)))
 
+(defun nnimap-capability (capability)
+  (member capability (nnimap-capabilities nnimap-object)))
+
 (defun nnimap-ver4-p ()
-  (member "IMAP4REV1" (nnimap-capabilities nnimap-object)))
+  (nnimap-capability "IMAP4REV1"))
 
 (defun nnimap-get-partial-article (article parts structure)
   (let ((result
@@ -640,7 +669,8 @@
   (let ((result (nnimap-possibly-change-group
 		 ;; Don't SELECT the group if we're going to select it
 		 ;; later, anyway.
-		 (if dont-check
+		 (if (and dont-check
+			  (assoc group nnimap-current-infos))
 		     nil
 		   group)
 		 server))
@@ -669,7 +699,8 @@
 				  1 group "SELECT")))))
 	      (when (and info
 			 marks)
-		(nnimap-update-infos marks (list info)))
+		(nnimap-update-infos marks (list info))
+		(nnimap-store-info info (gnus-active (gnus-info-group info))))
 	      (goto-char (point-max))
 	      (let ((uidnext (nth 5 (car marks))))
 		(setq high (or (if uidnext
@@ -700,8 +731,6 @@
       ;; to examine a mailbox that doesn't exist.  This seems to be
       ;; the only way that allows us to reliably go back to unselected
       ;; state on Courier.
-      (nnimap-command "EXAMINE DOES.NOT.EXIST")
-      (setf (nnimap-group nnimap-object) nil)
       (car (nnimap-command "RENAME %S %S"
 			   (utf7-encode group t) (utf7-encode new-name t))))))
 
@@ -832,8 +861,9 @@
 (defun nnimap-find-article-by-message-id (group message-id)
   (with-current-buffer (nnimap-buffer)
     (erase-buffer)
-    (setf (nnimap-group nnimap-object) nil)
-    (nnimap-send-command "EXAMINE %S" (utf7-encode group t))
+    (unless (equal group (nnimap-group nnimap-object))
+      (setf (nnimap-group nnimap-object) nil)
+      (nnimap-send-command "EXAMINE %S" (utf7-encode group t)))
     (let ((sequence
 	   (nnimap-send-command "UID SEARCH HEADER Message-Id %S" message-id))
 	  article result)
@@ -850,7 +880,7 @@
     (nnimap-command "UID STORE %s +FLAGS.SILENT (\\Deleted)"
 		    (nnimap-article-ranges articles))
     (cond
-     ((member "UIDPLUS" (nnimap-capabilities nnimap-object))
+     ((nnimap-capability "UIDPLUS")
       (nnimap-command "UID EXPUNGE %s"
 		      (nnimap-article-ranges articles))
       t)
@@ -906,9 +936,12 @@
       (nnimap-add-cr)
       (setq message (buffer-substring-no-properties (point-min) (point-max)))
       (with-current-buffer (nnimap-buffer)
+	(erase-buffer)
 	(setq sequence (nnimap-send-command
 			"APPEND %S {%d}" (utf7-encode group t)
 			(length message)))
+	(unless nnimap-streaming
+	  (nnimap-wait-for-connection "^[+]"))
 	(process-send-string (get-buffer-process (current-buffer)) message)
 	(process-send-string (get-buffer-process (current-buffer))
 			     (if (nnimap-newlinep nnimap-object)
@@ -1009,7 +1042,7 @@
     (with-current-buffer (nnimap-buffer)
       (erase-buffer)
       (setf (nnimap-group nnimap-object) nil)
-      (let ((qresyncp (member "QRESYNC" (nnimap-capabilities nnimap-object)))
+      (let ((qresyncp (nnimap-capability "QRESYNC"))
 	    params groups sequences active uidvalidity modseq group)
 	;; Go through the infos and gather the data needed to know
 	;; what and how to request the data.
@@ -1181,7 +1214,8 @@
 	      (setq marks (gnus-info-marks info))
 	      (dolist (type (cdr nnimap-mark-alist))
 		(when (or (not (listp permanent-flags))
-			  (memq (assoc (caddr type) flags) permanent-flags)
+			  (memq (car (assoc (caddr type) flags))
+				permanent-flags)
 			  (memq '%* permanent-flags))
 		  (let ((old-marks (assoc (car type) marks))
 			(new-marks
@@ -1454,12 +1488,14 @@
   (nnimap-wait-for-response sequence)
   (nnimap-parse-response))
 
-(defun nnimap-wait-for-connection ()
+(defun nnimap-wait-for-connection (&optional regexp)
+  (unless regexp
+    (setq regexp "^[*.] .*\n"))
   (let ((process (get-buffer-process (current-buffer))))
     (goto-char (point-min))
     (while (and (memq (process-status process)
 		      '(open run))
-		(not (re-search-forward "^[*.] .*\n" nil t)))
+		(not (re-search-forward regexp nil t)))
       (nnheader-accept-process-output process)
       (goto-char (point-min)))
     (forward-line -1)
@@ -1520,12 +1556,16 @@
 	     (split-string
 	      (buffer-substring
 	       (1+ (point))
-	       (1- (search-forward "]" (line-end-position) 'move)))))
+	       (if (search-forward "]" (line-end-position) 'move)
+		   (1- (point))
+		 (point)))))
 	    ((eql char ?\()
 	     (split-string
 	      (buffer-substring
 	       (1+ (point))
-	       (1- (search-forward ")" (line-end-position) 'move)))))
+	       (if (search-forward ")" (line-end-position) 'move)
+		   (1- (point))
+		 (point)))))
 	    ((eql char ?\")
 	     (forward-char 1)
 	     (buffer-substring
@@ -1593,6 +1633,7 @@
 	  new-articles)
       (erase-buffer)
       (nnimap-command "SELECT %S" nnimap-inbox)
+      (setf (nnimap-group nnimap-object) nnimap-inbox)
       (setq new-articles (nnimap-new-articles (nnimap-get-flags "1:*")))
       (when new-articles
 	(nnimap-fetch-inbox new-articles)
@@ -1645,7 +1686,7 @@
       (cond
        ;; If the server supports it, we now delete the message we have
        ;; just copied over.
-       ((member "UIDPLUS" (nnimap-capabilities nnimap-object))
+       ((nnimap-capability "UIDPLUS")
 	(setq sequence (nnimap-send-command "UID EXPUNGE %s" range)))
        ;; If it doesn't support UID EXPUNGE, then we only expunge if the
        ;; user has configured it.
@@ -1665,9 +1706,8 @@
 (defun nnimap-new-articles (flags)
   (let (new)
     (dolist (elem flags)
-      (when (or (null (cdr elem))
-		(and (not (memq '%Deleted (cdr elem)))
-		     (not (memq '%Seen (cdr elem)))))
+      (unless (gnus-list-memq-of-list nnimap-unsplittable-articles
+				      (cdr elem))
 	(push (car elem) new)))
     (gnus-compress-sequence (nreverse new))))
 
--- a/lisp/gnus/nnir.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/nnir.el	Sat Nov 06 10:28:31 2010 +0200
@@ -32,161 +32,40 @@
 
 ;; TODO: Documentation in the Gnus manual
 
-;; From: Reiner Steib
-;; Subject: Re: Including nnir.el
-;; Newsgroups: gmane.emacs.gnus.general
-;; Message-ID: <v9d5dnp6aq.fsf@marauder.physik.uni-ulm.de>
-;; Date: 2006-06-05 22:49:01 GMT
-;;
-;; On Sun, Jun 04 2006, Sascha Wilde wrote:
-;;
-;; > The one thing most hackers like to forget: Documentation.  By now the
-;; > documentation is only in the comments at the head of the source, I
-;; > would use it as basis to cook up some minimal texinfo docs.
-;; >
-;; > Where in the existing gnus manual would this fit best?
+;; Where in the existing gnus manual would this fit best?
 
-;; Maybe (info "(gnus)Combined Groups") for a general description.
-;; `gnus-group-make-nnir-group' might be described in (info
-;; "(gnus)Foreign Groups") as well.
-
-
-;; The most recent version of this can always be fetched from the Gnus
-;; repository.  See http://www.gnus.org/ for more information.
-
-;; This code is still in the development stage but I'd like other
-;; people to have a look at it.  Please do not hesitate to contact me
-;; with your ideas.
-
-;; What does it do?  Well, it allows you to index your mail using some
-;; search engine (freeWAIS-sf, swish-e and others -- see later),
-;; then type `G G' in the Group buffer and issue a query to the search
-;; engine.  You will then get a buffer which shows all articles
-;; matching the query, sorted by Retrieval Status Value (score).
+;; What does it do?  Well, it allows you to search your mail using
+;; some search engine (imap, namazu, swish-e, gmane and others -- see
+;; later) by typing `G G' in the Group buffer.  You will then get a
+;; buffer which shows all articles matching the query, sorted by
+;; Retrieval Status Value (score).
 
 ;; When looking at the retrieval result (in the Summary buffer) you
 ;; can type `G T' (aka M-x gnus-summary-nnir-goto-thread RET) on an
 ;; article.  You will be teleported into the group this article came
-;; from, showing the thread this article is part of.  (See below for
-;; restrictions.)
-
-;; The Lisp installation is simple: just put this file on your
-;; load-path, byte-compile it, and load it from ~/.gnus or something.
-;; This will install a new command `G G' in your Group buffer for
-;; searching your mail.  Note that you also need to configure a number
-;; of variables, as described below.
+;; from, showing the thread this article is part of.
 
-;; Restrictions:
-;;
-;; * This expects that you use nnml or another one-file-per-message backend,
-;;   because the others doesn't support nnfolder.
-;; * It can only search the mail backend's which are supported by one
-;;   search engine, because of different query languages.
-;; * There are restrictions to the Wais setup.
-;; * There are restrictions to the imap setup.
-;; * gnus-summary-nnir-goto-thread: Fetches whole group first, before
-;;   limiting to the right articles.  This is much too slow, of
-;;   course.  May issue a query for number of articles to fetch; you
-;;   must accept the default of all articles at this point or things
-;;   may break.
-
-;; The Lisp setup involves setting a few variables and setting up the
+;; The Lisp setup may involve setting a few variables and setting up the
 ;; search engine. You can define the variables in the server definition
 ;; like this :
 ;;   (setq gnus-secondary-select-methods '(
 ;;       (nnimap "" (nnimap-address "localhost")
 ;;                  (nnir-search-engine namazu)
 ;;       )))
-;; Or you can define the global ones. The variables set in the mailer-
-;; definition will be used first.
-;; The variable to set is `nnir-search-engine'.  Choose one of the engines
-;; listed in `nnir-engines'.  (Actually `nnir-engines' is an alist,
-;; type `C-h v nnir-engines RET' for more information; this includes
-;; examples for setting `nnir-search-engine', too.)
-;;
-;; The variable nnir-mail-backend isn't used anymore.
-;;
-
-;; You must also set up a search engine.  I'll tell you about the two
-;; search engines currently supported:
+;; The main variable to set is `nnir-search-engine'.  Choose one of
+;; the engines listed in `nnir-engines'.  (Actually `nnir-engines' is
+;; an alist, type `C-h v nnir-engines RET' for more information; this
+;; includes examples for setting `nnir-search-engine', too.)
 
-;; 1. freeWAIS-sf
-;;
-;; As always with freeWAIS-sf, you need a so-called `format file'.  I
-;; use the following file:
-;;
-;; ,-----
-;; | # Kai's format file for freeWAIS-sf for indexing mails.
-;; | # Each mail is in a file, much like the MH format.
-;; |
-;; | # Document separator should never match -- each file is a document.
-;; | record-sep: /^@this regex should never match@$/
-;; |
-;; | # Searchable fields specification.
-;; |
-;; | region: /^[sS]ubject:/ /^[sS]ubject: */
-;; |         subject "Subject header" stemming TEXT BOTH
-;; | end: /^[^ \t]/
-;; |
-;; | region: /^([tT][oO]|[cC][cC]):/ /^([tT][oO]|[cC][cC]): */
-;; |         to "To and Cc headers" SOUNDEX BOTH
-;; | end: /^[^ \t]/
-;; |
-;; | region: /^[fF][rR][oO][mM]:/ /^[fF][rR][oO][mM]: */
-;; |         from "From header" SOUNDEX BOTH
-;; | end: /^[^ \t]/
-;; |
-;; | region: /^$/
-;; |         stemming TEXT GLOBAL
-;; | end: /^@this regex should never match@$/
-;; `-----
-;;
-;; 1998-07-22: waisindex would dump core on me for large articles with
-;; the above settings.  I used /^$/ as the end regex for the global
-;; field.  That seemed to work okay.
+;; If you use one of the local indices (namazu, find-grep, swish) you
+;; must also set up a search engine backend.
 
-;; There is a Perl module called `WAIS.pm' which is available from
-;; CPAN as well as ls6-ftp.cs.uni-dortmund.de:/pub/wais/Perl.  This
-;; module comes with a nifty tool called `makedb', which I use for
-;; indexing.  Here's my `makedb.conf':
-;;
-;; ,-----
-;; | # Config file for makedb
-;; |
-;; | # Global options
-;; | waisindex = /usr/local/bin/waisindex
-;; | wais_opt  = -stem -t fields
-;; | # `-stem' option necessary when `stemming' is specified for the
-;; | # global field in the *.fmt file
-;; |
-;; | # Own variables
-;; | homedir = /home/kai
-;; |
-;; | # The mail database.
-;; | database        = mail
-;; | files           = `find $homedir/Mail -name \*[0-9] -print`
-;; | dbdir           = $homedir/.wais
-;; | limit           = 100
-;; `-----
-;;
-;; The Lisp setup involves the `nnir-wais-*' variables.  The most
-;; difficult to understand variable is probably
-;; `nnir-wais-remove-prefix'.  Here's what it does: the output of
-;; `waissearch' basically contains the file name and the (full)
-;; directory name.  As Gnus works with group names rather than
-;; directory names, the directory name is transformed into a group
-;; name as follows: first, a prefix is removed from the (full)
-;; directory name, then all `/' are replaced with `.'.  The variable
-;; `nnir-wais-remove-prefix' should contain a regex matching exactly
-;; this prefix.  It defaults to `$HOME/Mail/' (note the trailing
-;; slash).
-
-;; 2. Namazu
+;; 1. Namazu
 ;;
 ;; The Namazu backend requires you to have one directory containing all
 ;; index files, this is controlled by the `nnir-namazu-index-directory'
 ;; variable.  To function the `nnir-namazu-remove-prefix' variable must
-;; also be correct, see the documentation for `nnir-wais-remove-prefix'
+;; also be correct, see the documentation for `nnir-namazu-remove-prefix'
 ;; above.
 ;;
 ;; It is particularly important not to pass any any switches to namazu
@@ -225,7 +104,7 @@
 ;; For maximum searching efficiency I have a cron job set to run this
 ;; command every four hours.
 
-;; 3. find-grep
+;; 2. find-grep
 ;;
 ;; The find-grep engine simply runs find(1) to locate eligible
 ;; articles and searches them with grep(1).  This, of course, is much
@@ -281,42 +160,14 @@
 ;; function should return the list of articles as a vector, as
 ;; described above.  Then, you need to register this backend in
 ;; `nnir-engines'.  Then, users can choose the backend by setting
-;; `nnir-search-engine'.
-
-;; Todo, or future ideas:
-
-;; * It should be possible to restrict search to certain groups.
-;;
-;; * There is currently no error checking.
-;;
-;; * The summary buffer display is currently really ugly, with all the
-;;   added information in the subjects.  How could I make this
-;;   prettier?
-;;
-;; * A function which can be called from an nnir summary buffer which
-;;   teleports you into the group the current article came from and
-;;   shows you the whole thread this article is part of.
-;;   Implementation suggestions?
-;;   (1998-07-24: There is now a preliminary implementation, but
-;;   it is much too slow and quite fragile.)
-;;
-;; * Support other mail backends.  In particular, probably quite a few
-;;   people use nnfolder.  How would one go about searching nnfolders
-;;   and producing the right data needed?  The group name and the RSV
-;;   are simple, but what about the article number?
-;;   - The article number is encoded in the `X-Gnus-Article-Number'
-;;     header of each mail.
-;;
-;; * Support compressed mail files.  Probably, just stripping off the
-;;   `.gz' or `.Z' file name extension is sufficient.
-;;
-;; * At least for imap, the query is performed twice.
-;;
-
-;; Have you got other ideas?
+;; `nnir-search-engine' as a server variable.
 
 ;;; Setup Code:
 
+;; For Emacs <22.2 and XEmacs.
+(eval-and-compile
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+
 (require 'nnoo)
 (require 'gnus-group)
 (require 'gnus-sum)
@@ -336,145 +187,27 @@
 
 (gnus-declare-backend "nnir" 'mail)
 
-(defvar nnir-imap-default-search-key "Whole message"
-  "The default IMAP search key for an nnir search. Must be one of
-  the keys in nnir-imap-search-arguments. To use raw imap queries
-  by default set this to \"Imap\"")
-
-(defvar nnir-imap-search-arguments
-  '(("Whole message" . "TEXT")
-    ("Subject" . "SUBJECT")
-    ("To" . "TO")
-    ("From" . "FROM")
-    ("Imap" . ""))
-  "Mapping from user readable keys to IMAP search items for use in nnir")
-
-(defvar nnir-imap-search-other "HEADER %S"
-  "The IMAP search item to use for anything other than
-  nnir-imap-search-arguments. By default this is the name of an
-  email header field")
-
-(defvar nnir-imap-search-argument-history ()
-  "The history for querying search options in nnir")
-
-(defvar nnir-get-article-nov-override-function nil
-  "If non-nil, a function that will be passed each search result.  This
-should return a message's headers in NOV format.
-
-If this variable is nil, or if the provided function returns nil for a search
-result, `gnus-retrieve-headers' will be called instead.")
-
-(defvar nnir-method-default-engines
-  '((nnimap . imap)
-    (nntp . nil))
-  "Alist of default search engines by server method")
-
-;;; Developer Extension Variable:
-
-(defvar nnir-engines
-  `((wais    nnir-run-waissearch
-             ())
-    (imap    nnir-run-imap
-             ((criteria
-	       "Search in"                        ; Prompt
-	       ,(mapcar 'car nnir-imap-search-arguments) ; alist for completing
-	       nil                                ; allow any user input
-	       nil                                ; initial value
-	       nnir-imap-search-argument-history  ; the history to use
-	       ,nnir-imap-default-search-key      ; default
-	       )))
-    (swish++ nnir-run-swish++
-             ((group . "Group spec: ")))
-    (swish-e nnir-run-swish-e
-             ((group . "Group spec: ")))
-    (namazu  nnir-run-namazu
-             ())
-    (find-grep nnir-run-find-grep
-	       ((grep-options . "Grep options: "))))
-  "Alist of supported search engines.
-Each element in the alist is a three-element list (ENGINE FUNCTION ARGS).
-ENGINE is a symbol designating the searching engine.  FUNCTION is also
-a symbol, giving the function that does the search.  The third element
-ARGS is a list of cons pairs (PARAM . PROMPT).  When issuing a query,
-the FUNCTION will issue a query for each of the PARAMs, using PROMPT.
-
-The value of `nnir-search-engine' must be one of the ENGINE symbols.
-For example, use the following line for searching using freeWAIS-sf:
-    (setq nnir-search-engine 'wais)
-Use the following line if you read your mail via IMAP and your IMAP
-server supports searching:
-    (setq nnir-search-engine 'imap)
-Note that you have to set additional variables for most backends.  For
-example, the `wais' backend needs the variables `nnir-wais-program',
-`nnir-wais-database' and `nnir-wais-remove-prefix'.
-
-Add an entry here when adding a new search engine.")
 
 ;;; User Customizable Variables:
 
 (defgroup nnir nil
-  "Search nnmh and nnml groups in Gnus with swish-e, freeWAIS-sf, or EWS."
+  "Search groups in Gnus with assorted seach engines."
   :group 'gnus)
 
-;; Mail backend.
-
-;; TODO:
-;; If `nil', use server parameters to find out which server to search. CCC
-;;
-(defcustom nnir-mail-backend '(nnml "")
-  "*Specifies which backend should be searched.
-More precisely, this is used to determine from which backend to fetch the
-messages found.
-
-This must be equal to an existing server, so maybe it is best to use
-something like the following:
-    (setq nnir-mail-backend (nth 0 gnus-secondary-select-methods))
-The above line works fine if the mail backend you want to search is
-the first element of gnus-secondary-select-methods (`nth' starts counting
-at zero)."
-  :type '(sexp)
+(defcustom nnir-method-default-engines
+  '((nnimap . imap)
+    (nntp . gmane))
+  "*Alist of default search engines keyed by server method"
+  :type '(alist)
   :group 'nnir)
 
-;; Search engine to use.
-
-(defcustom nnir-search-engine 'wais
-  "*The search engine to use.  Must be a symbol.
-See `nnir-engines' for a list of supported engines, and for example
-settings of `nnir-search-engine'."
-  :type '(sexp)
-  :group 'nnir)
-
-;; freeWAIS-sf.
-
-(defcustom nnir-wais-program "waissearch"
-  "*Name of waissearch executable."
+(defcustom nnir-imap-default-search-key "Whole message"
+  "*The default IMAP search key for an nnir search. Must be one of
+  the keys in `nnir-imap-search-arguments'. To use raw imap queries
+  by default set this to \"Imap\""
   :type '(string)
   :group 'nnir)
 
-(defcustom nnir-wais-database (expand-file-name "~/.wais/mail")
-  "*Name of Wais database containing the mail.
-
-Note that this should be a file name without extension.  For example,
-if you have a file /home/john/.wais/mail.fmt, use this:
-    (setq nnir-wais-database \"/home/john/.wais/mail\")
-The string given here is passed to `waissearch -d' as-is."
-  :type '(file)
-  :group 'nnir)
-
-(defcustom nnir-wais-remove-prefix (concat (getenv "HOME") "/Mail/")
-  "*The prefix to remove from each directory name returned by waissearch
-in order to get a group name (albeit with / instead of .).  This is a
-regular expression.
-
-For example, suppose that Wais returns file names such as
-\"/home/john/Mail/mail/misc/42\".  For this example, use the following
-setting:  (setq nnir-wais-remove-prefix \"/home/john/Mail/\")
-Note the trailing slash.  Removing this prefix gives \"mail/misc/42\".
-`nnir' knows to remove the \"/42\" and to replace \"/\" with \".\" to
-arrive at the correct group name, \"mail.misc\"."
-  :type '(regexp)
-  :group 'nnir)
-
 (defcustom nnir-swish++-configuration-file
   (expand-file-name "~/Mail/swish++.conf")
   "*Configuration file for swish++."
@@ -501,8 +234,8 @@
 in order to get a group name (albeit with / instead of .).  This is a
 regular expression.
 
-This variable is very similar to `nnir-wais-remove-prefix', except
-that it is for swish++, not Wais."
+This variable is very similar to `nnir-namazu-remove-prefix', except
+that it is for swish++, not Namazu."
   :type '(regexp)
   :group 'nnir)
 
@@ -552,13 +285,47 @@
 in order to get a group name (albeit with / instead of .).  This is a
 regular expression.
 
-This variable is very similar to `nnir-wais-remove-prefix', except
-that it is for swish-e, not Wais.
+This variable is very similar to `nnir-namazu-remove-prefix', except
+that it is for swish-e, not Namazu.
 
 This could be a server parameter."
   :type '(regexp)
   :group 'nnir)
 
+;; HyREX engine, see <URL:http://ls6-www.cs.uni-dortmund.de/>
+
+(defcustom nnir-hyrex-program "nnir-search"
+  "*Name of the nnir-search executable."
+  :type '(string)
+  :group 'nnir)
+
+(defcustom nnir-hyrex-additional-switches '()
+  "*A list of strings, to be given as additional arguments for nnir-search.
+Note that this should be a list. Ie, do NOT use the following:
+    (setq nnir-hyrex-additional-switches \"-ddl ddl.xml -c nnir\") ; wrong !
+Instead, use this:
+    (setq nnir-hyrex-additional-switches '(\"-ddl\" \"ddl.xml\" \"-c\" \"nnir\"))"
+  :type '(repeat (string))
+  :group 'nnir)
+
+(defcustom nnir-hyrex-index-directory (getenv "HOME")
+  "*Index directory for HyREX."
+  :type '(directory)
+  :group 'nnir)
+
+(defcustom nnir-hyrex-remove-prefix (concat (getenv "HOME") "/Mail/")
+  "*The prefix to remove from each file name returned by HyREX
+in order to get a group name (albeit with / instead of .).
+
+For example, suppose that HyREX returns file names such as
+\"/home/john/Mail/mail/misc/42\".  For this example, use the following
+setting:  (setq nnir-hyrex-remove-prefix \"/home/john/Mail/\")
+Note the trailing slash.  Removing this prefix gives \"mail/misc/42\".
+`nnir' knows to remove the \"/42\" and to replace \"/\" with \".\" to
+arrive at the correct group name, \"mail.misc\"."
+  :type '(directory)
+  :group 'nnir)
+
 ;; Namazu engine, see <URL:http://www.namazu.org/>
 
 (defcustom nnir-namazu-program "namazu"
@@ -587,11 +354,81 @@
   "*The prefix to remove from each file name returned by Namazu
 in order to get a group name (albeit with / instead of .).
 
-This variable is very similar to `nnir-wais-remove-prefix', except
-that it is for Namazu, not Wais."
+For example, suppose that Namazu returns file names such as
+\"/home/john/Mail/mail/misc/42\".  For this example, use the following
+setting:  (setq nnir-namazu-remove-prefix \"/home/john/Mail/\")
+Note the trailing slash.  Removing this prefix gives \"mail/misc/42\".
+`nnir' knows to remove the \"/42\" and to replace \"/\" with \".\" to
+arrive at the correct group name, \"mail.misc\"."
   :type '(directory)
   :group 'nnir)
 
+;; Imap variables
+
+(defvar nnir-imap-search-arguments
+  '(("Whole message" . "TEXT")
+    ("Subject" . "SUBJECT")
+    ("To" . "TO")
+    ("From" . "FROM")
+    ("Imap" . ""))
+  "Mapping from user readable keys to IMAP search items for use in nnir")
+
+(defvar nnir-imap-search-other "HEADER %S"
+  "The IMAP search item to use for anything other than
+  `nnir-imap-search-arguments'. By default this is the name of an
+  email header field")
+
+(defvar nnir-imap-search-argument-history ()
+  "The history for querying search options in nnir")
+
+;;; Developer Extension Variable:
+
+(defvar nnir-engines
+  `((imap    nnir-run-imap
+             ((criteria
+	       "Imap Search in"                   ; Prompt
+	       ,(mapcar 'car nnir-imap-search-arguments) ; alist for completing
+	       nil                                ; allow any user input
+	       nil                                ; initial value
+	       nnir-imap-search-argument-history  ; the history to use
+	       ,nnir-imap-default-search-key      ; default
+	       )))
+    (gmane   nnir-run-gmane
+	     ((author . "Gmane Author: ")))
+    (swish++ nnir-run-swish++
+             ((group . "Swish++ Group spec: ")))
+    (swish-e nnir-run-swish-e
+             ((group . "Swish-e Group spec: ")))
+    (namazu  nnir-run-namazu
+             ())
+    (hyrex   nnir-run-hyrex
+	     ((group . "Hyrex Group spec: ")))
+    (find-grep nnir-run-find-grep
+	       ((grep-options . "Grep options: "))))
+  "Alist of supported search engines.
+Each element in the alist is a three-element list (ENGINE FUNCTION ARGS).
+ENGINE is a symbol designating the searching engine.  FUNCTION is also
+a symbol, giving the function that does the search.  The third element
+ARGS is a list of cons pairs (PARAM . PROMPT).  When issuing a query,
+the FUNCTION will issue a query for each of the PARAMs, using PROMPT.
+
+The value of `nnir-search-engine' must be one of the ENGINE symbols.
+For example, for searching a server using namazu include
+    (nnir-search-engine namazu)
+in the server definition.  Note that you have to set additional
+variables for most backends.  For example, the `namazu' backend
+needs the variables `nnir-namazu-program',
+`nnir-namazu-index-directory' and `nnir-namazu-remove-prefix'.
+
+Add an entry here when adding a new search engine.")
+
+(defvar nnir-get-article-nov-override-function nil
+  "If non-nil, a function that will be passed each search result.  This
+should return a message's headers in NOV format.
+
+If this variable is nil, or if the provided function returns nil for a search
+result, `gnus-retrieve-headers' will be called instead.")
+
 ;;; Internal Variables:
 
 (defvar nnir-current-query nil
@@ -609,43 +446,33 @@
 (defvar nnir-tmp-buffer " *nnir*"
   "Internal: temporary buffer.")
 
+(defvar nnir-search-history ()
+  "Internal: the history for querying search options in nnir")
+
+(defvar nnir-extra-parms nil
+  "Internal: stores request for extra search parms")
+
 ;;; Code:
 
 ;; Gnus glue.
 
-(defun gnus-group-make-nnir-group (extra-parms query)
+(defun gnus-group-make-nnir-group (nnir-extra-parms)
   "Create an nnir group.  Asks for query."
-  (interactive "P\nsQuery: ")
+  (interactive "P")
   (setq nnir-current-query nil
 	nnir-current-server nil
 	nnir-current-group-marked nil
 	nnir-artlist nil)
-  (let ((parms nil))
-    (if extra-parms
-        (setq parms (nnir-read-parms query))
-      (setq parms (list (cons 'query query))))
+  (let* ((query (read-string "Query: " nil 'nnir-search-history))
+	 (parms (list (cons 'query query)))
+	 (srv (if (gnus-server-server-name)
+		  "all"	"")))
     (add-to-list 'parms (cons 'unique-id (message-unique-id)) t)
     (gnus-group-read-ephemeral-group
-     (concat "nnir:" (prin1-to-string parms)) '(nnir "") t
-     (cons (current-buffer)
-           gnus-current-window-configuration)
+     (concat "nnir:" (prin1-to-string parms)) (list 'nnir srv) t
+     (cons (current-buffer) gnus-current-window-configuration)
      nil)))
 
-;; Why is this needed? Is this for compatibility with old/new gnusae? Using
-;; gnus-group-server instead works for me.  -- Justus Piater
-(defmacro nnir-group-server (group)
-  "Return the server for a newsgroup GROUP.
-The returned format is as `gnus-server-to-method' needs it.  See
-`gnus-group-real-prefix' and `gnus-group-real-name'."
-  `(let ((gname ,group))
-     (if (string-match "^\\([^:]+\\):" gname)
-	 (progn
-	   (setq gname (match-string 1 gname))
-	   (if (string-match "^\\([^+]+\\)\\+\\(.+\\)$" gname)
-	       (format "%s:%s" (match-string 1 gname) (match-string 2 gname))
-	     (concat gname ":")))
-       (format "%s:%s" (car gnus-select-method) (cadr gnus-select-method)))))
-
 ;; Summary mode commands.
 
 (defun gnus-summary-nnir-goto-thread ()
@@ -660,25 +487,29 @@
 	 (id (mail-header-id (gnus-summary-article-header)))
 	 (refs (split-string
 		(mail-header-references (gnus-summary-article-header)))))
-    (if (eq (car (gnus-group-method group)) 'nnimap)
-	(progn (nnimap-possibly-change-group (gnus-group-short-name group) nil)
-	       (with-current-buffer (nnimap-buffer)
-		 (let* ((cmd (let ((value (format
-					   "(OR HEADER REFERENCES %s HEADER Message-Id %s)"
-					   id id)))
-			       (dolist (refid refs value)
-				 (setq value (format
-					      "(OR (OR HEADER Message-Id %s HEADER REFERENCES %s) %s)"
-					      refid refid value)))))
-			(result (nnimap-command
-				 "UID SEARCH %s" cmd)))
-		   (gnus-summary-read-group-1 group t t gnus-summary-buffer nil
-					      (and (car result)
-						   (delete 0 (mapcar #'string-to-number
-								     (cdr (assoc "SEARCH" (cdr result))))))))))
+    (if (eq (car (gnus-find-method-for-group group)) 'nnimap)
+	(progn
+	  (nnimap-possibly-change-group (gnus-group-short-name group) nil)
+	  (with-current-buffer (nnimap-buffer)
+	    (let* ((cmd
+		    (let ((value
+			   (format
+			    "(OR HEADER REFERENCES %s HEADER Message-Id %s)"
+			    id id)))
+		      (dolist (refid refs value)
+			(setq value
+			      (format
+			       "(OR (OR HEADER Message-Id %s HEADER REFERENCES %s) %s)"
+			       refid refid value)))))
+		   (result (nnimap-command "UID SEARCH %s" cmd)))
+	      (gnus-summary-read-group-1
+	       group t t gnus-summary-buffer nil
+	       (and (car result)
+		    (delete 0 (mapcar
+			       #'string-to-number
+			       (cdr (assoc "SEARCH" (cdr result))))))))))
       (gnus-summary-read-group-1 group t t gnus-summary-buffer
 				 nil (list backend-number))
-      (gnus-summary-limit (list backend-number))
       (gnus-summary-refer-thread))))
 
 
@@ -709,24 +540,19 @@
                (equal server nnir-current-server)))
       nnir-artlist
     ;; Cache miss.
-    (setq nnir-artlist (nnir-run-query group)))
+    (setq nnir-artlist (nnir-run-query group server)))
   (with-current-buffer nntp-server-buffer
+    (setq nnir-current-query group)
+    (when server (setq nnir-current-server server))
+    (setq nnir-current-group-marked gnus-group-marked)
     (if (zerop (length nnir-artlist))
-	(progn
-	  (setq nnir-current-query nil
-		nnir-current-server nil
-		nnir-current-group-marked nil
-		nnir-artlist nil)
-	  (nnheader-report 'nnir "Search produced empty results."))
+	(nnheader-report 'nnir "Search produced empty results.")
       ;; Remember data for cache.
-      (setq nnir-current-query group)
-      (when server (setq nnir-current-server server))
-      (setq nnir-current-group-marked gnus-group-marked)
       (nnheader-insert "211 %d %d %d %s\n"
 		       (nnir-artlist-length nnir-artlist) ; total #
 		       1              ; first #
 		       (nnir-artlist-length nnir-artlist) ; last #
-		       group))))     ; group name
+		       group))))      ; group name
 
 (deffoo nnir-retrieve-headers (articles &optional group server fetch-old)
   (save-excursion
@@ -745,7 +571,7 @@
         (setq artfullgroup (nnir-artitem-group artitem))
         (setq artno (nnir-artitem-number artitem))
         (setq artgroup (gnus-group-real-name artfullgroup))
-	(setq server (nnir-group-server artfullgroup))
+	(setq server (gnus-group-server artfullgroup))
         ;; retrieve NOV or HEAD data for this article, transform into
         ;; NOV data and prepend to `novdata'
         (set-buffer nntp-server-buffer)
@@ -809,6 +635,26 @@
 	(gnus-request-article artno artfullgroup nntp-server-buffer)
 	(cons artfullgroup artno)))))
 
+(deffoo nnir-request-move-article (article group server accept-form
+					   &optional last internal-move-group)
+  (let* ((artitem (nnir-artlist-article nnir-artlist
+					article))
+	 (artfullgroup (nnir-artitem-group artitem))
+	 (artno (nnir-artitem-number artitem))
+	 (to-newsgroup (nth 1 accept-form))
+	 (to-method (gnus-find-method-for-group to-newsgroup))
+	 (from-method (gnus-find-method-for-group artfullgroup))
+	 (move-is-internal (gnus-server-equal from-method to-method)))
+    (gnus-request-move-article
+     artno
+     artfullgroup
+     (nth 1 from-method)
+     accept-form
+     last
+     (and move-is-internal
+	  to-newsgroup		; Not respooling
+	  (gnus-group-real-name to-newsgroup))) ; Is this move internal
+    ))
 
 (nnoo-define-skeleton nnir)
 
@@ -855,94 +701,50 @@
 
 ;;; Search Engine Interfaces:
 
-;; freeWAIS-sf interface.
-(defun nnir-run-waissearch (query server &optional group)
-  "Run given query agains waissearch.  Returns vector of (group name, file name)
-pairs (also vectors, actually)."
-  (when group
-    (error "The freeWAIS-sf backend cannot search specific groups"))
-  (save-excursion
-    (let ((qstring (cdr (assq 'query query)))
-	  (prefix (nnir-read-server-parm 'nnir-wais-remove-prefix server))
-          artlist score artno dirnam)
-      (set-buffer (get-buffer-create nnir-tmp-buffer))
-      (erase-buffer)
-      (message "Doing WAIS query %s..." query)
-      (call-process nnir-wais-program
-                    nil                 ; input from /dev/null
-                    t                   ; output to current buffer
-                    nil                 ; don't redisplay
-                    "-d" (nnir-read-server-parm 'nnir-wais-database server) ; database to search
-                    qstring)
-      (message "Massaging waissearch output...")
-      ;; remove superfluous lines
-      (keep-lines "Score:")
-      ;; extract data from result lines
-      (goto-char (point-min))
-      (while (re-search-forward
-              "Score: +\\([0-9]+\\).*'\\([0-9]+\\) +\\([^']+\\)/'" nil t)
-        (setq score (match-string 1)
-              artno (match-string 2)
-              dirnam (match-string 3))
-        (unless (string-match prefix dirnam)
-          (nnheader-report 'nnir "Dir name %s doesn't contain prefix %s"
-                           dirnam prefix))
-        (setq group (gnus-replace-in-string
-                     (replace-match "" t t dirnam) "/" "."))
-        (push (vector (nnir-group-full-name group server)
-                      (string-to-number artno)
-                      (string-to-number score))
-              artlist))
-      (message "Massaging waissearch output...done")
-      (apply 'vector
-             (sort artlist
-                   (function (lambda (x y)
-                               (> (nnir-artitem-rsv x)
-                                  (nnir-artitem-rsv y)))))))))
-
-;; IMAP interface.
-;; todo:
-;; send queries as literals
-;; handle errors
-
-
-(defun nnir-run-imap (query srv &optional group-option)
+;; imap interface
+(defun nnir-run-imap (query srv &optional groups)
   "Run a search against an IMAP back-end server.
 This uses a custom query language parser; see `nnir-imap-make-query' for
 details on the language and supported extensions"
   (save-excursion
     (let ((qstring (cdr (assq 'query query)))
-	  (server (cadr (gnus-server-to-method srv)))
-	  (group (or group-option (gnus-group-group-name)))
-	  (defs (caddr (gnus-server-to-method srv)))
-	  (criteria (or (cdr (assq 'criteria query))
-			(cdr (assoc nnir-imap-default-search-key
-				    nnir-imap-search-arguments))))
-	  (gnus-inhibit-demon t)
-	  artlist)
+          (server (cadr (gnus-server-to-method srv)))
+          (defs (caddr (gnus-server-to-method srv)))
+          (criteria (or (cdr (assq 'criteria query))
+                        (cdr (assoc nnir-imap-default-search-key
+                                    nnir-imap-search-arguments))))
+          (gnus-inhibit-demon t)
+	  (groups (or groups (nnir-get-active srv)))
+          artlist)
       (message "Opening server %s" server)
-      (condition-case ()
-	  (when (nnimap-possibly-change-group (gnus-group-short-name group) server)
-	    (with-current-buffer (nnimap-buffer)
-	      (message "Searching %s..." group)
-	      (let ((arts 0)
-		    (result
-		     (nnimap-command "UID SEARCH %s"
-				     (if (string= criteria "")
-					 qstring
-				       (nnir-imap-make-query criteria qstring)
-				       ))))
-		(mapc
-		 (lambda (artnum)
-		   (push (vector group artnum 1) artlist)
-		   (setq arts (1+ arts)))
-		 (and (car result)
-		      (delete 0 (mapcar #'string-to-number
-					(cdr (assoc "SEARCH" (cdr result)))))))
-		(message "Searching %s... %d matches" group arts)))
-	    (message "Searching %s...done" group))
-	(quit nil))
-      (reverse artlist))))
+      (apply
+       'vconcat
+       (mapcar
+	(lambda (x)
+	  (let ((group x))
+	    (condition-case ()
+		(when (nnimap-possibly-change-group
+		       (gnus-group-short-name group) server)
+		  (with-current-buffer (nnimap-buffer)
+		    (message "Searching %s..." group)
+		    (let ((arts 0)
+			  (result (nnimap-command "UID SEARCH %s"
+						  (if (string= criteria "")
+						      qstring
+						    (nnir-imap-make-query
+						     criteria qstring)))))
+		      (mapc
+		       (lambda (artnum) (push (vector group artnum 1) artlist)
+			 (setq arts (1+ arts)))
+		       (and (car result)
+			    (delete 0 (mapcar #'string-to-number
+					      (cdr (assoc "SEARCH"
+							  (cdr result)))))))
+		      (message "Searching %s... %d matches" group arts)))
+		  (message "Searching %s...done" group))
+	      (quit nil))
+	    (reverse artlist)))
+	groups)))))
 
 (defun nnir-imap-make-query (criteria qstring)
   "Parse the query string and criteria into an appropriate IMAP search
@@ -1132,8 +934,8 @@
 Tested with swish++ 4.7 on GNU/Linux and with swish++ 5.0b2 on
 Windows NT 4.0."
 
-  (when group
-    (error "The swish++ backend cannot search specific groups"))
+  ;; (when group
+  ;;   (error "The swish++ backend cannot search specific groups"))
 
   (save-excursion
     (let ( (qstring (cdr (assq 'query query)))
@@ -1221,8 +1023,8 @@
 Tested with swish-e-2.0.1 on Windows NT 4.0."
 
   ;; swish-e crashes with empty parameter to "-w" on commandline...
-  (when group
-    (error "The swish-e backend cannot search specific groups"))
+  ;; (when group
+  ;;   (error "The swish-e backend cannot search specific groups"))
 
   (save-excursion
     (let ((qstring (cdr (assq 'query query)))
@@ -1306,14 +1108,85 @@
                                (> (nnir-artitem-rsv x)
                                   (nnir-artitem-rsv y)))))))))
 
+;; HyREX interface
+(defun nnir-run-hyrex (query server &optional group)
+  (save-excursion
+    (let ((artlist nil)
+          (groupspec (cdr (assq 'group query)))
+          (qstring (cdr (assq 'query query)))
+	  (prefix (nnir-read-server-parm 'nnir-hyrex-remove-prefix server))
+	  score artno dirnam)
+      (when (and (not groupspec) group)
+        (setq groupspec
+	      (regexp-opt
+	       (mapcar (lambda (x) (gnus-group-real-name x)) group))))
+      (set-buffer (get-buffer-create nnir-tmp-buffer))
+      (erase-buffer)
+      (message "Doing hyrex-search query %s..." query)
+      (let* ((cp-list
+	      `( ,nnir-hyrex-program
+		 nil			; input from /dev/null
+		 t			; output
+		 nil			; don't redisplay
+		 "-i",(nnir-read-server-parm 'nnir-hyrex-index-directory server) ; index directory
+		 ,@(nnir-read-server-parm 'nnir-hyrex-additional-switches server)
+		 ,qstring	   ; the query, in hyrex-search format
+		 ))
+             (exitstatus
+              (progn
+                (message "%s args: %s" nnir-hyrex-program
+                         (mapconcat 'identity (cddddr cp-list) " "))
+                (apply 'call-process cp-list))))
+        (unless (or (null exitstatus)
+                    (zerop exitstatus))
+          (nnheader-report 'nnir "Couldn't run hyrex-search: %s" exitstatus)
+          ;; nnir-search failure reason is in this buffer, show it if
+          ;; the user wants it.
+          (when (> gnus-verbose 6)
+            (display-buffer nnir-tmp-buffer)))) ;; FIXME: Dont clear buffer !
+      (message "Doing hyrex-search query \"%s\"...done" qstring)
+      (sit-for 0)
+      ;; nnir-search returns:
+      ;;   for nnml/nnfolder: "filename mailid weigth"
+      ;;   for nnimap:        "group mailid weigth"
+      (goto-char (point-min))
+      (delete-non-matching-lines "^\\S + [0-9]+ [0-9]+$")
+      ;; HyREX doesn't search directly in groups -- so filter out here.
+      (when groupspec
+	(keep-lines groupspec))
+      ;; extract data from result lines
+      (goto-char (point-min))
+      (while (re-search-forward
+	      "\\(\\S +\\) \\([0-9]+\\) \\([0-9]+\\)" nil t)
+	(setq dirnam (match-string 1)
+	      artno (match-string 2)
+	      score (match-string 3))
+	(when (string-match prefix dirnam)
+	  (setq dirnam (replace-match "" t t dirnam)))
+	(push (vector (nnir-group-full-name
+                       (gnus-replace-in-string dirnam "/" ".") server)
+		      (string-to-number artno)
+		      (string-to-number score))
+	      artlist))
+      (message "Massaging hyrex-search output...done.")
+      (apply 'vector
+	     (sort artlist
+                   (function (lambda (x y)
+                               (if (string-lessp (nnir-artitem-group x)
+                                                 (nnir-artitem-group y))
+                                   t
+                                 (< (nnir-artitem-number x)
+                                    (nnir-artitem-number y)))))))
+      )))
+
 ;; Namazu interface
 (defun nnir-run-namazu (query server &optional group)
   "Run given query against Namazu.  Returns a vector of (group name, file name)
 pairs (also vectors, actually).
 
 Tested with Namazu 2.0.6 on a GNU/Linux system."
-  (when group
-    (error "The Namazu backend cannot search specific groups"))
+  ;; (when group
+  ;;   (error "The Namazu backend cannot search specific groups"))
   (save-excursion
     (let ((article-pattern (if (string= (gnus-group-server server) "nnmaildir")
 			       ":[0-9]+"
@@ -1375,7 +1248,7 @@
                                (> (nnir-artitem-rsv x)
                                   (nnir-artitem-rsv y)))))))))
 
-(defun nnir-run-find-grep (query server &optional group)
+(defun nnir-run-find-grep (query server &optional grouplist)
   "Run find and grep to obtain matching articles."
   (let* ((method (gnus-server-to-method server))
 	 (sym (intern
@@ -1387,65 +1260,141 @@
     (unless directory
       (error "No directory found in method specification of server %s"
 	     server))
-    (message "Searching %s using find-grep..." (or group server))
-    (save-window-excursion
-      (set-buffer (get-buffer-create nnir-tmp-buffer))
-      (erase-buffer)
-      (if (> gnus-verbose 6)
-	  (pop-to-buffer (current-buffer)))
-      (cd directory) ; Using relative paths simplifies postprocessing.
-      (let ((group
-	     (if (not group)
-		 "."
-	       ;; Try accessing the group literally as well as
-	       ;; interpreting dots as directory separators so the
-	       ;; engine works with plain nnml as well as the Gnus Cache.
-               (let ((group (gnus-group-real-name group)))
-                 ;; Replace cl-func find-if.
-                 (if (file-directory-p group)
-                     group
-                   (if (file-directory-p
-                        (setq group (gnus-replace-in-string group "\\." "/" t)))
-                       group))))))
-	(unless group
-	  (error "Cannot locate directory for group"))
-	(save-excursion
-	  (apply
-	   'call-process "find" nil t
-	   "find" group "-type" "f" "-name" "[0-9]*" "-exec"
-	   "grep"
-	   `("-l" ,@(and grep-options
-			 (split-string grep-options "\\s-" t))
-	     "-e" ,regexp "{}" "+"))))
+    (apply
+     'vconcat
+     (mapcar (lambda (x)
+	       (let ((group x))
+		 (message "Searching %s using find-grep..."
+			  (or group server))
+		 (save-window-excursion
+		   (set-buffer (get-buffer-create nnir-tmp-buffer))
+		   (erase-buffer)
+		   (if (> gnus-verbose 6)
+		       (pop-to-buffer (current-buffer)))
+		   (cd directory) ; Using relative paths simplifies
+				  ; postprocessing.
+		   (let ((group
+			  (if (not group)
+			      "."
+			    ;; Try accessing the group literally as
+			    ;; well as interpreting dots as directory
+			    ;; separators so the engine works with
+			    ;; plain nnml as well as the Gnus Cache.
+			    (let ((group (gnus-group-real-name group)))
+			      ;; Replace cl-func find-if.
+			      (if (file-directory-p group)
+				  group
+				(if (file-directory-p
+				     (setq group
+					   (gnus-replace-in-string
+					    group
+					    "\\." "/" t)))
+				    group))))))
+		     (unless group
+		       (error "Cannot locate directory for group"))
+		     (save-excursion
+		       (apply
+			'call-process "find" nil t
+			"find" group "-type" "f" "-name" "[0-9]*" "-exec"
+			"grep"
+			`("-l" ,@(and grep-options
+				      (split-string grep-options "\\s-" t))
+			  "-e" ,regexp "{}" "+"))))
 
-      ;; Translate relative paths to group names.
-      (while (not (eobp))
-	(let* ((path (split-string
-		      (buffer-substring (point) (line-end-position)) "/" t))
-	       (art (string-to-number (car (last path)))))
-	  (while (string= "." (car path))
-	    (setq path (cdr path)))
-	  (let ((group (mapconcat 'identity
-                                  ;; Replace cl-func: (subseq path 0 -1)
-                                  (let ((end (1- (length path)))
-                                        res)
-                                    (while (>= (setq end (1- end)) 0)
-                                      (push (pop path) res))
-                                    (nreverse res))
-                                  ".")))
-	    (push (vector (nnir-group-full-name group server) art 0)
-		  artlist))
-	  (forward-line 1)))
-      (message "Searching %s using find-grep...done" (or group server))
-      artlist)))
+		   ;; Translate relative paths to group names.
+		   (while (not (eobp))
+		     (let* ((path (split-string
+				   (buffer-substring
+				    (point)
+				    (line-end-position)) "/" t))
+			    (art (string-to-number (car (last path)))))
+		       (while (string= "." (car path))
+			 (setq path (cdr path)))
+		       (let ((group (mapconcat 'identity
+					       ;; Replace cl-func:
+					       ;; (subseq path 0 -1)
+					       (let ((end (1- (length path)))
+						     res)
+						 (while
+						     (>= (setq end (1- end)) 0)
+						   (push (pop path) res))
+						 (nreverse res))
+					       ".")))
+			 (push
+			  (vector (nnir-group-full-name group server) art 0)
+			  artlist))
+		       (forward-line 1)))
+		   (message "Searching %s using find-grep...done"
+			    (or group server))
+		   artlist)))
+     grouplist))))
+
+(declare-function mm-url-insert "mm-url" (url &optional follow-refresh))
+(declare-function mm-url-encode-www-form-urlencoded "mm-url" (pairs))
+
+;; gmane interface
+(defun nnir-run-gmane (query srv &optional groups)
+  "Run a search against a gmane back-end server."
+  (if (gnus-string-match-p "gmane" srv)
+      (let* ((case-fold-search t)
+	     (qstring (cdr (assq 'query query)))
+	     (server (cadr (gnus-server-to-method srv)))
+	     (groupspec (if groups
+			    (mapconcat
+			     (function (lambda (x)
+					 (format "group:%s"
+						 (gnus-group-short-name x))))
+			     groups " ") ""))
+	     (authorspec
+	      (if (assq 'author query)
+		  (format "author:%s" (cdr (assq 'author query))) ""))
+	     (search (format "%s %s %s"
+			     qstring groupspec authorspec))
+	     (gnus-inhibit-demon t)
+	     artlist)
+	(require 'mm-url)
+	(with-current-buffer nntp-server-buffer
+	  (erase-buffer)
+	  (mm-url-insert
+	   (concat
+	    "http://search.gmane.org/nov.php"
+	    "?"
+	    (mm-url-encode-www-form-urlencoded
+	     `(("query" . ,search)
+	       ("HITSPERPAGE" . "999")))))
+	  (unless (featurep 'xemacs) (set-buffer-multibyte t))
+	  (mm-decode-coding-region (point-min) (point-max) 'utf-8)
+	  (goto-char (point-min))
+	  (forward-line 1)
+	  (while (not (eobp))
+	    (unless (or (eolp) (looking-at "\x0d"))
+	      (let ((header (nnheader-parse-nov)))
+		(let ((xref (mail-header-xref header))
+		      (xscore (string-to-number (cdr (assoc 'X-Score
+			       (mail-header-extra header))))))
+		  (when (string-match " \\([^:]+\\)[:/]\\([0-9]+\\)" xref)
+		    (push
+		     (vector
+		      (gnus-group-prefixed-name (match-string 1 xref) srv)
+		      (string-to-number (match-string 2 xref)) xscore)
+		     artlist)))))
+	    (forward-line 1)))
+	;; Sort by score
+	(apply 'vector
+	       (sort artlist
+		     (function (lambda (x y)
+				 (> (nnir-artitem-rsv x)
+				    (nnir-artitem-rsv y)))))))
+    (message "Can't search non-gmane nntp groups")
+    nil))
 
 ;;; Util Code:
 
-(defun nnir-read-parms (query)
+(defun nnir-read-parms (query nnir-search-engine)
   "Reads additional search parameters according to `nnir-engines'."
   (let ((parmspec (caddr (assoc nnir-search-engine nnir-engines))))
-    (cons (cons 'query query)
-          (mapcar 'nnir-read-parm parmspec))))
+    (append query
+	   (mapcar 'nnir-read-parm parmspec))))
 
 (defun nnir-read-parm (parmspec)
   "Reads a single search parameter.
@@ -1459,69 +1408,49 @@
 	  (cons sym (format (cdr mapping) result)))
       (cons sym (read-string prompt)))))
 
-(defun nnir-run-query (query)
+(defun nnir-run-query (query nserver)
   "Invoke appropriate search engine function (see `nnir-engines').
-If some groups were process-marked, run the query for each of the groups
-and concat the results."
-  (let ((q (car (read-from-string query))))
-    (if gnus-group-marked
-	(apply 'vconcat
-	       (mapcar (lambda (x)
-			 (let* ((server (nnir-group-server x))
-				(engine
-				 (or (nnir-read-server-parm 'nnir-search-engine
-							    server)
-				     (cdr
-				      (assoc (car (gnus-server-to-method server))
-					     nnir-method-default-engines))))
-				search-func)
-			   (setq search-func (cadr
-					      (assoc
-					       engine
-					       nnir-engines)))
-			   (if search-func
-			       (funcall search-func q server x)
-			     nil)))
-		       gnus-group-marked))
-      (apply 'vconcat
-	     (mapcar (lambda (x)
-		       (if (and (equal (cadr x) 'ok) (not (equal (cadar x) "-ephemeral")))
-			   (let* ((server (format "%s:%s" (caar x) (cadar x)))
-				  (engine
-				   (or (nnir-read-server-parm 'nnir-search-engine
-							      server)
-				       (cdr
-					(assoc (car (gnus-server-to-method server))
-					       nnir-method-default-engines))))
-				  search-func)
-			     (setq search-func (cadr
-						(assoc
-						 engine
+  If some groups were process-marked, run the query for each of the groups
+  and concat the results."
+  (let ((q (car (read-from-string query)))
+        (groups (if (string= "all-ephemeral" nserver)
+		    (with-current-buffer gnus-server-buffer
+		      (list (list (gnus-server-server-name))))
+		  (nnir-sort-groups-by-server
+		   (or gnus-group-marked
+		       (if (gnus-group-group-name)
+			   (list (gnus-group-group-name))
+			 (cdr (assoc (gnus-group-topic-name)
+				     gnus-topic-alist))))))))
+    (apply 'vconcat
+           (mapcar (lambda (x)
+                     (let* ((server (car x))
+                            (nnir-search-engine
+                             (or (nnir-read-server-parm 'nnir-search-engine
+                                                        server)
+                                 (cdr (assoc (car
+                                              (gnus-server-to-method server))
+                                             nnir-method-default-engines))))
+                            search-func)
+                       (setq search-func (cadr
+                                          (assoc nnir-search-engine
 						 nnir-engines)))
-			     (if search-func
-				 (funcall search-func q server nil)
-			       nil))
-			 nil))
-		     gnus-opened-servers)
-	     ))
-    ))
+                       (if search-func
+			   (funcall search-func
+				    (if nnir-extra-parms
+					(nnir-read-parms q nnir-search-engine)
+				      q)
+				    server (cdr x))
+                         nil)))
+                   groups))))
 
 (defun nnir-read-server-parm (key server)
-  "Returns the parameter value of for the given server, where server is of
-form 'backend:name'."
+  "Returns the parameter value of key for the given server, where
+server is of form 'backend:name'."
   (let ((method (gnus-server-to-method server)))
     (cond ((and method (assq key (cddr method)))
-	   (nth 1 (assq key (cddr method))))
-	  ((and nnir-mail-backend
-		(gnus-server-equal method nnir-mail-backend))
-	   (symbol-value key))
-	  (t nil))))
-;;     (if method
-;;       (if (assq key (cddr method))
-;; 	  (nth 1 (assq key (cddr method)))
-;; 	(symbol-value key))
-;;       (symbol-value key))
-;;     ))
+    	   (nth 1 (assq key (cddr method))))
+    	  (t nil))))
 
 (defun nnir-group-full-name (shortname server)
   "For the given group name, return a full Gnus group name.
@@ -1564,8 +1493,8 @@
   (elt artitem 2))
 
 (defun nnir-artlist-artitem-rsv (artlist n)
-  "Returns from ARTLIST the Retrieval Status Value of the Nth artitem
-\(counting from 1)."
+  "Returns from ARTLIST the Retrieval Status Value of the Nth
+artitem (counting from 1)."
   (nnir-artitem-rsv (nnir-artlist-article artlist n)))
 
 ;; unused?
@@ -1580,6 +1509,38 @@
             with-dups)
     res))
 
+(defun nnir-sort-groups-by-server (groups)
+  "sorts a list of groups into an alist keyed by server"
+(if (car groups)
+  (let (value)
+    (dolist (var groups value)
+      (let ((server (gnus-group-server var)))
+	(if (assoc server value)
+	    (nconc (cdr (assoc server value)) (list var))
+	  (push (cons (gnus-group-server var) (list var)) value))))
+    value)
+  nil))
+
+(defun nnir-get-active (srv)
+  (let ((method (gnus-server-to-method srv))
+	groups)
+    (gnus-request-list method)
+    (with-current-buffer nntp-server-buffer
+      (let ((cur (current-buffer))
+	    name)
+	(goto-char (point-min))
+	(unless (string= gnus-ignored-newsgroups "")
+	  (delete-matching-lines gnus-ignored-newsgroups))
+	(while (not (eobp))
+	  (ignore-errors
+	    (push (mm-string-as-unibyte
+		   (let ((p (point)))
+		     (skip-chars-forward "^ \t\\\\")
+		     (setq name (buffer-substring (+ p 1) (- (point) 1)))
+		     (gnus-group-full-name name method)))
+		  groups))
+	  (forward-line))))
+    groups))
 
 ;; The end.
 (provide 'nnir)
--- a/lisp/gnus/nnmail.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/nnmail.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,8 @@
 ;;; nnmail.el --- mail support functions for the Gnus mail backends
 
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news, mail
@@ -1347,7 +1348,7 @@
 ;;; Utility functions
 
 (declare-function gnus-activate-group "gnus-start"
-                  (group &optional scan dont-check method))
+                  (group &optional scan dont-check method dont-sub-check))
 
 (defun nnmail-do-request-post (accept-func &optional server)
   "Utility function to directly post a message to an nnmail-derived group.
--- a/lisp/gnus/nnmairix.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/nnmairix.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1357,7 +1357,7 @@
 		 (not (member (car server) gnus-ephemeral-servers))
 		 (not (member (gnus-method-to-server (car server)) occ)))
 	(push
-	 (list mserver)
+	 mserver
 	 openedserver)))
     openedserver))
 
--- a/lisp/gnus/nntp.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/nntp.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,8 +1,8 @@
 ;;; nntp.el --- nntp access for Gnus
 
-;; Copyright (C) 1987, 1988, 1989, 1990, 1992, 1993,
-;;   1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002,
-;;   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 1988, 1989, 1990, 1992, 1993, 1994, 1995, 1996,
+;;   1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+;;   2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -1172,7 +1172,7 @@
 reading."
   (nntp-send-command "^.*\n" "MODE READER"))
 
-(declare-function netrc-parse "netrc" (file))
+(declare-function netrc-parse "netrc" (&optional file))
 (declare-function netrc-machine "netrc"
 		  (list machine &optional port defaultport))
 (declare-function netrc-get "netrc" (alist type))
--- a/lisp/gnus/shr.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/shr.el	Sat Nov 06 10:28:31 2010 +0200
@@ -90,6 +90,7 @@
 (defvar shr-list-mode nil)
 (defvar shr-content-cache nil)
 (defvar shr-kinsoku-shorten nil)
+(defvar shr-table-depth 0)
 
 (defvar shr-map
   (let ((map (make-sparse-keymap)))
@@ -180,7 +181,7 @@
 	    result))
     (dolist (sub dom)
       (if (stringp sub)
-	  (push (cons :text sub) result)
+	  (push (cons 'text sub) result)
 	(push (shr-transform-dom sub) result)))
     (nreverse result)))
 
@@ -193,7 +194,7 @@
 (defun shr-generic (cont)
   (dolist (sub cont)
     (cond
-     ((eq (car sub) :text)
+     ((eq (car sub) 'text)
       (shr-insert (cdr sub)))
      ((listp (cdr sub))
       (shr-descend sub)))))
@@ -285,7 +286,9 @@
 			    (aref (char-category-set (following-char)) ?>)))
 		  (backward-char 1))
 	      (while (and (>= (setq count (1- count)) 0)
-			  (aref (char-category-set (following-char)) ?>))
+			  (aref (char-category-set (following-char)) ?>)
+			  (aref fill-find-break-point-function-table
+				(following-char)))
 		(forward-char 1)))
 	    (when (eq (following-char) ? )
 	      (forward-char 1))
@@ -337,9 +340,13 @@
   "Browse the URL under point."
   (interactive)
   (let ((url (get-text-property (point) 'shr-url)))
-    (if (not url)
-	(message "No link under point")
-      (browse-url url))))
+    (cond
+     ((not url)
+      (message "No link under point"))
+     ((string-match "^mailto:" url)
+      (gnus-url-mailto url))
+     (t
+      (browse-url url)))))
 
 (defun shr-save-contents (directory)
   "Save the contents from URL in a file."
@@ -369,18 +376,17 @@
           (let ((alt (buffer-substring start end))
 		(inhibit-read-only t))
 	    (delete-region start end)
-	    (shr-put-image data start alt))))))
+	    (goto-char start)
+	    (shr-put-image data alt))))))
   (kill-buffer (current-buffer)))
 
-(defun shr-put-image (data point alt)
+(defun shr-put-image (data alt)
   (if (display-graphic-p)
       (let ((image (ignore-errors
                      (shr-rescale-image data))))
         (when image
-          (put-image image point alt)))
-    (save-excursion
-      (goto-char point)
-      (insert alt))))
+	  (insert-image image (or alt "*"))))
+    (insert alt)))
 
 (defun shr-rescale-image (data)
   (if (or (not (fboundp 'imagemagick-types))
@@ -409,6 +415,10 @@
 		     image)))
       image)))
 
+;; url-cache-extract autoloads url-cache.
+(declare-function url-cache-create-filename "url-cache" (url))
+(autoload 'mm-disable-multibyte "mm-util")
+
 (defun shr-get-image-data (url)
   "Get image data for URL.
 Return a string with image data."
@@ -426,6 +436,8 @@
   (apply #'shr-fontize-cont cont types)
   (shr-ensure-paragraph))
 
+(autoload 'widget-convert-button "wid-edit")
+
 (defun shr-urlify (start url)
   (widget-convert-button
    'url-link start (point)
@@ -470,14 +482,6 @@
 (defun shr-tag-s (cont)
   (shr-fontize-cont cont 'strike-through))
 
-(defun shr-tag-span (cont)
-  (let ((start (point))
-	(color (cdr (assq 'color (shr-parse-style (cdr (assq :style cont)))))))
-    (shr-generic cont)
-    (when color
-      (let ((overlay (make-overlay start (point))))
-	(overlay-put overlay 'face (cons 'foreground-color color))))))
-
 (defun shr-parse-style (style)
   (when style
     (let ((plist nil))
@@ -501,24 +505,43 @@
     (shr-urlify (or shr-start start) url)))
 
 (defun shr-tag-object (cont)
-  (let ((url (cdr (assq :src (cdr (assq 'embed cont)))))
-	(start (point)))
+  (let ((start (point))
+	url)
+    (dolist (elem cont)
+      (when (eq (car elem) 'embed)
+	(setq url (or url (cdr (assq :src (cdr elem))))))
+      (when (and (eq (car elem) 'param)
+		 (equal (cdr (assq :name (cdr elem))) "movie"))
+	(setq url (or url (cdr (assq :value (cdr elem)))))))
     (when url
       (shr-insert " [multimedia] ")
-      (shr-urlify start url))))
+      (shr-urlify start url))
+    (shr-generic cont)))
 
-(defun shr-tag-img (cont)
-  (when (and cont
-	     (cdr (assq :src cont)))
+(defun shr-tag-video (cont)
+  (let ((image (cdr (assq :poster cont)))
+	(url (cdr (assq :src cont)))
+	(start (point)))
+    (shr-tag-img nil image)
+    (shr-urlify start url)))
+
+(defun shr-tag-img (cont &optional url)
+  (when (or url
+	    (and cont
+		 (cdr (assq :src cont))))
     (when (and (> (current-column) 0)
 	       (not (eq shr-state 'image)))
       (insert "\n"))
     (let ((alt (cdr (assq :alt cont)))
-	  (url (cdr (assq :src cont))))
+	  (url (or url (cdr (assq :src cont)))))
       (let ((start (point-marker)))
 	(when (zerop (length alt))
-	  (setq alt "[img]"))
+	  (setq alt "*"))
 	(cond
+	 ((or (member (cdr (assq :height cont)) '("0" "1"))
+	      (member (cdr (assq :width cont)) '("0" "1")))
+	  ;; Ignore zero-sized or single-pixel images.
+	  )
 	 ((and (not shr-inhibit-images)
 	       (string-match "\\`cid:" url))
 	  (let ((url (substring url (match-end 0)))
@@ -526,27 +549,27 @@
 	    (if (or (not shr-content-function)
 		    (not (setq image (funcall shr-content-function url))))
 		(insert alt)
-	      (shr-put-image image (point) alt))))
+	      (shr-put-image image alt))))
 	 ((or shr-inhibit-images
 	      (and shr-blocked-images
 		   (string-match shr-blocked-images url)))
 	  (setq shr-start (point))
 	  (let ((shr-state 'space))
-	    (if (> (length alt) 8)
-		(shr-insert (substring alt 0 8))
+	    (if (> (string-width alt) 8)
+		(shr-insert (truncate-string-to-width alt 8))
 	      (shr-insert alt))))
 	 ((url-is-cached (shr-encode-url url))
-	  (shr-put-image (shr-get-image-data url) (point) alt))
+	  (shr-put-image (shr-get-image-data url) alt))
 	 (t
 	  (insert alt)
 	  (ignore-errors
 	    (url-retrieve (shr-encode-url url) 'shr-image-fetched
 			  (list (current-buffer) start (point-marker))
 			  t))))
-	(insert " ")
 	(put-text-property start (point) 'keymap shr-map)
 	(put-text-property start (point) 'shr-alt alt)
 	(put-text-property start (point) 'shr-image url)
+	(put-text-property start (point) 'help-echo alt)
 	(setq shr-state 'image)))))
 
 (defun shr-tag-pre (cont)
@@ -630,6 +653,7 @@
   (setq cont (or (cdr (assq 'tbody cont))
 		 cont))
   (let* ((shr-inhibit-images t)
+	 (shr-table-depth (1+ shr-table-depth))
 	 (shr-kinsoku-shorten t)
 	 ;; Find all suggested widths.
 	 (columns (shr-column-specs cont))
@@ -651,8 +675,9 @@
   ;; Finally, insert all the images after the table.  The Emacs buffer
   ;; model isn't strong enough to allow us to put the images actually
   ;; into the tables.
-  (dolist (elem (shr-find-elements cont 'img))
-    (shr-tag-img (cdr elem))))
+  (when (zerop shr-table-depth)
+    (dolist (elem (shr-find-elements cont 'img))
+      (shr-tag-img (cdr elem)))))
 
 (defun shr-tag-table (cont)
   (shr-ensure-paragraph)
--- a/lisp/gnus/sieve-manage.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/sieve-manage.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,7 @@
 ;;; sieve-manage.el --- Implementation of the managesive protocol in elisp
 
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;;   2008, 2009, 2010  Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+;;   2010  Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 
@@ -79,6 +79,7 @@
   (require 'password))
 
 (eval-when-compile
+  (require 'cl)				; caddr
   (require 'sasl)
   (require 'starttls))
 (autoload 'sasl-find-mechanism "sasl")
--- a/lisp/gnus/smime.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/gnus/smime.el	Sat Nov 06 10:28:31 2010 +0200
@@ -587,6 +587,9 @@
       (kill-buffer digbuf)
       retbuf))
 
+(declare-function ldap-search "ldap"
+		  (filter &optional host attributes attrsonly withdn))
+
 (defun smime-cert-by-ldap-1 (mail host)
   "Get cetificate for MAIL from the ldap server at HOST."
   (let ((ldapresult
@@ -595,7 +598,9 @@
 	      (progn
 		(require 'smime-ldap)
 		'smime-ldap-search)
-	    'ldap-search)
+	    (progn
+	      (require 'ldap)
+	      'ldap-search))
 	  (concat "mail=" mail)
 	  host '("userCertificate") nil))
 	(retbuf (generate-new-buffer (format "*certificate for %s*" mail)))
--- a/lisp/info.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/info.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,8 +1,8 @@
 ;; info.el --- info package for Emacs
 
-;; Copyright (C) 1985, 1986, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-;;   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+;;   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+;;   2010  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: help
@@ -3379,6 +3379,8 @@
 (declare-function find-library-name "find-func" (library))
 (declare-function finder-unknown-keywords "finder" ())
 (declare-function lm-commentary "lisp-mnt" (&optional file))
+(defvar finder-keywords-hash)
+(defvar package-alist)                  ; finder requires package
 
 (defun Info-finder-find-node (filename nodename &optional no-going-back)
   "Finder-specific implementation of Info-find-node-2."
@@ -4930,5 +4932,4 @@
 
 (provide 'info)
 
-;; arch-tag: f2480fe2-2139-40c1-a49b-6314991164ac
 ;;; info.el ends here
--- a/lisp/international/characters.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/international/characters.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1234,6 +1234,131 @@
 (optimize-char-table (standard-category-table))
 
 
+;; Display of glyphless characters.
+
+(defvar char-acronym-table
+  (make-char-table 'char-acronym-table nil)
+  "Char table of acronyms for non-graphic characters.")
+
+(let ((c0-acronyms '("NUL" "SOH" "STX" "ETX" "EOT" "ENQ" "ACK" "BEL"
+		     "BS"   nil   nil  "VT"  "FF"  "CR"  "SO"  "SI"
+		     "DLE" "DC1" "DC2" "DC3" "DC4" "NAK" "SYN" "ETB"
+		     "CAN" "EM"  "SUB" "ESC" "FC"  "GS"  "RS"  "US")))
+  (dotimes (i 32)
+    (aset char-acronym-table i (car c0-acronyms))
+    (setq c0-acronyms (cdr c0-acronyms))))
+
+(let ((c1-acronyms '("XXX" "XXX" "BPH" "NBH" "IND" "NEL" "SSA" "ESA"
+		     "HTS" "HTJ" "VTS" "PLD" "PLU" "R1"  "SS2" "SS1"
+		     "DCS" "PU1" "PU2" "STS" "CCH" "MW"  "SPA" "EPA"
+		     "SOS" "XXX" "SC1" "CSI" "ST"  "OSC" "PM"  "APC")))
+  (dotimes (i 32)
+    (aset char-acronym-table (+ #x0080 i) (car c1-acronyms))
+    (setq c1-acronyms (cdr c1-acronyms))))
+
+(aset char-acronym-table #x17B4 "KIVAQ")   ; KHMER VOWEL INHERENT AQ
+(aset char-acronym-table #x17B5 "KIVAA")   ; KHMER VOWEL INHERENT AA
+(aset char-acronym-table #x200B "ZWSP")    ; ZERO WIDTH SPACE
+(aset char-acronym-table #x200C "ZWNJ")    ; ZERO WIDTH NON-JOINER
+(aset char-acronym-table #x200D "ZWJ")	   ; ZERO WIDTH JOINER
+(aset char-acronym-table #x200E "LRM")	   ; LEFT-TO-RIGHT MARK
+(aset char-acronym-table #x200F "RLM")	   ; RIGHT-TO-LEFT MARK
+(aset char-acronym-table #x202A "LRE")	   ; LEFT-TO-RIGHT EMBEDDING
+(aset char-acronym-table #x202B "RLE")	   ; RIGHT-TO-LEFT EMBEDDING
+(aset char-acronym-table #x202C "PDF")	   ; POP DIRECTIONAL FORMATTING
+(aset char-acronym-table #x202D "LRO")	   ; LEFT-TO-RIGHT OVERRIDE
+(aset char-acronym-table #x202E "RLO")	   ; RIGHT-TO-LEFT OVERRIDE
+(aset char-acronym-table #x2060 "WJ")	   ; WORD JOINER
+(aset char-acronym-table #x206A "ISS")	   ; INHIBIT SYMMETRIC SWAPPING
+(aset char-acronym-table #x206B "ASS")	   ; ACTIVATE SYMMETRIC SWAPPING
+(aset char-acronym-table #x206C "IAFS")    ; INHIBIT ARABIC FORM SHAPING
+(aset char-acronym-table #x206D "AAFS")    ; ACTIVATE ARABIC FORM SHAPING
+(aset char-acronym-table #x206E "NADS")    ; NATIONAL DIGIT SHAPES
+(aset char-acronym-table #x206F "NODS")    ; NOMINAL DIGIT SHAPES
+(aset char-acronym-table #xFEFF "ZWNBSP")  ; ZERO WIDTH NO-BREAK SPACE
+(aset char-acronym-table #xFFF9 "IAA")	   ; INTERLINEAR ANNOTATION ANCHOR
+(aset char-acronym-table #xFFFA "IAS")     ; INTERLINEAR ANNOTATION SEPARATOR
+(aset char-acronym-table #xFFFB "IAT")     ; INTERLINEAR ANNOTATION TERMINATOR
+(aset char-acronym-table #x1D173 "BEGBM")  ; MUSICAL SYMBOL BEGIN BEAM
+(aset char-acronym-table #x1D174 "ENDBM")  ; MUSICAL SYMBOL END BEAM
+(aset char-acronym-table #x1D175 "BEGTIE") ; MUSICAL SYMBOL BEGIN TIE
+(aset char-acronym-table #x1D176 "END")	   ; MUSICAL SYMBOL END TIE
+(aset char-acronym-table #x1D177 "BEGSLR") ; MUSICAL SYMBOL BEGIN SLUR
+(aset char-acronym-table #x1D178 "ENDSLR") ; MUSICAL SYMBOL END SLUR
+(aset char-acronym-table #x1D179 "BEGPHR") ; MUSICAL SYMBOL BEGIN PHRASE
+(aset char-acronym-table #x1D17A "ENDPHR") ; MUSICAL SYMBOL END PHRASE
+(aset char-acronym-table #xE0001 "|->TAG") ; LANGUAGE TAG
+(aset char-acronym-table #xE0020 "SP TAG") ; TAG SPACE
+(dotimes (i 94)
+  (aset char-acronym-table (+ #xE0021 i) (format " %c TAG" (+ 33 i))))
+(aset char-acronym-table #xE007F "->|TAG") ; CANCEL TAG
+
+;;; Control of displaying glyphless characters.
+(defvar glyphless-char-control
+  '((format-control . thin-space)
+    (no-font . hexa-code))
+  "List of directives to control displaying of glyphless characters.
+
+Each element has the form (TARGET . METHOD), where TARGET is a
+symbol specifying the target character group to control, and
+METHOD is a symbol specifying the method of displaying them.
+
+TARGET must be one of these symbols:
+  `c0-control': U+0000..U+001F.
+  `c1-control': U+0080..U+009F.
+  `format-control': Characters of Unicode General Category `Cf'.
+     Ex: U+200C (ZWNJ), U+200E (LRM)), but don't include characters
+     that have graphic image such as U+00AD (SHY).
+  `no-font': characters for which no suitable font is found.
+
+METHOD must be one of these symbols:
+  `zero-width': don't display.
+  `thin-space': display a thin space (1-pixel width).
+  `empty-box': display an empty box.
+  `acronym': display an acronum string in a box.
+  `hexa-code': display a hexadecimal character code in a box.
+
+Just setting this variable does not take effect.  Call the
+function `update-glyphless-char-display' (which see) after
+setting this variable.")
+
+(defun update-glyphless-char-display ()
+  "Make the setting of `glyphless-char-control' take effect.
+This function updates the char-table `glyphless-char-display'."
+  (dolist (elt glyphless-char-control)
+    (let ((target (car elt))
+	  (method (cdr elt)))
+      (cond ((eq target 'c0-control)
+	     (set-char-table-range glyphless-char-display '(#x00 . #x1F)
+				   method))
+	    ((eq target 'c1-control)
+	     (set-char-table-range glyphless-char-display '(#x80 . #x9F)
+				   method))
+	    ((eq target 'format-control)
+	     (map-char-table
+	      #'(lambda (char category)
+		  (if (eq category 'Cf)
+		      (let ((this-method method)
+			    from to)
+			(if (consp char)
+			    (setq from (car char) to (cdr char))
+			  (setq from char to char))
+			(while (<= from to)
+			  (when (/= from #xAD)
+			    (if (eq method 'acronym)
+				(setq this-method 
+				      (aref char-acronym-table from)))
+			    (set-char-table-range glyphless-char-display
+						  from this-method))
+			  (setq from (1+ from))))))
+	      unicode-category-table))
+	    ((eq target 'no-font)
+	     (set-char-table-extra-slot glyphless-char-display 0 method))
+	    (t
+	     (error "Invalid target character group: %s" target))))))
+
+(update-glyphless-char-display)
+
 ;;; Setting word boundary.
 
 (setq word-combining-categories
--- a/lisp/menu-bar.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/menu-bar.el	Sat Nov 06 10:28:31 2010 +0200
@@ -83,8 +83,8 @@
      (define-key global-map [menu-bar help-menu]
        (cons (purecopy "Info") menu-bar-help-menu)))
 
-;; This alias is for compatibility with 19.28 and before.
-(defvar menu-bar-files-menu menu-bar-file-menu)
+;; Only declared obsolete (and only made a proper alias) in 23.3.
+(define-obsolete-variable-alias 'menu-bar-files-menu 'menu-bar-file-menu "22.1")
 
 ;; This is referenced by some code below; it is defined in uniquify.el
 (defvar uniquify-buffer-name-style)
--- a/lisp/mh-e/ChangeLog	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/mh-e/ChangeLog	Sat Nov 06 10:28:31 2010 +0200
@@ -1,3 +1,7 @@
+2010-11-03  Glenn Morris  <rgm@gnu.org>
+
+	* mh-mime.el (dots, type, ov): Avoid unnecessary declaration.
+
 2010-05-14  Peter S Galbraith  <psg@debian.org>
 
 	* mh-mime.el (mh-decode-message-subject): New function to decode
--- a/lisp/mh-e/ChangeLog.1	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/mh-e/ChangeLog.1	Sat Nov 06 10:28:31 2010 +0200
@@ -5452,7 +5452,7 @@
 	from mh-exec-cmd.
 
 	* mh-utils.el (mh-temp-folders-buffer): Sequences and folders
-	loose the -temp from their buffer names as they are interesting to
+	lose the -temp from their buffer names as they are interesting to
 	the user.
 
 	* mh-seq.el (mh-list-sequences): New name, mh-sequences-buffer as
@@ -11400,7 +11400,8 @@
 	(dist): Leave release in current directory.
 
 
-  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+    Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
@@ -11417,4 +11418,3 @@
   You should have received a copy of the GNU General Public License
   along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
-;; arch-tag: 2577172b-b1bf-4d87-acfb-c9d8780e8851
--- a/lisp/mh-e/mh-mime.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/mh-e/mh-mime.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,8 +1,7 @@
 ;;; mh-mime.el --- MH-E MIME support
 
-;; Copyright (C) 1993, 1995,
-;;   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
@@ -837,9 +836,10 @@
 ;;; Button Display
 
 ;; Shush compiler.
-(defvar dots)                           ; XEmacs
-(defvar type)                           ; XEmacs
-(defvar ov)                             ; XEmacs
+(when (featurep 'xemacs)
+  (defvar dots)
+  (defvar type)
+  (defvar ov))
 
 (defun mh-insert-mime-button (handle index displayed)
   "Insert MIME button for HANDLE.
@@ -1834,5 +1834,4 @@
 ;; sentence-end-double-space: nil
 ;; End:
 
-;; arch-tag: 0dd36518-1b64-4a84-8f4e-59f422d3f002
 ;;; mh-mime.el ends here
--- a/lisp/mouse-sel.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/mouse-sel.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,7 @@
 ;;; mouse-sel.el --- multi-click selection support for Emacs 19
 
-;; Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006,
+;;   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Mike Williams <mdub@bigfoot.com>
 ;; Keywords: mouse
@@ -299,7 +299,7 @@
 	SELECTION-THING-SYMBOL 	= name of variable where the current selection
  				  type for this selection should be stored.")
 
-(declare-function x-select-text "term/x-win" (text))
+(declare-function x-select-text "term/common-win" (text))
 
 (defvar mouse-sel-set-selection-function
   (if (eq mouse-sel-default-bindings 'interprogram-cut-paste)
@@ -314,7 +314,7 @@
   SELECTION, the name of the selection concerned, and
   VALUE, the text to store.
 
-This sets the selection, unless `mouse-sel-default-bindings' 
+This sets the selection, unless `mouse-sel-default-bindings'
 is `interprogram-cut-paste'.")
 
 (declare-function x-selection-value "term/x-win" ())
@@ -749,5 +749,4 @@
 
 (provide 'mouse-sel)
 
-;; arch-tag: 86e6c73f-deaa-48d3-a24e-c565fda1f7d7
 ;;; mouse-sel.el ends here
--- a/lisp/mouse.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/mouse.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1280,7 +1280,7 @@
   (or mouse-yank-at-point (mouse-set-point click))
   (let ((primary
 	 (cond
-	  ((fboundp 'x-get-selection-value) ; MS-DOS and MS-Windows
+	  ((fboundp 'x-get-selection-value) ; MS-DOS, MS-Windows and X.
 	   (or (x-get-selection-value)
 	       (x-get-selection 'PRIMARY)))
 	  ;; FIXME: What about xterm-mouse-mode etc.?
--- a/lisp/net/dbus.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/net/dbus.el	Sat Nov 06 10:28:31 2010 +0200
@@ -239,7 +239,7 @@
 arrived.  SERVICE is the object name for which the name owner has
 been changed.  OLD-OWNER is the previous owner of SERVICE, or the
 empty string if SERVICE was not owned yet.  NEW-OWNER is the new
-owner of SERVICE, or the empty string if SERVICE looses any name owner.
+owner of SERVICE, or the empty string if SERVICE loses any name owner.
 
 usage: (dbus-name-owner-changed-handler service old-owner new-owner)"
   (save-match-data
@@ -1010,5 +1010,4 @@
 
 (provide 'dbus)
 
-;; arch-tag: a47caf84-9162-4811-90cc-5d388e37b9bd
 ;;; dbus.el ends here
--- a/lisp/net/gnutls.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/net/gnutls.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,4 +1,5 @@
 ;;; gnutls.el --- Support SSL/TLS connections through GnuTLS
+
 ;; Copyright (C) 2010 Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <tzz@lifelogs.com>
@@ -65,6 +66,8 @@
   (let ((proc (open-network-stream name buffer host service)))
     (gnutls-negotiate proc 'gnutls-x509pki)))
 
+(declare-function gnutls-boot "gnutls.c" (proc type proplist))
+
 (defun gnutls-negotiate (proc type &optional priority-string
                               trustfiles keyfiles)
   "Negotiate a SSL/TLS connection.
@@ -95,6 +98,9 @@
 
     proc))
 
+(declare-function gnutls-errorp "gnutls.c" (error))
+(declare-function gnutls-error-string "gnutls.c" (error))
+
 (defun gnutls-message-maybe (doit format &rest params)
   "When DOIT, message with the caller name followed by FORMAT on PARAMS."
   ;; (apply 'debug format (or params '(nil)))
--- a/lisp/net/tramp.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/net/tramp.el	Sat Nov 06 10:28:31 2010 +0200
@@ -2861,7 +2861,11 @@
 	    (setq buffer-file-name filename)
 	    (setq buffer-read-only (not (file-writable-p filename)))
 	    (set-visited-file-modtime)
-	    (set-buffer-modified-p nil))
+	    (set-buffer-modified-p nil)
+	    ;; For root, preserve owner and group when editing files.
+	    (when (string-equal (file-remote-p filename 'user) "root")
+	      (set (make-local-variable 'backup-by-copying-when-mismatch) t)
+	      (put 'backup-by-copying-when-mismatch 'permanent-local t)))
 	  (when (and (stringp local-copy)
 		     (or remote-copy (null tramp-temp-buffer-file-name)))
 	    (delete-file local-copy))
--- a/lisp/play/doctor.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/play/doctor.el	Sat Nov 06 10:28:31 2010 +0200
@@ -29,40 +29,94 @@
 
 ;;; Code:
 
-(defvar **mad**)        (defvar *debug*)      (defvar *print-space*)
-(defvar *print-upcase*) (defvar abuselst)     (defvar abusewords)
-(defvar account)        (defvar afraidof)     (defvar arerelated)
-(defvar areyou)         (defvar bak)          (defvar beclst)
-(defvar bother)         (defvar bye)          (defvar canyou)
-(defvar chatlst)        (defvar continue)     (defvar deathlst)
-(defvar describe)       (defvar drnk)         (defvar drugs)
-(defvar eliza-flag)     (defvar elizalst)     (defvar famlst)
-(defvar feared)         (defvar fears)        (defvar feelings-about)
-(defvar foullst)        (defvar found)        (defvar hello)
-(defvar history)        (defvar howareyoulst) (defvar howdyflag)
-(defvar huhlst)         (defvar ibelieve)     (defvar improve)
-(defvar inter)          (defvar isee)         (defvar isrelated)
-(defvar lincount)       (defvar longhuhlst)   (defvar lover)
-(defvar machlst)        (defvar mathlst)      (defvar maybe)
-(defvar moods)          (defvar neglst)       (defvar obj)
-(defvar object)         (defvar owner)        (defvar please)
-(defvar problems)       (defvar qlist)        (defvar random-adjective)
-(defvar relation)       (defvar remlst)       (defvar repetitive-shortness)
-(defvar replist)        (defvar rms-flag)     (defvar schoollst)
-(defvar sent)           (defvar sexlst)       (defvar shortbeclst)
-(defvar shortlst)       (defvar something)    (defvar sportslst)
-(defvar stallmanlst)    (defvar states)       (defvar subj)
-(defvar suicide-flag)   (defvar sure)         (defvar thing)
-(defvar things)         (defvar thlst)        (defvar toklst)
-(defvar typos)          (defvar verb)         (defvar want)
-(defvar whatwhen)       (defvar whereoutp)    (defvar whysay)
-(defvar whywant)        (defvar zippy-flag)   (defvar zippylst)
+(defvar doctor--**mad**)
+(defvar doctor--*print-space*)
+(defvar doctor--*print-upcase*)
+(defvar doctor--abuselst)
+(defvar doctor--abusewords)
+(defvar doctor--afraidof)
+(defvar doctor--arerelated)
+(defvar doctor--areyou)
+(defvar doctor--bak)
+(defvar doctor--beclst)
+(defvar doctor--bother)
+(defvar doctor--bye)
+(defvar doctor--canyou)			; unused?
+(defvar doctor--chatlst)
+(defvar doctor--continue)
+(defvar doctor--deathlst)
+(defvar doctor--describe)
+(defvar doctor--drnk)
+(defvar doctor--drugs)
+(defvar doctor--eliza-flag)
+(defvar doctor--elizalst)
+(defvar doctor--famlst)
+(defvar doctor--feared)
+(defvar doctor--fears)
+(defvar doctor--feelings-about)
+(defvar doctor--foullst)
+(defvar doctor-found)
+(defvar doctor--hello)
+(defvar doctor--history)
+(defvar doctor--howareyoulst)
+(defvar doctor--howdyflag)
+(defvar doctor--huhlst)
+(defvar doctor--ibelieve)
+(defvar doctor--improve)
+(defvar doctor--inter)
+(defvar doctor--isee)
+(defvar doctor--isrelated)
+(defvar doctor--lincount)
+(defvar doctor--longhuhlst)
+(defvar doctor--lover)
+(defvar doctor--machlst)
+(defvar doctor--mathlst)
+(defvar doctor--maybe)
+(defvar doctor--moods)
+(defvar doctor--neglst)
+(defvar doctor-obj)
+(defvar doctor-object)
+(defvar doctor-owner)
+(defvar doctor--please)
+(defvar doctor--problems)
+(defvar doctor--qlist)
+(defvar doctor--random-adjective)
+(defvar doctor--relation)
+(defvar doctor--remlst)
+(defvar doctor--repetitive-shortness)
+(defvar doctor--replist)
+(defvar doctor--rms-flag)
+(defvar doctor--schoollst)
+(defvar doctor-sent)
+(defvar doctor--sexlst)
+(defvar doctor--shortbeclst)
+(defvar doctor--shortlst)
+(defvar doctor--something)
+(defvar doctor--sportslst)
+(defvar doctor--stallmanlst)
+(defvar doctor--states)
+(defvar doctor-subj)
+(defvar doctor--suicide-flag)
+(defvar doctor--sure)
+(defvar doctor--thing)
+(defvar doctor--things)
+(defvar doctor--thlst)
+(defvar doctor--toklst)
+(defvar doctor--typos)
+(defvar doctor-verb)
+(defvar doctor--want)
+(defvar doctor--whatwhen)
+(defvar doctor--whereoutp)
+(defvar doctor--whysay)
+(defvar doctor--whywant)
+(defvar doctor--zippy-flag)
+(defvar doctor--zippylst)
 
 (defun doc// (x) x)
 
 (defmacro doc$ (what)
   "quoted arg form of doctor-$"
-  (list 'doctor-$ (list 'quote what)))
+  `(doctor-$ ',what))
 
 (defun doctor-$ (what)
   "Return the car of a list, rotating the list each time"
@@ -86,484 +140,411 @@
   (make-doctor-variables)
   (turn-on-auto-fill)
   (doctor-type '(i am the psychotherapist \.
-		 (doc$ please) (doc$ describe) your (doc$ problems) \.
+		 (doc$ doctor--please) (doc$ doctor--describe) your (doc$ doctor--problems) \.
 		 each time you are finished talking, type \R\E\T twice \.))
   (insert "\n"))
 
 (defun make-doctor-variables ()
-  (make-local-variable 'typos)
-  (setq typos
-	(mapcar (function (lambda (x)
-			    (put (car x) 'doctor-correction  (cadr x))
-			    (put (cadr x) 'doctor-expansion (car (cddr x)))
-			    (car x)))
-		'((theyll they\'ll (they will))
-		  (theyre they\'re (they are))
-		  (hes he\'s (he is))
-		  (he7s he\'s (he is))
-		  (im i\'m (you are))
-		  (i7m i\'m (you are))
-		  (isa is\ a (is a))
-		  (thier their (their))
-		  (dont don\'t (do not))
-		  (don7t don\'t (do not))
-		  (you7re you\'re (i am))
-		  (you7ve you\'ve (i have))
-		  (you7ll you\'ll (i will)))))
-  (make-local-variable 'found)
-  (setq found nil)
-  (make-local-variable 'owner)
-  (setq owner nil)
-  (make-local-variable 'history)
-  (setq history nil)
-  (make-local-variable '*debug*)
-  (setq *debug* nil)
-  (make-local-variable 'inter)
-  (setq inter
-	'((well\,)
-	  (hmmm \.\.\.\ so\,)
-	  (so)
-	  (\.\.\.and)
-	  (then)))
-  (make-local-variable 'continue)
-  (setq continue
-	'((continue)
-	  (proceed)
-	  (go on)
-	  (keep going) ))
-  (make-local-variable 'relation)
-  (setq relation
-	'((your relationship with)
-	  (something you remember about)
-	  (your feelings toward)
-	  (some experiences you have had with)
-	  (how you feel about)))
-  (make-local-variable 'fears)
-  (setq fears '( ((doc$ whysay) you are (doc$ afraidof) (doc// feared) \?)
-		 (you seem terrified by (doc// feared) \.)
-		 (when did you first feel (doc$ afraidof) (doc// feared) \?) ))
-  (make-local-variable 'sure)
-  (setq sure '((sure)(positive)(certain)(absolutely sure)))
-  (make-local-variable 'afraidof)
-  (setq afraidof '( (afraid of) (frightened by) (scared of) ))
-  (make-local-variable 'areyou)
-  (setq areyou '( (are you)(have you been)(have you been) ))
-  (make-local-variable 'isrelated)
-  (setq isrelated '( (has something to do with)(is related to)
-		     (could be the reason for) (is caused by)(is because of)))
-  (make-local-variable 'arerelated)
-  (setq arerelated '((have something to do with)(are related to)
-		     (could have caused)(could be the reason for) (are caused by)
-		     (are because of)))
-  (make-local-variable 'moods)
-  (setq moods '( ((doc$ areyou)(doc// found) often \?)
-		 (what causes you to be (doc// found) \?)
-		 ((doc$ whysay) you are (doc// found) \?) ))
-  (make-local-variable 'maybe)
-  (setq maybe
-	'((maybe)
-	  (perhaps)
-	  (possibly)))
-  (make-local-variable 'whatwhen)
-  (setq whatwhen
-	'((what happened when)
-	  (what would happen if)))
-  (make-local-variable 'hello)
-  (setq hello
-	'((how do you do \?) (hello \.) (howdy!) (hello \.) (hi \.) (hi there \.)))
-  (make-local-variable 'drnk)
-  (setq drnk
-	'((do you drink a lot of (doc// found) \?)
-	  (do you get drunk often \?)
-	  ((doc$ describe) your drinking habits \.) ))
-  (make-local-variable 'drugs)
-  (setq drugs '( (do you use (doc// found) often \?)((doc$ areyou)
-						 addicted to (doc// found) \?)(do you realize that drugs can
-						 be very harmful \?)((doc$ maybe) you should try to quit using (doc// found)
-						 \.)))
-  (make-local-variable 'whywant)
-  (setq whywant '( ((doc$ whysay) (doc// subj) might (doc$ want) (doc// obj) \?)
-		   (how does it feel to want \?)
-		   (why should (doc// subj) get (doc// obj) \?)
-		   (when did (doc// subj) first (doc$ want) (doc// obj) \?)
-		   ((doc$ areyou) obsessed with (doc// obj) \?)
-		   (why should i give (doc// obj) to (doc// subj) \?)
-		   (have you ever gotten (doc// obj) \?) ))
-  (make-local-variable 'canyou)
-  (setq canyou '((of course i can \.)
-		 (why should i \?)
-		 (what makes you think i would even want to \?)
-		 (i am the doctor\, i can do anything i damn please \.)
-		 (not really\, it\'s not up to me \.)
-		 (depends\, how important is it \?)
-		 (i could\, but i don\'t think it would be a wise thing to do \.)
-		 (can you \?)
-		 (maybe i can\, maybe i can\'t \.\.\.)
-		 (i don\'t think i should do that \.)))
-  (make-local-variable 'want)
-  (setq want '( (want) (desire) (wish) (want) (hope) ))
-  (make-local-variable 'shortlst)
-  (setq shortlst
-	'((can you elaborate on that \?)
-	  ((doc$ please) continue \.)
-	  (go on\, don\'t be afraid \.)
-	  (i need a little more detail please \.)
-	  (you\'re being a bit brief\, (doc$ please) go into detail \.)
-	  (can you be more explicit \?)
-	  (and \?)
-	  ((doc$ please) go into more detail \?)
-	  (you aren\'t being very talkative today\!)
-	  (is that all there is to it \?)
-	  (why must you respond so briefly \?)))
-
-  (make-local-variable 'famlst)
-  (setq famlst
-	'((tell me (doc$ something) about (doc// owner) family \.)
-	  (you seem to dwell on (doc// owner) family \.)
-	  ((doc$ areyou) hung up on (doc// owner) family \?)))
-  (make-local-variable 'huhlst)
-  (setq huhlst
-	'(((doc$ whysay)(doc// sent) \?)
-	  (is it because of (doc$ things) that you say (doc// sent) \?) ))
-  (make-local-variable 'longhuhlst)
-  (setq longhuhlst
-	'(((doc$ whysay) that \?)
-	  (i don\'t understand \.)
-	  ((doc$ thlst))
-	  ((doc$ areyou) (doc$ afraidof) that \?)))
-  (make-local-variable 'feelings-about)
-  (setq feelings-about
-	'((feelings about)
-	  (apprehensions toward)
-	  (thoughts on)
-	  (emotions toward)))
-  (make-local-variable 'random-adjective)
-  (setq random-adjective
-	'((vivid)
-	  (emotionally stimulating)
-	  (exciting)
-	  (boring)
-	  (interesting)
-	  (recent)
-	  (random)   ;How can we omit this?
-	  (unusual)
-	  (shocking)
-	  (embarrassing)))
-  (make-local-variable 'whysay)
-  (setq whysay
-	'((why do you say)
-	  (what makes you believe)
-	  (are you sure that)
-	  (do you really think)
-	  (what makes you think) ))
-  (make-local-variable 'isee)
-  (setq isee
-	'((i see \.\.\.)
-	  (yes\,)
-	  (i understand \.)
-	  (oh \.) ))
-  (make-local-variable 'please)
-  (setq please
-	'((please\,)
-	  (i would appreciate it if you would)
-	  (perhaps you could)
-	  (please\,)
-	  (would you please)
-	  (why don\'t you)
-	  (could you)))
-  (make-local-variable 'bye)
-  (setq bye
-	'((my secretary will send you a bill \.)
-	  (bye bye \.)
-	  (see ya \.)
-	  (ok\, talk to you some other time \.)
-	  (talk to you later \.)
-	  (ok\, have fun \.)
-	  (ciao \.)))
-  (make-local-variable 'something)
-  (setq something
-	'((something)
-	  (more)
-	  (how you feel)))
-  (make-local-variable 'thing)
-  (setq thing
-	'((your life)
-	  (your sex life)))
-  (make-local-variable 'things)
-  (setq things
-	'((your plans)
-	  (the people you hang around with)
-	  (problems at school)
-	  (any hobbies you have)
-	  (hangups you have)
-	  (your inhibitions)
-	  (some problems in your childhood)
-	  (some problems at home)))
-  (make-local-variable 'describe)
-  (setq describe
-	'((describe)
-	  (tell me about)
-	  (talk about)
-	  (discuss)
-	  (tell me more about)
-	  (elaborate on)))
-  (make-local-variable 'ibelieve)
-  (setq ibelieve
-	'((i believe) (i think) (i have a feeling) (it seems to me that)
-	  (it looks like)))
-  (make-local-variable 'problems)
-  (setq problems '( (problems)
-		    (inhibitions)
-		    (hangups)
-		    (difficulties)
-		    (anxieties)
-		    (frustrations) ))
-  (make-local-variable 'bother)
-  (setq bother
-	'((does it bother you that)
-	  (are you annoyed that)
-	  (did you ever regret)
-	  (are you sorry)
-	  (are you satisfied with the fact that)))
-  (make-local-variable 'machlst)
-  (setq machlst
-	'((you have your mind on (doc// found) \, it seems \.)
-	  (you think too much about  (doc// found) \.)
-	  (you should try taking your mind off of (doc// found)\.)
-	  (are you a computer hacker \?)))
-  (make-local-variable 'qlist)
-  (setq qlist
-	'((what do you think \?)
-	  (i\'ll ask the questions\, if you don\'t mind!)
-	  (i could ask the same thing myself \.)
-	  ((doc$ please) allow me to do the questioning \.)
-	  (i have asked myself that question many times \.)
-	  ((doc$ please) try to answer that question yourself \.)))
-  (make-local-variable 'foullst)
-  (setq foullst
-	'(((doc$ please) watch your tongue!)
-	  ((doc$ please) avoid such unwholesome thoughts \.)
-	  ((doc$ please) get your mind out of the gutter \.)
-	  (such lewdness is not appreciated \.)))
-  (make-local-variable 'deathlst)
-  (setq deathlst
-	'((this is not a healthy way of thinking \.)
-	  ((doc$ bother) you\, too\, may die someday \?)
-	  (i am worried by your obsession with this topic!)
-	  (did you watch a lot of crime and violence on television as a child \?))
-	)
-  (make-local-variable 'sexlst)
-  (setq sexlst
-	'(((doc$ areyou) (doc$ afraidof) sex \?)
-	  ((doc$ describe)(doc$ something) about your sexual history \.)
-	  ((doc$ please)(doc$ describe) your sex life \.\.\.)
-	  ((doc$ describe) your (doc$ feelings-about) your sexual partner \.)
-	  ((doc$ describe) your most (doc$ random-adjective) sexual experience \.)
-	  ((doc$ areyou) satisfied with (doc// lover) \.\.\. \?)))
-  (make-local-variable 'neglst)
-  (setq neglst
-	'((why not \?)
-	  ((doc$ bother) i ask that \?)
-	  (why not \?)
-	  (why not \?)
-	  (how come \?)
-	  ((doc$ bother) i ask that \?)))
-  (make-local-variable 'beclst)
-  (setq beclst '(
-		 (is it because (doc// sent) that you came to me \?)
-		 ((doc$ bother)(doc// sent) \?)
-		 (when did you first know that (doc// sent) \?)
-		 (is the fact that (doc// sent) the real reason \?)
-		 (does the fact that (doc// sent) explain anything else \?)
-		 ((doc$ areyou)(doc$ sure)(doc// sent) \? ) ))
-  (make-local-variable 'shortbeclst)
-  (setq shortbeclst '(
-		      ((doc$ bother) i ask you that \?)
-		      (that\'s not much of an answer!)
-		      ((doc$ inter) why won\'t you talk about it \?)
-		      (speak up!)
-		      ((doc$ areyou) (doc$ afraidof) talking about it \?)
-		      (don\'t be (doc$ afraidof) elaborating \.)
-		      ((doc$ please) go into more detail \.)))
-  (make-local-variable 'thlst)
-  (setq thlst '(
-		((doc$ maybe)(doc$ thing)(doc$ isrelated) this \.)
-		((doc$ maybe)(doc$ things)(doc$ arerelated) this \.)
-		(is it because of (doc$ things) that you are going through all this \?)
-		(how do you reconcile (doc$ things) \? )
-		((doc$ maybe) this (doc$ isrelated)(doc$ things) \?) ))
-  (make-local-variable 'remlst)
-  (setq remlst '( (earlier you said (doc$ history) \?)
-		  (you mentioned that (doc$ history) \?)
-		  ((doc$ whysay)(doc$ history) \? ) ))
-  (make-local-variable 'toklst)
-  (setq toklst
-	'((is this how you relax \?)
-	  (how long have you been smoking	grass \?)
-	  ((doc$ areyou) (doc$ afraidof) of being drawn to using harder stuff \?)))
-  (make-local-variable 'states)
-  (setq states
-	'((do you get (doc// found) often \?)
-	  (do you enjoy being (doc// found) \?)
-	  (what makes you (doc// found) \?)
-	  (how often (doc$ areyou)(doc// found) \?)
-	  (when were you last (doc// found) \?)))
-  (make-local-variable 'replist)
-  (setq replist
-	'((i . (you))
-	  (my . (your))
-	  (me . (you))
-	  (you . (me))
-	  (your . (my))
-	  (mine . (yours))
-	  (yours . (mine))
-	  (our . (your))
-	  (ours . (yours))
-	  (we . (you))
-	  (dunno . (do not know))
-;;	  (yes . ())
-	  (no\, . ())
-	  (yes\, . ())
-	  (ya . (i))
-	  (aint . (am not))
-	  (wanna . (want to))
-	  (gimme . (give me))
-	  (gotta . (have to))
-	  (gonna . (going to))
-	  (never . (not ever))
-	  (doesn\'t . (does not))
-	  (don\'t . (do not))
-	  (aren\'t . (are not))
-	  (isn\'t . (is not))
-	  (won\'t . (will not))
-	  (can\'t . (cannot))
-	  (haven\'t . (have not))
-	  (i\'m . (you are))
-	  (ourselves . (yourselves))
-	  (myself . (yourself))
-	  (yourself . (myself))
-	  (you\'re . (i am))
-	  (you\'ve . (i have))
-	  (i\'ve . (you have))
-	  (i\'ll . (you will))
-	  (you\'ll . (i shall))
-	  (i\'d . (you would))
-	  (you\'d . (i would))
-	  (here . (there))
-	  (please . ())
-	  (eh\, . ())
-	  (eh . ())
-	  (oh\, . ())
-	  (oh . ())
-	  (shouldn\'t . (should not))
-	  (wouldn\'t . (would not))
-	  (won\'t . (will not))
-	  (hasn\'t . (has not))))
-  (make-local-variable 'stallmanlst)
-  (setq stallmanlst '(
-		      ((doc$ describe) your (doc$ feelings-about) him \.)
-		      ((doc$ areyou) a friend of Stallman \?)
-		      ((doc$ bother) Stallman is (doc$ random-adjective) \?)
-		      ((doc$ ibelieve) you are (doc$ afraidof) him \.)))
-  (make-local-variable 'schoollst)
-  (setq schoollst '(
-		    ((doc$ describe) your (doc// found) \.)
-		    ((doc$ bother) your grades could (doc$ improve) \?)
-		    ((doc$ areyou) (doc$ afraidof) (doc// found) \?)
-		    ((doc$ maybe) this (doc$ isrelated) to your attitude \.)
-		    ((doc$ areyou) absent often \?)
-		    ((doc$ maybe) you should study (doc$ something) \.)))
-  (make-local-variable 'improve)
-  (setq improve '((improve) (be better) (be improved) (be higher)))
-  (make-local-variable 'elizalst)
-  (setq elizalst '(
-		   ((doc$ areyou) (doc$ sure) \?)
-		   ((doc$ ibelieve) you have (doc$ problems) with (doc// found) \.)
-		   ((doc$ whysay) (doc// sent) \?)))
-  (make-local-variable 'sportslst)
-  (setq sportslst '(
-		    (tell me (doc$ something) about (doc// found) \.)
-		    ((doc$ describe) (doc$ relation) (doc// found) \.)
-		    (do you find (doc// found) (doc$ random-adjective) \?)))
-  (make-local-variable 'mathlst)
-  (setq mathlst '(
-		  ((doc$ describe) (doc$ something) about math \.)
-		  ((doc$ maybe) your (doc$ problems) (doc$ arerelated) (doc// found) \.)
-		  (i don\'t know much (doc// found) \, but (doc$ continue)
-		     anyway \.)))
-  (make-local-variable 'zippylst)
-  (setq zippylst '(
-		   ((doc$ areyou) Zippy \?)
-		   ((doc$ ibelieve) you have some serious (doc$ problems) \.)
-		   ((doc$ bother) you are a pinhead \?)))
-  (make-local-variable 'chatlst)
-  (setq chatlst '(
-		  ((doc$ maybe) we could chat \.)
-		  ((doc$ please) (doc$ describe) (doc$ something) about chat mode \.)
-		  ((doc$ bother) our discussion is so (doc$ random-adjective) \?)))
-  (make-local-variable 'abuselst)
-  (setq abuselst '(
-		   ((doc$ please) try to be less abusive \.)
-		   ((doc$ describe) why you call me (doc// found) \.)
-		   (i\'ve had enough of you!)))
-  (make-local-variable 'abusewords)
-  (setq abusewords '(boring bozo clown clumsy cretin dumb dummy
-			    fool foolish gnerd gnurd idiot jerk
-			    lose loser louse lousy luse luser
-			    moron nerd nurd oaf oafish reek
-			    stink stupid tool toolish twit))
-  (make-local-variable 'howareyoulst)
-  (setq howareyoulst  '((how are you) (hows it going) (hows it going eh)
-			(how\'s it going) (how\'s it going eh) (how goes it)
-			(whats up) (whats new) (what\'s up) (what\'s new)
-			(howre you) (how\'re you) (how\'s everything)
-			(how is everything) (how do you do)
-			(how\'s it hanging) (que pasa)
-			(how are you doing) (what do you say)))
-  (make-local-variable 'whereoutp)
-  (setq whereoutp '( huh remem rthing ) )
-  (make-local-variable 'subj)
-  (setq subj nil)
-  (make-local-variable 'verb)
-  (setq verb nil)
-  (make-local-variable 'obj)
-  (setq obj nil)
-  (make-local-variable 'feared)
-  (setq feared nil)
-  (make-local-variable 'repetitive-shortness)
-  (setq repetitive-shortness '(0 . 0))
-  (make-local-variable '**mad**)
-  (setq **mad** nil)
-  (make-local-variable 'rms-flag)
-  (setq rms-flag nil)
-  (make-local-variable 'eliza-flag)
-  (setq eliza-flag nil)
-  (make-local-variable 'zippy-flag)
-  (setq zippy-flag nil)
-  (make-local-variable 'suicide-flag)
-  (setq suicide-flag nil)
-  (make-local-variable 'lover)
-  (setq lover '(your partner))
-  (make-local-variable 'bak)
-  (setq bak nil)
-  (make-local-variable 'lincount)
-  (setq lincount 0)
-  (make-local-variable '*print-upcase*)
-  (setq *print-upcase* nil)
-  (make-local-variable '*print-space*)
-  (setq *print-space* nil)
-  (make-local-variable 'howdyflag)
-  (setq howdyflag nil)
-  (make-local-variable 'object)
-  (setq object nil))
+  (set (make-local-variable 'doctor--typos)
+       (mapcar (lambda (x)
+		 (put (car x) 'doctor-correction  (cadr x))
+		 (put (cadr x) 'doctor-expansion (car (cddr x)))
+		 (car x))
+	       '((theyll they\'ll (they will))
+		 (theyre they\'re (they are))
+		 (hes he\'s (he is))
+		 (he7s he\'s (he is))
+		 (im i\'m (you are))
+		 (i7m i\'m (you are))
+		 (isa is\ a (is a))
+		 (thier their (their))
+		 (dont don\'t (do not))
+		 (don7t don\'t (do not))
+		 (you7re you\'re (i am))
+		 (you7ve you\'ve (i have))
+		 (you7ll you\'ll (i will)))))
+  (set (make-local-variable 'doctor-found) nil)
+  (set (make-local-variable 'doctor-owner) nil)
+  (set (make-local-variable 'doctor--history) nil)
+  (set (make-local-variable 'doctor--inter) '((well\,)
+				      (hmmm \.\.\.\ so\,)
+				      (so)
+				      (\.\.\.and)
+				      (then)))
+  (set (make-local-variable 'doctor--continue) '((continue)
+						 (proceed)
+						 (go on)
+						 (keep going)))
+  (set (make-local-variable 'doctor--relation)
+       '((your relationship with)
+	 (something you remember about)
+	 (your feelings toward)
+	 (some experiences you have had with)
+	 (how you feel about)))
+  (set (make-local-variable 'doctor--fears)
+       '(((doc$ doctor--whysay) you are (doc$ doctor--afraidof) (doc// doctor--feared) \?)
+	 (you seem terrified by (doc// doctor--feared) \.)
+	 (when did you first feel (doc$ doctor--afraidof) (doc// doctor--feared) \?)))
+  (set (make-local-variable 'doctor--sure) '((sure)
+					     (positive)
+					     (certain)
+					     (absolutely sure)))
+  (set (make-local-variable 'doctor--afraidof) '((afraid of)
+					 (frightened by)
+					 (scared of)))
+  (set (make-local-variable 'doctor--areyou) '((are you)
+				       (have you been)
+				       (have you been)))
+  (set (make-local-variable 'doctor--isrelated)
+       '((has something to do with)
+	 (is related to)
+	 (could be the reason for)
+	 (is caused by)
+	 (is because of)))
+  (set (make-local-variable 'doctor--arerelated) '((have something to do with)
+					   (are related to)
+					   (could have caused)
+					   (could be the reason for)
+					   (are caused by)
+					   (are because of)))
+  (set (make-local-variable 'doctor--moods)
+       '(((doc$ doctor--areyou) (doc// doctor-found) often \?)
+	 (what causes you to be (doc// doctor-found) \?)
+	 ((doc$ doctor--whysay) you are (doc// doctor-found) \?)))
+  (set (make-local-variable 'doctor--maybe) '((maybe)
+				      (perhaps)
+				      (possibly)))
+  (set (make-local-variable 'doctor--whatwhen) '((what happened when)
+						 (what would happen if)))
+  (set (make-local-variable 'doctor--hello) '((how do you do \?)
+				      (hello \.)
+				      (howdy!)
+				      (hello \.)
+				      (hi \.)
+				      (hi there \.)))
+  (set (make-local-variable 'doctor--drnk)
+       '((do you drink a lot of (doc// doctor-found) \?)
+	 (do you get drunk often \?)
+	 ((doc$ doctor--describe) your drinking habits \.)))
+  (set (make-local-variable 'doctor--drugs)
+       '((do you use (doc// doctor-found) often \?)
+	 ((doc$ doctor--areyou) addicted to (doc// doctor-found) \?)
+	 (do you realize that drugs can be very harmful \?)
+	 ((doc$ doctor--maybe) you should try to quit using (doc// doctor-found) \.)))
+  (set (make-local-variable 'doctor--whywant)
+       '(((doc$ doctor--whysay) (doc// doctor-subj) might (doc$ doctor--want) (doc// doctor-obj) \?)
+	 (how does it feel to want \?)
+	 (why should (doc// doctor-subj) get (doc// doctor-obj) \?)
+	 (when did (doc// doctor-subj) first (doc$ doctor--want) (doc// doctor-obj) \?)
+	 ((doc$ doctor--areyou) obsessed with (doc// doctor-obj) \?)
+	 (why should i give (doc// doctor-obj) to (doc// doctor-subj) \?)
+	 (have you ever gotten (doc// doctor-obj) \?)))
+  (set (make-local-variable 'doctor--canyou)
+       '((of course i can \.)
+	 (why should i \?)
+	 (what makes you think i would even want to \?)
+	 (i am the doctor\, i can do anything i damn please \.)
+	 (not really\, it\'s not up to me \.)
+	 (depends\, how important is it \?)
+	 (i could\, but i don\'t think it would be a wise thing to do \.)
+	 (can you \?)
+	 (maybe i can\, maybe i can\'t \.\.\.)
+	 (i don\'t think i should do that \.)))
+  (set (make-local-variable 'doctor--want) '((want) (desire) (wish) (want) (hope)))
+  (set (make-local-variable 'doctor--shortlst)
+       '((can you elaborate on that \?)
+	 ((doc$ doctor--please) continue \.)
+	 (go on\, don\'t be afraid \.)
+	 (i need a little more detail please \.)
+	 (you\'re being a bit brief\, (doc$ doctor--please) go into detail \.)
+	 (can you be more explicit \?)
+	 (and \?)
+	 ((doc$ doctor--please) go into more detail \?)
+	 (you aren\'t being very talkative today\!)
+	 (is that all there is to it \?)
+	 (why must you respond so briefly \?)))
+  (set (make-local-variable 'doctor--famlst)
+       '((tell me (doc$ doctor--something) about (doc// doctor-owner) family \.)
+	 (you seem to dwell on (doc// doctor-owner) family \.)
+	 ((doc$ doctor--areyou) hung up on (doc// doctor-owner) family \?)))
+  (set (make-local-variable 'doctor--huhlst)
+       '(((doc$ doctor--whysay)(doc// doctor-sent) \?)
+	 (is it because of (doc$ doctor--things) that you say (doc// doctor-sent) \?)))
+  (set (make-local-variable 'doctor--longhuhlst)
+       '(((doc$ doctor--whysay) that \?)
+	 (i don\'t understand \.)
+	 ((doc$ doctor--thlst))
+	 ((doc$ doctor--areyou) (doc$ doctor--afraidof) that \?)))
+  (set (make-local-variable 'doctor--feelings-about) '((feelings about)
+					       (apprehensions toward)
+					       (thoughts on)
+					       (emotions toward)))
+  (set (make-local-variable 'doctor--random-adjective)
+       '((vivid)
+	 (emotionally stimulating)
+	 (exciting)
+	 (boring)
+	 (interesting)
+	 (recent)
+	 (random) ; how can we omit this?
+	 (unusual)
+	 (shocking)
+	 (embarrassing)))
+  (set (make-local-variable 'doctor--whysay) '((why do you say)
+				       (what makes you believe)
+				       (are you sure that)
+				       (do you really think)
+				       (what makes you think)))
+  (set (make-local-variable 'doctor--isee) '((i see \.\.\.)
+				     (yes\,)
+				     (i understand \.)
+				     (oh \.) ))
+  (set (make-local-variable 'doctor--please) '((please\,)
+				       (i would appreciate it if you would)
+				       (perhaps you could)
+				       (please\,)
+				       (would you please)
+				       (why don\'t you)
+				       (could you)))
+  (set (make-local-variable 'doctor--bye)
+       '((my secretary will send you a bill \.)
+	 (bye bye \.)
+	 (see ya \.)
+	 (ok\, talk to you some other time \.)
+	 (talk to you later \.)
+	 (ok\, have fun \.)
+	 (ciao \.)))
+  (set (make-local-variable 'doctor--something) '((something)
+						  (more)
+						  (how you feel)))
+  (set (make-local-variable 'doctor--thing) '((your life)
+				      (your sex life)))
+  (set (make-local-variable 'doctor--things) '((your plans)
+				       (the people you hang around with)
+				       (problems at school)
+				       (any hobbies you have)
+				       (hangups you have)
+				       (your inhibitions)
+				       (some problems in your childhood)
+				       (some problems at home)))
+  (set (make-local-variable 'doctor--describe) '((describe)
+					 (tell me about)
+					 (talk about)
+					 (discuss)
+					 (tell me more about)
+					 (elaborate on)))
+  (set (make-local-variable 'doctor--ibelieve)
+       '((i believe) (i think) (i have a feeling) (it seems to me that)
+	 (it looks like)))
+  (set (make-local-variable 'doctor--problems) '((problems)
+					 (inhibitions)
+					 (hangups)
+					 (difficulties)
+					 (anxieties)
+					 (frustrations)))
+  (set (make-local-variable 'doctor--bother) '((does it bother you that)
+				       (are you annoyed that)
+				       (did you ever regret)
+				       (are you sorry)
+				       (are you satisfied with the fact that)))
+  (set (make-local-variable 'doctor--machlst)
+       '((you have your mind on (doc// doctor-found) \, it seems \.)
+	 (you think too much about  (doc// doctor-found) \.)
+	 (you should try taking your mind off of (doc// doctor-found)\.)
+	 (are you a computer hacker \?)))
+  (set (make-local-variable 'doctor--qlist)
+       '((what do you think \?)
+	 (i\'ll ask the questions\, if you don\'t mind!)
+	 (i could ask the same thing myself \.)
+	 ((doc$ doctor--please) allow me to do the questioning \.)
+	 (i have asked myself that question many times \.)
+	 ((doc$ doctor--please) try to answer that question yourself \.)))
+  (set (make-local-variable 'doctor--foullst)
+       '(((doc$ doctor--please) watch your tongue!)
+	 ((doc$ doctor--please) avoid such unwholesome thoughts \.)
+	 ((doc$ doctor--please) get your mind out of the gutter \.)
+	 (such lewdness is not appreciated \.)))
+  (set (make-local-variable 'doctor--deathlst)
+       '((this is not a healthy way of thinking \.)
+	 ((doc$ doctor--bother) you\, too\, may die someday \?)
+	 (i am worried by your obsession with this topic!)
+	 (did you watch a lot of crime and violence on television as a child \?)))
+  (set (make-local-variable 'doctor--sexlst)
+       '(((doc$ doctor--areyou) (doc$ doctor--afraidof) sex \?)
+	 ((doc$ doctor--describe)(doc$ doctor--something) about your sexual history \.)
+	 ((doc$ doctor--please)(doc$ doctor--describe) your sex life \.\.\.)
+	 ((doc$ doctor--describe) your (doc$ doctor--feelings-about) your sexual partner \.)
+	 ((doc$ doctor--describe) your most (doc$ doctor--random-adjective) sexual experience \.)
+	 ((doc$ doctor--areyou) satisfied with (doc// doctor--lover) \.\.\. \?)))
+  (set (make-local-variable 'doctor--neglst) '((why not \?)
+				       ((doc$ doctor--bother) i ask that \?)
+				       (why not \?)
+				       (why not \?)
+				       (how come \?)
+				       ((doc$ doctor--bother) i ask that \?)))
+  (set (make-local-variable 'doctor--beclst)
+       '((is it because (doc// doctor-sent) that you came to me \?)
+	 ((doc$ doctor--bother)(doc// doctor-sent) \?)
+	 (when did you first know that (doc// doctor-sent) \?)
+	 (is the fact that (doc// doctor-sent) the real reason \?)
+	 (does the fact that (doc// doctor-sent) explain anything else \?)
+	 ((doc$ doctor--areyou)(doc$ doctor--sure)(doc// doctor-sent) \? )))
+  (set (make-local-variable 'doctor--shortbeclst)
+   '(((doc$ doctor--bother) i ask you that \?)
+     (that\'s not much of an answer!)
+     ((doc$ doctor--inter) why won\'t you talk about it \?)
+     (speak up!)
+     ((doc$ doctor--areyou) (doc$ doctor--afraidof) talking about it \?)
+     (don\'t be (doc$ doctor--afraidof) elaborating \.)
+     ((doc$ doctor--please) go into more detail \.)))
+  (set (make-local-variable 'doctor--thlst)
+       '(((doc$ doctor--maybe)(doc$ doctor--thing)(doc$ doctor--isrelated) this \.)
+	 ((doc$ doctor--maybe)(doc$ doctor--things)(doc$ doctor--arerelated) this \.)
+	 (is it because of (doc$ doctor--things) that you are going through all this \?)
+	 (how do you reconcile (doc$ doctor--things) \? )
+	 ((doc$ doctor--maybe) this (doc$ doctor--isrelated)(doc$ doctor--things) \?)))
+  (set (make-local-variable 'doctor--remlst)
+       '((earlier you said (doc$ doctor--history) \?)
+	 (you mentioned that (doc$ doctor--history) \?)
+	 ((doc$ doctor--whysay)(doc$ doctor--history) \? )))
+  (set (make-local-variable 'doctor--toklst)
+       '((is this how you relax \?)
+	 (how long have you been smoking	grass \?)
+	 ((doc$ doctor--areyou) (doc$ doctor--afraidof) of being drawn to using harder stuff \?)))
+  (set (make-local-variable 'doctor--states)
+       '((do you get (doc// doctor-found) often \?)
+	 (do you enjoy being (doc// doctor-found) \?)
+	 (what makes you (doc// doctor-found) \?)
+	 (how often (doc$ doctor--areyou)(doc// doctor-found) \?)
+	 (when were you last (doc// doctor-found) \?)))
+  (set (make-local-variable 'doctor--replist) '((i . (you))
+					(my . (your))
+					(me . (you))
+					(you . (me))
+					(your . (my))
+					(mine . (yours))
+					(yours . (mine))
+					(our . (your))
+					(ours . (yours))
+					(we . (you))
+					(dunno . (do not know))
+					;;	  (yes . ())
+					(no\, . ())
+					(yes\, . ())
+					(ya . (i))
+					(aint . (am not))
+					(wanna . (want to))
+					(gimme . (give me))
+					(gotta . (have to))
+					(gonna . (going to))
+					(never . (not ever))
+					(doesn\'t . (does not))
+					(don\'t . (do not))
+					(aren\'t . (are not))
+					(isn\'t . (is not))
+					(won\'t . (will not))
+					(can\'t . (cannot))
+					(haven\'t . (have not))
+					(i\'m . (you are))
+					(ourselves . (yourselves))
+					(myself . (yourself))
+					(yourself . (myself))
+					(you\'re . (i am))
+					(you\'ve . (i have))
+					(i\'ve . (you have))
+					(i\'ll . (you will))
+					(you\'ll . (i shall))
+					(i\'d . (you would))
+					(you\'d . (i would))
+					(here . (there))
+					(please . ())
+					(eh\, . ())
+					(eh . ())
+					(oh\, . ())
+					(oh . ())
+					(shouldn\'t . (should not))
+					(wouldn\'t . (would not))
+					(won\'t . (will not))
+					(hasn\'t . (has not))))
+  (set (make-local-variable 'doctor--stallmanlst)
+       '(((doc$ doctor--describe) your (doc$ doctor--feelings-about) him \.)
+	 ((doc$ doctor--areyou) a friend of Stallman \?)
+	 ((doc$ doctor--bother) Stallman is (doc$ doctor--random-adjective) \?)
+	 ((doc$ doctor--ibelieve) you are (doc$ doctor--afraidof) him \.)))
+  (set (make-local-variable 'doctor--schoollst)
+       '(((doc$ doctor--describe) your (doc// doctor-found) \.)
+	 ((doc$ doctor--bother) your grades could (doc$ doctor--improve) \?)
+	 ((doc$ doctor--areyou) (doc$ doctor--afraidof) (doc// doctor-found) \?)
+	 ((doc$ doctor--maybe) this (doc$ doctor--isrelated) to your attitude \.)
+	 ((doc$ doctor--areyou) absent often \?)
+	 ((doc$ doctor--maybe) you should study (doc$ doctor--something) \.)))
+  (set (make-local-variable 'doctor--improve)
+       '((improve) (be better) (be improved) (be higher)))
+  (set (make-local-variable 'doctor--elizalst)
+       '(((doc$ doctor--areyou) (doc$ doctor--sure) \?)
+	 ((doc$ doctor--ibelieve) you have (doc$ doctor--problems) with (doc// doctor-found) \.)
+	 ((doc$ doctor--whysay) (doc// doctor-sent) \?)))
+  (set (make-local-variable 'doctor--sportslst)
+       '((tell me (doc$ doctor--something) about (doc// doctor-found) \.)
+	 ((doc$ doctor--describe) (doc$ doctor--relation) (doc// doctor-found) \.)
+	 (do you find (doc// doctor-found) (doc$ doctor--random-adjective) \?)))
+  (set (make-local-variable 'doctor--mathlst)
+       '(((doc$ doctor--describe) (doc$ doctor--something) about math \.)
+	 ((doc$ doctor--maybe) your (doc$ doctor--problems) (doc$ doctor--arerelated) (doc// doctor-found) \.)
+	 (i don\'t know much (doc// doctor-found) \, but (doc$ doctor--continue)
+	    anyway \.)))
+  (set (make-local-variable 'doctor--zippylst)
+       '(((doc$ doctor--areyou) Zippy \?)
+	 ((doc$ doctor--ibelieve) you have some serious (doc$ doctor--problems) \.)
+	 ((doc$ doctor--bother) you are a pinhead \?)))
+  (set (make-local-variable 'doctor--chatlst)
+       '(((doc$ doctor--maybe) we could chat \.)
+	 ((doc$ doctor--please) (doc$ doctor--describe) (doc$ doctor--something) about chat mode \.)
+	 ((doc$ doctor--bother) our discussion is so (doc$ doctor--random-adjective) \?)))
+  (set (make-local-variable 'doctor--abuselst)
+       '(((doc$ doctor--please) try to be less abusive \.)
+	 ((doc$ doctor--describe) why you call me (doc// doctor-found) \.)
+	 (i\'ve had enough of you!)))
+  (set (make-local-variable 'doctor--abusewords)
+       '(boring bozo clown clumsy cretin dumb dummy
+		fool foolish gnerd gnurd idiot jerk
+		lose loser louse lousy luse luser
+		moron nerd nurd oaf oafish reek
+		stink stupid tool toolish twit))
+  (set (make-local-variable 'doctor--howareyoulst)
+       '((how are you) (hows it going) (hows it going eh)
+	 (how\'s it going) (how\'s it going eh) (how goes it)
+	 (whats up) (whats new) (what\'s up) (what\'s new)
+	 (howre you) (how\'re you) (how\'s everything)
+	 (how is everything) (how do you do)
+	 (how\'s it hanging) (que pasa)
+	 (how are you doing) (what do you say)))
+  (set (make-local-variable 'doctor--whereoutp) '(huh remem rthing))
+  (set (make-local-variable 'doctor-subj) nil)
+  (set (make-local-variable 'doctor-verb) nil)
+  (set (make-local-variable 'doctor-obj) nil)
+  (set (make-local-variable 'doctor--feared) nil)
+  (set (make-local-variable 'doctor--repetitive-shortness) '(0 . 0))
+  (set (make-local-variable 'doctor--**mad**) nil)
+  (set (make-local-variable 'doctor--rms-flag) nil)
+  (set (make-local-variable 'doctor--eliza-flag) nil)
+  (set (make-local-variable 'doctor--zippy-flag) nil)
+  (set (make-local-variable 'doctor--suicide-flag) nil)
+  (set (make-local-variable 'doctor--lover) '(your partner))
+  (set (make-local-variable 'doctor--bak) nil)
+  (set (make-local-variable 'doctor--lincount) 0)
+  (set (make-local-variable 'doctor--*print-upcase*) nil)
+  (set (make-local-variable 'doctor--*print-space*) nil)
+  (set (make-local-variable 'doctor--howdyflag) nil)
+  (set (make-local-variable 'doctor-object) nil))
 
 ;; Define equivalence classes of words that get treated alike.
 
 (defun doctor-meaning (x) (get x 'doctor-meaning))
 
 (defmacro doctor-put-meaning (symb val)
-    "Store the base meaning of a word on the property list."
-    (list 'put (list 'quote symb) ''doctor-meaning val))
+  "Store the base meaning of a word on the property list."
+  `(put ',symb 'doctor-meaning ,val))
 
 (doctor-put-meaning howdy 'howdy)
 (doctor-put-meaning hi 'howdy)
@@ -855,10 +836,10 @@
   (interactive)
   (let ((sent (doctor-readin)))
     (insert "\n")
-    (setq lincount (1+ lincount))
+    (setq doctor--lincount (1+ doctor--lincount))
     (doctor-doc sent)
     (insert "\n")
-    (setq bak sent)))
+    (setq doctor--bak sent)))
 
 (defun doctor-readin nil
   "Read a sentence.  Return it as a list of words."
@@ -878,70 +859,70 @@
 
 ;; Main processing function for sentences that have been read.
 
-(defun doctor-doc (sent)
+(defun doctor-doc (doctor-sent)
   (cond
-   ((equal sent '(foo))
-    (doctor-type '(bar! (doc$ please)(doc$ continue) \.)))
-   ((member sent howareyoulst)
-    (doctor-type '(i\'m ok \.  (doc$ describe) yourself \.)))
-   ((or (member sent '((good bye) (see you later) (i quit) (so long)
+   ((equal doctor-sent '(foo))
+    (doctor-type '(bar! (doc$ doctor--please)(doc$ doctor--continue) \.)))
+   ((member doctor-sent doctor--howareyoulst)
+    (doctor-type '(i\'m ok \.  (doc$ doctor--describe) yourself \.)))
+   ((or (member doctor-sent '((good bye) (see you later) (i quit) (so long)
 		       (go away) (get lost)))
-	(memq (car sent)
+	(memq (car doctor-sent)
 	      '(bye halt break quit done exit goodbye
 		    bye\, stop pause goodbye\, stop pause)))
-    (doctor-type (doc$ bye)))
-   ((and (eq (car sent) 'you)
-	 (memq (cadr sent) abusewords))
-    (setq found (cadr sent))
-    (doctor-type (doc$ abuselst)))
-   ((eq (car sent) 'whatmeans)
-    (doctor-def (cadr sent)))
-   ((equal sent '(parse))
-    (doctor-type (list  'subj '= subj ",  "
-			'verb '= verb "\n"
-			'object 'phrase '= obj ","
-			'noun 'form '=  object "\n"
-			'current 'keyword 'is found
+    (doctor-type (doc$ doctor--bye)))
+   ((and (eq (car doctor-sent) 'you)
+	 (memq (cadr doctor-sent) doctor--abusewords))
+    (setq doctor-found (cadr doctor-sent))
+    (doctor-type (doc$ doctor--abuselst)))
+   ((eq (car doctor-sent) 'whatmeans)
+    (doctor-def (cadr doctor-sent)))
+   ((equal doctor-sent '(parse))
+    (doctor-type (list  'subj '= doctor-subj ",  "
+			'verb '= doctor-verb "\n"
+			'object 'phrase '= doctor-obj ","
+			'noun 'form '=  doctor-object "\n"
+			'current 'keyword 'is doctor-found
 			", "
 			'most 'recent 'possessive
-			'is owner "\n"
+			'is doctor-owner "\n"
 			'sentence 'used 'was
 			"..."
-			'(doc// bak))))
-   ((memq (car sent) '(are is do has have how when where who why))
-    (doctor-type (doc$ qlist)))
-   ;;   ((eq (car sent) 'forget)
-   ;;    (set (cadr sent) nil)
-   ;;    (doctor-type '((doc$ isee)(doc$ please)
-   ;;     (doc$ continue)\.)))
+			'(doc// doctor--bak))))
+   ((memq (car doctor-sent) '(are is do has have how when where who why))
+    (doctor-type (doc$ doctor--qlist)))
+   ;;   ((eq (car doctor-sent) 'forget)
+   ;;    (set (cadr doctor-sent) nil)
+   ;;    (doctor-type '((doc$ doctor--isee)(doc$ doctor--please)
+   ;;     (doc$ doctor--continue)\.)))
    (t
-    (if (doctor-defq sent) (doctor-define sent found))
-    (if (> (length sent) 12)(setq sent (doctor-shorten sent)))
-    (setq sent (doctor-correct-spelling (doctor-replace sent replist)))
-    (cond ((and (not (memq 'me sent))(not (memq 'i sent))
-		(memq 'am sent))
-	   (setq sent (doctor-replace sent '((am . (are)))))))
-    (cond ((equal (car sent) 'yow) (doctor-zippy))
-	  ((< (length sent) 2)
-	   (cond ((eq (doctor-meaning (car sent)) 'howdy)
+    (if (doctor-defq doctor-sent) (doctor-define doctor-sent doctor-found))
+    (if (> (length doctor-sent) 12)(setq doctor-sent (doctor-shorten doctor-sent)))
+    (setq doctor-sent (doctor-correct-spelling (doctor-replace doctor-sent doctor--replist)))
+    (cond ((and (not (memq 'me doctor-sent))(not (memq 'i doctor-sent))
+		(memq 'am doctor-sent))
+	   (setq doctor-sent (doctor-replace doctor-sent '((am . (are)))))))
+    (cond ((equal (car doctor-sent) 'yow) (doctor-zippy))
+	  ((< (length doctor-sent) 2)
+	   (cond ((eq (doctor-meaning (car doctor-sent)) 'howdy)
 		  (doctor-howdy))
 		 (t (doctor-short))))
 	  (t
-	   (if (memq 'am sent)
-	       (setq sent (doctor-replace sent '((me . (i))))))
-	   (setq sent (doctor-fixup sent))
-	   (if (and (eq (car sent) 'do) (eq (cadr sent) 'not))
+	   (if (memq 'am doctor-sent)
+	       (setq doctor-sent (doctor-replace doctor-sent '((me . (i))))))
+	   (setq doctor-sent (doctor-fixup doctor-sent))
+	   (if (and (eq (car doctor-sent) 'do) (eq (cadr doctor-sent) 'not))
 	       (cond ((zerop (random 3))
-		      (doctor-type '(are you (doc$ afraidof) that \?)))
+		      (doctor-type '(are you (doc$ doctor--afraidof) that \?)))
 		     ((zerop (random 2))
 		      (doctor-type '(don\'t tell me what to do \. i am the
 					    doctor here!))
 		      (doctor-rthing))
 		     (t
-		      (doctor-type '((doc$ whysay) that i shouldn\'t
-				     (cddr sent)
+		      (doctor-type '((doc$ doctor--whysay) that i shouldn\'t
+				     (cddr doctor-sent)
 				     \?))))
-	     (doctor-go (doctor-wherego sent))))))))
+	     (doctor-go (doctor-wherego doctor-sent))))))))
 
 ;; Things done to process sentences once read.
 
@@ -949,8 +930,9 @@
   "Correct the spelling and expand each word in sentence."
   (if sent
       (apply 'append (mapcar (lambda (word)
-				(if (memq word typos)
-				    (get (get word 'doctor-correction) 'doctor-expansion)
+				(if (memq word doctor--typos)
+				    (get (get word 'doctor-correction)
+					 'doctor-expansion)
 				  (list word)))
 			     sent))))
 
@@ -972,33 +954,32 @@
 (defun doctor-define (sent found)
   (doctor-svo sent found 1 nil)
   (and
-   (doctor-nounp subj)
-   (not (doctor-pronounp subj))
-   subj
-   (doctor-meaning object)
-   (put subj 'doctor-meaning (doctor-meaning object))
+   (doctor-nounp doctor-subj)
+   (not (doctor-pronounp doctor-subj))
+   doctor-subj
+   (doctor-meaning doctor-object)
+   (put doctor-subj 'doctor-meaning (doctor-meaning doctor-object))
    t))
 
 (defun doctor-defq (sent)
-  "Set global var FOUND to first keyword found in sentence SENT."
-  (setq found nil)
+  "Set global var DOCTOR-FOUND to first keyword found in sentence SENT."
+  (setq doctor-found nil)
   (let ((temp '(means applies mean refers refer related
 		      similar defined associated linked like same)))
     (while temp
 	   (if (memq (car temp) sent)
-	       (setq found (car temp)
+	       (setq doctor-found (car temp)
 		     temp nil)
 	       (setq temp (cdr temp)))))
-  found)
+  doctor-found)
 
 (defun doctor-def (x)
-  (progn
-   (doctor-type (list 'the 'word x 'means (doctor-meaning x) 'to 'me))
-   nil))
+  (doctor-type (list 'the 'word x 'means (doctor-meaning x) 'to 'me))
+  nil)
 
 (defun doctor-forget ()
   "Delete the last element of the history list."
-  (setq history (reverse (cdr (reverse history)))))
+  (setq doctor--history (reverse (cdr (reverse doctor--history)))))
 
 (defun doctor-query (x)
   "Prompt for a line of input from the minibuffer until a noun or verb is seen.
@@ -1026,16 +1007,16 @@
 
 (defun doctor-subjsearch (sent key type)
   "Search for the subject of a sentence SENT, looking for the noun closest
-to and preceding KEY by at least TYPE words.  Set global variable subj to
+to and preceding KEY by at least TYPE words.  Set global variable doctor-subj to
 the subject noun, and return the portion of the sentence following it."
   (let ((i (- (length sent) (length (memq key sent)) type)))
     (while (and (> i -1) (not (doctor-nounp (nth i sent))))
       (setq i (1- i)))
     (cond ((> i -1)
-	   (setq subj (nth i sent))
+	   (setq doctor-subj (nth i sent))
 	   (nthcdr (1+ i) sent))
 	  (t
-	   (setq subj 'you)
+	   (setq doctor-subj 'you)
 	   nil))))
 
 (defun doctor-nounp (x)
@@ -1149,12 +1130,12 @@
 	  (t 'something))))
 
 (defun doctor-getnoun (x)
-  (cond ((null x)(setq object 'something))
-	((atom x)(setq object x))
+  (cond ((null x)(setq doctor-object 'something))
+	((atom x)(setq doctor-object x))
 	((eq (length x) 1)
-	 (setq object (cond
-		       ((doctor-nounp (setq object (car x))) object)
-		       (t (doctor-query object)))))
+	 (setq doctor-object (cond
+		       ((doctor-nounp (setq doctor-object (car x))) doctor-object)
+		       (t (doctor-query doctor-object)))))
 	((eq (car x) 'to)
 	 (doctor-build 'to\  (doctor-getnoun (cdr x))))
 	((doctor-prepp (car x))
@@ -1170,7 +1151,7 @@
 						   (car x) (car x))))))
 				     " ")
 		       (doctor-getnoun (cdr x))))
-	(t (setq object (car x))
+	(t (setq doctor-object (car x))
 	   (doctor-build (doctor-build (car x) " ") (doctor-getnoun (cdr x))))
 	))
 
@@ -1238,9 +1219,9 @@
 		  under underneath with without)))
 
 (defun doctor-remember (thing)
-  (cond ((null history)
-	 (setq history (list thing)))
-	(t (setq history (append history (list thing))))))
+  (cond ((null doctor--history)
+	 (setq doctor--history (list thing)))
+	(t (setq doctor--history (append doctor--history (list thing))))))
 
 (defun doctor-type (x)
   (setq x (doctor-fix-2 x))
@@ -1317,57 +1298,58 @@
 element pair in RLIST."
   (apply 'append
 	 (mapcar
-	  (function
 	   (lambda (x)
 	     (cdr (or (assq x rlist)   ; either find a replacement
-		      (list x x)))))   ; or fake an identity mapping
-	  sent)))
+		      (list x x))))    ; or fake an identity mapping
+	   sent)))
 
 (defun doctor-wherego (sent)
-  (cond ((null sent)(doc$ whereoutp))
+  (cond ((null sent)(doc$ doctor--whereoutp))
 	((null (doctor-meaning (car sent)))
 	 (doctor-wherego (cond ((zerop (random 2))
 				(reverse (cdr sent)))
 			       (t (cdr sent)))))
 	(t
-	 (setq found (car sent))
+	 (setq doctor-found (car sent))
 	 (doctor-meaning (car sent)))))
 
 (defun doctor-svo (sent key type mem)
   "Find subject, verb and object in sentence SENT with focus on word KEY.
 TYPE is number of words preceding KEY to start looking for subject.
 MEM is t if results are to be put on Doctor's memory stack.
-Return in the global variables SUBJ, VERB and OBJECT."
+Return in the global variables DOCTOR-SUBJ, DOCTOR-VERB, DOCTOR-OBJECT,
+and DOCTOR-OBJ."
   (let ((foo (doctor-subjsearch sent key type)))
     (or foo
 	(setq foo sent
 	      mem nil))
     (while (and (null (doctor-verbp (car foo))) (cdr foo))
       (setq foo (cdr foo)))
-    (setq verb (car foo))
-    (setq obj (doctor-getnoun (cdr foo)))
-    (cond ((eq object 'i)(setq object 'me))
-	  ((eq subj 'me)(setq subj 'i)))
-    (cond (mem (doctor-remember (list subj verb obj))))))
+    (setq doctor-verb (car foo))
+    (setq doctor-obj (doctor-getnoun (cdr foo)))
+    (cond ((eq doctor-object 'i)(setq doctor-object 'me))
+	  ((eq doctor-subj 'me)(setq doctor-subj 'i)))
+    (cond (mem (doctor-remember (list doctor-subj doctor-verb doctor-obj))))))
 
 (defun doctor-possess (sent key)
   "Set possessive in SENT for keyword KEY.
-Hack on previous word, setting global variable OWNER to correct result."
+Hack on previous word, setting global variable DOCTOR-OWNER to correct result."
   (let* ((i (- (length sent) (length (memq key sent)) 1))
 	 (prev (if (< i 0) 'your
 		 (nth i sent))))
-    (setq owner (if (or (doctor-possessivepronounp prev)
-			(string-equal "s"
-				      (substring (doctor-make-string prev)
-						 -1)))
-		    prev
-		  'your))))
+    (setq doctor-owner
+	  (if (or (doctor-possessivepronounp prev)
+		  (string-equal "s"
+				(substring (doctor-make-string prev)
+					   -1)))
+	      prev
+	    'your))))
 
 ;; Output of replies.
 
 (defun doctor-txtype (ans)
   "Output to buffer a list of symbols or strings as a sentence."
-  (setq *print-upcase* t *print-space* nil)
+  (setq doctor--*print-upcase* t doctor--*print-space* nil)
   (mapc 'doctor-type-symbol ans)
   (insert "\n"))
 
@@ -1375,20 +1357,18 @@
   "Output a symbol to the buffer with some fancy case and spacing hacks."
   (setq word (doctor-make-string word))
   (if (string-equal word "i") (setq word "I"))
-  (if *print-upcase*
-      (progn
-	(setq word (capitalize word))
-	(if *print-space*
-	    (insert " "))))
+  (when doctor--*print-upcase*
+    (setq word (capitalize word))
+    (if doctor--*print-space* (insert " ")))
   (cond ((or (string-match "^[.,;:?! ]" word)
-	     (not *print-space*))
+	     (not doctor--*print-space*))
 	 (insert word))
 	(t (insert ?\s word)))
   (and auto-fill-function
        (> (current-column) fill-column)
        (apply auto-fill-function nil))
-  (setq *print-upcase* (string-match "[.?!]$" word)
-	*print-space* t))
+  (setq doctor--*print-upcase* (string-match "[.?!]$" word)
+	doctor--*print-space* t))
 
 (defun doctor-build (str1 str2)
   "Make a symbol out of the concatenation of the two non-list arguments."
@@ -1426,220 +1406,219 @@
   (funcall (intern (concat "doctor-" (doctor-make-string destination)))))
 
 (defun doctor-desire1 ()
-  (doctor-go (doc$ whereoutp)))
+  (doctor-go (doc$ doctor--whereoutp)))
 
 (defun doctor-huh ()
-  (cond ((< (length sent) 9) (doctor-type (doc$ huhlst)))
-	(t (doctor-type (doc$ longhuhlst)))))
+  (cond ((< (length doctor-sent) 9) (doctor-type (doc$ doctor--huhlst)))
+	(t (doctor-type (doc$ doctor--longhuhlst)))))
 
-(defun doctor-rthing () (doctor-type (doc$ thlst)))
+(defun doctor-rthing () (doctor-type (doc$ doctor--thlst)))
 
-(defun doctor-remem () (cond ((null history)(doctor-huh))
-			     ((doctor-type (doc$ remlst)))))
+(defun doctor-remem () (cond ((null doctor--history)(doctor-huh))
+			     ((doctor-type (doc$ doctor--remlst)))))
 
 (defun doctor-howdy ()
-  (cond ((not howdyflag)
-	 (doctor-type '((doc$ hello) what brings you to see me \?))
-	 (setq howdyflag t))
+  (cond ((not doctor--howdyflag)
+	 (doctor-type '((doc$ doctor--hello) what brings you to see me \?))
+	 (setq doctor--howdyflag t))
 	(t
-	 (doctor-type '((doc$ ibelieve) we\'ve introduced ourselves already \.))
-	 (doctor-type '((doc$ please) (doc$ describe) (doc$ things) \.)))))
+	 (doctor-type '((doc$ doctor--ibelieve) we\'ve introduced ourselves already \.))
+	 (doctor-type '((doc$ doctor--please) (doc$ doctor--describe) (doc$ doctor--things) \.)))))
 
 (defun doctor-when ()
-  (cond ((< (length (memq found sent)) 3)(doctor-short))
+  (cond ((< (length (memq doctor-found doctor-sent)) 3)(doctor-short))
 	(t
-	 (setq sent (cdr (memq found sent)))
-	 (setq sent (doctor-fixup sent))
-	 (doctor-type '((doc$ whatwhen)(doc// sent) \?)))))
+	 (setq doctor-sent (cdr (memq doctor-found doctor-sent)))
+	 (setq doctor-sent (doctor-fixup doctor-sent))
+	 (doctor-type '((doc$ doctor--whatwhen)(doc// doctor-sent) \?)))))
 
 (defun doctor-conj ()
-  (cond ((< (length (memq found sent)) 4)(doctor-short))
+  (cond ((< (length (memq doctor-found doctor-sent)) 4)(doctor-short))
 	(t
-	 (setq sent (cdr (memq found sent)))
-	 (setq sent (doctor-fixup sent))
-	 (cond ((eq (car sent) 'of)
-		(doctor-type '(are you (doc$ sure) that is the real reason \?))
-		(setq things (cons (cdr sent) things)))
+	 (setq doctor-sent (cdr (memq doctor-found doctor-sent)))
+	 (setq doctor-sent (doctor-fixup doctor-sent))
+	 (cond ((eq (car doctor-sent) 'of)
+		(doctor-type '(are you (doc$ doctor--sure) that is the real reason \?))
+		(setq doctor--things (cons (cdr doctor-sent) doctor--things)))
 	       (t
-		(doctor-remember sent)
-		(doctor-type (doc$ beclst)))))))
+		(doctor-remember doctor-sent)
+		(doctor-type (doc$ doctor--beclst)))))))
 
 (defun doctor-short ()
-  (cond ((= (car repetitive-shortness) (1- lincount))
-	 (rplacd repetitive-shortness
-		 (1+ (cdr repetitive-shortness))))
+  (cond ((= (car doctor--repetitive-shortness) (1- doctor--lincount))
+	 (rplacd doctor--repetitive-shortness
+		 (1+ (cdr doctor--repetitive-shortness))))
 	(t
-	 (rplacd repetitive-shortness 1)))
-  (rplaca repetitive-shortness lincount)
-  (cond ((> (cdr repetitive-shortness) 6)
-	 (cond ((not **mad**)
-		(doctor-type '((doc$ areyou)
+	 (rplacd doctor--repetitive-shortness 1)))
+  (rplaca doctor--repetitive-shortness doctor--lincount)
+  (cond ((> (cdr doctor--repetitive-shortness) 6)
+	 (cond ((not doctor--**mad**)
+		(doctor-type '((doc$ doctor--areyou)
 			       just trying to see what kind of things
 			       i have in my vocabulary \? please try to
 			       carry on a reasonable conversation!))
-		(setq **mad** t))
+		(setq doctor--**mad** t))
 	       (t
 		(doctor-type '(i give up \. you need a lesson in creative
 				 writing \.\.\.))
 		)))
 	(t
-	 (cond ((equal sent (doctor-assm '(yes)))
-		(doctor-type '((doc$ isee) (doc$ inter) (doc$ whysay) this is so \?)))
-	       ((equal sent (doctor-assm '(because)))
-		(doctor-type (doc$ shortbeclst)))
-	       ((equal sent (doctor-assm '(no)))
-		(doctor-type (doc$ neglst)))
-	       (t (doctor-type (doc$ shortlst)))))))
+	 (cond ((equal doctor-sent (doctor-assm '(yes)))
+		(doctor-type '((doc$ doctor--isee) (doc$ doctor--inter) (doc$ doctor--whysay) this is so \?)))
+	       ((equal doctor-sent (doctor-assm '(because)))
+		(doctor-type (doc$ doctor--shortbeclst)))
+	       ((equal doctor-sent (doctor-assm '(no)))
+		(doctor-type (doc$ doctor--neglst)))
+	       (t (doctor-type (doc$ doctor--shortlst)))))))
 
-(defun doctor-alcohol () (doctor-type (doc$ drnk)))
+(defun doctor-alcohol () (doctor-type (doc$ doctor--drnk)))
 
 (defun doctor-desire ()
-  (let ((foo (memq found sent)))
+  (let ((foo (memq doctor-found doctor-sent)))
     (cond ((< (length foo) 2)
-	   (doctor-go (doctor-build (doctor-meaning found) 1)))
+	   (doctor-go (doctor-build (doctor-meaning doctor-found) 1)))
 	  ((memq (cadr foo) '(a an))
 	   (rplacd foo (append '(to have) (cdr foo)))
-	   (doctor-svo sent found 1 nil)
-	   (doctor-remember (list subj 'would 'like obj))
-	   (doctor-type (doc$ whywant)))
+	   (doctor-svo doctor-sent doctor-found 1 nil)
+	   (doctor-remember (list doctor-subj 'would 'like doctor-obj))
+	   (doctor-type (doc$ doctor--whywant)))
 	  ((not (eq (cadr foo) 'to))
-	   (doctor-go (doctor-build (doctor-meaning found) 1)))
+	   (doctor-go (doctor-build (doctor-meaning doctor-found) 1)))
 	  (t
-	   (doctor-svo sent found 1 nil)
-	   (doctor-remember (list subj 'would 'like obj))
-	   (doctor-type (doc$ whywant))))))
+	   (doctor-svo doctor-sent doctor-found 1 nil)
+	   (doctor-remember (list doctor-subj 'would 'like doctor-obj))
+	   (doctor-type (doc$ doctor--whywant))))))
 
 (defun doctor-drug ()
-  (doctor-type (doc$ drugs))
-  (doctor-remember (list 'you 'used found)))
+  (doctor-type (doc$ doctor--drugs))
+  (doctor-remember (list 'you 'used doctor-found)))
 
 (defun doctor-toke ()
-  (doctor-type (doc$ toklst)))
+  (doctor-type (doc$ doctor--toklst)))
 
 (defun doctor-state ()
-  (doctor-type (doc$ states))(doctor-remember (list 'you 'were found)))
+  (doctor-type (doc$ doctor--states))(doctor-remember (list 'you 'were doctor-found)))
 
 (defun doctor-mood ()
-  (doctor-type (doc$ moods))(doctor-remember (list 'you 'felt found)))
+  (doctor-type (doc$ doctor--moods))(doctor-remember (list 'you 'felt doctor-found)))
 
 (defun doctor-fear ()
-  (setq feared (doctor-setprep sent found))
-  (doctor-type (doc$ fears))
-  (doctor-remember (list 'you 'were 'afraid 'of feared)))
+  (setq doctor--feared (doctor-setprep doctor-sent doctor-found))
+  (doctor-type (doc$ doctor--fears))
+  (doctor-remember (list 'you 'were 'afraid 'of doctor--feared)))
 
 (defun doctor-hate ()
-  (doctor-svo sent found 1 t)
-  (cond ((memq 'not sent) (doctor-forget) (doctor-huh))
-	((equal subj 'you)
-	 (doctor-type '(why do you (doc// verb)(doc// obj) \?)))
-	(t (doctor-type '((doc$ whysay)(list subj verb obj))))))
+  (doctor-svo doctor-sent doctor-found 1 t)
+  (cond ((memq 'not doctor-sent) (doctor-forget) (doctor-huh))
+	((equal doctor-subj 'you)
+	 (doctor-type '(why do you (doc// doctor-verb)(doc// doctor-obj) \?)))
+	(t (doctor-type '((doc$ doctor--whysay)(list doctor-subj doctor-verb doctor-obj))))))
 
 (defun doctor-symptoms ()
-  (doctor-type '((doc$ maybe) you should consult a medical doctor\;
+  (doctor-type '((doc$ doctor--maybe) you should consult a medical doctor\;
 		 i am a psychotherapist. \.)))
 
 (defun doctor-hates ()
-  (doctor-svo sent found 1 t)
+  (doctor-svo doctor-sent doctor-found 1 t)
   (doctor-hates1))
 
 (defun doctor-hates1 ()
-  (doctor-type '((doc$ whysay)(list subj verb obj) \?)))
+  (doctor-type '((doc$ doctor--whysay)(list doctor-subj doctor-verb doctor-obj) \?)))
 
 (defun doctor-loves ()
-  (doctor-svo sent found 1 t)
+  (doctor-svo doctor-sent doctor-found 1 t)
   (doctor-qloves))
 
 (defun doctor-qloves ()
-  (doctor-type '((doc$ bother)(list subj verb obj) \?)))
+  (doctor-type '((doc$ doctor--bother)(list doctor-subj doctor-verb doctor-obj) \?)))
 
 (defun doctor-love ()
-  (doctor-svo sent found 1 t)
-  (cond ((memq 'not sent) (doctor-forget) (doctor-huh))
-	((memq 'to sent) (doctor-hates1))
+  (doctor-svo doctor-sent doctor-found 1 t)
+  (cond ((memq 'not doctor-sent) (doctor-forget) (doctor-huh))
+	((memq 'to doctor-sent) (doctor-hates1))
 	(t
-	 (cond ((equal object 'something)
-		(setq object '(this person you love))))
-	 (cond ((equal subj 'you)
-		(setq lover obj)
-		(cond ((equal lover '(this person you love))
-		       (setq lover '(your partner))
+	 (cond ((equal doctor-object 'something)
+		(setq doctor-object '(this person you love))))
+	 (cond ((equal doctor-subj 'you)
+		(setq doctor--lover doctor-obj)
+		(cond ((equal doctor--lover '(this person you love))
+		       (setq doctor--lover '(your partner))
 		       (doctor-forget)
 		       (doctor-type '(with whom are you in love \?)))
-		      ((doctor-type '((doc$ please)
-				      (doc$ describe)
-				      (doc$ relation)
-				      (doc// lover)
+		      ((doctor-type '((doc$ doctor--please)
+				      (doc$ doctor--describe)
+				      (doc$ doctor--relation)
+				      (doc// doctor--lover)
 				      \.)))))
-	       ((equal subj 'i)
+	       ((equal doctor-subj 'i)
 		(doctor-txtype '(we were discussing you!)))
 	       (t (doctor-forget)
-		  (setq obj 'someone)
-		  (setq verb (doctor-build verb 's))
+		  (setq doctor-obj 'someone)
+		  (setq doctor-verb (doctor-build doctor-verb 's))
 		  (doctor-qloves))))))
 
 (defun doctor-mach ()
-  (setq found (doctor-plural found))
-  (doctor-type (doc$ machlst)))
+  (setq doctor-found (doctor-plural doctor-found))
+  (doctor-type (doc$ doctor--machlst)))
 
 (defun doctor-sexnoun () (doctor-sexverb))
 
 (defun doctor-sexverb ()
-  (if (or (memq 'me sent)(memq 'myself sent)(memq 'i sent))
+  (if (or (memq 'me doctor-sent)(memq 'myself doctor-sent)(memq 'i doctor-sent))
       (doctor-foul)
-    (doctor-type (doc$ sexlst))))
+    (doctor-type (doc$ doctor--sexlst))))
 
 (defun doctor-death ()
-  (cond (suicide-flag (doctor-type (doc$ deathlst)))
-	((or (equal found 'suicide)
-             (and (or (equal found 'kill)
-                      (equal found 'killing))
-                  (memq 'yourself sent)))
-	 (setq suicide-flag t)
+  (cond (doctor--suicide-flag (doctor-type (doc$ doctor--deathlst)))
+	((or (equal doctor-found 'suicide)
+             (and (or (equal doctor-found 'kill)
+                      (equal doctor-found 'killing))
+                  (memq 'yourself doctor-sent)))
+	 (setq doctor--suicide-flag t)
 	 (doctor-type '(If you are really suicidal, you might
 			   want to contact the Samaritans via
 			   E-mail: jo@samaritans.org or, at your option,
 			   anonymous E-mail: samaritans@anon.twwells.com\ \.
                            or find a Befrienders crisis center at
 			   http://www.befrienders.org/\ \.
-			   (doc$ please) (doc$ continue) \.)))
-	(t (doctor-type (doc$ deathlst)))))
+			   (doc$ doctor--please) (doc$ doctor--continue) \.)))
+	(t (doctor-type (doc$ doctor--deathlst)))))
 
 (defun doctor-foul ()
-  (doctor-type (doc$ foullst)))
+  (doctor-type (doc$ doctor--foullst)))
 
 (defun doctor-family ()
-  (doctor-possess sent found)
-  (doctor-type (doc$ famlst)))
+  (doctor-possess doctor-sent doctor-found)
+  (doctor-type (doc$ doctor--famlst)))
 
 ;; I did not add this -- rms.
 ;; But he might have removed it.  I put it back.  --roland
 (defun doctor-rms ()
-  (cond (rms-flag (doctor-type (doc$ stallmanlst)))
-	(t (setq rms-flag t) (doctor-type '(do you know Stallman \?)))))
+  (cond (doctor--rms-flag (doctor-type (doc$ doctor--stallmanlst)))
+	(t (setq doctor--rms-flag t) (doctor-type '(do you know Stallman \?)))))
 
-(defun doctor-school nil (doctor-type (doc$ schoollst)))
+(defun doctor-school nil (doctor-type (doc$ doctor--schoollst)))
 
 (defun doctor-eliza ()
-  (cond (eliza-flag (doctor-type (doc$ elizalst)))
-	(t (setq eliza-flag t)
-	   (doctor-type '((doc// found) \? hah !
-			  (doc$ please) (doc$ continue) \.)))))
+  (cond (doctor--eliza-flag (doctor-type (doc$ doctor--elizalst)))
+	(t (setq doctor--eliza-flag t)
+	   (doctor-type '((doc// doctor-found) \? hah !
+			  (doc$ doctor--please) (doc$ doctor--continue) \.)))))
 
-(defun doctor-sports ()  (doctor-type (doc$ sportslst)))
+(defun doctor-sports () (doctor-type (doc$ doctor--sportslst)))
 
-(defun doctor-math () (doctor-type (doc$ mathlst)))
+(defun doctor-math () (doctor-type (doc$ doctor--mathlst)))
 
 (defun doctor-zippy ()
-  (cond (zippy-flag (doctor-type (doc$ zippylst)))
-	(t (setq zippy-flag t)
+  (cond (doctor--zippy-flag (doctor-type (doc$ doctor--zippylst)))
+	(t (setq doctor--zippy-flag t)
 	   (doctor-type '(yow! are we interactive yet \?)))))
 
 
-(defun doctor-chat () (doctor-type (doc$ chatlst)))
+(defun doctor-chat () (doctor-type (doc$ doctor--chatlst)))
 
 (random t)
 
 (provide 'doctor)
 
-;; arch-tag: 579380f6-4902-4ea5-bccb-6339e30e1257
 ;;; doctor.el ends here
--- a/lisp/play/fortune.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/play/fortune.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,7 @@
 ;;; fortune.el --- use fortune to create signatures
 
-;; Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;;  2008, 2009, 2010  Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+;;  2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Holger Schauer <Holger.Schauer@gmx.de>
 ;; Keywords: games utils mail
@@ -285,48 +285,41 @@
 ;;; Display fortune
 (defun fortune-in-buffer (interactive &optional file)
   "Put a fortune cookie in the *fortune* buffer.
-
-INTERACTIVE is ignored.  Optional argument FILE,
-when supplied, specifies the file to choose the fortune from."
+INTERACTIVE is ignored.  Optional argument FILE, when supplied,
+specifies the file to choose the fortune from."
   (let ((fortune-buffer (or (get-buffer fortune-buffer-name)
 			    (generate-new-buffer fortune-buffer-name)))
 	(fort-file (expand-file-name
 		    (substitute-in-file-name
 		     (or file fortune-file)))))
     (with-current-buffer fortune-buffer
-      (toggle-read-only 0)
-      (erase-buffer)
-
-      (if fortune-always-compile
-	  (fortune-compile fort-file))
-
-      (apply 'call-process
-             fortune-program            ; program to call
-             nil fortune-buffer nil     ; INFILE BUFFER DISPLAY
-             (append (if (stringp fortune-program-options)
-                         (split-string fortune-program-options)
-                       fortune-program-options) (list fort-file))))))
+      (let ((inhibit-read-only t))
+        (erase-buffer)
+        (if fortune-always-compile
+            (fortune-compile fort-file))
+        (apply 'call-process
+               fortune-program            ; program to call
+               nil fortune-buffer nil     ; INFILE BUFFER DISPLAY
+               (append (if (stringp fortune-program-options)
+                           (split-string fortune-program-options)
+                         fortune-program-options) (list fort-file)))))))
 
 ;;;###autoload
 (defun fortune (&optional file)
   "Display a fortune cookie.
-
 If called with a prefix asks for the FILE to choose the fortune from,
 otherwise uses the value of `fortune-file'.  If you want to have fortune
 choose from a set of files in a directory, call interactively with prefix
 and choose the directory as the fortune-file."
-  (interactive
-    (list
-     (if current-prefix-arg
-	 (fortune-ask-file)
-       fortune-file)))
+  (interactive (list (if current-prefix-arg
+                         (fortune-ask-file)
+                       fortune-file)))
   (fortune-in-buffer t file)
   (switch-to-buffer (get-buffer fortune-buffer-name))
-  (toggle-read-only 1))
+  (setq buffer-read-only t))
 
 
 ;;; Provide ourselves.
 (provide 'fortune)
 
-;; arch-tag: a1e4cb8a-3792-40e7-86a7-fc75ce094bcc
 ;;; fortune.el ends here
--- a/lisp/play/gomoku.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/play/gomoku.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,7 @@
 ;;; gomoku.el --- Gomoku game between you and Emacs
 
-;; Copyright (C) 1988, 1994, 1996, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1994, 1996, 2001, 2002, 2003, 2004, 2005, 2006,
+;;   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Philippe Schnoebelen <phs@lsv.ens-cachan.fr>
 ;; Maintainer: FSF
@@ -195,8 +195,8 @@
 \\{gomoku-mode-map}"
   (gomoku-display-statistics)
   (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults '(gomoku-font-lock-keywords t))
-  (toggle-read-only t))
+  (setq font-lock-defaults '(gomoku-font-lock-keywords t)
+	buffer-read-only t))
 
 ;;;
 ;;; THE BOARD.
@@ -278,7 +278,7 @@
 ;; its contents as a set, i.e. not considering the order of its elements. The
 ;; highest score is given to the "OOOO" qtuples because playing in such a
 ;; qtuple is winning the game. Just after this comes the "XXXX" qtuple because
-;; not playing in it is just loosing the game, and so on. Note that a
+;; not playing in it is just losing the game, and so on. Note that a
 ;; "polluted" qtuple, i.e. one containing at least one X and at least one O,
 ;; has score zero because there is no more any point in playing in it, from
 ;; both an attacking and a defending point of view.
@@ -299,15 +299,15 @@
 ;; these values will change (hopefully improve) the strength of the program
 ;; and may change its style (rather aggressive here).
 
-(defconst nil-score	  7  "Score of an empty qtuple.")
-(defconst Xscore	 15  "Score of a qtuple containing one X.")
-(defconst XXscore	400  "Score of a qtuple containing two X's.")
-(defconst XXXscore     1800  "Score of a qtuple containing three X's.")
-(defconst XXXXscore  100000  "Score of a qtuple containing four X's.")
-(defconst Oscore	 35  "Score of a qtuple containing one O.")
-(defconst OOscore	800  "Score of a qtuple containing two O's.")
-(defconst OOOscore    15000  "Score of a qtuple containing three O's.")
-(defconst OOOOscore  800000  "Score of a qtuple containing four O's.")
+(defconst gomoku-nil-score	  7  "Score of an empty qtuple.")
+(defconst gomoku-Xscore	 15  "Score of a qtuple containing one X.")
+(defconst gomoku-XXscore	400  "Score of a qtuple containing two X's.")
+(defconst gomoku-XXXscore     1800  "Score of a qtuple containing three X's.")
+(defconst gomoku-XXXXscore  100000  "Score of a qtuple containing four X's.")
+(defconst gomoku-Oscore	 35  "Score of a qtuple containing one O.")
+(defconst gomoku-OOscore	800  "Score of a qtuple containing two O's.")
+(defconst gomoku-OOOscore    15000  "Score of a qtuple containing three O's.")
+(defconst gomoku-OOOOscore  800000  "Score of a qtuple containing four O's.")
 
 ;; These values are not just random: if, given the following situation:
 ;;
@@ -320,7 +320,7 @@
 ;; you want Emacs to play in "a" and not in "b", then the parameters must
 ;; satisfy the inequality:
 ;;
-;;		   6 * XXscore > XXXscore + XXscore
+;;		   6 * gomoku-XXscore > gomoku-XXXscore + gomoku-XXscore
 ;;
 ;; because "a" mainly belongs to six "XX" qtuples (the others are less
 ;; important) while "b" belongs to one "XXX" and one "XX" qtuples.  Other
@@ -334,26 +334,26 @@
 ;; we just have to set up a translation table.
 
 (defconst gomoku-score-trans-table
-  (vector nil-score Xscore XXscore XXXscore XXXXscore 0
-	  Oscore    0	   0	   0	    0	      0
-	  OOscore   0	   0	   0	    0	      0
-	  OOOscore  0	   0	   0	    0	      0
-	  OOOOscore 0	   0	   0	    0	      0
+  (vector gomoku-nil-score gomoku-Xscore gomoku-XXscore gomoku-XXXscore gomoku-XXXXscore 0
+	  gomoku-Oscore    0	   0	   0	    0	      0
+	  gomoku-OOscore   0	   0	   0	    0	      0
+	  gomoku-OOOscore  0	   0	   0	    0	      0
+	  gomoku-OOOOscore 0	   0	   0	    0	      0
 	  0)
   "Vector associating qtuple contents to their score.")
 
 
 ;; If you do not modify drastically the previous constants, the only way for a
-;; square to have a score higher than OOOOscore is to belong to a "OOOO"
+;; square to have a score higher than gomoku-OOOOscore is to belong to a "OOOO"
 ;; qtuple, thus to be a winning move. Similarly, the only way for a square to
-;; have a score between XXXXscore and OOOOscore is to belong to a "XXXX"
+;; have a score between gomoku-XXXXscore and gomoku-OOOOscore is to belong to a "XXXX"
 ;; qtuple. We may use these considerations to detect when a given move is
-;; winning or loosing.
+;; winning or losing.
 
-(defconst gomoku-winning-threshold OOOOscore
+(defconst gomoku-winning-threshold gomoku-OOOOscore
   "Threshold score beyond which an Emacs move is winning.")
 
-(defconst gomoku-loosing-threshold XXXXscore
+(defconst gomoku-losing-threshold gomoku-XXXXscore
   "Threshold score beyond which a human move is winning.")
 
 
@@ -394,10 +394,10 @@
 ;;;
 
 ;; At initialization the board is empty so that every qtuple amounts for
-;; nil-score. Therefore, the score of any square is nil-score times the number
+;; gomoku-nil-score. Therefore, the score of any square is gomoku-nil-score times the number
 ;; of qtuples that pass through it. This number is 3 in a corner and 20 if you
 ;; are sufficiently far from the sides. As computing the number is time
-;; consuming, we initialize every square with 20*nil-score and then only
+;; consuming, we initialize every square with 20*gomoku-nil-score and then only
 ;; consider squares at less than 5 squares from one side. We speed this up by
 ;; taking symmetry into account.
 ;; Also, as it is likely that successive games will be played on a board with
@@ -421,7 +421,7 @@
       (setq gomoku-score-table (copy-sequence gomoku-saved-score-table))
       ;; No, compute it:
       (setq gomoku-score-table
-	    (make-vector gomoku-vector-length (* 20 nil-score)))
+	    (make-vector gomoku-vector-length (* 20 gomoku-nil-score)))
       (let (i j maxi maxj maxi2 maxj2)
 	(setq maxi  (/ (1+ gomoku-board-width) 2)
 	      maxj  (/ (1+ gomoku-board-height) 2)
@@ -872,7 +872,7 @@
 	    (t
 	     (setq score (aref gomoku-score-table square))
 	     (gomoku-play-move square 1)
-	     (cond ((and (>= score gomoku-loosing-threshold)
+	     (cond ((and (>= score gomoku-losing-threshold)
 			 ;; Just testing SCORE > THRESHOLD is not enough for
 			 ;; detecting wins, it just gives an indication that
 			 ;; we confirm with GOMOKU-FIND-FILLED-QTUPLE.
@@ -1206,5 +1206,4 @@
 
 (provide 'gomoku)
 
-;; arch-tag: b1b8205e-77fc-4597-b373-3ea2c04311eb
 ;;; gomoku.el ends here
--- a/lisp/play/landmark.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/play/landmark.el	Sat Nov 06 10:28:31 2010 +0200
@@ -255,8 +255,8 @@
   (lm-display-statistics)
   (use-local-map lm-mode-map)
   (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults '(lm-font-lock-keywords t))
-  (toggle-read-only t)
+  (setq font-lock-defaults '(lm-font-lock-keywords t)
+	buffer-read-only t)
   (run-mode-hooks 'lm-mode-hook))
 
 
@@ -282,7 +282,7 @@
 ;; its contents as a set, i.e. not considering the order of its elements. The
 ;; highest score is given to the "OOOO" qtuples because playing in such a
 ;; qtuple is winning the game. Just after this comes the "XXXX" qtuple because
-;; not playing in it is just loosing the game, and so on. Note that a
+;; not playing in it is just losing the game, and so on. Note that a
 ;; "polluted" qtuple, i.e. one containing at least one X and at least one O,
 ;; has score zero because there is no more any point in playing in it, from
 ;; both an attacking and a defending point of view.
@@ -352,13 +352,13 @@
 ;; qtuple, thus to be a winning move. Similarly, the only way for a square to
 ;; have a score between XXXXscore and OOOOscore is to belong to a "XXXX"
 ;; qtuple. We may use these considerations to detect when a given move is
-;; winning or loosing.
+;; winning or losing.
 
 (defconst lm-winning-threshold
   (aref lm-score-trans-table (+ 6 6 6 6)) ;; OOOOscore
   "Threshold score beyond which an Emacs move is winning.")
 
-(defconst lm-loosing-threshold
+(defconst lm-losing-threshold
   (aref lm-score-trans-table (+ 1 1 1 1)) ;; XXXXscore
   "Threshold score beyond which a human move is winning.")
 
@@ -771,7 +771,7 @@
 	    (t
 	     (setq score (aref lm-score-table square))
 	     (lm-play-move square 1)
-	     (cond ((and (>= score lm-loosing-threshold)
+	     (cond ((and (>= score lm-losing-threshold)
 			 ;; Just testing SCORE > THRESHOLD is not enough for
 			 ;; detecting wins, it just gives an indication that
 			 ;; we confirm with LM-FIND-FILLED-QTUPLE.
@@ -1702,5 +1702,4 @@
 
 (provide 'landmark)
 
-;; arch-tag: ae5031be-96e6-459e-a3df-1df53117d3f2
 ;;; landmark.el ends here
--- a/lisp/progmodes/ada-mode.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/progmodes/ada-mode.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,8 @@
 ;;; ada-mode.el --- major-mode for editing Ada sources
 
-;; Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+;;   2004, 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Rolf Ebert      <ebert@inf.enst.fr>
 ;;      Markus Heritsch <Markus.Heritsch@studbox.uni-stuttgart.de>
@@ -1117,9 +1118,9 @@
 	(funcall (symbol-function 'speedbar-add-supported-extension)
 		 spec)
 	(funcall (symbol-function 'speedbar-add-supported-extension)
-		 body)))
-  )
-
+		 body))))
+
+(defvar ada-font-lock-syntactic-keywords) ; defined below
 
 ;;;###autoload
 (defun ada-mode ()
@@ -5538,5 +5539,4 @@
 ;;; provide ourselves
 (provide 'ada-mode)
 
-;; arch-tag: 1b7d45ec-1698-43b5-8d4a-e479ea023270
 ;;; ada-mode.el ends here
--- a/lisp/progmodes/cc-cmds.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/progmodes/cc-cmds.el	Sat Nov 06 10:28:31 2010 +0200
@@ -3974,17 +3974,19 @@
 		    ;; "Invalid search bound (wrong side of point)"
 		    ;; error in the subsequent re-search.  Maybe
 		    ;; another fix would be needed (2007-12-08).
-		    (or (<= (- (cdr c-lit-limits) 2) (point))
-			(and 
-			 (search-forward-regexp
-			  (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)")
-			  (- (cdr c-lit-limits) 2) t)
-			 (not (search-forward-regexp
-			       "\\(\\s \\|\\sw\\)"
-			       (- (cdr c-lit-limits) 2) 'limit))
-			 ;; The comment ender IS on its own line.  Exclude
-			 ;; this line from the filling.
-			 (set-marker end (c-point 'bol)))))
+;		    (or (<= (- (cdr c-lit-limits) 2) (point))
+; 2010-10-17  Construct removed.
+;		    (or (< (- (cdr c-lit-limits) 2) (point))
+		    (and 
+		     (search-forward-regexp
+		      (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)")
+		      (- (cdr c-lit-limits) 2) t)
+		     (not (search-forward-regexp
+			   "\\(\\s \\|\\sw\\)"
+			   (- (cdr c-lit-limits) 2) 'limit))
+		     ;; The comment ender IS on its own line.  Exclude this
+		     ;; line from the filling.
+		     (set-marker end (c-point 'bol))));)
 
 		;; The comment ender is hanging.  Replace all space between it
 		;; and the last word either by one or two 'x's (when
--- a/lisp/progmodes/cc-fonts.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/progmodes/cc-fonts.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1048,6 +1048,9 @@
 	  ;; Start of containing declaration (if any); limit for searching
 	  ;; backwards for it.
 	  decl-start decl-search-lim
+	  ;; Start of containing declaration (if any); limit for searching
+	  ;; backwards for it.
+	  decl-start decl-search-lim
 	  ;; The result from `c-forward-decl-or-cast-1'.
 	  decl-or-cast
 	  ;; The maximum of the end positions of all the checked type
@@ -1318,6 +1321,40 @@
 
       nil)))
 
+(defun c-font-lock-enum-tail (limit)
+  ;; Fontify an enum's identifiers when POINT is within the enum's brace
+  ;; block.
+  ;;
+  ;; This function will be called from font-lock for a region bounded by POINT
+  ;; and LIMIT, as though it were to identify a keyword for
+  ;; font-lock-keyword-face.  It always returns NIL to inhibit this and
+  ;; prevent a repeat invocation.  See elisp/lispref page "Search-based
+  ;; Fontification".
+  ;;
+  ;; Note that this function won't attempt to fontify beyond the end of the
+  ;; current enum block, if any.
+  (let* ((paren-state (c-parse-state))
+	 (encl-pos (c-most-enclosing-brace paren-state))
+	 (start (point))
+	)
+    (when (and
+	   encl-pos
+	   (eq (char-after encl-pos) ?\{)
+	   (save-excursion
+	     (goto-char encl-pos)
+	     (c-backward-syntactic-ws)
+	     (c-simple-skip-symbol-backward)
+	     (or (looking-at c-brace-list-key) ; "enum"
+		 (progn (c-backward-syntactic-ws)
+			(c-simple-skip-symbol-backward)
+			(looking-at c-brace-list-key)))))
+      (c-syntactic-skip-backward "^{," nil t)
+      (c-put-char-property (1- (point)) 'c-type 'c-decl-id-start)
+
+      (c-forward-syntactic-ws)
+      (c-font-lock-declarators limit t nil)))
+  nil)
+
 (c-lang-defconst c-simple-decl-matchers
   "Simple font lock matchers for types and declarations.  These are used
 on level 2 only and so aren't combined with `c-complex-decl-matchers'."
@@ -1582,11 +1619,14 @@
 generic casts and declarations are fontified.  Used on level 2 and
 higher."
 
-  t `(;; Fontify the identifiers inside enum lists.  (The enum type
+  t `(,@(when (c-lang-const c-brace-id-list-kwds)
+      ;; Fontify the remaining identifiers inside an enum list when we start
+      ;; inside it.
+	  `(c-font-lock-enum-tail
+      ;; Fontify the identifiers inside enum lists.  (The enum type
       ;; name is handled by `c-simple-decl-matchers' or
       ;; `c-complex-decl-matchers' below.
-      ,@(when (c-lang-const c-brace-id-list-kwds)
-	  `((,(c-make-font-lock-search-function
+	    (,(c-make-font-lock-search-function
 	       (concat
 		"\\<\\("
 		(c-make-keywords-re nil (c-lang-const c-brace-id-list-kwds))
--- a/lisp/progmodes/idlwave.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/progmodes/idlwave.el	Sat Nov 06 10:28:31 2010 +0200
@@ -6911,9 +6911,10 @@
 ;;----------------------------------------------------------------------
 ;;----------------------------------------------------------------------
 ;;----------------------------------------------------------------------
-(defvar rtn)
-(defun idlwave-pset (item)
-  (set 'rtn item))
+(when (featurep 'xemacs)
+  (defvar rtn)
+  (defun idlwave-pset (item)
+    (set 'rtn item)))
 
 (defun idlwave-popup-select (ev list title &optional sort)
   "Select an item in LIST with a popup menu.
@@ -7683,7 +7684,6 @@
 	  (t nil))))
 
 (defvar link) ;dynamic variables set by help callback
-(defvar props)
 (defun idlwave-complete-sysvar-help (mode word)
   (let ((word (or (nth 1 idlwave-completion-help-info) word))
 	(entry (assoc word idlwave-system-variables-alist)))
@@ -9364,5 +9364,4 @@
 
 (provide 'idlwave)
 
-;; arch-tag: f77f3b0c-c37c-424f-a328-0886fd42b6fb
 ;;; idlwave.el ends here
--- a/lisp/progmodes/octave-mod.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/progmodes/octave-mod.el	Sat Nov 06 10:28:31 2010 +0200
@@ -446,9 +446,6 @@
     ;; (fundesc (atom "=" atom))
     ))
 
-(defconst octave-smie-closer-alist
-  (smie-bnf-closer-alist octave-smie-bnf-table))
-
 (defconst octave-smie-op-levels
   (smie-prec2-levels
    (smie-merge-prec2s
@@ -521,15 +518,18 @@
    (t
     (smie-default-forward-token))))
 
-(defconst octave-smie-indent-rules
-  '((";"
-     (:parent ("function" "if" "while" "else" "elseif" "for" "otherwise"
-               "case" "try" "catch" "unwind_protect" "unwind_protect_cleanup")
-      ;; FIXME: don't hardcode 2.
-      (+ parent octave-block-offset))
-     ;; (:parent "switch" 4) ;For (invalid) code between switch and case.
-     0)
-    ((:before . "case") octave-block-offset)))
+(defun octave-smie-rules (kind token)
+  (pcase (cons kind token)
+    (`(:elem . basic) octave-block-offset)
+    (`(:before . "case") octave-block-offset)
+    (`(:after . ";")
+     (if (smie-parent-p "function" "if" "while" "else" "elseif" "for"
+                        "otherwise" "case" "try" "catch" "unwind_protect"
+                        "unwind_protect_cleanup")
+         '(+ parent octave-block-offset)
+       ;; For (invalid) code between switch and case.
+       ;; (if (smie-parent-p "switch") 4)
+       0))))
 
 (defvar electric-indent-chars)
 
@@ -619,32 +619,15 @@
 including a reproducible test case and send the message."
   (setq local-abbrev-table octave-abbrev-table)
 
-  (smie-setup octave-smie-op-levels octave-smie-indent-rules)
+  (smie-setup octave-smie-op-levels #'octave-smie-rules
+              :forward-token  #'octave-smie-forward-token
+              :backward-token #'octave-smie-backward-token)
   (set (make-local-variable 'smie-indent-basic) 'octave-block-offset)
-  (set (make-local-variable 'smie-backward-token-function)
-       'octave-smie-backward-token)
-  (set (make-local-variable 'smie-forward-token-function)
-       'octave-smie-forward-token)
-  (set (make-local-variable 'forward-sexp-function)
-       'smie-forward-sexp-command)
-  (set (make-local-variable 'smie-closer-alist) octave-smie-closer-alist)
-  ;; Only needed for interactive calls to blink-matching-open.
-  (set (make-local-variable 'blink-matching-check-function)
-       #'smie-blink-matching-check)
 
-  (when octave-blink-matching-block
-    (add-hook 'post-self-insert-hook #'smie-blink-matching-open 'append 'local)
     (set (make-local-variable 'smie-blink-matching-triggers)
-         (append smie-blink-matching-triggers '(\;)
-                 ;; Rather than wait for SPC or ; to blink, try to blink as
-                 ;; soon as we type the last char of a block ender.
-                 ;; But strip ?d from this list so that we don't blink twice
-                 ;; when the user writes "endif" (once at "end" and another
-                 ;; time at "endif").
-                 (delq ?d (delete-dups
-                           (mapcar (lambda (kw)
-                                     (aref (cdr kw) (1- (length (cdr kw)))))
-                                   smie-closer-alist))))))
+       (cons ?\; smie-blink-matching-triggers))
+  (unless octave-blink-matching-block
+    (remove-hook 'post-self-insert-hook #'smie-blink-matching-open 'local))
 
   (set (make-local-variable 'electric-indent-chars)
        (cons ?\; electric-indent-chars))
--- a/lisp/progmodes/perl-mode.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/progmodes/perl-mode.el	Sat Nov 06 10:28:31 2010 +0200
@@ -274,6 +274,11 @@
       ;; Be careful not to match "sub { (...) ... }".
       ("\\<sub\\(?:[[:space:]]+[^{}[:punct:][:space:]]+\\)?[[:space:]]*(\\([^)]+\\))"
        (1 "."))
+      ;; Turn __DATA__ trailer into a comment.
+      ("^\\(_\\)_\\(?:DATA\\|END\\)__[ \t]*\\(?:\\(\n\\)#.-\\*-.*perl.*-\\*-\\|\n.*\\)"
+       (1 "< c") (2 "> c")
+       (0 (ignore (put-text-property (match-beginning 0) (match-end 0)
+                                     'syntax-multiline t))))
       ;; Regexp and funny quotes.  Distinguishing a / that starts a regexp
       ;; match from the division operator is ...interesting.
       ;; Basically, / is a regexp match if it's preceded by an infix operator
--- a/lisp/progmodes/prolog.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/progmodes/prolog.el	Sat Nov 06 10:28:31 2010 +0200
@@ -173,10 +173,11 @@
     )
   "Precedence levels of infix operators.")
 
-(defconst prolog-smie-indent-rules
-  '((":-")
-    ("->"))
-  "Prolog indentation rules.")
+(defun prolog-smie-rules (kind token)
+  (pcase (cons kind token)
+    (`(:elem . basic) prolog-indent-width)
+    (`(:after . ".") 0) ;; To work around smie-closer-alist.
+    (`(:after . ,(or `":-" `"->")) prolog-indent-width)))
 
 (defun prolog-mode-variables ()
   (make-local-variable 'paragraph-separate)
@@ -185,19 +186,17 @@
   (setq paragraph-ignore-fill-prefix t)
   (make-local-variable 'imenu-generic-expression)
   (setq imenu-generic-expression '((nil "^\\sw+" 0)))
-  (smie-setup prolog-smie-op-levels prolog-smie-indent-rules)
-  (set (make-local-variable 'smie-forward-token-function)
-       #'prolog-smie-forward-token)
-  (set (make-local-variable 'smie-backward-token-function)
-       #'prolog-smie-backward-token)
-  (set (make-local-variable 'forward-sexp-function)
-       'smie-forward-sexp-command)
-  (set (make-local-variable 'smie-indent-basic) prolog-indent-width)
+
+  ;; Setup SMIE.
+  (smie-setup prolog-smie-op-levels #'prolog-smie-rules
+              :forward-token #'prolog-smie-forward-token
+              :backward-token #'prolog-smie-backward-token)
   (set (make-local-variable 'smie-blink-matching-triggers) '(?.))
   (set (make-local-variable 'smie-closer-alist) '((t . ".")))
   (add-hook 'post-self-insert-hook #'smie-blink-matching-open 'append 'local)
   ;; There's no real closer in Prolog anyway.
   (set (make-local-variable 'smie-blink-matching-inners) t)
+
   (make-local-variable 'comment-start)
   (setq comment-start "%")
   (make-local-variable 'comment-start-skip)
--- a/lisp/progmodes/ruby-mode.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/progmodes/ruby-mode.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,7 @@
 ;;; ruby-mode.el --- Major mode for editing Ruby files
 
-;; Copyright (C) 1994, 1995, 1996 1997, 1998, 1999, 2000, 2001,
-;;   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;; Copyright (C) 1994, 1995, 1996 1997, 1998, 1999, 2000, 2001, 2002,
+;;   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 ;;   Free Software Foundation, Inc.
 
 ;; Authors: Yukihiro Matsumoto
@@ -1108,6 +1108,8 @@
               (if mlist (concat mlist mname) mname)
             mlist)))))
 
+(declare-function ruby-syntax-propertize-heredoc "ruby-mode" (limit))
+
 (if (eval-when-compile (fboundp #'syntax-propertize-rules))
     ;; New code that works independently from font-lock.
     (progn
@@ -1162,7 +1164,7 @@
               ;; inf-loop.
               (if (< (point) start) (goto-char start))))))
       )
-      
+
   ;; For Emacsen where syntax-propertize-rules is not (yet) available,
   ;; fallback on the old font-lock-syntactic-keywords stuff.
 
@@ -1478,5 +1480,4 @@
 
 (provide 'ruby-mode)
 
-;; arch-tag: e6ecc893-8005-420c-b7f9-34ab99a1fff9
 ;;; ruby-mode.el ends here
--- a/lisp/progmodes/sql.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/progmodes/sql.el	Sat Nov 06 10:28:31 2010 +0200
@@ -7,7 +7,8 @@
 ;; Maintainer: Michael Mauger <mmaug@yahoo.com>
 ;; Version: 2.8
 ;; Keywords: comm languages processes
-;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el
+;; URL: http://savannah.gnu.org/projects/emacs/
+;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode
 
 ;; This file is part of GNU Emacs.
 
@@ -4270,6 +4271,5 @@
 
 (provide 'sql)
 
-;; arch-tag: 7e1fa1c4-9ca2-402e-87d2-83a5eccb7ac3
 ;;; sql.el ends here
 
--- a/lisp/select.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/select.el	Sat Nov 06 10:28:31 2010 +0200
@@ -75,8 +75,9 @@
 (declare-function x-get-selection-internal "xselect.c"
 		  (selection-symbol target-type &optional time-stamp))
 
-;; This is for temporary compatibility with pre-release Emacs 19.
-(defalias 'x-selection 'x-get-selection)
+;; Only declared obsolete in 23.3.
+(define-obsolete-function-alias 'x-selection 'x-get-selection "at least 19.34")
+
 (defun x-get-selection (&optional type data-type)
   "Return the value of an X Windows selection.
 The argument TYPE (default `PRIMARY') says which selection,
--- a/lisp/speedbar.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/speedbar.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,8 @@
 ;;; speedbar --- quick access to files and tags in a frame
 
 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: file, tags, tools
@@ -1128,9 +1129,9 @@
     (setq font-lock-keywords nil) ;; no font-locking please
     (setq truncate-lines t)
     (make-local-variable 'frame-title-format)
-    (setq frame-title-format (concat "Speedbar " speedbar-version))
-    (setq case-fold-search nil)
-    (toggle-read-only 1)
+    (setq frame-title-format (concat "Speedbar " speedbar-version)
+	  case-fold-search nil
+	  buffer-read-only t)
     (speedbar-set-mode-line-format)
     ;; Add in our dframe hooks.
     (if speedbar-track-mouse-flag
@@ -4142,5 +4143,4 @@
 ;; run load-time hooks
 (run-hooks 'speedbar-load-hook)
 
-;; arch-tag: 4477e6d1-f78c-48b9-a503-387d3c9767d5
 ;;; speedbar ends here
--- a/lisp/startup.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/startup.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,7 @@
 ;;; startup.el --- process Emacs shell arguments
 
-;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-;;   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
+;;   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -691,6 +691,9 @@
 
 (defvar server-name)
 (defvar server-process)
+;; Autoload in package.el, but when we bootstrap, we don't have loaddefs yet.
+(defvar package-enable-at-startup)
+(declare-function package-initialize "package" ())
 
 (defun command-line ()
   (setq before-init-time (current-time)
@@ -1172,8 +1175,30 @@
 		 (eq face-ignored-fonts old-face-ignored-fonts))
       (clear-face-cache)))
 
-  ;; Load ELPA packages.
-  (and user-init-file package-enable-at-startup (package-initialize))
+  ;; If any package directory exists, initialize the package system.
+  (and user-init-file
+       package-enable-at-startup
+       (catch 'package-dir-found
+	 (let (dirs)
+	   (if (boundp 'package-directory-list)
+	       (setq dirs package-directory-list)
+	     (dolist (f load-path)
+	       (and (stringp f)
+		    (equal (file-name-nondirectory f) "site-lisp")
+		    (push (expand-file-name "elpa" f) dirs))))
+	   (push (if (boundp 'package-user-dir)
+		     package-user-dir
+		   (locate-user-emacs-file "elpa"))
+		 dirs)
+	   (dolist (dir dirs)
+	     (when (file-directory-p dir)
+	       (dolist (subdir (directory-files dir))
+		 (when (and (file-directory-p (expand-file-name subdir dir))
+			    ;; package-subdirectory-regexp from package.el
+			    (string-match "^\\([^.].*\\)-\\([0-9]+\\(?:[.][0-9]+\\)*\\)$"
+					  subdir))
+		   (throw 'package-dir-found t)))))))
+       (package-initialize))
 
   (setq after-init-time (current-time))
   (run-hooks 'after-init-hook)
@@ -2359,5 +2384,4 @@
       (setq file (replace-match "/" t t file)))
     file))
 
-;; arch-tag: 7e294698-244d-4758-984b-4047f887a5db
 ;;; startup.el ends here
--- a/lisp/subr.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/subr.el	Sat Nov 06 10:28:31 2010 +0200
@@ -3593,18 +3593,18 @@
 ;;;; Comparing version strings.
 
 (defconst version-separator "."
-  "*Specify the string used to separate the version elements.
+  "Specify the string used to separate the version elements.
 
 Usually the separator is \".\", but it can be any other string.")
 
 
 (defconst version-regexp-alist
-  '(("^[-_+ ]?alpha$"   . -3)
-    ("^[-_+]$"                 . -3) ; treat "1.2.3-20050920" and "1.2-3" as alpha releases
-    ("^[-_+ ]cvs$"             . -3)	; treat "1.2.3-CVS" as alpha release
-    ("^[-_+ ]?beta$"    . -2)
+  '(("^[-_+ ]?alpha$"           . -3)
+    ("^[-_+]$"                  . -3) ; treat "1.2.3-20050920" and "1.2-3" as alpha releases
+    ("^[-_+ ]cvs$"              . -3) ; treat "1.2.3-CVS" as alpha release
+    ("^[-_+ ]?beta$"            . -2)
     ("^[-_+ ]?\\(pre\\|rcc\\)$" . -1))
-  "*Specify association between non-numeric version and its priority.
+  "Specify association between non-numeric version and its priority.
 
 This association is used to handle version string like \"1.0pre2\",
 \"0.9alpha1\", etc.  It's used by `version-to-list' (which see) to convert the
@@ -3698,7 +3698,7 @@
 	      (setq al (cdr al)))
 	    (cond (al
 		   (push (cdar al) lst))
-		  ;; Convert 22.3a to 22.3.1.
+		  ;; Convert 22.3a to 22.3.1, 22.3b to 22.3.2, etc.
 		  ((string-match "^[-_+ ]?\\([a-zA-Z]\\)$" s)
 		   (push (- (aref (downcase (match-string 1 s)) 0) ?a -1)
 			 lst))
@@ -3754,7 +3754,7 @@
   "Return t if L1, a list specification of a version, is lower or equal to L2.
 
 Note that integer list (1) is equal to (1 0), (1 0 0), (1 0 0 0),
-etc.  That is, the trailing zeroes are irrelevant.  Also, integer
+etc.  That is, the trailing zeroes are insignificant.  Also, integer
 list (1) is greater than (1 -1) which is greater than (1 -2)
 which is greater than (1 -3)."
   (while (and l1 l2 (= (car l1) (car l2)))
@@ -3796,7 +3796,7 @@
   "Return t if version V1 is lower (older) than or equal to V2.
 
 Note that version string \"1\" is equal to \"1.0\", \"1.0.0\", \"1.0.0.0\",
-etc.  That is, the trailing \".0\"s are insignificant..  Also, version
+etc.  That is, the trailing \".0\"s are insignificant.  Also, version
 string \"1\" is higher (newer) than \"1pre\", which is higher than \"1beta\",
 which is higher than \"1alpha\"."
   (version-list-<= (version-to-list v1) (version-to-list v2)))
@@ -3805,7 +3805,7 @@
   "Return t if version V1 is equal to V2.
 
 Note that version string \"1\" is equal to \"1.0\", \"1.0.0\", \"1.0.0.0\",
-etc.  That is, the trailing \".0\"s are insignificant..  Also, version
+etc.  That is, the trailing \".0\"s are insignificant.  Also, version
 string \"1\" is higher (newer) than \"1pre\", which is higher than \"1beta\",
 which is higher than \"1alpha\"."
   (version-list-= (version-to-list v1) (version-to-list v2)))
--- a/lisp/term/w32console.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/term/w32console.el	Sat Nov 06 10:28:31 2010 +0200
@@ -45,7 +45,7 @@
     ("white"         15 65535 65535 65535))
 "A list of VGA console colors, their indices and 16-bit RGB values.")
 
-(declare-function x-setup-function-keys "w32-fns" (frame))
+(declare-function x-setup-function-keys "term/common-win" (frame))
 
 (defun terminal-init-w32console ()
   "Terminal initialization function for w32 console."
@@ -62,4 +62,4 @@
   (tty-set-up-initial-frame-faces)
   (run-hooks 'terminal-init-w32-hook))
 
-;; arch-tag: 3195fd5e-ab86-4a46-b1dc-4f7a8c8deff3
+;;; w32console.el ends here
--- a/lisp/term/x-win.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/term/x-win.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1279,6 +1279,13 @@
 (setq interprogram-cut-function 'x-select-text)
 (setq interprogram-paste-function 'x-selection-value)
 
+;; Make paste from other applications use the decoding in x-select-request-type
+;; and not just STRING.
+(defun x-get-selection-value ()
+  "Get the current value of the PRIMARY selection.
+Request data types in the order specified by `x-select-request-type'."
+  (x-selection-value-internal 'PRIMARY))
+
 (defun x-clipboard-yank ()
   "Insert the clipboard contents, or the last stretch of killed text."
   (interactive "*")
--- a/lisp/textmodes/bibtex.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/textmodes/bibtex.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,8 @@
 ;;; bibtex.el --- BibTeX mode for GNU Emacs
 
 ;; Copyright (C) 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002,
-;;   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;;   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Stefan Schoef <schoef@offis.uni-oldenburg.de>
 ;;      Bengt Martensson <bengt@mathematik.uni-Bremen.de>
@@ -3835,16 +3836,16 @@
           (with-current-buffer (get-buffer-create err-buf)
             (setq default-directory dir)
             (unless (eq major-mode 'compilation-mode) (compilation-mode))
-            (toggle-read-only -1)
-            (delete-region (point-min) (point-max))
-            (insert "BibTeX mode command `bibtex-validate'\n"
-                    (if syntax-error
-                        "Maybe undetected errors due to syntax errors.  Correct and validate again.\n"
-                      "\n"))
-            (dolist (err error-list)
-              (insert (format "%s:%d: %s\n" file (car err) (cdr err))))
-            (set-buffer-modified-p nil)
-            (toggle-read-only 1)
+            (let ((inhibit-read-only t))
+              (delete-region (point-min) (point-max))
+              (insert "BibTeX mode command `bibtex-validate'\n"
+                      (if syntax-error
+                          "Maybe undetected errors due to syntax errors.  \
+Correct and validate again.\n"
+                        "\n"))
+              (dolist (err error-list)
+                (insert (format "%s:%d: %s\n" file (car err) (cdr err))))
+              (set-buffer-modified-p nil))
             (goto-char (point-min))
             (forward-line 2)) ; first error message
           (display-buffer err-buf)
@@ -3896,12 +3897,11 @@
         (let ((err-buf "*BibTeX validation errors*"))
           (with-current-buffer (get-buffer-create err-buf)
             (unless (eq major-mode 'compilation-mode) (compilation-mode))
-            (toggle-read-only -1)
-            (delete-region (point-min) (point-max))
-            (insert "BibTeX mode command `bibtex-validate-globally'\n\n")
-            (dolist (err (sort error-list 'string-lessp)) (insert err))
-            (set-buffer-modified-p nil)
-            (toggle-read-only 1)
+            (let ((inhibit-read-only t))
+              (delete-region (point-min) (point-max))
+              (insert "BibTeX mode command `bibtex-validate-globally'\n\n")
+              (dolist (err (sort error-list 'string-lessp)) (insert err))
+              (set-buffer-modified-p nil))
             (goto-char (point-min))
             (forward-line 2)) ; first error message
           (display-buffer err-buf)
@@ -4778,5 +4778,4 @@
 
 (provide 'bibtex)
 
-;; arch-tag: ee2be3af-caad-427f-b42a-d20fad630d04
 ;;; bibtex.el ends here
--- a/lisp/textmodes/ispell.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/textmodes/ispell.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,8 @@
 ;;; ispell.el --- interface to International Ispell Versions 3.1 and 3.2
 
 ;; Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author:           Ken Stevens <k.stevens@ieee.org>
 ;; Maintainer:       Ken Stevens <k.stevens@ieee.org>
@@ -2739,9 +2740,11 @@
 	(if extended-char-mode		; ~ extended character mode
 	    (ispell-send-string (concat extended-char-mode "\n"))))
       (if ispell-async-processp
-	  (if (fboundp 'set-process-query-on-exit-flag) ;; not XEmacs
+	  (if (featurep 'emacs)
 	      (set-process-query-on-exit-flag ispell-process nil)
-	    (process-kill-without-query ispell-process))))))
+	    (if (fboundp 'set-process-query-on-exit-flag)
+		(set-process-query-on-exit-flag ispell-process nil)
+	      (process-kill-without-query ispell-process)))))))
 
 ;;;###autoload
 (defun ispell-kill-ispell (&optional no-error)
@@ -3896,6 +3899,9 @@
 
 ;;; returns optionally adjusted region-end-point.
 
+;; If comment-padright is defined, newcomment must be loaded.
+(declare-function comment-add "newcomment" (arg))
+
 (defun ispell-add-per-file-word-list (word)
   "Add WORD to the per-file word list."
   (or ispell-buffer-local-name
@@ -3970,5 +3976,4 @@
 ; LocalWords:  uuencoded unidiff sc nn VM SGML eval IspellPersDict unsplitable
 ; LocalWords:  lns XEmacs HTML casechars Multibyte
 
-;; arch-tag: 4941b9f9-3b7c-4a76-a4ed-5fa8b6010ef5
 ;;; ispell.el ends here
--- a/lisp/textmodes/reftex-index.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/textmodes/reftex-index.el	Sat Nov 06 10:28:31 2010 +0200
@@ -1699,7 +1699,7 @@
           (let* ((lines (split-string (buffer-substring beg end) "\n"))
                  (lines1 (sort lines 'reftex-compare-phrase-lines)))
             (message "Sorting lines...done")
-            (let ((inhibit-quit t))  ;; make sure we do not loose lines
+            (let ((inhibit-quit t))  ;; make sure we do not lose lines
               (delete-region beg end)
               (insert (mapconcat 'identity lines1 "\n"))))
           (goto-char (point-max))
@@ -2104,5 +2104,4 @@
    ["Save and Return" reftex-index-phrases-save-and-return t]))
 
 
-;; arch-tag: 4b2362af-c156-42c1-8932-ea2823e205c1
 ;;; reftex-index.el ends here
--- a/lisp/textmodes/reftex-toc.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/textmodes/reftex-toc.el	Sat Nov 06 10:28:31 2010 +0200
@@ -546,7 +546,6 @@
 ;; Promotion/Demotion stuff
 
 (defvar delta)
-(defvar mpos)
 (defvar pro-or-de)
 (defvar start-pos)
 (defvar start-line)
@@ -575,7 +574,7 @@
 					    (if (bolp) 1 0)))))
          (start-pos (point))
          (pro-or-de (if (> delta 0) "de" "pro"))
-         beg end entries data sections nsec mpos msg)
+         beg end entries data sections nsec msg)
     (setq msg
           (catch 'exit
             (if (reftex-region-active-p)
@@ -629,24 +628,20 @@
 
 
 (defun reftex-toc-restore-region (point-line &optional mark-line)
-  (when mark-line
-    (goto-char (point-min))
-    (forward-line (1- mark-line))
-    (setq mpos (point)))
-  (when point-line
-    (goto-char (point-min))
-    (forward-line (1- point-line)))
-  (if mark-line
-      (progn
-        (set-mark mpos)
-        (if (featurep 'xemacs)
-            (zmacs-activate-region)
-          (setq mark-active t
-                deactivate-mark nil)))))
-
-(defvar name1)
-(defvar dummy)
-(defvar dummy2)
+  (let (mpos)
+    (when mark-line
+      (goto-char (point-min))
+      (forward-line (1- mark-line))
+      (setq mpos (point)))
+    (when point-line
+      (goto-char (point-min))
+      (forward-line (1- point-line)))
+    (when mark-line
+      (set-mark mpos)
+      (if (featurep 'xemacs)
+          (zmacs-activate-region)
+        (setq mark-active t
+              deactivate-mark nil)))))
 
 (defun reftex-toc-promote-prepare (x)
   "Look at a toc entry and see if we could pro/demote it.
@@ -678,7 +673,7 @@
                           (error "Something is wrong!  Contact maintainer!")))
                     ;; Section has changed, request scan and loading
                     ;; We use a variable to delay until after the safe-exc.
-                    ;; because otherwise we loose the region.
+                    ;; because otherwise we lose the region.
                     (setq load t)))
                 ;; Scan document and load all files, this exits command
                 (if load (reftex-toc-load-all-files-for-promotion))) ; exits
@@ -1100,5 +1095,4 @@
    ["Help" reftex-toc-show-help t]))
 
 
-;; arch-tag: 92400ce2-0b86-4c89-a606-4ed71acea17e
 ;;; reftex-toc.el ends here
--- a/lisp/vc/add-log.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/vc/add-log.el	Sat Nov 06 10:28:31 2010 +0200
@@ -698,7 +698,7 @@
 Optional arg BUFFER-FILE overrides `buffer-file-name'."
   ;; If we are called from a diff, first switch to the source buffer;
   ;; in order to respect buffer-local settings of change-log-default-name, etc.
-  (with-current-buffer (let ((buff (if (eq major-mode 'diff-mode)
+  (with-current-buffer (let ((buff (if (derived-mode-p 'diff-mode)
 				       (car (ignore-errors
 					     (diff-find-source-location))))))
 			 (if (buffer-live-p buff) buff
@@ -1180,7 +1180,7 @@
 		((apply 'derived-mode-p add-log-c-like-modes)
 		 (or (c-cpp-define-name)
 		     (c-defun-name)))
-		((memq major-mode add-log-tex-like-modes)
+		((apply #'derived-mode-p add-log-tex-like-modes)
 		 (if (re-search-backward
 		      "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)"
 		      nil t)
--- a/lisp/vc/ediff-util.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/vc/ediff-util.el	Sat Nov 06 10:28:31 2010 +0200
@@ -311,7 +311,7 @@
 	    ediff-word-mode-job (ediff-word-mode-job))
 
       ;; Don't delete variants in case of ediff-buffer-* jobs without asking.
-      ;; This is because one may loose work---dangerous.
+      ;; This is because one may lose work---dangerous.
       (if (string-match "buffer" (symbol-name ediff-job-name))
 	  (setq ediff-keep-variants t))
 
@@ -4289,5 +4289,4 @@
 ;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
 ;; End:
 
-;; arch-tag: f51099b6-ef4b-470f-88a1-3a0e0b03a879
 ;;; ediff-util.el ends here
--- a/lisp/vc/vc-arch.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/vc/vc-arch.el	Sat Nov 06 10:28:31 2010 +0200
@@ -428,7 +428,7 @@
 	(message "There are unresolved conflicts in %s"
 		 (file-name-nondirectory rej))))))
 
-(defun vc-arch-checkin (files rev comment  &optional extra-args-ignored)
+(defun vc-arch-checkin (files rev comment)
   (if rev (error "Committing to a specific revision is unsupported"))
   ;; FIXME: This implementation probably only works for singleton filesets
   (let ((summary (file-relative-name (car files) (vc-arch-root (car files)))))
--- a/lisp/vc/vc-cvs.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/vc/vc-cvs.el	Sat Nov 06 10:28:31 2010 +0200
@@ -314,7 +314,7 @@
                   (directory-file-name dir))))
     (eq dir t)))
 
-(defun vc-cvs-checkin (files rev comment  &optional extra-args-ignored)
+(defun vc-cvs-checkin (files rev comment)
   "CVS-specific version of `vc-backend-checkin'."
   (unless (or (not rev) (vc-cvs-valid-revision-number-p rev))
     (if (not (vc-cvs-valid-symbolic-tag-name-p rev))
--- a/lisp/vc/vc-mtn.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/vc/vc-mtn.el	Sat Nov 06 10:28:31 2010 +0200
@@ -175,7 +175,7 @@
 
 (declare-function log-edit-extract-headers "log-edit" (headers string))
 
-(defun vc-mtn-checkin (files rev comment  &optional extra-args-ignored)
+(defun vc-mtn-checkin (files rev comment)
   (apply 'vc-mtn-command nil 0 files
 	 (nconc (list "commit" "-m")
 		(log-edit-extract-headers '(("Author" . "--author")
--- a/lisp/vc/vc-rcs.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/vc/vc-rcs.el	Sat Nov 06 10:28:31 2010 +0200
@@ -349,7 +349,7 @@
 	 (yes-or-no-p (format "Directory %s is empty; remove it? " dir))
 	 (delete-directory dir))))
 
-(defun vc-rcs-checkin (files rev comment &optional extra-args-ignored)
+(defun vc-rcs-checkin (files rev comment)
   "RCS-specific version of `vc-backend-checkin'."
   (let ((switches (vc-switches 'RCS 'checkin)))
     ;; Now operate on the files
--- a/lisp/vc/vc-sccs.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/vc/vc-sccs.el	Sat Nov 06 10:28:31 2010 +0200
@@ -237,7 +237,7 @@
       (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "")
 					   (file-name-nondirectory file)))))
 
-(defun vc-sccs-checkin (files rev comment &optional extra-args-ignored)
+(defun vc-sccs-checkin (files rev comment)
   "SCCS-specific version of `vc-backend-checkin'."
   (dolist (file (vc-expand-dirs files))
     (apply 'vc-sccs-do-command nil 0 "delta" (vc-name file)
--- a/lisp/woman.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/woman.el	Sat Nov 06 10:28:31 2010 +0200
@@ -2475,23 +2475,23 @@
 Start at FROM and re-scan new text as appropriate."
   (goto-char from)
   (let ((woman0-if-to (make-marker))
-	request woman0-macro-alist
+	woman-request woman0-macro-alist
 	(woman0-search-regex-start woman0-search-regex-start)
 	(woman0-search-regex
 	 (concat woman0-search-regex-start woman0-search-regex-end))
 	woman0-rename-alist)
     (set-marker-insertion-type woman0-if-to t)
     (while (re-search-forward woman0-search-regex nil t)
-      (setq request (match-string 1))
-      (cond ((string= request "ig") (woman0-ig))
-	    ((string= request "if") (woman0-if "if"))
-	    ((string= request "ie") (woman0-if "ie"))
-	    ((string= request "el") (woman0-el))
-	    ((string= request "so") (woman0-so))
-	    ((string= request "rn") (woman0-rn))
-	    ((string= request "de") (woman0-de))
-	    ((string= request "am") (woman0-de 'append))
-	    (t                      (woman0-macro request))))
+      (setq woman-request (match-string 1))
+      (cond ((string= woman-request "ig") (woman0-ig))
+	    ((string= woman-request "if") (woman0-if "if"))
+	    ((string= woman-request "ie") (woman0-if "ie"))
+	    ((string= woman-request "el") (woman0-el))
+	    ((string= woman-request "so") (woman0-so))
+	    ((string= woman-request "rn") (woman0-rn))
+	    ((string= woman-request "de") (woman0-de))
+	    ((string= woman-request "am") (woman0-de 'append))
+	    (t                      (woman0-macro woman-request))))
     (set-marker woman0-if-to nil)
     (woman0-rename)
     ;; Should now re-run `woman0-roff-buffer' if any renaming was
@@ -2522,6 +2522,7 @@
   (goto-char from)			; necessary!
   (woman2-process-escapes to 'numeric))
 
+;; request does not appear to be used dynamically by any callees.
 (defun woman0-if (request)
   ".if/ie c anything -- Discard unless c evaluates to true.
 Remember condition for use by a subsequent `.el'.
@@ -2573,6 +2574,7 @@
 	(woman-if-ignore woman0-if-to request) ; ERROR!
       (woman-if-body request woman0-if-to (eq c negated)))))
 
+;; request is not used dynamically by any callees.
 (defun woman-if-body (request to delete) ; should be reversed as `accept'?
   "Process if-body, including \\{ ... \\}.
 REQUEST is the invoking directive without the leading dot.
@@ -2629,6 +2631,7 @@
 	 (if (looking-at "[ \t]*\\{") (search-forward "\\}"))
 	 (forward-line 1))))
 
+;; request is not used dynamically by any callees.
 (defun woman-if-ignore (to request)
   "Ignore but warn about an if request ending at TO, named REQUEST."
   (WoMan-warn-ignored request "ignored -- condition not handled!")
@@ -2760,15 +2763,17 @@
   (beginning-of-line)			; delete .de/am line
   (woman-delete-line 1))
 
-(defun woman0-macro (request)
-  "Process the macro call named REQUEST."
+;; request may be used dynamically (woman-interpolate-macro calls
+;; woman-forward-arg).
+(defun woman0-macro (woman-request)
+  "Process the macro call named WOMAN-REQUEST."
   ;; Leaves point at start of new text.
-  (let ((macro (assoc request woman0-macro-alist)))
+  (let ((macro (assoc woman-request woman0-macro-alist)))
     (if macro
 	(woman-interpolate-macro (cdr macro))
       ;; SHOULD DELETE THE UNINTERPRETED REQUEST!!!!!
       ;; Output this message once only per call (cf. strings)?
-      (WoMan-warn "Undefined macro %s not interpolated!" request))))
+      (WoMan-warn "Undefined macro %s not interpolated!" woman-request))))
 
 (defun woman-interpolate-macro (macro)
   "Interpolate (.de) or append (.am) expansion of MACRO into the buffer."
@@ -2985,8 +2990,10 @@
 
 ;;; Formatting macros that do not cause a break:
 
-(defvar request)  ; Bound locally by woman1-roff-buffer
-(defvar unquote)  ; Bound locally by woman1-roff-buffer
+;; Bound locally by woman[012]-roff-buffer, and also, annoyingly and
+;; confusingly, as a function argument.  Use dynamically in
+;; woman-unquote and woman-forward-arg.
+(defvar woman-request)
 
 (defun woman-unquote (to)
   "Delete any double-quote characters between point and TO.
@@ -3001,7 +3008,7 @@
 	(setq in-quote (not in-quote))
 	))
     (if in-quote
-	(WoMan-warn "Unpaired \" in .%s arguments." request))))
+	(WoMan-warn "Unpaired \" in .%s arguments." woman-request))))
 
 (defsubst woman-unquote-args ()
   "Delete any double-quote characters up to the end of the line."
@@ -3010,7 +3017,7 @@
 (defun woman1-roff-buffer ()
   "Process non-breaking requests."
   (let ((case-fold-search t)
-	request fn unquote)
+	woman-request fn woman1-unquote)
     (while
 	;; Find next control line:
 	(re-search-forward woman-request-regexp nil t)
@@ -3018,14 +3025,14 @@
        ;; Construct woman function to call:
        ((setq fn (intern-soft
 		  (concat "woman1-"
-			  (setq request (match-string 1)))))
+			  (setq woman-request (match-string 1)))))
 	(if (get fn 'notfont)		; not a font-change request
 	    (funcall fn)
 	  ;; Delete request or macro name:
 	  (woman-delete-match 0)
 	  ;; If no args then apply to next line else unquote args
-	  ;; (unquote is used by called function):
-	  (setq unquote (not (eolp)))
+	  ;; (woman1-unquote is used by called function):
+	  (setq woman1-unquote (not (eolp)))
 	  (if (eolp) (delete-char 1))
 ;	    ;; Hide leading control character in unquoted argument:
 ;	    (cond ((memq (following-char) '(?. ?'))
@@ -3034,7 +3041,7 @@
 	  ;; Call the appropriate function:
 	  (funcall fn)
 	  ;; Hide leading control character in quoted argument (only):
-	  (if (and unquote (memq (following-char) '(?. ?')))
+	  (if (and woman1-unquote (memq (following-char) '(?. ?')))
 	      (insert "\\&"))))))))
 
 ;;; Font-changing macros:
@@ -3047,6 +3054,8 @@
   ".I -- Set words of current line in italic font."
   (woman1-B-or-I ".ft I\n"))
 
+(defvar woman1-unquote)          ; bound locally by woman1-roff-buffer
+
 (defun woman1-B-or-I (B-or-I)
   ".B/I -- Set words of current line in bold/italic font.
 B-OR-I is the appropriate complete control line."
@@ -3055,7 +3064,7 @@
   ;; Return to bol to process .SM/.B, .B/.if etc.
   ;; or start of first arg to hide leading control char.
   (save-excursion
-    (if unquote
+    (if woman1-unquote
 	(woman-unquote-args)
       (while (looking-at "^[.']") (forward-line))
       (end-of-line)
@@ -3102,11 +3111,12 @@
   ;; Return to start of first arg to hide leading control char:
   (save-excursion
     (setq fonts (cdr fonts))
-    (woman-forward-arg unquote 'concat)	; unquote is bound above
+    ;; woman1-unquote is bound in woman1-roff-buffer.
+    (woman-forward-arg woman1-unquote 'concat)
     (while (not (eolp))
       (insert (car fonts))
       (setq fonts (cdr fonts))
-      (woman-forward-arg unquote 'concat)) ; unquote is bound above
+      (woman-forward-arg woman1-unquote 'concat))
     (insert "\\fR")))
 
 (defun woman-forward-arg (&optional unquote concat)
@@ -3123,7 +3133,7 @@
 	  (re-search-forward "\"\\|$"))
 	(if (eq (preceding-char) ?\")
 	    (if unquote (delete-char -1))
-	  (WoMan-warn "Unpaired \" in .%s arguments." request)))
+	  (WoMan-warn "Unpaired \" in .%s arguments." woman-request)))
     ;; (re-search-forward "[^\\\n] \\|$")	; inconsistent
     (skip-syntax-forward "^ "))
   (cond ((null concat) (skip-chars-forward " \t")) ; don't skip eol!
@@ -3338,7 +3348,12 @@
 
 ;;; Output translation:
 
-(defvar translations nil)  ; Also bound locally by woman2-roff-buffer
+;; This is only set by woman2-tr.  It is bound locally in woman2-roff-buffer.
+;; It is also used by woman-translate.  woman-translate may be called
+;; outside the scope of woman2-roff-buffer (by experiment).  Therefore
+;; this used to be globally bound to nil, to avoid an error.  Instead
+;; we can use bound-and-true-p in woman-translate.
+(defvar woman-translations)
 ;; A list of the form (\"[ace]\" (a . b) (c . d) (e . ?\ )) or nil.
 
 (defun woman-get-next-char ()
@@ -3358,8 +3373,8 @@
   ;; This should be an update, but consing onto the front of the alist
   ;; has the same effect and match duplicates should not matter.
   ;; Initialize translation data structures:
-  (let ((matches (car translations))
-	(alist (cdr translations))
+  (let ((matches (car woman-translations))
+	(alist (cdr woman-translations))
 	a b)
     ;; `matches' must be a string:
     (setq matches
@@ -3381,15 +3396,15 @@
 	  (if (= (string-to-char matches) ?\])
 	      (substring matches 3)
 	    (concat "[" matches))
-	  translations (cons matches alist))
+	  woman-translations (cons matches alist))
     ;; Format any following text:
     (woman2-format-paragraphs to)))
 
 (defsubst woman-translate (to)
   "Translate up to marker TO.  Do this last of all transformations."
-  (if translations
-      (let ((matches (car translations))
-	    (alist (cdr translations))
+  (if (bound-and-true-p woman-translations)
+      (let ((matches (car woman-translations))
+	    (alist (cdr woman-translations))
 	    ;; Translations are case-sensitive, eg ".tr ab" does not
 	    ;; affect "A" (bug#6849).
 	    (case-fold-search nil))
@@ -3633,7 +3648,7 @@
 	(insert-and-inherit (symbol-function 'insert-and-inherit))
 	(set-text-properties (symbol-function 'set-text-properties))
 	(woman-registers woman-registers)
-	fn request translations
+	fn woman-request woman-translations
 	tab-stop-list)
     (set-marker-insertion-type to t)
     ;; ?roff does not squeeze multiple spaces, but does fill, so...
@@ -3649,13 +3664,13 @@
            ;; Construct woman function to call:
            ((setq fn (intern-soft
                       (concat "woman2-"
-                              (setq request (match-string 1)))))
+                              (setq woman-request (match-string 1)))))
             ;; Delete request or macro name:
             (woman-delete-match 0))
            ;; Unrecognised request:
            ((prog1 nil
-              ;; (WoMan-warn ".%s request ignored!" request)
-              (WoMan-warn-ignored request "ignored!")
+              ;; (WoMan-warn ".%s request ignored!" woman-request)
+              (WoMan-warn-ignored woman-request "ignored!")
               ;; (setq fn 'woman2-LP)
               ;; AVOID LEAVING A BLANK LINE!
               ;; (setq fn 'woman2-format-paragraphs)
@@ -4486,6 +4501,7 @@
   (setq format (apply 'format format args))
   (WoMan-log-1 (concat "**  " format)))
 
+;; request is not used dynamically by any callees.
 (defun WoMan-warn-ignored (request ignored)
   "Log a warning message about ignored directive REQUEST.
 IGNORED is a string appended to the log message."
@@ -4557,5 +4573,4 @@
 
 (provide 'woman)
 
-;; arch-tag: eea35e90-552f-4712-a94b-d9ffd3db7651
 ;;; woman.el ends here
--- a/lisp/x-dnd.el	Fri Nov 05 23:47:58 2010 +0200
+++ b/lisp/x-dnd.el	Sat Nov 06 10:28:31 2010 +0200
@@ -220,7 +220,7 @@
 DATA is encoded in utf-16.  Decode the URL and call `x-dnd-handle-uri-list'."
   ;; Mozilla and applications based on it (Galeon for example) uses
   ;; text/unicode, but it is impossible to tell if it is le or be.  Use what
-  ;; the machine Emacs runs on use.  This looses if dropping between machines
+  ;; the machine Emacs runs on use.  This loses if dropping between machines
   ;; with different endian, but it is the best we can do.
   (let* ((coding (if (eq (byteorder) ?B) 'utf-16be 'utf-16le))
 	 (string (decode-coding-string data coding))
@@ -766,5 +766,4 @@
 
 (provide 'x-dnd)
 
-;; arch-tag: b621fb7e-50da-4323-850b-5fc71ae64621
 ;;; x-dnd.el ends here
--- a/src/ChangeLog	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/ChangeLog	Sat Nov 06 10:28:31 2010 +0200
@@ -1,33 +1,6 @@
 2010-11-05  Eli Zaretskii  <eliz@gnu.org>
 
-	* xdisp.c (x_consider_frame_title, tool_bar_lines_needed): Move
-	prototypes to HAVE_WINDOW_SYSTEM-only part.
-	(get_window_cursor_type): Move inside a HAVE_WINDOW_SYSTEM-only
-	part.  Remove "#ifdef HAVE_WINDOW_SYSTEM" from body of function.
-	(null_glyph_slice): Move declaration into HAVE_WINDOW_SYSTEM-only
-	part.
-
-	* frame.h (MOUSE_HL_INFO): Fix definition to work both for
-	TTY-only and GUI builds.
-
-	* dispnew.c (init_display): Setup initial frame's output_data for
-	text terminal frames.
-
-	* frame.h (MOUSE_HL_INFO): Fix TTY definition.
-
-	* dispextern.h (tty_draw_row_with_mouse_face): Add prototype.
-
-	* xdisp.c (draw_row_with_mouse_face): Don't #ifdef away on MSDOS.
-	Call tty_draw_row_with_mouse_face on MSDOS as well.
-
-	* msdos.c (tty_draw_row_with_mouse_face): Renamed from
-	draw_row_with_mouse_face.  Make the argument list identical with
-	GPM implementation.
-
-	* msdos.h (Display_Info): Restore typedef.
-	(initialize_msdos_display): Add prototype.
-
-2010-11-02  Eli Zaretskii  <eliz@gnu.org>
+	Unify mouse-highlight code for all GUI and TTY sessions.
 
 	* term.c: Remove static mouse_face_* variables.  All users
 	changed.
@@ -37,14 +10,6 @@
 	(term_mouse_movement): Call note_mouse_highlight instead of
 	term_mouse_highlight.
 
-2010-11-01  Eli Zaretskii  <eliz@gnu.org>
-
-	* msdos.c (dos_set_window_size, draw_row_with_mouse_face)
-	(IT_update_begin, IT_update_end, IT_frame_up_to_date)
-	(internal_terminal_init, dos_rawgetc): Replace Display_Info with
-	Mouse_HLInfo everywhere where mouse_face_* members were accessed
-	for mouse highlight purposes.
-
 	* nsterm.m (ns_update_window_begin, ns_update_window_end)
 	(ns_update_end, x_destroy_window, ns_frame_up_to_date)
 	(ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background)
@@ -68,42 +33,23 @@
 	* xdisp.c (show_mouse_face, note_mode_line_or_margin_highlight)
 	(note_mouse_highlight) [HAVE_WINDOW_SYSTEM]: Don't run GUI code
 	unless the frame is on a window-system.
-
-2010-10-31  Eli Zaretskii  <eliz@gnu.org>
-
-	* xdisp.c (get_tool_bar_item, handle_tool_bar_click)
+	(get_tool_bar_item, handle_tool_bar_click)
 	(note_tool_bar_highlight, draw_glyphs, erase_phys_cursor)
 	(show_mouse_face, clear_mouse_face, coords_in_mouse_face_p)
 	(note_mode_line_or_margin_highlight, note_mouse_highlight)
 	(x_clear_window_mouse_face, cancel_mouse_face, expose_frame):
 	Replace Display_Info with Mouse_HLInfo everywhere where
 	mouse_face_* members were accessed for mouse highlight purposes.
-
-	* frame.h (MOUSE_HL_INFO): New macro.
-
-	* lisp.h (Mouse_HLInfo): New data type.
-
-	* xterm.h (struct x_display_info):
-	* w32term.h (struct w32_display_info):
-	* nsterm.h (struct ns_display_info):
-	* termchar.h (struct tty_display_info): Use it instead of
-	mouse_face_* members.
-
-	* dispextern.h (DPYINFO_DEFINED): Remove definition.
-	(FRAME_X_DISPLAY_INFO): Remove definition.
-	(show_mouse_face, clear_mouse_face): Update type of 1st argument.
-
-2010-10-30  Eli Zaretskii  <eliz@gnu.org>
-
-	* xdisp.c (coords_in_mouse_face_p): Move prototype out of the
+	(coords_in_mouse_face_p): Move prototype out of the
 	HAVE_WINDOW_SYSTEM conditional.
 	(x_y_to_hpos_vpos, frame_to_window_pixel_xy): Move out of the
 	HAVE_WINDOW_SYSTEM block.
 	(try_window_id) [HAVE_GPM || MSDOS]: Call
 	x_clear_window_mouse_face.
 	(draw_row_with_mouse_face): Implementation for HAVE_WINDOW_SYSTEM
-	systems.
-	(show_mouse_face): Call it, instead of calling draw_glyphs directly.
+	systems.  Call tty_draw_row_with_mouse_face for TTY systems.
+	(show_mouse_face): Call draw_row_with_mouse_face, instead of
+	calling draw_glyphs directly.
 	(show_mouse_face, clear_mouse_face, coords_in_mouse_face_p)
 	(cursor_in_mouse_face_p, rows_from_pos_range)
 	(mouse_face_from_buffer_pos, mouse_face_from_string_pos)
@@ -115,30 +61,20 @@
 	Clear mouse highlight if pointer is over glyphs whose OBJECT is an
 	integer.
 	(mouse_face_from_buffer_pos): Add parentheses around && within ||.
-
-	* xmenu.c (popup_activated): Don't define on MSDOS.
+	(x_consider_frame_title, tool_bar_lines_needed): Move
+	prototypes to HAVE_WINDOW_SYSTEM-only part.
+	(get_window_cursor_type): Move inside a HAVE_WINDOW_SYSTEM-only
+	part.  Remove "#ifdef HAVE_WINDOW_SYSTEM" from body of function.
+	(null_glyph_slice): Move declaration into HAVE_WINDOW_SYSTEM-only
+	part.
 
 	* dispnew.c (mirror_make_current): Set Y coordinate of the
 	mode-line and header-line rows.
-
-	* termchar.h (struct tty_display_info): Define mouse_face_*
-	members not only for MSDOS.  Delete stray whitespace.
-	<mouse_face_beg_x, mouse_face_beg_y, mouse_face_overlay>: New
-	struct members.
-
-	* dispextern.h (DPYINFO_DEFINED) [HAVE_X_WINDOWS]: Define.
-	(DPYINFO_DEFINED) [HAVE_NTGUI]: Define.
-	(DPYINFO_DEFINED) [HAVE_NS]: Define.
-	(Display_Info) [!DPYINFO_DEFINED]: Define here.
-	(FRAME_X_DISPLAY_INFO) [HAVE_GPM]: Define.
-	(FRAME_X_DISPLAY_INFO): Define to NULL if not defined.
-	(frame_to_window_pixel_xy, note_mouse_highlight)
-	(x_clear_window_mouse_face, cancel_mouse_face, clear_mouse_face)
-	(show_mouse_face, cursor_in_mouse_face_p): Move prototypes out of
-	HAVE_WINDOW_SYSTEM conditional.
-	(draw_row_with_mouse_face): Declare prototype.
-
-	* msdos.h (Display_Info): Don't define here.
+	(init_display): Setup initial frame's output_data for text
+	terminal frames.
+
+	* xmenu.c (popup_activated): Don't define on MSDOS, which now has
+	its own definition on msdos.c.
 
 	* msdos.c (show_mouse_face, clear_mouse_face)
 	(fast_find_position, IT_note_mode_line_highlight)
@@ -146,6 +82,146 @@
 	(IT_frame_up_to_date, dos_rawgetc): Call note_mouse_highlight
 	instead of IT_note_mouse_highlight.
 	(draw_row_with_mouse_face, popup_activated): New functions.
+	(dos_set_window_size, draw_row_with_mouse_face, IT_update_begin)
+	(IT_update_end, IT_frame_up_to_date, internal_terminal_init)
+	(dos_rawgetc): Replace Display_Info with Mouse_HLInfo everywhere
+	where mouse_face_* members were accessed for mouse highlight
+	purposes.
+
+	* msdos.h (initialize_msdos_display): Add prototype.
+
+	* frame.h (MOUSE_HL_INFO): New macro.
+
+	* lisp.h (Mouse_HLInfo): New data type.
+
+	* xterm.h (struct x_display_info):
+	* w32term.h (struct w32_display_info):
+	* nsterm.h (struct ns_display_info):
+	* termchar.h (struct tty_display_info): Use it instead of
+	mouse_face_* members.
+
+	* dispextern.h (show_mouse_face, clear_mouse_face): Update type of
+	1st argument.
+	(frame_to_window_pixel_xy, note_mouse_highlight)
+	(x_clear_window_mouse_face, cancel_mouse_face, clear_mouse_face)
+	(show_mouse_face, cursor_in_mouse_face_p): Move prototypes out of
+	HAVE_WINDOW_SYSTEM conditional.
+	(draw_row_with_mouse_face): Declare prototype.
+	(tty_draw_row_with_mouse_face): Declare prototype.
+
+2010-11-05  Eli Zaretskii  <eliz@gnu.org>
+
+	* term.c (append_glyphless_glyph, produce_glyphless_glyph): Remove
+	unused variables.
+
+2010-11-05  Adrian Robert  <Adrian.B.Robert@gmail.com>
+
+	* nsterm.m (EmacsView-mouseExited:): Correct error in conditional
+	logic pointed out by Eli Zaretskii.
+
+2010-11-04  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* coding.c (coding-category-list): Refer to set-coding-system-priority
+	instead of the obsolete set-coding-priority in the doc string.
+
+
+2010-11-04  Adrian Robert  <Adrian.B.Robert@gmail.com>
+
+	* nsfont.m (nsfont_draw):  Correct previous patch to return
+	correct value.
+	* nsimage.m (EmacsImage-setXBMColor:): Correct previous patch:
+	don't change the method signature, change the return.
+
+2010-11-04  Ismail Donmez  <ismail@namtrac.org>  (tiny change)
+
+	* nsfont.m (nsfont_draw)
+	* nsimage.m (EmacsImage-setXBMColor:)
+	* nsterm.m (EmacsView-performDragOperation:): Correct empty return.
+
+2010-11-03  Julien Danjou  <julien@danjou.info>
+
+	* image.c (gif_load): Add support for transparency and specified
+	:background.
+
+2010-11-01  Kenichi Handa  <handa@m17n.org>
+
+	* dispextern.h (lookup_glyphless_char_display): Extern it.
+
+	* termhooks.h (struct terminal): New member charset_list.
+
+	* coding.c (Fset_terminal_coding_system_internal): Set the
+	`charset_list' member of struct terminal.
+
+	* term.c (produce_glyphs): Handle the case it->what == IT_GLYPHLESS.
+	(append_glyphless_glyph, produce_glyphless_glyph): New functions.
+
+	* xdisp.c (lookup_glyphless_char_display): Make it non-static.
+	(lookup_glyphless_char_display): Set it->what at the end.
+	(last_glyphless_glyph_frame, last_glyphless_glyph_face_id)
+	(last_glyphless_glyph_merged_face_id): Make them non-static.
+
+	* w32term.c (x_draw_glyphless_glyph_string_foreground):
+	Fix the arg with_background for font->driver->draw.
+
+2010-11-01  Kenichi Handa  <handa@m17n.org>
+
+	* w32gui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
+	Surround chp by parentheses.
+
+2010-11-01  Kenichi Handa  <handa@m17n.org>
+
+	Implement various display methods for glyphless characters.
+
+	* xdisp.c (Qglyphless_char, Vglyphless_char_display)
+	(Qglyphless_char_display, Qhexa_code, Qempty_box, Qthin_space)
+	(Qzero_width): New variables.
+	(THIN_SPACE_WIDTH): New macro.
+	(lookup_glyphless_char_display): New funciton.
+	(last_glyphless_glyph_frame, last_glyphless_glyph_face_id)
+	(last_glyphless_glyph_merged_face_id): New variables.
+	(get_next_display_element): Check glyphless characters.
+	(redisplay_internal): Initialize last_glyphless_glyph_frame and
+	last_glyphless_glyph_face_id.
+	(fill_glyphless_glyph_string): New function.
+	(BUILD_GLYPHLESS_GLYPH_STRING): New macro.
+	(BUILD_GLYPH_STRINGS): Handle the case GLYPHLESS_GLYPH.
+	(append_glyphless_glyph, produce_glyphless_glyph): New functions.
+	(x_produce_glyphs): If a suitable font is not found, produce a
+	glyphless glyph.  Handle the case it->what == IT_GLYPHLESS.
+	(syms_of_xdisp): Intern and staticpro Qglyphless_char,
+	Qglyphless_char_display, Qhexa_code, Qempty_box, Qthin_space, and
+	Qzero_width.
+	(Vglyphless_char_display): Declare it as a Lisp variable.
+
+	* dispextern.h (enum glyph_type): Add GLYPHLESS_GLYPH.
+	(struct glyph): Change the size of the member "type" to 3.
+	Add glyphless to the union slice and u.
+	(enum display_element_type): Add IT_GLYPHLESS.
+	(enum glyphless_display_method): New enum.
+	(struct it): New member glyphless_method.
+	(Vglyphless_char_display): Extern it.
+
+	* xterm.c (x_draw_glyphless_glyph_string_foreground): New function.
+	(x_draw_glyph_string): Handle the case GLYPHLESS_GLYPH.
+
+	* w32term.c (x_draw_glyphless_glyph_string_foreground): New function.
+	(x_draw_glyph_string): Handle the case GLYPHLESS_GLYPH.
+
+	* nsterm.m (ns_draw_glyph_string): Handle the case
+	GLYPHLESS_GLYPH (the detail is not yet implemented).
+
+2010-10-31  Glenn Morris  <rgm@gnu.org>
+
+	* xterm.c (x_connection_closed) [USE_X_TOOLKIT]: Fix merge, maybe.
+
+	* frame.c (syms_of_frame) <tool-bar-mode>:
+	Default to nil if !HAVE_WINDOW_SYSTEM.  (Bug#7299)
+
+2010-10-31  Chong Yidong  <cyd@stupidchicken.com>
+
+	* xterm.c (x_connection_closed): Print informative error message
+	when aborting on GTK.  This requires using shut_down_emacs
+	directly instead of Fkill_emacs.
 
 2010-10-29  Eli Zaretskii  <eliz@gnu.org>
 
--- a/src/buffer.h	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/buffer.h	Sat Nov 06 10:28:31 2010 +0200
@@ -1,7 +1,8 @@
 /* Header file for the buffer manipulation primitives.
-   Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
-                 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-                 Free Software Foundation, Inc.
+
+Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000,
+  2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -459,7 +460,7 @@
     struct Lisp_Marker *markers;
 
     /* Usually 0.  Temporarily set to 1 in decode_coding_gap to
-       prevent Fgarbage_collect from shrinking the gap and loosing
+       prevent Fgarbage_collect from shrinking the gap and losing
        not-yet-decoded bytes.  */
     int inhibit_shrinking;
   };
@@ -1019,5 +1020,3 @@
 #define PER_BUFFER_VALUE(BUFFER, OFFSET) \
       (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER)))
 
-/* arch-tag: 679305dd-d41c-4a50-b170-3caf5c97b2d1
-   (do not change this comment) */
--- a/src/coding.c	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/coding.c	Sat Nov 06 10:28:31 2010 +0200
@@ -9297,7 +9297,8 @@
        doc: /* Internal use only.  */)
   (Lisp_Object coding_system, Lisp_Object terminal)
 {
-  struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1));
+  struct terminal *term = get_terminal (terminal, 1);
+  struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (term);
   CHECK_SYMBOL (coding_system);
   setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding);
   /* We had better not send unsafe characters to terminal.  */
@@ -9306,6 +9307,10 @@
   terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK;
   terminal_coding->src_multibyte = 1;
   terminal_coding->dst_multibyte = 0;
+  if (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK)
+    term->charset_list = coding_charset_list (terminal_coding);
+  else
+    term->charset_list = Fcons (Qascii, Qnil);
   return Qnil;
 }
 
@@ -10554,7 +10559,7 @@
 one algorithm agrees with a byte sequence of source text, the coding
 system bound to the corresponding coding-category is selected.
 
-Don't modify this variable directly, but use `set-coding-priority'.  */);
+Don't modify this variable directly, but use `set-coding-system-priority'.  */);
   {
     int i;
 
--- a/src/dispextern.h	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/dispextern.h	Sat Nov 06 10:28:31 2010 +0200
@@ -284,6 +284,9 @@
   /* Glyph describes a static composition.  */
   COMPOSITE_GLYPH,
 
+  /* Glyph describes a glyphless character.  */
+  GLYPHLESS_GLYPH,
+
   /* Glyph describes an image.  */
   IMAGE_GLYPH,
 
@@ -338,7 +341,7 @@
 
   /* Which kind of glyph this is---character, image etc.  Value
      should be an enumerator of type enum glyph_type.  */
-  unsigned type : 2;
+  unsigned type : 3;
 
   /* 1 means this glyph was produced from multibyte text.  Zero
      means it was produced from unibyte text, i.e. charsets aren't
@@ -407,6 +410,11 @@
     /* Start and end indices of glyphs of a graphme cluster of a
        composition (type == COMPOSITE_GLYPH).  */
     struct { int from, to; } cmp;
+    /* Pixel offsets for upper and lower part of the acronym.  */
+    struct {
+      short upper_xoff, upper_yoff;
+      short lower_xoff, lower_yoff;
+    } glyphless;
   } slice;
 
   /* A union of sub-structures for different glyph types.  */
@@ -438,6 +446,19 @@
     }
     stretch;
 
+    /* Sub-stretch for type == GLYPHLESS_GLYPH.  */
+    struct
+    {
+      /* Value is an enum of the type glyphless_display_method.  */
+      unsigned method : 2;
+      /* 1 iff this glyph is for a character of no font. */
+      unsigned for_no_font : 1;
+      /* Length of acronym or hexadecimal code string (at most 8).  */
+      unsigned len : 4;
+      /* Character to display.  Actually we need only 22 bits.  */
+      unsigned ch : 26;
+    } glyphless;
+
     /* Used to compare all bit-fields above in one step.  */
     unsigned val;
   } u;
@@ -1923,6 +1944,9 @@
   /* A composition (static and automatic).  */
   IT_COMPOSITION,
 
+  /* A glyphless character (e.g. ZWNJ, LRE).  */
+  IT_GLYPHLESS,
+
   /* An image.  */
   IT_IMAGE,
 
@@ -1969,6 +1993,20 @@
   WINDOW_WRAP
 };
 
+/* An enumerator for the method of displaying glyphless characters.  */
+
+enum glyphless_display_method
+  {
+    /* Display a thin (1-pixel width) space.  */
+    GLYPHLESS_DISPLAY_THIN_SPACE,
+    /* Display an empty box of proper width.  */
+    GLYPHLESS_DISPLAY_EMPTY_BOX,
+    /* Display an acronym string in a box.  */
+    GLYPHLESS_DISPLAY_ACRONYM,
+    /* Display a hexadecimal character code in a box.  */
+    GLYPHLESS_DISPLAY_HEXA_CODE
+  };
+
 struct it_slice
 {
   Lisp_Object x;
@@ -2300,6 +2338,10 @@
      PRODUCE_GLYPHS, this should be set beforehand too.  */
   int char_to_display;
 
+  /* If what == IT_GLYPHLESS, the method to display such a
+     character.  */
+  enum glyphless_display_method glyphless_method;
+
   /* If what == IT_IMAGE, the id of the image to display.  */
   int image_id;
 
@@ -2981,9 +3023,10 @@
 extern Lisp_Object Vmouse_autoselect_window;
 extern int unibyte_display_via_language_environment;
 extern EMACS_INT underline_minimum_offset;
+extern Lisp_Object Vglyphless_char_display;
 
 extern void reseat_at_previous_visible_line_start (struct it *);
-
+extern Lisp_Object lookup_glyphless_char_display (int, struct it *);
 extern int calc_pixel_width_or_height (double *, struct it *, Lisp_Object,
                                        struct font *, int, int *);
 
--- a/src/font.c	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/font.c	Sat Nov 06 10:28:31 2010 +0200
@@ -1,8 +1,9 @@
 /* font.c -- "Font" primitives.
-   Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-   Copyright (C) 2006, 2007, 2008, 2009, 2010
-     National Institute of Advanced Industrial Science and Technology (AIST)
-     Registration Number H13PRO009
+
+Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright (C) 2006, 2007, 2008, 2009, 2010
+  National Institute of Advanced Industrial Science and Technology (AIST)
+  Registration Number H13PRO009
 
 This file is part of GNU Emacs.
 
@@ -3443,7 +3444,7 @@
       if (NILP (entity))
 	return Qnil;
     }
-  /* Don't loose the original name that was put in initially.  We need
+  /* Don't lose the original name that was put in initially.  We need
      it to re-apply the font when font parameters (like hinting or dpi) have
      changed.  */
   entity = font_open_for_lface (f, entity, attrs, spec);
@@ -3514,7 +3515,7 @@
   args[1] = make_unibyte_string (name, strlen (name));
   spec = Ffont_spec (2, args);
   ret = font_open_by_spec (f, spec);
-  /* Do not loose name originally put in.  */
+  /* Do not lose name originally put in.  */
   if (!NILP (ret))
     font_put_extra (ret, QCuser_spec, args[1]);
 
@@ -5399,5 +5400,3 @@
   Vfont_log = egetenv ("EMACS_FONT_LOG") ? Qnil : Qt;
 }
 
-/* arch-tag: 74c9475d-5976-4c93-a327-942ae3072846
-   (do not change this comment) */
--- a/src/frame.c	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/frame.c	Sat Nov 06 10:28:31 2010 +0200
@@ -4576,7 +4576,11 @@
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `tool-bar-mode'.  */);
+#ifdef HAVE_WINDOW_SYSTEM
   Vtool_bar_mode = Qt;
+#else
+  Vtool_bar_mode = Qnil;
+#endif
 
   DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame,
 		 doc: /* Minibufferless frames use this frame's minibuffer.
--- a/src/image.c	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/image.c	Sat Nov 06 10:28:31 2010 +0200
@@ -7096,12 +7096,15 @@
 static const int interlace_start[] = {0, 4, 2, 1};
 static const int interlace_increment[] = {8, 8, 4, 2};
 
+#define GIF_LOCAL_DESCRIPTOR_EXTENSION 249
+
 static int
 gif_load (struct frame *f, struct image *img)
 {
   Lisp_Object file, specified_file;
   Lisp_Object specified_data;
   int rc, width, height, x, y, i;
+  boolean transparent_p;
   XImagePtr ximg;
   ColorMapObject *gif_color_map;
   unsigned long pixel_colors[256];
@@ -7110,6 +7113,7 @@
   int ino, image_height, image_width;
   gif_memory_source memsrc;
   unsigned char *raster;
+  unsigned int transparency_color_index;
 
   specified_file = image_spec_value (img->spec, QCfile, NULL);
   specified_data = image_spec_value (img->spec, QCdata, NULL);
@@ -7182,6 +7186,18 @@
       return 0;
     }
 
+  for (i = 0; i < gif->SavedImages[ino].ExtensionBlockCount; i++)
+    if ((gif->SavedImages[ino].ExtensionBlocks[i].Function
+	 == GIF_LOCAL_DESCRIPTOR_EXTENSION)
+	&& gif->SavedImages[ino].ExtensionBlocks[i].ByteCount == 4
+	/* Transparency enabled?  */
+	&& gif->SavedImages[ino].ExtensionBlocks[i].Bytes[0] & 1)
+      {
+	transparent_p = 1;
+	transparency_color_index
+	  = (unsigned char) gif->SavedImages[ino].ExtensionBlocks[i].Bytes[3];
+      }
+
   img->corners[TOP_CORNER] = gif->SavedImages[ino].ImageDesc.Top;
   img->corners[LEFT_CORNER] = gif->SavedImages[ino].ImageDesc.Left;
   image_height = gif->SavedImages[ino].ImageDesc.Height;
@@ -7220,10 +7236,22 @@
   if (gif_color_map)
     for (i = 0; i < gif_color_map->ColorCount; ++i)
       {
-        int r = gif_color_map->Colors[i].Red << 8;
-        int g = gif_color_map->Colors[i].Green << 8;
-        int b = gif_color_map->Colors[i].Blue << 8;
-        pixel_colors[i] = lookup_rgb_color (f, r, g, b);
+	if (transparent_p && transparency_color_index == i)
+	  {
+	    Lisp_Object specified_bg
+	      = image_spec_value (img->spec, QCbackground, NULL);
+	    pixel_colors[i] = STRINGP (specified_bg)
+	      ? x_alloc_image_color (f, img, specified_bg,
+				     FRAME_BACKGROUND_PIXEL (f))
+	      : FRAME_BACKGROUND_PIXEL (f);
+	  }
+	else
+	  {
+	    int r = gif_color_map->Colors[i].Red << 8;
+	    int g = gif_color_map->Colors[i].Green << 8;
+	    int b = gif_color_map->Colors[i].Blue << 8;
+	    pixel_colors[i] = lookup_rgb_color (f, r, g, b);
+	  }
       }
 
 #ifdef COLOR_TABLE_SUPPORT
--- a/src/nsfont.m	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/nsfont.m	Sat Nov 06 10:28:31 2010 +0200
@@ -1211,7 +1211,6 @@
     DPSstroke (context);
 
     DPSgrestore (context);
-    return to-from;
   }
 
 #else  /* NS_IMPL_COCOA */
@@ -1280,10 +1279,9 @@
       }
 
     CGContextRestoreGState (gcontext);
-    return;
   }
 #endif  /* NS_IMPL_COCOA */
-
+  return to-from;
 }
 
 
--- a/src/nsimage.m	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/nsimage.m	Sat Nov 06 10:28:31 2010 +0200
@@ -336,7 +336,7 @@
   NSColor *rgbColor;
 
   if (bmRep == nil || color == nil)
-    return;
+    return self;
 
   if ([color colorSpaceName] != NSCalibratedRGBColorSpace)
     rgbColor = [color colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
@@ -361,6 +361,8 @@
           planes[2][i] = bb;
         }
   }
+
+  return self;
 }
 
 
--- a/src/nsterm.m	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/nsterm.m	Sat Nov 06 10:28:31 2010 +0200
@@ -2981,6 +2981,22 @@
       ns_unfocus (s->f);
       break;
 
+    case GLYPHLESS_GLYPH:
+      n = ns_get_glyph_string_clip_rect (s, r);
+      ns_focus (s->f, r, n);
+
+      if (s->for_overlaps || (s->cmp_from > 0
+			      && ! s->first_glyph->u.cmp.automatic))
+        s->background_filled_p = 1;
+      else
+        ns_maybe_dumpglyphs_background
+          (s, s->first_glyph->type == COMPOSITE_GLYPH);
+      /* ... */ 
+      /* Not yet implemented.  */
+      /* ... */ 
+      ns_unfocus (s->f);
+      break;
+
     default:
       abort ();
     }
@@ -5295,7 +5311,7 @@
 
   NSTRACE (mouseExited);
 
-  if (hlinfo || !emacsframe)
+  if (!hlinfo)
     return;
 
   last_mouse_movement_time = EV_TIMESTAMP (theEvent);
@@ -5418,7 +5434,7 @@
   NSTRACE (performDragOperation);
 
   if (!emacs_event)
-    return;
+    return NO;
 
   position = [self convertPoint: [sender draggingLocation] fromView: nil];
   x = lrint (position.x);  y = lrint (position.y);
--- a/src/term.c	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/term.c	Sat Nov 06 10:28:31 2010 +0200
@@ -1487,6 +1487,8 @@
 static void produce_stretch_glyph (struct it *);
 static void append_composite_glyph (struct it *);
 static void produce_composite_glyph (struct it *);
+static void append_glyphless_glyph (struct it *, int, char *);
+static void produce_glyphless_glyph (struct it *, int, Lisp_Object);
 
 /* Append glyphs to IT's glyph_row.  Called from produce_glyphs for
    terminal frames if IT->glyph_row != NULL.  IT->char_to_display is
@@ -1595,6 +1597,12 @@
       goto done;
     }
 
+  if (it->what == IT_GLYPHLESS)
+    {
+      produce_glyphless_glyph (it, 0, Qnil);
+      goto done;
+    }
+
   if (it->char_to_display >= 040 && it->char_to_display < 0177)
     {
       it->pixel_width = it->nglyphs = 1;
@@ -1646,11 +1654,22 @@
     }
   else
     {
-      it->pixel_width = CHAR_WIDTH (it->char_to_display);
-      it->nglyphs = it->pixel_width;
-
-      if (it->glyph_row)
-	append_glyph (it);
+      Lisp_Object charset_list = FRAME_TERMINAL (it->f)->charset_list;
+
+      if (char_charset (it->char_to_display, charset_list, NULL))
+	{
+	  it->pixel_width = CHAR_WIDTH (it->char_to_display);
+	  it->nglyphs = it->pixel_width;
+	  if (it->glyph_row)
+	    append_glyph (it);
+	}
+      else
+	{
+	  Lisp_Object acronym = lookup_glyphless_char_display (-1, it);
+
+	  xassert (it->what == IT_GLYPHLESS);
+	  produce_glyphless_glyph (it, 1, acronym);
+	}
     }
 
  done:
@@ -1830,6 +1849,156 @@
 }
 
 
+/* Append a glyph for a glyphless character to IT->glyph_row.  FACE_ID
+   is a face ID to be used for the glyph.  What actually appended are
+   glyphs of type CHAR_GLYPH of which characters are in STR
+   (it->nglyphs bytes).  */
+
+static void
+append_glyphless_glyph (struct it *it, int face_id, char *str)
+{
+  struct glyph *glyph, *end;
+  int i;
+
+  xassert (it->glyph_row);
+  glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area];
+  end = it->glyph_row->glyphs[1 + it->area];
+
+  /* If the glyph row is reversed, we need to prepend the glyph rather
+     than append it.  */
+  if (it->glyph_row->reversed_p && it->area == TEXT_AREA)
+    {
+      struct glyph *g;
+      int move_by = it->pixel_width;
+
+      /* Make room for the new glyphs.  */
+      if (move_by > end - glyph) /* don't overstep end of this area */
+	move_by = end - glyph;
+      for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--)
+	g[move_by] = *g;
+      glyph = it->glyph_row->glyphs[it->area];
+      end = glyph + move_by;
+    }
+
+  if (glyph >= end)
+    return;
+  glyph->type = CHAR_GLYPH;
+  glyph->pixel_width = 1;
+  glyph->face_id = face_id;
+  glyph->padding_p = 0;
+  glyph->charpos = CHARPOS (it->position);
+  glyph->object = it->object;
+  if (it->bidi_p)
+    {
+      glyph->resolved_level = it->bidi_it.resolved_level;
+      if ((it->bidi_it.type & 7) != it->bidi_it.type)
+	abort ();
+      glyph->bidi_type = it->bidi_it.type;
+    }
+  else
+    {
+      glyph->resolved_level = 0;
+      glyph->bidi_type = UNKNOWN_BT;
+    }
+
+  /* BIDI Note: we put the glyphs of characters left to right, even in
+     the REVERSED_P case because we write to the terminal
+     left-to-right.  */
+  for (i = 0; i < it->nglyphs && glyph < end; ++i)
+    {
+      if (i > 0)
+	glyph[0] = glyph[-1];
+      glyph->u.ch = str[i];
+      ++it->glyph_row->used[it->area];
+      ++glyph;
+    }
+}
+
+/* Declared in xdisp.c */
+extern struct frame *last_glyphless_glyph_frame;
+extern unsigned last_glyphless_glyph_face_id;
+extern int last_glyphless_glyph_merged_face_id;
+extern Lisp_Object Qglyphless_char;
+
+/* Produce glyphs for a glyphless character for iterator IT.
+   IT->glyphless_method specifies which method to use for displaying
+   the character.  See the description of enum
+   glyphless_display_method in dispextern.h for the detail.
+
+   FOR_NO_FONT is nonzero if and only if this is for a character that
+   is not supproted by the coding system of the terminal.  ACRONYM, if
+   non-nil, is an acronym string for the character.
+
+   The glyphs actually produced are of type CHAR_GLYPH.  */
+
+static void
+produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
+{
+  int face_id;
+  int width, len;
+  char buf[9], *str = "    ";
+
+  /* Get a face ID for the glyph by utilizing a cache (the same way as
+     doen for `escape-glyph' in get_next_display_element).  */
+  if (it->f == last_glyphless_glyph_frame
+      && it->face_id == last_glyphless_glyph_face_id)
+    {
+      face_id = last_glyphless_glyph_merged_face_id;
+    }
+  else
+    {
+      /* Merge the `glyphless-char' face into the current face.  */
+      face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id);
+      last_glyphless_glyph_frame = it->f;
+      last_glyphless_glyph_face_id = it->face_id;
+      last_glyphless_glyph_merged_face_id = face_id;
+    }
+
+  if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE)
+    {
+      /* As there's no way to produce a thin space, we produce
+	 a space of canonical width..  */
+      len = 1;
+    }
+  else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX)
+    {
+      len = CHAR_WIDTH (it->c);
+      if (len == 0)
+	len = 1;
+      else if (width > 4)
+	len = 4;
+    }
+  else
+    {
+      if (it->glyphless_method == GLYPHLESS_DISPLAY_ACRONYM)
+	{
+	  if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display))
+	    acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c);
+	  buf[0] = '[';
+	  str = STRINGP (acronym) ? (char *) SDATA (acronym) : "";
+	  for (len = 0; len < 6 && str[len] && ASCII_BYTE_P (str[len]); len++)
+	    buf[1 + len] = str[len];
+	  buf[1 + len] = ']';
+	  len += 2;
+	}
+      else
+	{
+	  xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEXA_CODE);
+	  len = (it->c < 0x100 ? sprintf (buf, "U+%02X", it->c)
+		 : it->c < 0x10000 ? sprintf (buf, "U+%04X", it->c)
+		 : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "U+%06X", it->c)
+		 : sprintf (buf, "E+%06X", it->c));
+	}
+      str = buf;
+    }
+
+  it->pixel_width = len;
+  it->nglyphs = len;
+  if (len > 0 && it->glyph_row)
+    append_glyphless_glyph (it, face_id, str);
+}
+
+
 /* Get information about special display element WHAT in an
    environment described by IT.  WHAT is one of IT_TRUNCATION or
    IT_CONTINUATION.  Maybe produce glyphs for WHAT if IT has a
--- a/src/termhooks.h	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/termhooks.h	Sat Nov 06 10:28:31 2010 +0200
@@ -328,6 +328,11 @@
   /* Parameter alist of this terminal.  */
   Lisp_Object param_alist;
 
+  /* List of charsets supported by the terminal.  It is set by
+     Fset_terminal_coding_system_internal along with
+     the member terminal_coding.  */
+  Lisp_Object charset_list;
+
   /* All fields before `next_terminal' should be Lisp_Object and are traced
      by the GC.  All fields afterwards are ignored by the GC.  */
 
--- a/src/w32gui.h	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/w32gui.h	Sat Nov 06 10:28:31 2010 +0200
@@ -59,13 +59,13 @@
 
 /* Dealing with bits of wchar_t as if they were an XChar2b.  */
 #define STORE_XCHAR2B(chp, byte1, byte2) \
-  ((*chp) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
+  ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
 
 #define XCHAR2B_BYTE1(chp) \
- (((*chp) & 0xff00) >> 8)
+  (((*(chp)) & 0xff00) >> 8)
 
 #define XCHAR2B_BYTE2(chp) \
- ((*chp) & 0x00ff)
+  ((*(chp)) & 0x00ff)
 
 
 /* Windows equivalent of XImage.  */
--- a/src/w32term.c	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/w32term.c	Sat Nov 06 10:28:31 2010 +0200
@@ -1394,6 +1394,94 @@
 }
 
 
+/* Draw the foreground of glyph string S for glyphless characters.  */
+
+static void
+x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
+{
+  struct glyph *glyph = s->first_glyph;
+  XChar2b char2b[8];
+  int x, i, j;
+  int with_background;
+
+  /* If first glyph of S has a left box line, start drawing the text
+     of S to the right of that box line.  */
+  if (s->face->box != FACE_NO_BOX
+      && s->first_glyph->left_box_line_p)
+    x = s->x + eabs (s->face->box_line_width);
+  else
+    x = s->x;
+
+  SetTextColor (s->hdc, s->gc->foreground);
+  SetBkColor (s->hdc, s->gc->background);
+  SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT);
+
+  s->char2b = char2b;
+  with_background = ! (s->for_overlaps
+		       || (s->background_filled_p && s->hl != DRAW_CURSOR));
+  for (i = 0; i < s->nchars; i++, glyph++)
+    {
+      char buf[7], *str = NULL;
+      int len = glyph->u.glyphless.len;
+
+      if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM)
+	{
+	  if (len > 1
+	      && CHAR_TABLE_P (Vglyphless_char_display)
+	      && (CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display))
+		  >= 1))
+	    {
+	      Lisp_Object acronym
+		= (! glyph->u.glyphless.for_no_font
+		   ? CHAR_TABLE_REF (Vglyphless_char_display,
+				     glyph->u.glyphless.ch)
+		   : XCHAR_TABLE (Vglyphless_char_display)->extras[0]);
+	      if (STRINGP (acronym))
+		str = (char *) SDATA (acronym);
+	    }
+	}
+      else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEXA_CODE)
+	{
+	  sprintf ((char *) buf, "%0*X",
+		   glyph->u.glyphless.ch < 0x10000 ? 4 : 6,
+		   glyph->u.glyphless.ch);
+	  str = buf;
+	}
+
+      if (str)
+	{
+	  struct font *font = s->font;
+	  int upper_len = (len + 1) / 2;
+	  unsigned code;
+	  HFONT old_font;
+
+	  old_font = SelectObject (s->hdc, FONT_HANDLE (font));
+	  /* It is assured that all LEN characters in STR is ASCII.  */
+	  for (j = 0; j < len; j++)
+	    {
+	      code = font->driver->encode_char (font, str[j]);
+	      STORE_XCHAR2B (char2b + j, code >> 8, code & 0xFF);
+	    }
+	  font->driver->draw (s, 0, upper_len,
+			      x + glyph->slice.glyphless.upper_xoff,
+			      s->ybase + glyph->slice.glyphless.upper_yoff,
+			      with_background);
+	  font->driver->draw (s, upper_len, len,
+			      x + glyph->slice.glyphless.lower_xoff,
+			      s->ybase + glyph->slice.glyphless.lower_yoff,
+			      with_background);
+	  SelectObject (s->hdc, old_font);
+	}
+      if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE)
+	w32_draw_rectangle (s->hdc, s->gc,
+			    x, s->ybase - glyph->ascent,
+			    glyph->pixel_width - 1,
+			    glyph->ascent + glyph->descent - 1);
+      x += glyph->pixel_width;
+   }
+}
+
+
 /* Brightness beyond which a color won't have its highlight brightness
    boosted.
 
@@ -2282,6 +2370,14 @@
       x_draw_composite_glyph_string_foreground (s);
       break;
 
+    case GLYPHLESS_GLYPH:
+      if (s->for_overlaps)
+	s->background_filled_p = 1;
+      else
+	x_draw_glyph_string_background (s, 0);
+      x_draw_glyphless_glyph_string_foreground (s);
+      break;
+
     default:
       abort ();
     }
--- a/src/xdisp.c	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/xdisp.c	Sat Nov 06 10:28:31 2010 +0200
@@ -931,6 +931,21 @@
 /* Number of seconds to wait before displaying an hourglass cursor.  */
 Lisp_Object Vhourglass_delay;
 
+/* Name of the face used to display glyphless characters.  */
+Lisp_Object Qglyphless_char;
+
+/* Char-table to control the display of glyphless characters.  */
+Lisp_Object Vglyphless_char_display;
+
+/* Symbol for the purpose of Vglyphless_char_display.  */
+Lisp_Object Qglyphless_char_display;
+
+/* Method symbols for Vglyphless_char_display.  */
+static Lisp_Object Qhexa_code, Qempty_box, Qthin_space, Qzero_width;
+
+/* Default pixel width of `thin-space' display method.  */
+#define THIN_SPACE_WIDTH 1
+
 /* Default number of seconds to wait before displaying an hourglass
    cursor.  */
 #define DEFAULT_HOURGLASS_DELAY 1
@@ -5731,6 +5746,57 @@
 				 (IT)->string)))
 
 
+/* Lookup the char-table Vglyphless_char_display for character C (-1
+   if we want information for no-font case), and return the display
+   method symbol.  By side-effect, update it->what and
+   it->glyphless_method.  This function is called from
+   get_next_display_element for each character element, and from
+   x_produce_glyphs when no suitable font was found.  */
+
+Lisp_Object
+lookup_glyphless_char_display (int c, struct it *it)
+{
+  Lisp_Object glyphless_method = Qnil;
+
+  if (CHAR_TABLE_P (Vglyphless_char_display)
+      && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= 1)
+    glyphless_method = (c >= 0
+			? CHAR_TABLE_REF (Vglyphless_char_display, c)
+			: XCHAR_TABLE (Vglyphless_char_display)->extras[0]);
+ retry:
+  if (NILP (glyphless_method))
+    {
+      if (c >= 0)
+	/* The default is to display the character by a proper font.  */
+	return Qnil;
+      /* The default for the no-font case is to display an empty box.  */
+      glyphless_method = Qempty_box;
+    }
+  if (EQ (glyphless_method, Qzero_width))
+    {
+      if (c >= 0)
+	return glyphless_method;
+      /* This method can't be used for the no-font case.  */
+      glyphless_method = Qempty_box;
+    }
+  if (EQ (glyphless_method, Qthin_space))
+    it->glyphless_method = GLYPHLESS_DISPLAY_THIN_SPACE;
+  else if (EQ (glyphless_method, Qempty_box))
+    it->glyphless_method = GLYPHLESS_DISPLAY_EMPTY_BOX;
+  else if (EQ (glyphless_method, Qhexa_code))
+    it->glyphless_method = GLYPHLESS_DISPLAY_HEXA_CODE;
+  else if (STRINGP (glyphless_method))
+    it->glyphless_method = GLYPHLESS_DISPLAY_ACRONYM;
+  else
+    {
+      /* Invalid value.  We use the default method.  */
+      glyphless_method = Qnil;
+      goto retry;
+    }
+  it->what = IT_GLYPHLESS;
+  return glyphless_method;
+}
+
 /* Load IT's display element fields with information about the next
    display element from the current position of IT.  Value is zero if
    end of buffer (or C string) is reached.  */
@@ -5739,6 +5805,10 @@
 static unsigned last_escape_glyph_face_id = (1 << FACE_ID_BITS);
 static int last_escape_glyph_merged_face_id = 0;
 
+struct frame *last_glyphless_glyph_frame = NULL;
+unsigned last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
+int last_glyphless_glyph_merged_face_id = 0;
+
 int
 get_next_display_element (struct it *it)
 {
@@ -5817,6 +5887,15 @@
 	      goto get_next;
 	    }
 
+	  if (! NILP (lookup_glyphless_char_display (c, it)))
+	    {
+	      if (it->what == IT_GLYPHLESS)
+		goto done;
+	      /* Don't display this character.  */
+	      set_iterator_to_next (it, 0);
+	      goto get_next;
+	    }
+
 	  if (! ASCII_CHAR_P (c) && ! NILP (Vnobreak_char_display))
 	    nbsp_or_shy = (c == 0xA0   ? char_is_nbsp
 			   : c == 0xAD ? char_is_soft_hyphen
@@ -6031,6 +6110,7 @@
     }
 #endif
 
+ done:
   /* Is this character the last one of a run of characters with
      box?  If yes, set IT->end_of_box_run_p to 1.  */
   if (it->face_box_p
@@ -11579,6 +11659,8 @@
   reconsider_clip_changes (w, current_buffer);
   last_escape_glyph_frame = NULL;
   last_escape_glyph_face_id = (1 << FACE_ID_BITS);
+  last_glyphless_glyph_frame = NULL;
+  last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
 
   /* If new fonts have been loaded that make a glyph matrix adjustment
      necessary, do it.  */
@@ -20660,6 +20742,42 @@
 }
 
 
+/* Fill glyph string S from a sequence glyphs for glyphless characters.
+   See the comment of fill_glyph_string for arguments.
+   Value is the index of the first glyph not in S.  */
+
+
+static int
+fill_glyphless_glyph_string (struct glyph_string *s, int face_id,
+			     int start, int end, int overlaps)
+{
+  struct glyph *glyph, *last;
+  int voffset;
+
+  xassert (s->first_glyph->type == GLYPHLESS_GLYPH);
+  s->for_overlaps = overlaps;
+  glyph = s->row->glyphs[s->area] + start;
+  last = s->row->glyphs[s->area] + end;
+  voffset = glyph->voffset;
+  s->face = FACE_FROM_ID (s->f, face_id);
+  s->font = s->face->font;
+  s->nchars = 1;
+  s->width = glyph->pixel_width;
+  glyph++;
+  while (glyph < last
+	 && glyph->type == GLYPHLESS_GLYPH
+	 && glyph->voffset == voffset
+	 && glyph->face_id == face_id)
+    {
+      s->nchars++;
+      s->width += glyph->pixel_width;
+      glyph++;
+    }
+  s->ybase += voffset;
+  return glyph - s->row->glyphs[s->area];
+}
+
+
 /* Fill glyph string S from a sequence of character glyphs.
 
    FACE_ID is the face id of the string.  START is the index of the
@@ -21170,6 +21288,28 @@
   } while (0)
 
 
+/* Add a glyph string for a sequence of glyphless character's glyphs
+   to the list of strings between HEAD and TAIL.  The meanings of
+   arguments are the same as those of BUILD_CHAR_GLYPH_STRINGS.  */
+
+#define BUILD_GLYPHLESS_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \
+  do									    \
+    {									    \
+      int face_id;							    \
+      XChar2b *char2b;							    \
+									    \
+      face_id = (row)->glyphs[area][START].face_id;			    \
+									    \
+      s = (struct glyph_string *) alloca (sizeof *s);			    \
+      INIT_GLYPH_STRING (s, NULL, w, row, area, START, HL);		    \
+      append_glyph_string (&HEAD, &TAIL, s);				    \
+      s->x = (X);							    \
+      START = fill_glyphless_glyph_string (s, face_id, START, END,	    \
+					   overlaps);			    \
+    }									    \
+  while (0)
+
+
 /* Build a list of glyph strings between HEAD and TAIL for the glyphs
    of AREA of glyph row ROW on window W between indices START and END.
    HL overrides the face for drawing glyph strings, e.g. it is
@@ -21193,7 +21333,7 @@
 	      BUILD_CHAR_GLYPH_STRINGS (START, END, HEAD, TAIL,		\
 					HL, X, LAST_X);			\
 	      break;							\
-	      								\
+									\
 	    case COMPOSITE_GLYPH:					\
 	      if (first_glyph->u.cmp.automatic)				\
 		BUILD_GSTRING_GLYPH_STRING (START, END, HEAD, TAIL,	\
@@ -21202,21 +21342,26 @@
 		BUILD_COMPOSITE_GLYPH_STRING (START, END, HEAD, TAIL,	\
 					      HL, X, LAST_X);		\
 	      break;							\
-	      								\
+									\
 	    case STRETCH_GLYPH:						\
 	      BUILD_STRETCH_GLYPH_STRING (START, END, HEAD, TAIL,	\
 					  HL, X, LAST_X);		\
 	      break;							\
-	      								\
+									\
 	    case IMAGE_GLYPH:						\
 	      BUILD_IMAGE_GLYPH_STRING (START, END, HEAD, TAIL,		\
 					HL, X, LAST_X);			\
 	      break;							\
-	      								\
+									\
+	    case GLYPHLESS_GLYPH:					\
+	      BUILD_GLYPHLESS_GLYPH_STRING (START, END, HEAD, TAIL,	\
+					    HL, X, LAST_X);		\
+	      break;							\
+									\
 	    default:							\
 	      abort ();							\
 	    }								\
-	  								\
+									\
 	  if (s)							\
 	    {								\
 	      set_glyph_string_background_width (s, START, LAST_X);	\
@@ -22112,6 +22257,229 @@
 }
 
 
+/* Append a glyph for a glyphless character to IT->glyph_row.  FACE_ID
+   is a face ID to be used for the glyph.  FOR_NO_FONT is nonzero if
+   and only if this is for a character for which no font was found.
+
+   If the display method (it->glyphless_method) is
+   GLYPHLESS_DISPLAY_ACRONYM or GLYPHLESS_DISPLAY_HEXA_CODE, LEN is a
+   length of the acronym or the hexadecimal string, UPPER_XOFF and
+   UPPER_YOFF are pixel offsets for the upper part of the string,
+   LOWER_XOFF and LOWER_YOFF are for the lower part.
+
+   For the other display methods, LEN through LOWER_YOFF are zero.  */
+
+static void
+append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len,
+			short upper_xoff, short upper_yoff,
+			short lower_xoff, short lower_yoff)
+{
+  struct glyph *glyph;
+  enum glyph_row_area area = it->area;
+
+  glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
+  if (glyph < it->glyph_row->glyphs[area + 1])
+    {
+      /* If the glyph row is reversed, we need to prepend the glyph
+	 rather than append it.  */
+      if (it->glyph_row->reversed_p && area == TEXT_AREA)
+	{
+	  struct glyph *g;
+
+	  /* Make room for the additional glyph.  */
+	  for (g = glyph - 1; g >= it->glyph_row->glyphs[area]; g--)
+	    g[1] = *g;
+	  glyph = it->glyph_row->glyphs[area];
+	}
+      glyph->charpos = CHARPOS (it->position);
+      glyph->object = it->object;
+      glyph->pixel_width = it->pixel_width;
+      glyph->ascent = it->ascent;
+      glyph->descent = it->descent;
+      glyph->voffset = it->voffset;
+      glyph->type = GLYPHLESS_GLYPH;
+      glyph->u.glyphless.method = it->glyphless_method;
+      glyph->u.glyphless.for_no_font = for_no_font;
+      glyph->u.glyphless.len = len;
+      glyph->u.glyphless.ch = it->c;
+      glyph->slice.glyphless.upper_xoff = upper_xoff;
+      glyph->slice.glyphless.upper_yoff = upper_yoff;
+      glyph->slice.glyphless.lower_xoff = lower_xoff;
+      glyph->slice.glyphless.lower_yoff = lower_yoff;
+      glyph->avoid_cursor_p = it->avoid_cursor_p;
+      glyph->multibyte_p = it->multibyte_p;
+      glyph->left_box_line_p = it->start_of_box_run_p;
+      glyph->right_box_line_p = it->end_of_box_run_p;
+      glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent
+				      || it->phys_descent > it->descent);
+      glyph->padding_p = 0;
+      glyph->glyph_not_available_p = 0;
+      glyph->face_id = face_id;
+      glyph->font_type = FONT_TYPE_UNKNOWN;
+      if (it->bidi_p)
+	{
+	  glyph->resolved_level = it->bidi_it.resolved_level;
+	  if ((it->bidi_it.type & 7) != it->bidi_it.type)
+	    abort ();
+	  glyph->bidi_type = it->bidi_it.type;
+	}
+      ++it->glyph_row->used[area];
+    }
+  else
+    IT_EXPAND_MATRIX_WIDTH (it, area);
+}
+
+
+/* Produce a glyph for a glyphless character for iterator IT.
+   IT->glyphless_method specifies which method to use for displaying
+   the character.  See the description of enum
+   glyphless_display_method in dispextern.h for the detail.
+
+   FOR_NO_FONT is nonzero if and only if this is for a character for
+   which no font was found.  ACRONYM, if non-nil, is an acronym string
+   for the character.  */
+
+static void
+produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
+{
+  int face_id;
+  struct face *face;
+  struct font *font;
+  int base_width, base_height, width, height;
+  short upper_xoff, upper_yoff, lower_xoff, lower_yoff;
+  int len;
+
+  /* Get the metrics of the base font.  We always refer to the current
+     ASCII face.  */
+  face = FACE_FROM_ID (it->f, it->face_id)->ascii_face;
+  font = face->font ? face->font : FRAME_FONT (it->f);
+  it->ascent = FONT_BASE (font) + font->baseline_offset;
+  it->descent = FONT_DESCENT (font) - font->baseline_offset;
+  base_height = it->ascent + it->descent;
+  base_width = font->average_width;
+
+  /* Get a face ID for the glyph by utilizing a cache (the same way as
+     doen for `escape-glyph' in get_next_display_element).  */
+  if (it->f == last_glyphless_glyph_frame
+      && it->face_id == last_glyphless_glyph_face_id)
+    {
+      face_id = last_glyphless_glyph_merged_face_id;
+    }
+  else
+    {
+      /* Merge the `glyphless-char' face into the current face.  */
+      face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id);
+      last_glyphless_glyph_frame = it->f;
+      last_glyphless_glyph_face_id = it->face_id;
+      last_glyphless_glyph_merged_face_id = face_id;
+    }
+
+  if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE)
+    {
+      it->pixel_width = THIN_SPACE_WIDTH;
+      len = 0;
+      upper_xoff = upper_yoff = lower_xoff = lower_yoff = 0;
+    }
+  else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX)
+    {
+      width = CHAR_WIDTH (it->c);
+      if (width == 0)
+	width = 1;
+      else if (width > 4)
+	width = 4;
+      it->pixel_width = base_width * width;
+      len = 0;
+      upper_xoff = upper_yoff = lower_xoff = lower_yoff = 0;
+    }
+  else
+    {
+      char buf[7], *str;
+      unsigned int code[6];
+      int upper_len;
+      int ascent, descent;
+      struct font_metrics metrics_upper, metrics_lower;
+
+      face = FACE_FROM_ID (it->f, face_id);
+      font = face->font ? face->font : FRAME_FONT (it->f);
+      PREPARE_FACE_FOR_DISPLAY (it->f, face);
+
+      if (it->glyphless_method == GLYPHLESS_DISPLAY_ACRONYM)
+	{
+	  if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display))
+	    acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c);
+	  str = STRINGP (acronym) ? (char *) SDATA (acronym) : "";
+	}
+      else
+	{
+	  xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEXA_CODE);
+	  sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c);
+	  str = buf;
+	}
+      for (len = 0; str[len] && ASCII_BYTE_P (str[len]); len++)
+	code[len] = font->driver->encode_char (font, str[len]);
+      upper_len = (len + 1) / 2;
+      font->driver->text_extents (font, code, upper_len,
+				  &metrics_upper);
+      font->driver->text_extents (font, code + upper_len, len - upper_len,
+				  &metrics_lower);
+
+
+
+      /* +4 is for vertical bars of a box plus 1-pixel spaces at both side.  */
+      width = max (metrics_upper.width, metrics_lower.width) + 4;
+      upper_xoff = upper_yoff = 2; /* the typical case */
+      if (base_width >= width)
+	{
+	  /* Align the upper to the left, the lower to the right.  */
+	  it->pixel_width = base_width;
+	  lower_xoff = base_width - 2 - metrics_lower.width;
+	}
+      else
+	{
+	  /* Center the shorter one.  */
+	  it->pixel_width = width;
+	  if (metrics_upper.width >= metrics_lower.width)
+	    lower_xoff = (width - metrics_lower.width) / 2;
+	  else
+	    upper_xoff = (width - metrics_upper.width) / 2;
+	}
+  
+      /* +5 is for horizontal bars of a box plus 1-pixel spaces at
+	 top, bottom, and between upper and lower strings.  */
+      height = (metrics_upper.ascent + metrics_upper.descent
+		+ metrics_lower.ascent + metrics_lower.descent) + 5;
+      /* Center vertically.
+	 H:base_height, D:base_descent
+	 h:height, ld:lower_descent, la:lower_ascent, ud:upper_descent
+
+	 ascent = - (D - H/2 - h/2 + 1); "+ 1" for rounding up
+	 descent = D - H/2 + h/2;
+	 lower_yoff = descent - 2 - ld;
+	 upper_yoff = lower_yoff - la - 1 - ud;  */
+      ascent = - (it->descent - (base_height + height + 1) / 2);
+      descent = it->descent - (base_height - height) / 2;
+      lower_yoff = descent - 2 - metrics_lower.descent;
+      upper_yoff = (lower_yoff - metrics_lower.ascent - 1
+		    - metrics_upper.descent);
+      /* Don't make the height shorter than the base height. */
+      if (height > base_height)
+	{
+	  it->ascent = ascent;
+	  it->descent = descent;
+	}
+    }
+
+  it->phys_ascent = it->ascent;
+  it->phys_descent = it->descent;
+  if (it->glyph_row)
+    append_glyphless_glyph (it, face_id, for_no_font, len,
+			    upper_xoff, upper_yoff,
+			    lower_xoff, lower_yoff);
+  it->nglyphs = 1;
+  take_vertical_position_into_account (it);
+}
+
+
 /* RIF:
    Produce glyphs/get display metrics for the display element IT is
    loaded with.  See the description of struct it in dispextern.h
@@ -22129,28 +22497,24 @@
       XChar2b char2b;
       struct face *face = FACE_FROM_ID (it->f, it->face_id);
       struct font *font = face->font;
-      int font_not_found_p = font == NULL;
       struct font_metrics *pcm = NULL;
       int boff;			/* baseline offset */
 
-      if (font_not_found_p)
-	{
-	  /* When no suitable font found, display an empty box based
-	     on the metrics of the font of the default face (or what
-	     remapped).  */
-	  struct face *no_font_face
-	    = FACE_FROM_ID (it->f,
-			    NILP (Vface_remapping_alist) ? DEFAULT_FACE_ID
-			    : lookup_basic_face (it->f, DEFAULT_FACE_ID));
-	  font = no_font_face->font;
-	  boff = font->baseline_offset;
-	}
-      else
-	{
-	  boff = font->baseline_offset;
-	  if (font->vertical_centering)
-	    boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
-	}
+      if (font == NULL)
+	{
+	  /* When no suitable font is found, display this character by
+	     the method specified in the first extra slot of
+	     Vglyphless_char_display.  */
+	  Lisp_Object acronym = lookup_glyphless_char_display (-1, it);
+
+	  xassert (it->what == IT_GLYPHLESS);
+	  produce_glyphless_glyph (it, 1, STRINGP (acronym) ? acronym : Qnil);
+	  goto done;
+	}
+
+      boff = font->baseline_offset;
+      if (font->vertical_centering)
+	boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
 
       if (it->char_to_display != '\n' && it->char_to_display != '\t')
 	{
@@ -22170,8 +22534,7 @@
  	      it->descent = FONT_DESCENT (font) - boff;
  	    }
 
-	  if (! font_not_found_p
-	      && get_char_glyph_code (it->char_to_display, font, &char2b))
+	  if (get_char_glyph_code (it->char_to_display, font, &char2b))
 	    {
 	      pcm = get_per_char_metric (it->f, font, &char2b);
 	      if (pcm->width == 0
@@ -22761,11 +23124,14 @@
       if (it->glyph_row)
 	append_composite_glyph (it);
     }
+  else if (it->what == IT_GLYPHLESS)
+    produce_glyphless_glyph (it, 0, Qnil);
   else if (it->what == IT_IMAGE)
     produce_image_glyph (it);
   else if (it->what == IT_STRETCH)
     produce_stretch_glyph (it);
 
+ done:
   /* Accumulate dimensions.  Note: can't assume that it->descent > 0
      because this isn't true for images with `:ascent 100'.  */
   xassert (it->ascent >= 0 && it->descent >= 0);
@@ -26661,6 +27027,35 @@
 
   hourglass_atimer = NULL;
   hourglass_shown_p = 0;
+
+  DEFSYM (Qglyphless_char, "glyphless-char");
+  DEFSYM (Qhexa_code, "hexa-code");
+  DEFSYM (Qempty_box, "empty-box");
+  DEFSYM (Qthin_space, "thin-space");
+  DEFSYM (Qzero_width, "zero-width");
+
+  DEFSYM (Qglyphless_char_display, "glyphless-char-display");
+  /* Intern this now in case it isn't already done.
+     Setting this variable twice is harmless.
+     But don't staticpro it here--that is done in alloc.c.  */
+  Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots");
+  Fput (Qglyphless_char_display, Qchar_table_extra_slots, make_number (1));
+
+  DEFVAR_LISP ("glyphless-char-display", &Vglyphless_char_display,
+	       doc: /* Char-table to control displaying of glyphless characters.
+Each element, if non-nil, is an ASCII acronym string (displayed in a box)
+or one of these symbols:
+  hexa-code: display with hexadecimal character code in a box
+  empty-box: display with an empty box
+  thin-space: display with 1-pixel width space
+  zero-width: don't display
+
+It has one extra slot to control the display of a character for which
+no font is found.  The value of the slot is `hexa-code' or `empty-box'.
+The default is `empty-box'.  */);
+  Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil);
+  Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0),
+			      Qempty_box);
 }
 
 
--- a/src/xterm.c	Fri Nov 05 23:47:58 2010 +0200
+++ b/src/xterm.c	Sat Nov 06 10:28:31 2010 +0200
@@ -1330,6 +1330,83 @@
 }
 
 
+/* Draw the foreground of glyph string S for glyphless characters.  */
+
+static void
+x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
+{
+  struct glyph *glyph = s->first_glyph;
+  XChar2b char2b[8];
+  int x, i, j;
+
+  /* If first glyph of S has a left box line, start drawing the text
+     of S to the right of that box line.  */
+  if (s->face && s->face->box != FACE_NO_BOX
+      && s->first_glyph->left_box_line_p)
+    x = s->x + eabs (s->face->box_line_width);
+  else
+    x = s->x;
+
+  s->char2b = char2b;
+
+  for (i = 0; i < s->nchars; i++, glyph++)
+    {
+      char buf[7], *str = NULL;
+      int len = glyph->u.glyphless.len;
+
+      if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM)
+	{
+	  if (len > 0
+	      && CHAR_TABLE_P (Vglyphless_char_display)
+	      && (CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display))
+		  >= 1))
+	    {
+	      Lisp_Object acronym
+		= (! glyph->u.glyphless.for_no_font
+		   ? CHAR_TABLE_REF (Vglyphless_char_display,
+				     glyph->u.glyphless.ch)
+		   : XCHAR_TABLE (Vglyphless_char_display)->extras[0]);
+	      if (STRINGP (acronym))
+		str = (char *) SDATA (acronym);
+	    }
+	}
+      else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEXA_CODE)
+	{
+	  sprintf ((char *) buf, "%0*X",
+		   glyph->u.glyphless.ch < 0x10000 ? 4 : 6,
+		   glyph->u.glyphless.ch);
+	  str = buf;
+	}
+
+      if (str)
+	{
+	  int upper_len = (len + 1) / 2;
+	  unsigned code;
+
+	  /* It is assured that all LEN characters in STR is ASCII.  */
+	  for (j = 0; j < len; j++)
+	    {
+	      code = s->font->driver->encode_char (s->font, str[j]);
+	      STORE_XCHAR2B (char2b + j, code >> 8, code & 0xFF);
+	    }
+	  s->font->driver->draw (s, 0, upper_len,
+				 x + glyph->slice.glyphless.upper_xoff,
+				 s->ybase + glyph->slice.glyphless.upper_yoff,
+				 0);
+	  s->font->driver->draw (s, upper_len, len,
+				 x + glyph->slice.glyphless.lower_xoff,
+				 s->ybase + glyph->slice.glyphless.lower_yoff,
+				 0);
+	}
+      if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE)
+	XDrawRectangle (s->display, s->window, s->gc,
+			x, s->ybase - glyph->ascent,
+			glyph->pixel_width - 1,
+			glyph->ascent + glyph->descent - 1);
+      x += glyph->pixel_width;
+   }
+}
+
 #ifdef USE_X_TOOLKIT
 
 static struct frame *x_frame_of_widget (Widget);
@@ -2656,6 +2733,14 @@
       x_draw_composite_glyph_string_foreground (s);
       break;
 
+    case GLYPHLESS_GLYPH:
+      if (s->for_overlaps)
+	s->background_filled_p = 1;
+      else
+	x_draw_glyph_string_background (s, 1);
+      x_draw_glyphless_glyph_string_foreground (s);
+      break;
+
     default:
       abort ();
     }
@@ -7671,47 +7756,43 @@
 	delete_frame (frame, Qnoelisp);
       }
 
-  /* We have to close the display to inform Xt that it doesn't
-     exist anymore.  If we don't, Xt will continue to wait for
-     events from the display.  As a consequence, a sequence of
-
-     M-x make-frame-on-display RET :1 RET
-     ...kill the new frame, so that we get an IO error...
-     M-x make-frame-on-display RET :1 RET
-
-     will indefinitely wait in Xt for events for display `:1', opened
-     in the first call to make-frame-on-display.
-
-     Closing the display is reported to lead to a bus error on
-     OpenWindows in certain situations.  I suspect that is a bug
-     in OpenWindows.  I don't know how to circumvent it here.  */
-
+  /* If DPYINFO is null, this means we didn't open the display in the
+     first place, so don't try to close it.  */
   if (dpyinfo)
     {
 #ifdef USE_X_TOOLKIT
-      /* If DPYINFO is null, this means we didn't open the display
-	 in the first place, so don't try to close it.  */
-      {
-	fatal_error_signal_hook = x_fatal_error_signal;
-	XtCloseDisplay (dpy);
-	fatal_error_signal_hook = NULL;
-      }
-#endif
+      /* We have to close the display to inform Xt that it doesn't
+	 exist anymore.  If we don't, Xt will continue to wait for
+	 events from the display.  As a consequence, a sequence of
+
+	 M-x make-frame-on-display RET :1 RET
+	 ...kill the new frame, so that we get an IO error...
+	 M-x make-frame-on-display RET :1 RET
+
+	 will indefinitely wait in Xt for events for display `:1',
+	 opened in the first call to make-frame-on-display.
+
+	 Closing the display is reported to lead to a bus error on
+	 OpenWindows in certain situations.  I suspect that is a bug
+	 in OpenWindows.  I don't know how to circumvent it here.  */
+      fatal_error_signal_hook = x_fatal_error_signal;
+      XtCloseDisplay (dpy);
+      fatal_error_signal_hook = NULL;
+#endif /* USE_X_TOOLKIT */
 
 #ifdef USE_GTK
-      /* There is a long-standing bug in GTK that prevents the GTK
-	 main loop from recovering gracefully from disconnects
-	 (https://bugzilla.gnome.org/show_bug.cgi?id=85715).  Among
-	 other problems, this gives rise to a stream of Glib error
-	 messages that, in one incident, filled up a user's hard disk
-	 (http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00927.html).
-	 So, kill Emacs unconditionally if the display is closed.  */
-      {
-	fprintf (stderr, "%s\n", error_msg);
-	Fkill_emacs (make_number (70));
-	abort ();  /* NOTREACHED */
-      }
-#endif
+      /* A long-standing GTK bug prevents proper disconnect handling
+	 (https://bugzilla.gnome.org/show_bug.cgi?id=85715).  Once,
+	 the resulting Glib error message loop filled a user's disk.
+	 To avoid this, kill Emacs unconditionally on disconnect.  */
+      shut_down_emacs (0, 0, Qnil);
+      fprintf (stderr, "%s\n\
+When compiled with GTK, Emacs cannot recover from X disconnects.\n\
+This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715\n\
+For details, see etc/PROBLEMS.\n",
+	       error_msg);
+      abort ();
+#endif /* USE_GTK */
 
       /* Indicate that this display is dead.  */
       dpyinfo->display = 0;