changeset 83541:694bbb62a75d

Merged from emacs@sv.gnu.org Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-371 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-372 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-373 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-374 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-375 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-376 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-377 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-378 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-379 Merge from erc--emacs--21 * emacs@sv.gnu.org/emacs--devo--0--patch-380 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-381 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-382 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-383 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-384 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-385 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-386 Update from erc--emacs--22 * emacs@sv.gnu.org/emacs--devo--0--patch-387 Fix ERC bug introduced in last patch * emacs@sv.gnu.org/emacs--devo--0--patch-388 Update from erc--emacs--22 * emacs@sv.gnu.org/emacs--devo--0--patch-389 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-390 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-391 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-392 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-393 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-394 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-395 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-396 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-397 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-398 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-399 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-400 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-401 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-402 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-403 Rcirc update from Ryan Yeske * emacs@sv.gnu.org/emacs--devo--0--patch-404 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-405 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-406 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-407 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-408 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-409 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-410 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-411 Miscellaneous tq-related fixes. * emacs@sv.gnu.org/emacs--devo--0--patch-412 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-121 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-122 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-123 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-124 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-125 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-126 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-127 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-581
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 14 Oct 2006 16:56:21 +0000
parents 0c89a85addc3 (current diff) e5542d6aad7f (diff)
children 2d56e13fd23d
files ChangeLog admin/FOR-RELEASE configure.in etc/TODO lisp/ChangeLog lisp/allout.el lisp/bindings.el lisp/cus-start.el lisp/edmacro.el lisp/emulation/viper-init.el lisp/emulation/viper-util.el lisp/faces.el lisp/files.el lisp/font-lock.el lisp/frame.el lisp/net/rcirc.el lisp/net/zone-mode.el lisp/progmodes/gdb-ui.el lisp/progmodes/vhdl-mode.el lisp/simple.el lisp/startup.el lisp/term/mac-win.el lisp/term/x-win.el lisp/term/xterm.el lisp/url/url-handlers.el lisp/url/url-util.el lisp/whitespace.el lisp/x-dnd.el lispintro/texinfo.tex lispref/ChangeLog lispref/elisp.texi man/ChangeLog man/emacs.texi src/.gdbinit src/alloc.c src/buffer.c src/coding.c src/fileio.c src/fns.c src/frame.c src/image.c src/keyboard.c src/macfns.c src/macterm.c src/macterm.h src/print.c src/process.c src/puresize.h src/w32term.c src/window.c src/xdisp.c src/xfaces.c src/xfns.c src/xselect.c src/xterm.c src/xterm.h
diffstat 175 files changed, 8151 insertions(+), 11196 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jul 30 10:19:46 2006 +0000
+++ b/ChangeLog	Sat Oct 14 16:56:21 2006 +0000
@@ -1,3 +1,12 @@
+2006-08-16  Andreas Schwab  <schwab@suse.de>
+
+	* configure.in (PKG_CHECK_MODULES): Use AS_MESSAGE_LOG_FD instead
+	of hardcoding it.
+
+2006-08-16  Richard Stallman  <rms@gnu.org>
+
+	* INSTALL.CVS: Clean up wording.
+
 2006-07-14  Eli Zaretskii  <eliz@gnu.org>
 
 	* configure.in (PKG_CHECK_MODULES): Redirect the output of
--- a/INSTALL.CVS	Sun Jul 30 10:19:46 2006 +0000
+++ b/INSTALL.CVS	Sat Oct 14 16:56:21 2006 +0000
@@ -12,8 +12,9 @@
 before it builds the final Emacs binary.
 
 Normally, it is not necessary to use "make bootstrap" after every CVS
-update.  Unless there are problems, we suggest the following
-procedure:
+update.  Unless there are problems, we suggest using the following
+alternative procedure after you have done "make bootstrap" at least
+once:
 
   $ ./configure
   $ make
--- a/admin/ChangeLog	Sun Jul 30 10:19:46 2006 +0000
+++ b/admin/ChangeLog	Sat Oct 14 16:56:21 2006 +0000
@@ -1,3 +1,7 @@
+2006-08-13  Chong Yidong  <cyd@stupidchicken.com>
+
+	* FOR-RELEASE: Elisp manual checking completed.
+
 2006-07-17  Reiner Steib  <Reiner.Steib@gmx.de>
 
 	* FOR-RELEASE: Update refcard section.
--- a/admin/FOR-RELEASE	Sun Jul 30 10:19:46 2006 +0000
+++ b/admin/FOR-RELEASE	Sat Oct 14 16:56:21 2006 +0000
@@ -29,7 +29,9 @@
 ** Send an email to the various distributions, including the GNOME
 and KDE projects, to use the new Emacs icons in etc/images/icons.
 
-* BUGS
+* WINDOWS SUPPORT BUGS.
+These don't need to be fixed to start pretest, but we call the
+attention of Windows users to fixing them.
 
 ** Markus Gritsch's report about Emacs looping on Windoze with the following
 .emacs file, and then reduce Emacs frame width to "something quite narrow":
@@ -39,73 +41,23 @@
 	 '(hscroll-step 1)
 	)
 
-** David Kastrup's report on strange scrolling of large images.
+** Drew Adams 12 Aug bug rpt: overlay  display artifact: trace left behind
+Windows only bug.
 
-** Jorgen Schaefer <forcer@forcix.cx>'s June 18 bug report about
-  fields and invisible overlays needs attention from a field expert.
+* BUGS
+
+** Milan Zamazal's Aug 23 bug report about crashes with certain fonts.
+
+** C-g fails to interrupt accept-process-output in Gnus.
 
 ** Implement buffer-chars-modified-tick.
 
-* DOCUMENTATION
-
-** Check the Emacs Lisp manual.
-
-Each manual section should be checked for factual correctness
-regarding recent changes by at least two people.  After each file
-name, on the same line or the following line, come the names of the
-people who have checked it.
+** henman@it.to-be.co.jp 09 Aug 2006: ispell.el problem.
 
-SECTION                  READERS
-----------------------------------
-lispref/abbrevs.texi     "Luc Teirlinck"   Chong Yidong
-lispref/advice.texi      Joakim Verona     Chong Yidong
-lispref/anti.texi        Chong Yidong      Kim F. Storm
-lispref/backups.texi     "Luc Teirlinck"   Chong Yidong
-lispref/buffers.texi     "Luc Teirlinck"   Chong Yidong
-lispref/calendar.texi    Joakim Verona     Chong Yidong
-lispref/commands.texi    "Luc Teirlinck"   Chong Yidong
-lispref/compile.texi     "Luc Teirlinck"   Chong Yidong
-lispref/control.texi     "Luc Teirlinck"   Chong Yidong
-lispref/customize.texi   Chong Yidong      "Luc Teirlinck"
-lispref/debugging.texi   Joakim Verona     Lute Kamstra
-lispref/display.texi     Chong Yidong      Jason Rumney
-lispref/edebug.texi      Chong Yidong      "Luc Teirlinck"
-lispref/elisp.texi       "Luc Teirlinck"   Lute Kamstra
-lispref/errors.texi      "Luc Teirlinck"   Chong Yidong
-lispref/eval.texi        "Luc Teirlinck"   Chong Yidong
-lispref/files.texi       "Luc Teirlinck"   Chong Yidong
-lispref/frames.texi      "Luc Teirlinck"   Chong Yidong
-lispref/functions.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/hash.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/help.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/hooks.texi	 Lute Kamstra      Chong Yidong
-lispref/internals.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/intro.texi	 "Luc Teirlinck"   Josh Varner
-lispref/keymaps.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/lists.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/loading.texi     "Luc Teirlinck"   Chong Yidong
-lispref/locals.texi      Chong Yidong      Nick Roberts
-lispref/macros.texi      "Luc Teirlinck"   Chong Yidong
-lispref/maps.texi        Chong Yidong	   Kim F. Storm
-lispref/markers.texi     "Luc Teirlinck"   Chong Yidong
-lispref/minibuf.texi     "Luc Teirlinck"   Chong Yidong
-lispref/modes.texi	 Chong Yidong
-lispref/nonascii.texi    "Luc Teirlinck"   Chong Yidong
-lispref/numbers.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/objects.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/os.texi		 "Luc Teirlinck"   Chong Yidong
-lispref/positions.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/processes.texi   Chong Yidong	   ttn
-lispref/searching.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/sequences.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/streams.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/strings.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/symbols.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/syntax.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/text.texi        Chong Yidong
-lispref/tips.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/variables.texi	 "Luc Teirlinck"   Chong Yidong
-lispref/windows.texi     "Luc Teirlinck"   Chong Yidong
+** Make key-binding use the maps specified by positions given in the events.
+
+
+* DOCUMENTATION
 
 ** Check the Emacs Tutorial.
 
--- a/configure.in	Sun Jul 30 10:19:46 2006 +0000
+++ b/configure.in	Sat Oct 14 16:56:21 2006 +0000
@@ -1500,7 +1500,7 @@
      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
         AC_MSG_CHECKING(for $2)
 
-        if $PKG_CONFIG --exists "$2" 2>&5; then
+        if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD; then
             AC_MSG_RESULT(yes)
             succeeded=yes
 
--- a/etc/ChangeLog	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/ChangeLog	Sat Oct 14 16:56:21 2006 +0000
@@ -1,3 +1,79 @@
+2006-08-25  Richard Stallman  <rms@gnu.org>
+
+	* TUTORIAL: Give priority to graphical terminals over text terminals
+	regarding C-z.
+
+2006-08-21  Sun Yijiang  <sunyijiang@gmail.com>
+
+	* TUTORIAL.cn: Sync with the latest TUTORIAL.
+
+2006-08-20  Dave Love  <fx@gnu.org>
+
+	* emacs.py: Update to Dave Love's latest version.
+	(__all__): Fix args -> eargs.  Add new `modpath' fun.
+	(eargs): Add `imports' arg.
+	(all_names): New fun.
+	(complete): Rewrite without using rlcompleter.
+	Remove `namespace' arg, add `imports' arg.
+	(ehelp): Replace g and l args with `imports'.
+	(eimport): Use __main__ rather than `emacs' namespace.
+	(modpath): New fun.
+
+2006-08-20  Slawomir Nowaczyk  <slawomir.nowaczyk.847@student.lu.se>  (tiny change)
+
+	* emacs.py (eexecfile): Use the __main__ rather than `emacs' namespace.
+
+2006-08-18  Primoz PETERLIN  <primoz.peterlin@mf.uni-lj.si>
+
+	* TUTORIAL.sl: Synchronize with TUTORIAL.
+
+2006-08-18  Mats Lidell  <matsl@contactor.se>
+
+	* TUTORIAL.sv: Synchronize with TUTORIAL.
+
+2006-08-18  Alfredo Finelli  <alfredofnl@tiscali.it>
+
+	* TUTORIAL.it: Synchronize with TUTORIAL.
+
+2006-08-15  Carsten Dominik  <dominik@science.uva.nl>
+
+	* orgcard.tex: Version number change.
+
+2006-08-12  Werner Lemberg  <wl@gnu.org>
+
+	* TUTORIAL.de: Synchronize with TUTORIAL.
+
+2006-08-10  Romain Francoise  <romain@orebokech.com>
+
+	* NEWS: Mention that zone-mode.el is now obsolete.
+
+2006-08-09  Richard Stallman  <rms@gnu.org>
+
+	* TUTORIAL: Don't say which side scroll bar is on.
+
+2006-08-06  Nick Roberts  <nickrob@snap.net.nz>
+
+	* DEBUG (Note): Add note about following a longjmp call.
+	Add local variables list for outline mode.
+
+2006-08-03  Michael Olson  <mwolson@gnu.org>
+
+	* ERC-NEWS: Update for ERC 5.1.4.
+
+2006-08-01  Kenichi Handa  <handa@m17n.org>
+
+	* NEWS (find-operation-coding-system): Describe the more detail of
+	the change.
+
+2006-07-28  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* GNUS-NEWS: Regenerate from Oort Gnus node in texi/gnus.texi using
+	texi/gnus-news.el of the trunk.
+
+2006-07-29  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* NEWS: Fix typo.
+
 2006-07-17  Reiner Steib  <Reiner.Steib@gmx.de>
 
 	* ru-refcard.ps: Regenerate.
@@ -168,7 +244,7 @@
 
 2006-05-29  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
-	* NEWS: Mention F10 for Gtk+/Leddtif/Lucid menus.
+	* NEWS: Mention F10 for Gtk+/Lesstif/Lucid menus.
 
 2006-05-26  Eli Zaretskii  <eliz@gnu.org>
 
--- a/etc/DEBUG	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/DEBUG	Sat Oct 14 16:56:21 2006 +0000
@@ -272,6 +272,13 @@
 The above commands also exist in a version with an `x' suffix which
 takes an object of the relevant type as argument.
 
+** Following longjmp call.
+
+Recent versions of glibc (2.4+?) encrypt stored values for setjmp/longjmp which
+prevents GDB from being able to follow a longjmp call using `next'.  To
+disable this protection you need to set the environment variable
+LD_POINTER_GUARD to 0.
+
 ** Using GDB in Emacs
 
 Debugging with GDB in Emacs offers some advantages over the command line (See
@@ -739,4 +746,10 @@
 and look at those registers directly, to see the actual current values
 of these variables.
 
+
+Local variables:
+mode: outline
+paragraph-separate: "[ 	]*$"
+end:
+
 ;;; arch-tag: fbf32980-e35d-481f-8e4c-a2eca2586e6b
--- a/etc/ERC-NEWS	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/ERC-NEWS	Sat Oct 14 16:56:21 2006 +0000
@@ -1,6 +1,27 @@
 ERC NEWS                                                       -*- outline -*-
 
-* Changes in ERC 5.2 (unreleased)
+* Changes in ERC 5.1.4
+
+** Make find-function and find-variable work in Emacs 22 for
+names that are constructed by `define-erc-module'.
+
+** Fix bug introduced in ERC 5.1.3 that caused messages to go the
+wrong buffer.
+
+** Changes and additions to modules
+
+*** Highlighting (erc-match.el)
+
+**** Don't activate view-mode.
+
+*** Logging (erc-log.el)
+
+**** When this module is activated, make sure logging is enabled on
+already-opened buffers.  Ditto for disabling logging when the module
+is deactivated.
+
+**** Fix some errors that occur when exiting Emacs without first
+quitting open IRC servers.
 
 * Changes in ERC 5.1.3
 
--- a/etc/GNUS-NEWS	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/GNUS-NEWS	Sat Oct 14 16:56:21 2006 +0000
@@ -1,152 +1,201 @@
 GNUS NEWS -- history of user-visible changes.
-Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-   2005, 2006 Free Software Foundation, Inc.
+Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+   2006 Free Software Foundation, Inc.
 See the end for copying conditions.
 
 Please send Gnus bug reports to bugs@gnus.org.
 For older news, see Gnus info node "New Features".
 
 
-* Changes in Oort Gnus
-
-** `F' (`gnus-article-followup-with-original') and `R'
-(`gnus-article-reply-with-original') only yank the text in the region if the
-region is active.
-
-** `gnus-group-read-ephemeral-group' can be called interactively, using `G M'.
-
-** In draft groups, `e' is now bound to `gnus-draft-edit-message'.
-Use `B w' for `gnus-summary-edit-article' instead.
-
-** The revised Gnus FAQ is included in the manual.
-See the info node "Frequently Asked Questions".
+* Installation changes
 
 ** Upgrading from previous (stable) version if you have used Oort.
 
 If you have tried Oort (the unstable Gnus branch leading to this
-release) but went back to a stable version, be careful when upgrading
-to this version.  In particular, you will probably want to remove all
-.marks (nnml) and .mrk (nnfolder) files, so that flags are read from
-your ~/.newsrc.eld instead of from the .marks/.mrk file where this
+release) but went back to a stable version, be careful when upgrading to
+this version.  In particular, you will probably want to remove all
+`.marks' (nnml) and `.mrk' (nnfolder) files, so that flags are read from
+your `.newsrc.eld' instead of from the `.marks'/`.mrk' file where this
 release store flags.  See a later entry for more information about
-marks.  Note that downgrading isn't safe in general.
+marks.  Note that downgrading isn't save in general.
+
+** Lisp files are now installed in `.../site-lisp/gnus/' by default.  It
+defaulted to `.../site-lisp/' formerly.  In addition to this, the new
+installer issues a warning if other Gnus installations which will shadow
+the latest one are detected.  You can then remove those shadows manually
+or remove them using `make remove-installed-shadows'.
+
+** New `make.bat' for compiling and installing Gnus under MS Windows
+
+Use `make.bat' if you want to install Gnus under MS Windows, the first
+argument to the batch-program should be the directory where `xemacs.exe'
+respectively `emacs.exe' is located, iff you want to install Gnus after
+compiling it, give `make.bat' `/copy' as the second parameter.
+
+`make.bat' has been rewritten from scratch, it now features automatic
+recognition of XEmacs and GNU Emacs, generates `gnus-load.el', checks if
+errors occur while compilation and generation of info files and reports
+them at the end of the build process.  It now uses `makeinfo' if it is
+available and falls back to `infohack.el' otherwise.  `make.bat' should
+now install all files which are necessary to run Gnus and be generally a
+complete replacement for the `configure; make; make install' cycle used
+under Unix systems.
+
+The new `make.bat' makes `make-x.bat' and `xemacs.mak' superfluous, so
+they have been removed.
+
+** `~/News/overview/' not used.
+
+As a result of the following change, the `~/News/overview/' directory is
+not used any more.  You can safely delete the entire hierarchy.
+
+** `(require 'gnus-load)'
+
+If you use a stand-alone Gnus distribution, you'd better add `(require
+'gnus-load)' into your `~/.emacs' after adding the Gnus lisp directory
+into load-path.
+
+File `gnus-load.el' contains autoload commands, functions and variables,
+some of which may not be included in distributions of Emacsen.
+
+
+
+* New packages and libraries within Gnus
+
+** The revised Gnus FAQ is included in the manual, *Note Frequently Asked
+Questions::.
+
+** TLS wrapper shipped with Gnus
+
+TLS/SSL is now supported in IMAP and NNTP via `tls.el' and GNUTLS.  The
+old TLS/SSL support via (external third party) `ssl.el' and OpenSSL
+still works.
+
+** Improved anti-spam features.
+
+Gnus is now able to take out spam from your mail and news streams using
+a wide variety of programs and filter rules.  Among the supported
+methods are RBL blocklists, bogofilter and white/blacklists.  Hooks for
+easy use of external packages such as SpamAssassin and Hashcash are also
+new.  *Note Thwarting Email Spam::.
+
+** Gnus supports server-side mail filtering using Sieve.
+
+Sieve rules can be added as Group Parameters for groups, and the
+complete Sieve script is generated using `D g' from the Group buffer,
+and then uploaded to the server using `C-c C-l' in the generated Sieve
+buffer.  *Note Sieve Commands::, and the new Sieve manual *Note Top:
+(sieve)Top.
+
+
+
+* Changes in group mode
+
+** `gnus-group-read-ephemeral-group' can be called interactively, using `G
+M'.
+
+** Retrieval of charters and control messages
+
+There are new commands for fetching newsgroup charters (`H c') and
+control messages (`H C').
+
+** The new variable `gnus-parameters' can be used to set group parameters.
+
+Earlier this was done only via `G p' (or `G c'), which stored the
+parameters in `~/.newsrc.eld', but via this variable you can enjoy the
+powers of customize, and simplified backups since you set the variable
+in `~/.gnus.el' instead of `~/.newsrc.eld'.  The variable maps regular
+expressions matching group names to group parameters, a'la:
+(setq gnus-parameters
+ '(("mail\\..*"
+    (gnus-show-threads nil)
+    (gnus-use-scoring nil))
+   ("^nnimap:\\(foo.bar\\)$"
+    (to-group . "\\1"))))
+
+** Unread count correct in nnimap groups.
+
+The estimated number of unread articles in the group buffer should now
+be correct for nnimap groups.  This is achieved by calling
+`nnimap-fixup-unread-after-getting-new-news' from the
+`gnus-setup-news-hook' (called on startup) and
+`gnus-after-getting-new-news-hook'. (called after getting new mail).  If
+you have modified those variables from the default, you may want to add
+`nnimap-fixup-unread-after-getting-new-news' again.  If you were happy
+with the estimate and want to save some (minimal) time when getting new
+mail, remove the function.
+
+** Group names are treated as UTF-8 by default.
+
+This is supposedly what USEFOR wanted to migrate to.  See
+`gnus-group-name-charset-group-alist' and
+`gnus-group-name-charset-method-alist' for customization.
+
+** `gnus-group-charset-alist' and `gnus-group-ignored-charsets-alist'.
+
+The regexps in these variables are compared with full group names
+instead of real group names in 5.8.  Users who customize these variables
+should change those regexps accordingly.  For example:
+("^han\\>" euc-kr) -> ("\\(^\\|:\\)han\\>" euc-kr)
+
+
+
+* Changes in summary and article mode
+
+** `F' (`gnus-article-followup-with-original') and `R'
+(`gnus-article-reply-with-original') only yank the text in the region if
+the region is active.
+
+** In draft groups, `e' is now bound to `gnus-draft-edit-message'.  Use `B
+w' for `gnus-summary-edit-article' instead.
 
 ** Article Buttons
 
-More buttons for URLs, mail addresses, Message-IDs, Info links, man pages and
-Emacs or Gnus related references, see the info node "Article Buttons".  The
-variables `gnus-button-*-level' can be used to control the appearance of all
-article buttons, see the info node "Article Button Levels".
-
-** Dired integration
-
-`gnus-dired-minor-mode' installs key bindings in dired buffers to send a file
-as an attachment (`C-c C-m C-a'), open a file using the approriate mailcap
-entry (`C-c C-m C-l'), and print a file using the mailcap entry (`C-c C-m
-C-p').  See the info node "Other modes".
-
-
-** Gnus can display RSS newsfeeds as a newsgroup.  To get started do `B
-nnrss RET RET' in the Group buffer.
+More buttons for URLs, mail addresses, Message-IDs, Info links, man
+pages and Emacs or Gnus related references.  *Note Article Buttons::.
+The variables `gnus-button-*-level' can be used to control the
+appearance of all article buttons.  *Note Article Button Levels::.
 
 ** Single-part yenc encoded attachments can be decoded.
 
 ** Picons
-The picons code has been reimplemented to work in Emacs 21 -- some of
-the previous options have been removed or renamed.
+
+The picons code has been reimplemented to work in GNU Emacs--some of the
+previous options have been removed or renamed.
 
 Picons are small "personal icons" representing users, domain and
-newsgroups, which can be displayed in the Article buffer.  To enable
-picons, install the picons database from
-
-      http://www.cs.indiana.edu/picons/ftp/index.html
-
-and point `gnus-picon-databases' to that location.
-
-** If the new option `gnus-treat-body-boundary' is `head', a boundary
-line is drawn at the end of the headers.
+newsgroups, which can be displayed in the Article buffer.  *Note
+Picons::.
 
-** Retrieval of charters and control messages
-There are new commands for fetching newsgroup charters (`H c') and
-control messages (`H C').
-
-** Delayed articles
-You can delay the sending of a message with `C-c C-j' in the Message
-buffer.  The messages are delivered at specified time.  This is useful
-for sending yourself reminders.  Setup with (gnus-delay-initialize).
-
-** If `auto-compression-mode' is enabled, attachments are automatically
-decompressed when activated.
-
-** If the new option `nnml-use-compressed-files' is non-nil,
-the nnml back end allows compressed message files.
+** If the new option `gnus-treat-body-boundary' is non-`nil', a boundary
+line is drawn at the end of the headers.
 
 ** Signed article headers (X-PGP-Sig) can be verified with `W p'.
 
-** The Summary Buffer uses an arrow in the fringe to indicate the
-current article in Emacs 21 running on a graphical display.  Customize
-`gnus-summary-display-arrow' to disable it.
+** The Summary Buffer uses an arrow in the fringe to indicate the current
+article.  Use `(setq gnus-summary-display-arrow nil)' to disable it.
 
 ** Warn about email replies to news
+
 Do you often find yourself replying to news by email by mistake?  Then
 the new option `gnus-confirm-mail-reply-to-news' is just the thing for
 you.
 
-** If the new option `gnus-summary-display-while-building' is non-nil,
+** If the new option `gnus-summary-display-while-building' is non-`nil',
 the summary buffer is shown and updated as it's being built.
 
-** The new `recent' mark "." indicates newly arrived messages (as
-opposed to old but unread messages).
-
-** The new option `gnus-gcc-mark-as-read' automatically marks
-Gcc articles as read.
-
-** The nndoc back end now supports mailman digests and exim bounces.
+** The new `recent' mark `.' indicates newly arrived messages (as opposed
+to old but unread messages).
 
 ** Gnus supports RFC 2369 mailing list headers, and adds a number of
-related commands in mailing list groups.
+related commands in mailing list groups.  *Note Mailing List::.
 
-** The Date header can be displayed in a format that can be read aloud
-in English, see `gnus-treat-date-english'.
-
-** The envelope sender address can be customized when using Sendmail, see
-`message-sendmail-envelope-from'.
+** The Date header can be displayed in a format that can be read aloud in
+English.  *Note Article Date::.
 
 ** diffs are automatically highlighted in groups matching
 `mm-uu-diff-groups-regexp'
 
-** TLS wrapper shipped with Gnus
-
-TLS/SSL is now supported in IMAP and NNTP via tls.el and GNUTLS.  The
-old TLS/SSL support via (external third party) ssl.el and OpenSSL
-still works.
-
-** New make.bat for compiling and installing Gnus under MS Windows
-
-Use make.bat if you want to install Gnus under MS Windows, the first
-argument to the batch-program should be the directory where xemacs.exe
-respectively emacs.exe is located, iff you want to install Gnus after
-compiling it, give make.bat /copy as the second parameter.
-
-`make.bat' has been rewritten from scratch, it now features automatic
-recognition of XEmacs and GNU Emacs, generates gnus-load.el, checks if
-errors occur while compilation and generation of info files and reports
-them at the end of the build process.  It now uses makeinfo if it is
-available and falls back to infohack.el otherwise.  `make.bat' should now
-install all files which are necessary to run Gnus and be generally a
-complete replacement for the "configure; make; make install" cycle used
-under Unix systems.
-
-The new make.bat makes make-x.bat superfluous, so it has been removed.
-
-** Support for non-ASCII domain names
-
-Message supports non-ASCII domain names in From:, To: and Cc: and will
-encode them when you try to send a message.  The variable
-`message-use-idna' controls this.  Gnus will also decode non-ASCII
-domain names in From:, To: and Cc: when you view a message.  The
-variable `gnus-use-idna' controls this.
-
 ** Better handling of Microsoft citation styles
 
 Gnus now tries to recognize the mangled header block that some Microsoft
@@ -155,227 +204,183 @@
 `gnus-cite-unsightly-citation-regexp' matches the start of these
 citations.
 
-** gnus-article-skip-boring
-
-If you set `gnus-article-skip-boring' to t, then Gnus will not scroll
-down to show you a page that contains only boring text, which by
-default means cited text and signature.  You can customize what is
-skippable using `gnus-article-boring-faces'.
-
-This feature is especially useful if you read many articles that
-consist of a little new content at the top with a long, untrimmed
-message cited below.
-
-** The format spec %C for positioning point has changed to %*.
+The new command `W Y f' (`gnus-article-outlook-deuglify-article') allows
+deuglifying broken Outlook (Express) articles.
 
-** The new variable `gnus-parameters' can be used to set group parameters.
-
-Earlier this was done only via `G p' (or `G c'), which stored the
-parameters in ~/.newsrc.eld, but via this variable you can enjoy the
-powers of customize, and simplified backups since you set the variable
-in ~/.emacs instead of ~/.newsrc.eld.  The variable maps regular
-expressions matching group names to group parameters, a'la:
-
-     (setq gnus-parameters
-           '(("mail\\..*"
-              (gnus-show-threads nil)
-              (gnus-use-scoring nil))
-             ("^nnimap:\\(foo.bar\\)$"
-              (to-group . "\\1"))))
+** `gnus-article-skip-boring'
 
-** Smileys (":-)", ";-)" etc) are now iconized for Emacs too.
-
-Customize `gnus-treat-display-smileys' to disable it.
-
-** Gnus no longer generates the Sender: header automatically.
+If you set `gnus-article-skip-boring' to `t', then Gnus will not scroll
+down to show you a page that contains only boring text, which by default
+means cited text and signature.  You can customize what is skippable
+using `gnus-article-boring-faces'.
 
-Earlier it was generated iff the user configurable email address was
-different from the Gnus guessed default user address.  As the guessing
-algorithm is rarely correct these days, and (more controversially) the
-only use of the Sender: header was to check if you are entitled to
-cancel/supersede news (which is now solved by Cancel Locks instead,
-see another entry), generation of the header has been disabled by
-default.  See the variables `message-required-headers',
-`message-required-news-headers', and `message-required-mail-headers'.
-
-** Features from third party message-utils.el added to message.el.
-
-Message now asks if you wish to remove "(was: <old subject>)" from
-subject lines (see `message-subject-trailing-was-query').  C-c M-m and
-C-c M-f inserts markers indicating included text.  C-c C-f a adds a
-X-No-Archive: header.  C-c C-f x inserts appropriate headers and a
-note in the body for cross-postings and followups (see the variables
-`message-cross-post-*').
-
-** References and X-Draft-Headers are no longer generated when you
-start composing messages and `message-generate-headers-first' is nil.
-
-** Improved anti-spam features.
+This feature is especially useful if you read many articles that consist
+of a little new content at the top with a long, untrimmed message cited
+below.
 
-Gnus is now able to take out spam from your mail and news streams
-using a wide variety of programs and filter rules.  Among the supported
-methods are RBL blocklists, bogofilter and white/blacklists.  Hooks
-for easy use of external packages such as SpamAssassin and Hashcash
-are also new.
-
-** Easy inclusion of X-Faces headers.
-
-** In the summary buffer, the new command / N inserts new messages and
-/ o inserts old messages.
-
-** Gnus decodes morse encoded messages if you press W m.
+** Smileys (`:-)', `;-)' etc) are now displayed graphically in Emacs too.
 
-** Unread count correct in nnimap groups.
+Put `(setq gnus-treat-display-smileys nil)' in `~/.gnus.el' to disable
+it.
 
-The estimated number of unread articles in the group buffer should now
-be correct for nnimap groups.  This is achieved by calling
-`nnimap-fixup-unread-after-getting-new-news' from the
-`gnus-setup-news-hook' (called on startup) and
-`gnus-after-getting-new-news-hook' (called after getting new mail).
-If you have modified those variables from the default, you may want to
-add n-f-u-a-g-n-n again.  If you were happy with the estimate and want
-to save some (minimal) time when getting new mail, remove the
-function.
-
-** Group Carbon Copy (GCC) quoting
+** Face headers handling.  *Note Face::.
 
-To support groups that contains SPC and other weird characters, groups
-are quoted before they are placed in the Gcc: header.  This means
-variables such as `gnus-message-archive-group' should no longer
-contain quote characters to make groups containing SPC work.  Also, if
-you are using the string "nnml:foo, nnml:bar" (indicating Gcc into two
-groups) you must change it to return the list ("nnml:foo" "nnml:bar"),
-otherwise the Gcc: line will be quoted incorrectly.  Note that
-returning the string "nnml:foo, nnml:bar" was incorrect earlier, it
-just didn't generate any problems since it was inserted directly.
-
-** ~/News/overview/ not used.
-
-As a result of the following change, the ~/News/overview/ directory is
-not used any more.  You can safely delete the entire hierarchy.
-
-** gnus-agent
+** In the summary buffer, the new command `/ N' inserts new messages and `/
+o' inserts old messages.
 
-The Gnus Agent has seen a major update.  It is now enabled by default,
-and all nntp and nnimap servers from `gnus-select-method' and
-`gnus-secondary-select-method' are agentized by default.  Earlier only
-the server in `gnus-select-method' was agentized by the default, and the
-agent was disabled by default.  When the agent is enabled, headers are
-now also retrieved from the Agent cache instead of the backends when
-possible.  Earlier this only happened in the unplugged state.  You can
-enroll or remove servers with `J a' and `J r' in the server buffer.
-Gnus will not download articles into the Agent cache, unless you
-instruct it to do so, though, by using `J u' or `J s' from the Group
-buffer.  You revert to the old behaviour of having the Agent disabled
-by customizing `gnus-agent'.  Note that putting `(gnus-agentize)' in
-~/.gnus is not needed any more.
+** Gnus decodes morse encoded messages if you press `W m'.
 
-** gnus-summary-line-format
+** `gnus-summary-line-format'
 
-The default value changed to "%U%R%z%I%(%[%4L: %-23,23f%]%) %s\n".
+The default value changed to `%U%R%z%I%(%[%4L: %-23,23f%]%) %s\n'.
 Moreover `gnus-extra-headers', `nnmail-extra-headers' and
 `gnus-ignored-from-addresses' changed their default so that the users
-name will be replaced by the recipient's name or the group name
-posting to for NNTP groups.
-
-** deuglify.el (gnus-article-outlook-deuglify-article)
-
-A new file from Raymond Scholz <rscholz@zonix.de> for deuglifying
-broken Outlook (Express) articles.
-
-** (require 'gnus-load)
-
-If you use a stand-alone Gnus distribution, you'd better add
-"(require 'gnus-load)" to your ~/.emacs after adding the Gnus
-lisp directory into load-path.
-
-File gnus-load.el contains autoload commands, functions and variables,
-some of which may not be included in distributions of Emacsen.
-
-** gnus-slave-unplugged
+name will be replaced by the recipient's name or the group name posting
+to for NNTP groups.
 
-A new command which starts gnus offline in slave mode.
-
-** message-insinuate-rmail
-
-Adding (message-insinuate-rmail) in .emacs and customizing
-`mail-user-agent' to `gnus-user-agent' convinces Rmail to compose,
-reply and forward messages in Message mode, where you can enjoy the
-power of MML.
-
-** message-minibuffer-local-map
-
-The line below enables BBDB in resending a message:
-
-(define-key message-minibuffer-local-map [?\t] 'bbdb-complete-name)
-
-** Externalizing and deleting of attachments.
-
-If `gnus-gcc-externalize-attachments' (or
-`message-fcc-externalize-attachments') is non-nil, attach local files
-as external parts.
+** Deleting of attachments.
 
 The command `gnus-mime-save-part-and-strip' (bound to `C-o' on MIME
 buttons) saves a part and replaces the part with an external one.
 `gnus-mime-delete-part' (bound to `d' on MIME buttons) removes a part.
 It works only on back ends that support editing.
 
-** gnus-default-charset
+** `gnus-default-charset'
+
+The default value is determined from the `current-language-environment'
+variable, instead of `iso-8859-1'.  Also the `.*' item in
+`gnus-group-charset-alist' is removed.
+
+** Printing capabilities are enhanced.
+
+Gnus supports Muttprint natively with `O P' from the Summary and Article
+buffers.  Also, each individual MIME part can be printed using `p' on
+the MIME button.
+
+** Extended format specs.
+
+Format spec `%&user-date;' is added into
+`gnus-summary-line-format-alist'.  Also, user defined extended format
+specs are supported.  The extended format specs look like `%u&foo;',
+which invokes function `gnus-user-format-function-FOO'.  Because `&' is
+used as the escape character, old user defined format `%u&' is no longer
+supported.
+
+** `/ *' (`gnus-summary-limit-include-cached') is rewritten.
+
+It was aliased to `Y c' (`gnus-summary-insert-cached-articles').  The
+new function filters out other articles.
+
+** Some limiting commands accept a `C-u' prefix to negate the match.
+
+If `C-u' is used on subject, author or extra headers, i.e., `/ s', `/
+a', and `/ x' (`gnus-summary-limit-to-{subject,author,extra}')
+respectively, the result will be to display all articles that do not
+match the expression.
+
+** Gnus inlines external parts (message/external).
+
+
+
+* Changes in Message mode and related Gnus features
+
+** Delayed articles
+
+You can delay the sending of a message with `C-c C-j' in the Message
+buffer.  The messages are delivered at specified time.  This is useful
+for sending yourself reminders.  *Note Delayed Articles::.
+
+** If the new option `nnml-use-compressed-files' is non-`nil', the nnml
+back end allows compressed message files.
+
+** The new option `gnus-gcc-mark-as-read' automatically marks Gcc articles
+as read.
+
+** Externalizing of attachments
 
-The default value now guesses on the basis of your environment instead
-of using Latin-1.  Also the ".*" item in gnus-group-charset-alist is
-removed.
+If `gnus-gcc-externalize-attachments' or
+`message-fcc-externalize-attachments' is non-`nil', attach local files
+as external parts.
+
+** The envelope sender address can be customized when using Sendmail.
+ *Note Mail Variables: (message)Mail Variables.
+
+** Gnus no longer generate the Sender: header automatically.
+
+Earlier it was generated iff the user configurable email address was
+different from the Gnus guessed default user address.  As the guessing
+algorithm is rarely correct these days, and (more controversially) the
+only use of the Sender: header was to check if you are entitled to
+cancel/supersede news (which is now solved by Cancel Locks instead, see
+another entry), generation of the header has been disabled by default.
+See the variables `message-required-headers',
+`message-required-news-headers', and `message-required-mail-headers'.
+
+** Features from third party `message-utils.el' added to `message.el'.
+
+Message now asks if you wish to remove `(was: <old subject>)' from
+subject lines (see `message-subject-trailing-was-query').  `C-c M-m' and
+`C-c M-f' inserts markers indicating included text.  `C-c C-f a' adds a
+X-No-Archive: header.  `C-c C-f x' inserts appropriate headers and a
+note in the body for cross-postings and followups (see the variables
+`message-cross-post-*').
 
-** gnus-posting-styles
+** References and X-Draft-From headers are no longer generated when you
+start composing messages and `message-generate-headers-first' is `nil'.
+
+** Easy inclusion of X-Faces headers.  *Note X-Face::.
+
+** Group Carbon Copy (GCC) quoting
+
+To support groups that contains SPC and other weird characters, groups
+are quoted before they are placed in the Gcc: header.  This means
+variables such as `gnus-message-archive-group' should no longer contain
+quote characters to make groups containing SPC work.  Also, if you are
+using the string `nnml:foo, nnml:bar' (indicating Gcc into two groups)
+you must change it to return the list `("nnml:foo" "nnml:bar")',
+otherwise the Gcc: line will be quoted incorrectly.  Note that returning
+the string `nnml:foo, nnml:bar' was incorrect earlier, it just didn't
+generate any problems since it was inserted directly.
+
+** `message-insinuate-rmail'
+
+Adding `(message-insinuate-rmail)' and `(setq mail-user-agent
+'gnus-user-agent)' in `.emacs' convinces Rmail to compose, reply and
+forward messages in message-mode, where you can enjoy the power of MML.
+
+** `message-minibuffer-local-map'
+
+The line below enables BBDB in resending a message:
+(define-key message-minibuffer-local-map [(tab)]
+  'bbdb-complete-name)
+
+** `gnus-posting-styles'
 
 Add a new format of match like
-
-        ((header "to" "larsi.*org")
-         (Organization "Somewhere, Inc."))
-
+((header "to" "larsi.*org")
+ (Organization "Somewhere, Inc."))
 The old format like the lines below is obsolete, but still accepted.
+(header "to" "larsi.*org"
+   (Organization "Somewhere, Inc."))
 
-        (header "to" "larsi.*org"
-         (Organization "Somewhere, Inc."))
+** `message-ignored-news-headers' and `message-ignored-mail-headers'
 
-** message-ignored-news-headers and message-ignored-mail-headers
-
-X-Draft-From and X-Gnus-Agent-Meta-Information have been added into
+`X-Draft-From' and `X-Gnus-Agent-Meta-Information' have been added into
 these two variables.  If you customized those, perhaps you need add
 those two headers too.
 
-** Gnus reads the NOV and articles in the Agent if plugged.
-
-If one reads an article while plugged, and the article already exists
-in the Agent, it won't get downloaded once more.  Customize
-`gnus-agent-cache' to revert to the old behavior.
-
-** Gnus supports the "format=flowed" (RFC 2646) parameter.
-
-On composing messages, it is enabled by `use-hard-newlines'.  Decoding
-format=flowed was present but not documented in earlier versions.
+** Gnus supports the "format=flowed" (RFC 2646) parameter.  On composing
+messages, it is enabled by `use-hard-newlines'.  Decoding format=flowed
+was present but not documented in earlier versions.
 
 ** The option `mm-fill-flowed' can be used to disable treatment of
-format=flowed messages.  Also, flowed text is disabled when sending
-inline PGP signed messages.  (New in Gnus 5.10.8)
-
-** The tool bar icons are now (de)activated correctly in the group
-buffer, see the variable `gnus-group-update-tool-bar'.  It's default
-value depends on your Emacs version.  (New in Gnus 5.10.8)
-
-** Gnus supports the generation of RFC 2298 Disposition Notification requests.
+"format=flowed" messages.  Also, flowed text is disabled when sending
+inline PGP signed messages.  (New in Gnus 5.10.7)
 
-This is invoked with the C-c M-n key binding from message mode.
-
-** Gnus supports Maildir groups.
-
-Gnus includes a new backend nnmaildir.el.
+** Gnus supports the generation of RFC 2298 Disposition Notification
+requests.
 
-** Printing capabilities are enhanced.
-
-Gnus supports Muttprint natively with O P from the Summary and Article
-buffers.  Also, each individual MIME part can be printed using p on
-the MIME button.
+This is invoked with the `C-c M-n' key binding from message mode.
 
 ** Message supports the Importance: (RFC 2156) header.
 
@@ -384,151 +389,130 @@
 
 ** Gnus supports Cancel Locks in News.
 
-This means a header "Cancel-Lock" is inserted in news posting.  It is
-used to determine if you wrote a article or not (for cancelling and
+This means a header `Cancel-Lock' is inserted in news posting.  It is
+used to determine if you wrote an article or not (for canceling and
 superseding).  Gnus generates a random password string the first time
-you post a message, and saves it using the Custom system.  While the
-variable is called `canlock-password', it is not security sensitive
-data.  Publishing your canlock string on the web will not allow anyone
-to be able to anything she could not already do.  The behaviour can be
-changed by customizing `message-insert-canlock'.
-
-** Gnus supports server-side mail filtering using Sieve.
-
-Sieve rules can be added as Group Parameters for groups, and the
-complete Sieve script is generated using `D g' from the Group buffer,
-and then uploaded to the server using `C-c C-l' in the generated Sieve
-buffer.  Search the online Gnus manual for "sieve", and see the new
-Sieve manual, for more information.
-
-** Extended format specs.
-
-Format spec "%&user-date;" is added into
-`gnus-summary-line-format-alist'.  Also, user defined extended format
-specs are supported.  The extended format specs look like "%u&foo;",
-which invokes function `gnus-user-format-function-foo'.  Because "&" is
-used as the escape character, old user defined format "%u&" is no
-longer supported.
-
-** `/ *' (gnus-summary-limit-include-cached) is rewritten.
-
-It was aliased to `Y c' (gnus-summary-insert-cached-articles). The new
-function filters out other articles.
-
-** Some limiting commands accept a C-u prefix to negate the match.
+you post a message, and saves it in your `~/.emacs' using the Custom
+system.  While the variable is called `canlock-password', it is not
+security sensitive data.  Publishing your canlock string on the web will
+not allow anyone to be able to anything she could not already do.  The
+behavior can be changed by customizing `message-insert-canlock'.
 
-If C-u is used on subject, author or extra headers, i.e., `/ s', `/
-a', and `/ x' (gnus-summary-limit-to-{subject,author,extra})
-respectively, the result will be to display all articles that do not
-match the expression.
-
-** Group names are treated as UTF-8 by default.
-
-This is supposedly what USEFOR wanted to migrate to.  See
-`gnus-group-name-charset-group-alist' and
-`gnus-group-name-charset-method-alist' for customization.
-
-** The nnml and nnfolder backends store marks for each group.
-
-This makes it possible to take backup of nnml/nnfolder servers/groups
-separately of ~/.newsrc.eld, while preserving marks.  It also makes it
-possible to share articles and marks between users (without sharing
-the ~/.newsrc.eld file) within e.g. a department.  It works by storing
-the marks stored in ~/.newsrc.eld in a per-group file ".marks" (for
-nnml) and "groupname.mrk" (for nnfolder, named "groupname").  If the
-nnml/nnfolder is moved to another machine, Gnus will automatically use
-the .marks or .mrk file instead of the information in ~/.newsrc.eld.
-The new server variables `nnml-marks-is-evil' and
-`nnfolder-marks-is-evil' can be used to disable this feature.
-
-** The menu bar item (in Group and Summary buffer) named "Misc" has
-been renamed to "Gnus".
-
-** The menu bar item (in Message mode) named "MML" has been renamed to
-"Attachments".  Note that this menu also contains security related
-stuff, like signing and encryption.
-
-** gnus-group-charset-alist and gnus-group-ignored-charsets-alist.
-
-The regexps in these variables are compared with full group names
-instead of real group names in 5.8.  Users who customize these
-variables should change those regexps accordingly. For example:
-
-   ("^han\\>" euc-kr) -> ("\\(^\\|:\\)han\\>" euc-kr)
-
-** Gnus supports PGP (RFC 1991/2440), PGP/MIME (RFC 2015/3156) and
-S/MIME (RFC 2630-2633).
+** Gnus supports PGP (RFC 1991/2440), PGP/MIME (RFC 2015/3156) and S/MIME
+(RFC 2630-2633).
 
 It needs an external S/MIME and OpenPGP implementation, but no
-additional lisp libraries.  This add several menu items to the
-Attachments menu, and C-c RET key bindings, when composing messages.
+additional Lisp libraries.  This add several menu items to the
+Attachments menu, and `C-c RET' key bindings, when composing messages.
 This also obsoletes `gnus-article-hide-pgp-hook'.
 
-** Gnus inlines external parts (message/external).
-
 ** MML (Mime compose) prefix changed from `M-m' to `C-c C-m'.
 
 This change was made to avoid conflict with the standard binding of
 `back-to-indentation', which is also useful in message mode.
 
-** The default for message-forward-show-mml changed to symbol best.
+** The default for `message-forward-show-mml' changed to the symbol `best'.
+
+The behavior for the `best' value is to show MML (i.e., convert to MIME)
+when appropriate.  MML will not be used when forwarding signed or
+encrypted messages, as the conversion invalidate the digital signature.
+
+** If `auto-compression-mode' is enabled, attachments are automatically
+decompressed when activated.
+
+** Support for non-ASCII domain names
+
+Message supports non-ASCII domain names in From:, To: and Cc: and will
+query you whether to perform encoding when you try to send a message.
+The variable `message-use-idna' controls this.  Gnus will also decode
+non-ASCII domain names in From:, To: and Cc: when you view a message.
+The variable `gnus-use-idna' controls this.
+
+** You can now drag and drop attachments to the Message buffer.  See
+`mml-dnd-protocol-alist' and `mml-dnd-attach-options'.  *Note MIME:
+(message)MIME.
+
 
-The behaviour for the `best' value is to show MML (i.e., convert MIME
-to MML) when appropriate.  MML will not be used when forwarding signed
-or encrypted messages, as the conversion invalidate the digital
-signature.
+
+* Changes in back ends
+
+** Gnus can display RSS newsfeeds as a newsgroup.  *Note RSS::.
+
+** The nndoc back end now supports mailman digests and exim bounces.
+
+** Gnus supports Maildir groups.
+
+Gnus includes a new back end `nnmaildir.el'.  *Note Maildir::.
 
-** Bug fixes.
+** The nnml and nnfolder back ends store marks for each groups.
+
+This makes it possible to take backup of nnml/nnfolder servers/groups
+separately of `~/.newsrc.eld', while preserving marks.  It also makes it
+possible to share articles and marks between users (without sharing the
+`~/.newsrc.eld' file) within e.g. a department.  It works by storing the
+marks stored in `~/.newsrc.eld' in a per-group file `.marks' (for nnml)
+and `GROUPNAME.mrk' (for nnfolder, named GROUPNAME).  If the
+nnml/nnfolder is moved to another machine, Gnus will automatically use
+the `.marks' or `.mrk' file instead of the information in
+`~/.newsrc.eld'.  The new server variables `nnml-marks-is-evil' and
+`nnfolder-marks-is-evil' can be used to disable this feature.
+
 
 
-* Changes in Pterodactyl Gnus (5.8/5.9)
+* Appearance
 
-The Gnus NEWS entries are short, but they reflect sweeping changes in
-four areas: Article display treatment, MIME treatment,
-internationalization and mail-fetching.
+** The menu bar item (in Group and Summary buffer) named "Misc" has been
+renamed to "Gnus".
 
-** The mail-fetching functions have changed.  See the manual for the
-many details.  In particular, all procmail fetching variables are gone.
-
-If you used procmail like in
+** The menu bar item (in Message mode) named "MML" has been renamed to
+"Attachments".  Note that this menu also contains security related
+stuff, like signing and encryption (*note Security: (message)Security.).
 
-(setq nnmail-use-procmail t)
-(setq nnmail-spool-file 'procmail)
-(setq nnmail-procmail-directory "~/mail/incoming/")
-(setq nnmail-procmail-suffix "\\.in")
+** The tool bars have been updated to use GNOME icons in Group, Summary and
+Message mode.  You can also customize the tool bars.  This is a new
+feature in Gnus 5.10.9.  (Only for Emacs, not in XEmacs.)
 
-this now has changed to
+** The tool bar icons are now (de)activated correctly in the group buffer,
+see the variable `gnus-group-update-tool-bar'.  Its default value
+depends on your Emacs version.  This is a new feature in Gnus 5.10.9.
 
-(setq mail-sources
-      '((directory :path "~/mail/incoming/"
-		   :suffix ".in")))
+
+* Miscellaneous changes
+
+** `gnus-agent'
 
-More information is available in the info doc at Select Methods ->
-Getting Mail -> Mail Sources
-
-** Gnus is now a MIME-capable reader.  This affects many parts of
-Gnus, and adds a slew of new commands.  See the manual for details.
+The Gnus Agent has seen a major updated and is now enabled by default,
+and all nntp and nnimap servers from `gnus-select-method' and
+`gnus-secondary-select-method' are agentized by default.  Earlier only
+the server in `gnus-select-method' was agentized by the default, and the
+agent was disabled by default.  When the agent is enabled, headers are
+now also retrieved from the Agent cache instead of the back ends when
+possible.  Earlier this only happened in the unplugged state.  You can
+enroll or remove servers with `J a' and `J r' in the server buffer.
+Gnus will not download articles into the Agent cache, unless you
+instruct it to do so, though, by using `J u' or `J s' from the Group
+buffer.  You revert to the old behavior of having the Agent disabled
+with `(setq gnus-agent nil)'.  Note that putting `(gnus-agentize)' in
+`~/.gnus.el' is not needed any more.
 
-** Gnus has also been multilingualized.  This also affects too
-many parts of Gnus to summarize here, and adds many new variables.
-
-** gnus-auto-select-first can now be a function to be
-called to position point.
+** Gnus reads the NOV and articles in the Agent if plugged.
 
-** The user can now decide which extra headers should be included in
-summary buffers and NOV files.
+If one reads an article while plugged, and the article already exists in
+the Agent, it won't get downloaded once more.  `(setq gnus-agent-cache
+nil)' reverts to the old behavior.
 
-** `gnus-article-display-hook' has been removed.  Instead, a number
-of variables starting with `gnus-treat-' have been added.
+** Dired integration
 
-** The Gnus posting styles have been redone again and now works in a
-subtly different manner.
+`gnus-dired-minor-mode' (see *Note Other modes::) installs key bindings
+in dired buffers to send a file as an attachment, open a file using the
+appropriate mailcap entry, and print a file using the mailcap entry.
 
-** New web-based backends have been added: nnslashdot, nnwarchive
-and nnultimate.  nnweb has been revamped, again, to keep up with
-ever-changing layouts.
+** The format spec `%C' for positioning point has changed to `%*'.
 
-** Gnus can now read IMAP mail via nnimap.
+** `gnus-slave-unplugged'
+
+A new command which starts Gnus offline in slave mode.
+
 
 
 * For older news, see Gnus info node "New Features".
@@ -536,8 +520,8 @@
 ----------------------------------------------------------------------
 Copyright information:
 
-Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-   2005, 2006 Free Software Foundation, Inc.
+Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+   2006 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
--- a/etc/NEWS	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/NEWS	Sat Oct 14 16:56:21 2006 +0000
@@ -95,7 +95,6 @@
 Its name is `pt-br-refcard.tex'.  The corresponding PostScript file is
 also included.
 
-
 ---
 ** A French translation of the `Emacs Survival Guide' is available.
 
@@ -202,6 +201,13 @@
 all frames you create.  A position specified with --geometry only
 affects the initial frame.
 
+---
+** Emacs built for MS-Windows now behaves like Emacs on X does,
+wrt its frame position: if you don't specify a position (in your
+.emacs init file, in the Registry, or with the --geometry command-line
+option), Emacs leaves the frame position to the Windows' window
+manager.
+
 +++
 ** Emacs can now be invoked in full-screen mode on a windowed display.
 When Emacs is invoked on a window system, the new command-line options
@@ -241,8 +247,9 @@
 
 +++
 ** If the environment variable EMAIL is defined, Emacs now uses its value
-to compute the default value of `use-mail-address', in preference to
+to compute the default value of `user-mail-address', in preference to
 concatenation of `user-login-name' with the name of your host machine.
+
 
 * Incompatible Editing Changes in Emacs 22.1
 
@@ -832,6 +839,13 @@
 the window now works sensibly, by automatically adjusting the window's
 vscroll property.
 
+*** New customize option `overline-margin' controls the space between
+overline and text.
+
+*** New variable `x-underline-at-descent-line' controls the relative
+position of the underline.  When set, it overrides the
+`x-use-underline-position-properties' variables.
+
 +++
 *** The new face `mode-line-inactive' is used to display the mode line
 of non-selected windows.  The `mode-line' face is now used to display
@@ -1764,9 +1778,8 @@
 available in `etc/orgcard.tex' and `etc/orgcard.ps'.
 
 +++
-** The new package dns-mode.el add syntax highlight of DNS master files.
-The key binding C-c C-s (`dns-mode-soa-increment-serial') can be used
-to increment the SOA serial.
+** The new package dns-mode.el adds syntax highlighting of DNS master files.
+It is a modern replacement for zone-mode.el, which is now obsolete.
 
 ---
 ** The new global minor mode `file-name-shadow-mode' modifies the way
@@ -1987,6 +2000,7 @@
 buffers and no warning will be issued (for compatibility with the
 behavior in older versions of Emacs).
 
+---
 ** Changes in Allout
 
 *** Topic cryptography added, enabling easy gpg topic encryption and
@@ -1995,11 +2009,19 @@
 and/or public key modes.  Time-limited key caching, user-provided
 symmetric key hinting and consistency verification, auto-encryption of
 pending topics on save, and more, make it easy to use encryption in
-powerful ways.
+powerful ways.  Encryption behavior customization is collected in the
+allout-encryption customization group.
 
 *** `allout-view-change-hook' marked as being deprecated - use
-`allout-exposure-change-hook' instead.  Both are currently being used, but
-`allout-view-change-hook' will be ignored in a subsequent allout version.
+`allout-exposure-change-hook' instead.  Both are still invoked, but
+`allout-view-change-hook' will eventually be ignored.  The new
+`allout-exposure-change-hook' is called with args that were passed to
+`allout-flag-region', making it easier to use.
+
+*** Other allout functions which change the outline structure also have
+hooks, enabling cooperative allout enhancements.  See
+`allout-structure-added-hook', `allout-structure-deleted-hook', and
+`allout-structure-shifted-hook'.
 
 *** Default command prefix changed to "\C-c " (control-c space), to avoid
 intruding on user's keybinding space.  Customize the
@@ -2010,23 +2032,43 @@
 particular avoiding the need for kludges for isearch dynamic-display,
 discretionary handling of edits of concealed text, undo concerns, etc.
 
+*** Some previously rough topic-header format edge cases are reconciled.
+Level 1 topics use the mode's comment format, and lines starting with the
+asterisk - for instance, the comment close of some languages (eg, c's "*/"
+or mathematica's "*)") - at the beginning of line are no longer are
+interpreted as level 1 topics in those modes.  (Yay!)
+
 *** Many substantial fixes and refinements, including:
 
-   - repaired inhibition of inadvertent edits to concealed text
-   - repaired retention of topic body hanging indent upon topic depth shifts
+   - repaired regexp-quoting of custom header prefixes, so any literals
+     will now work (for instance, mathematica's "(*" is now properly
+     accepted).
+   - repaired inhibition of inadvertent edits to concealed text.
    - refuse to create "containment discontinuities", where a
      topic is shifted deeper than the offspring-depth of its' container
    - auto-fill-mode is now left inactive when allout-mode starts, if it
      already was inactive.  also, `allout-inhibit-auto-fill' custom
      configuration variable makes it easy to disable auto fill in allout
      outlines in general or on a per-buffer basis.
-   - new hook `allout-mode-deactivate-hook', for coordinating with
-     deactivation of allout-mode.
+   - mode hook changes: new hook `allout-mode-deactivate-hook', for
+     coordinating with deactivation of allout-mode.  `allout-mode-hook' is
+     now run after the `allout-mode' variable is changed, as is the new
+     `allout-mode-deactivate-hook'.
+   - allout now tolerates fielded text in outlines without disruption.
+   - hot-spot navigation now is modularized with a new function,
+     `allout-hotspot-key-handler', enabling easier articulation and
+     enhancement of the functionality by allout addons.
+   - topic body navigation is easier, where repeated beginning of line and
+     end of line key commands cycle through the actually beginning/end of
+     line and then beginning/end of topic, etc.  see new customization vars
+     `allout-beginning-of-line-cycles' and `allout-end-of-line-cycles'.
+   - repaired retention of topic body hanging indent upon topic depth shifts
    - bulleting variation is simpler and more accommodating, both in the
      default behavior and in ability to vary when creating new topics
    - mode deactivation now does cleans up effectively, more properly
      restoring affected variables and hooks to former state, removing
-     overlays, etc.
+     overlays, etc.  see `allout-add-resumptions' and
+     `allout-do-resumptions', which replace the old `allout-resumptions'.
    - included a few unit-tests for interior functionality.  developers can
      have them automatically run at the end of module load by customizing
      the option `allout-run-unit-tests-on-load'.
@@ -3506,6 +3548,9 @@
 ** iso-acc.el is now obsolete.  Use one of the latin input methods instead.
 
 ---
+** zone-mode.el is now obsolete.  Use dns-mode.el instead.
+
+---
 ** cplus-md.el has been deleted.
 
 ** Ewoc changes
@@ -3654,8 +3699,10 @@
 
 * Incompatible Lisp Changes in Emacs 22.1
 
-** The function find-operation-coding-system accepts a cons (FILENAME
-. BUFFER) in an argument correponding to the target.
+** The function find-operation-coding-system may be called with a cons
+(FILENAME . BUFFER) in the second argument if the first argument
+OPERATION is `insert-file-contents', and thus a function registered in
+`file-coding-system-alist' is also called with such an argument.
 
 ---
 ** The variables post-command-idle-hook and post-command-idle-delay have
@@ -4625,6 +4672,7 @@
 
 *** The definition of a key-binding passed to define-key can use XEmacs-style
 key-sequences, such as [(control a)].
+
 ** Abbrev changes:
 
 +++
@@ -5354,6 +5402,11 @@
 property over the second half of the command to force (deferred)
 refontification of `bar' whenever the `e' is added/removed.
 
+*** `font-lock-extend-region-functions' makes it possible to alter the way
+the fontification region is chosen.  This can be used to prevent rounding
+up to whole lines, or to extend the region to include all related lines
+of multiline constructs so that such constructs get properly recognized.
+
 ** Major mode mechanism changes:
 
 +++
@@ -5448,6 +5501,9 @@
 *** `emacsserver' now runs `pre-command-hook' and `post-command-hook'
 when it receives a request from emacsclient.
 
++++
+*** `current-idle-time' reports how long Emacs has been idle.
+
 ** Lisp file loading changes:
 
 +++
--- a/etc/TODO	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/TODO	Sat Oct 14 16:56:21 2006 +0000
@@ -21,7 +21,7 @@
 but if you type M-n you should get the visited file name of the
 current buffer.
 
-** whitespace-cleanup should work only on the region if the region is active.
+** describe-face should show an example of text in the face.
 
 ** Distribute a bar cursor of width > 1 evenly between the two glyphs
    on each side of the bar (what to do at the edges?).
@@ -125,6 +125,9 @@
 
 ** Internationalize Emacs's messages.
 
+** Set up a facility to save backtraces when errors happen during
+specified filters, specified timers, and specified hooks.
+
 ** Install mmc@maruska.dyndns.org's no-flicker change.
 
 ** Add a "current vertical pixel level" value that goes with point,
--- a/etc/TUTORIAL	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/TUTORIAL	Sat Oct 14 16:56:21 2006 +0000
@@ -217,7 +217,7 @@
 to scroll it down again, you can give an argument to M-v.
 
 If you are using a windowed display, such as X11 or MS-Windows, there
-should be a tall rectangular area called a scroll bar at the left hand
+should be a tall rectangular area called a scroll bar at the
 side of the Emacs window.  You can scroll the text by clicking the
 mouse in the scroll bar.
 
@@ -644,18 +644,18 @@
 changes you have made; C-x C-c offers to save each changed file before
 it kills the Emacs.)
 
-C-z is the command to exit Emacs *temporarily*--so that you can go
-back to the same Emacs session afterward.
+If you are using a graphical display that supports multiple
+applications in parallel, you don't need any special command to move
+from Emacs to another application.  You can do this with the mouse or
+with window manager commands.  However, if you're using a text
+terminal which can only show one application at a time, you need to
+"suspend" Emacs to move to any other program.
 
-On systems which allow it, C-z "suspends" Emacs; that is, it returns
-to the shell but does not destroy the Emacs.  In the most common
-shells, you can resume Emacs with the `fg' command or with `%emacs'.
-
-On systems which do not implement suspending, C-z creates a subshell
-running under Emacs to give you the chance to run other programs and
-return to Emacs afterward; it does not truly "exit" from Emacs.  In
-this case, the shell command `exit' is the usual way to get back to
-Emacs from the subshell.
+C-z is the command to exit Emacs *temporarily*--so that you can go
+back to the same Emacs session afterward.  When Emacs is running on a
+text terminal, C-z "suspends" Emacs; that is, it returns to the shell
+but does not destroy the Emacs.  In the most common shells, you can
+resume Emacs with the `fg' command or with `%emacs'.
 
 The time to use C-x C-c is when you are about to log out.  It's also
 the right thing to use to exit an Emacs invoked under mail handling
--- a/etc/TUTORIAL.cn	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/TUTORIAL.cn	Sat Oct 14 16:56:21 2006 +0000
@@ -165,7 +165,7 @@
 ´ó²¿·ÖµÄ Emacs ÃüÁî½ÓÊÜÊý×Ö²ÎÊý£¬²¢ÇÒ¶ÔÓÚ¶àÊýÃüÁî¶øÑÔ£¬ÕâЩÊý×Ö²ÎÊýµÄ×÷
 ÓÃÊÇÖ¸¶¨ÃüÁîµÄÖظ´´ÎÊý¡£ÎªÒ»¸öÃüÁîÖ¸¶¨Êý×Ö²ÎÊý£¨Ò²¾ÍÊÇÖظ´´ÎÊý£©µÄ·½·¨
 ÊÇ£ºÏÈÊäÈë C-u£¬È»ºóÊäÈëÊý×Ö×÷Ϊ²ÎÊý£¬×îºóÔÙÊäÈëÃüÁî¡£Èç¹ûÄãÓÐMETA £¨»ò
-EDIT »ò ALT£©¼ü£¬ÄÇô»¹ÓÐÁíÒ»ÖÖ°ì·¨£º°´×¡ META ¼ü²»¶¯£¬È»ºóÊäÈëÊý×Ö¡£²»
+EDIT »ò ALT£©¼ü£¬ÄÇô»¹ÓÐÁíÒ»ÖÖ°ì·¨£º°´×¡ META ¼ü²»·Å£¬È»ºóÊäÈëÊý×Ö¡£²»
 ¹ýÎÒÃÇ»¹Êǽ¨ÒéÄãÓà C-u£¬ÒòΪËüÔÚÈκÎÖն˻úÉ϶¼ÄÜÓá£ÕâÖÖÊý×Ö²ÎÊýÒ²³ÆΪ
 ¡°Ç°×º²ÎÊý¡±£¬Òâ˼ÊÇ˵Õâ¸ö²ÎÊýÊÇÏÈÓÚʹÓÃËüµÄÃüÁî¶øÊäÈëµÄ¡£
 
@@ -174,9 +174,9 @@
 >> Ϊ C-n »òÕß C-p Ö¸¶¨Ò»¸öÊý×Ö²ÎÊý£¬ÕâÑùÄã¿ÉÒÔÖ»ÓÃÒ»¸öÃüÁî¾Í°Ñ¹â±êÒƶ¯
    µ½±¾Ðеĸ½½ü¡£
 
-ËäÈ»´ó²¿·ÖÃüÁîÓÃÊý×Ö²ÎÊýÀ´×÷ΪÆäÖظ´´ÎÊý£¬µ«ÊÇÒ²ÓÐЩÃüÁîÀýÍ⣬ËüÃǽ«Êý
-×Ö²ÎÊýÁí×öËüÓᣱÈÈçÓÐЩÃüÁĿǰ»¹Ã»Ñ§µ½£©½ö½ö½«Ç°×º²ÎÊý×÷Ϊһ¸ö±ê
-Ö¾¡ª¡ªÖ»ÒªÓÐÒ»¸öǰ׺²ÎÊý³öÏÖ£¬²»¹ÜÆäֵΪºÎ£¬ÃüÁîµÄ¹¦Äܶ¼»á¸Ä±ä¡£
+ËäÈ»´ó²¿·ÖÃüÁî°ÑÊý×Ö²ÎÊý½âÊÍΪÆäÖظ´´ÎÊý£¬µ«ÊÇÒ²ÓÐЩÃüÁîÀýÍ⣬ËüÃǽ«Êý
+×Ö²ÎÊýÁí×öËüÓᣱÈÈçÓÐЩÃüÁÎÒÃÇÄ¿Ç°»¹Ã»Ñ§µ½£©½ö½ö½«Ç°×º²ÎÊý×÷Ϊһ¸ö
+±êÖ¾¡ª¡ªÖ»Òª¸ø³öÓÐÒ»¸öǰ׺²ÎÊý£¬²»¹ÜÆäֵΪºÎ£¬Ëü¶¼»á¸Ä±äÃüÁîµÄ¹¦ÄÜ¡£
 
 ¶ø C-v ºÍ M-v ÔòÊôÓÚÁíÒ»ÖÖÀàÐ͵ÄÀýÍâ¡£µ±¸ø¶¨Ò»¸ö²ÎÊýʱ£¬ËüÃǽ«¹ö¶¯ÄãÖ¸
 ¶¨µÄ¡°ÐÐÊý¡±£¬¶ø²»ÊÇ¡°ÆÁÊý¡±¡£¾ÙÀýÀ´Ëµ£¬C-u 8 C-v ½«ÆÁÄ»ÏòϹö¶¯ 8 ÐУ¬
@@ -188,8 +188,8 @@
 ÒÔ¸ø¶¨Ò»¸ö²ÎÊýÈ»ºóÖ´ÐÐ M-v¡£
 
 Èç¹ûÄãÕýÔÚʹÓÃÒ»¸ö´°¿Úϵͳ£¬±ÈÈç X11 »òÕß΢ÈíµÄ Windows£¬ÄÇôÔÚ Emacs
-´°¿ÚµÄ×ó±ß»òÕßÓÒ±ßÓ¦¸ÃÓÐÒ»¸ö³¤·½ÐεÄÇøÓò½Ð¡°¹ö¶¯Ìõ¡±£¬Äã¿ÉÒÔÓÃÊó±ê²Ù×Ý
-¹ö¶¯ÌõÀ´¹ö¶¯ÎÄ×Ö¡£
+´°¿ÚµÄ±ßÔµÓ¦¸ÃÓÐÒ»¸ö³¤·½ÐεÄÇøÓò½Ð¡°¹ö¶¯Ìõ¡±£¬Äã¿ÉÒÔÓÃÊó±ê²Ù×ݹö¶¯ÌõÀ´
+¹ö¶¯ÎÄ×Ö¡£
 
 >> ÊÔ×ÅÔÚ¡°¹ö¶¯ÌõÄڵķ´°×ÇøÓò¡±ÉÏ°´Ò»ÏÂÊó±êÖмü¡£
    ÎÄ×ÖÓ¦¸Ã»á¹ö¶¯µ½Êó±êËùָʾµÄλÖá£
@@ -202,10 +202,10 @@
 * ÔÚ EMACS ʧȥÏìÓ¦µÄʱºò£¨WHEN EMACS IS HUNG£©
 -----------------------------------------------
 
-Èç¹û Emacs ¶ÔÄãµÄÃüÁîʧȥÏìÓ¦£¬Äã¿ÉÒԺܰ²È«µØÓà C-g À´ÖÕÖ¹Õâ¸öÃüÁî¡£
-C-g Ò²¿ÉÒÔ±»ÓÃÀ´ÖÕÖ¹Ò»¸öÖ´Ðйý¾ÃµÄÃüÁî¡£
+Èç¹û Emacs ¶ÔÄãµÄÃüÁîʧȥÏìÓ¦£¬Äã¿ÉÒÔÓà C-g À´°²È«µØÖÕÖ¹ÕâÌõÃüÁî¡£C-g
+Ò²¿ÉÒÔÖÕÖ¹Ò»ÌõÖ´Ðйý¾ÃµÄÃüÁî¡£
 
-C-g »¹¿ÉÒÔ±»À´È¡ÏûÊý×Ö²ÎÊýºÍÄÇЩÊäÈëµ½Ò»°ëµÄÃüÁî¡£
+C-g »¹¿ÉÒÔÈ¡ÏûÊý×Ö²ÎÊýºÍÖ»ÊäÈëµ½Ò»°ëµÄÃüÁî¡£
 
 >> ÊäÈë C-u 100 É趨һ¸öֵΪ 100 µÄÊý×Ö²ÎÊý£¬È»ºó°´ C-g¡£
    ÏÖÔÚÔÙ°´ C-f£¬¹â±êÓ¦¸ÃÖ»»áÒƶ¯Ò»¸ö×Ö·û£¬ÒòΪÄãÒѾ­Óà C-g È¡ÏûÁ˲ÎÊý¡£
@@ -219,16 +219,16 @@
 -----------------------------------
 
 ÓÐһЩ Emacs ÃüÁî±»¡°½ûÓá±ÁË£¬ÒÔ±ÜÃâ³õѧÕßÔÚ²»Á˽âÆäÈ·Çй¦ÄܵÄÇé¿öÏÂÎó
-ÓÃÕâЩÃüÁÔì³ÉÂé·³¡£
+ÓÃËüÃÇ£¬Ôì³ÉÂé·³¡£
 
 Èç¹ûÄãÓõ½ÁËÒ»¸ö±»½ûÓõÄÃüÁEmacs »áÏÔʾһ¸öÌáʾÏûÏ¢£¬¸æËßÄãÕâ¸öÃüÁî
 µ½µ×ÊǸÉʲôµÄ£¬Ñ¯ÎÊÄãÊÇ·ñÒª¼ÌÐø£¬²¢Ôڵõ½ÄãµÄ¿Ï¶¨Ö®ºóÔÙÖ´ÐÐÕâÃüÁî¡£
 
-ÄãÒªÊÇÕæµÄÏëÖ´Ðб»½ûÓõÄÃüÁÄÇôÔÚ Emacs ѯÎÊÄãµÄʱºòÓ¦¸Ã°´¿Õ¸ñ¡£Ò»°ã
-À´Ëµ£¬Èç¹ûÄã²»ÏëÖ´ÐУ¬°´¡°n¡±¾ÍÐÐÁË¡£
+Èç¹ûÄãÕæµÄÏëÓÃÕâÌõÃüÁÔÚ Emacs ѯÎÊÄãµÄʱºòÓ¦¸Ã°´¿Õ¸ñ¡£Ò»°ãÀ´Ëµ£¬Èç¹û
+Äã²»ÏëÓ㬾Ͱ´¡°n¡±¡£
 
 >> ÊÔÊÔ C-x C-l £¨ÕâÊÇÒ»¸ö±»½ûÓõÄÃüÁ
-   È»ºóÓà n À´»Ø´ðÎÊÌâ¡£
+   È»ºóÓà n À´»Ø´ðѯÎÊ¡£
 
 
 * ´°¸ñ£¨WINDOWS£©
@@ -245,7 +245,7 @@
 >> °Ñ¹â±êÒƵ½±¾ÐÐÈ»ºóÊäÈë C-u 0 C-l¡£
 
 >> ÊäÈë CONTROL-h k CONTROL-f¡£¹Û²ìµ±Ò»¸öд°¸ñ³öÏÖʱµ±Ç°´°¸ñ£¨ÓÃÀ´ÏÔʾ
-   CONTROL-f ÃüÁîµÄÎĵµ£©ÊÇÈçºÎËõСµÄ¡£
+   CONTROL-f ÃüÁîµÄÎĵµ£©ÊÇÈçºÎ±äСµÄ¡£
 
 >> ÊäÈë C-x 1 ¹ØµôÎĵµ´°¸ñ¡£
 
@@ -265,33 +265,33 @@
 Ó÷¨Ó¦¸ÃÒ»Ñù¡£Ò»°ãÀ´Ëµ <Delback> ¾ÍÊÇλÓÚ <Return> ¼üÉÏ·½Ä³´¦µÄÒ»¸ö´óºÅ
 ¼ü£¬Í¨³£±»±êʾΪ¡°Delete¡±¡¢¡°Del¡±»òÕß¡°Backspace¡±¡£
 
-Èç¹ûÄãÕÒµ½Á˱ê×Å¡°Backspace¡±µÄ¼ü£¬ÄÇôËüÓ¦¸Ã¾ÍÊÇ <Delback>£»¼´±ãÄãÓÖÔÚ
-¼üÅÌÆäËüµØ·½ÕÒµ½ÁËÒ»¸ö±êʾΪ¡°Del¡±µÄ¼ü£¬ÄÇôËüÒ²Ó¦¸Ã²»ÊÇ <Delback>¡£
+Èç¹ûÄãÕÒµ½ÁË¡°Backspace¡±¼ü£¬ÄÇôËüÓ¦¸Ã¾ÍÊÇ <Delback>£»ÄÄÅÂÄãÓÖÔÚ±ðµÄµØ
+·½ÕÒµ½ÁËÒ»¸ö¡°Del¡±¼ü£¬ÄÇôËüÒ²Ó¦¸Ã²»ÊÇ <Delback>¡£
 
-Ò»ÖÖ¸üͨÓõÄ˵·¨ÊÇ£¬<Delback> ½«Î»ÓÚ¹â±êÇ°µÄÒ»¸ö×Ö·ûɾ³ý¡£
+Ò»ÖÖ¸üͨÓõÄ˵·¨ÊÇ£¬<Delback> ½«É¾³ýλÓÚ¹â±êÇ°µÄÒ»¸ö×Ö·û¡£
 
 >> ÏÖÔÚ¾ÍÊÔÊÔ¡ª¡ªÇõã×Ö£¬È»ºó°´¼¸Ï <Delback> ɾ³ýËüÃÇ¡£
    ²»Óõ£ÐÄÄã»áÐÞ¸ÄÎļþ£¬Äã¸Éʲô¶¼Ã»¹Øϵ£¬ÕâÀï¾ÍÊÇר¸øÄãÁ·Ï°Óõġ£
 
 Èç¹ûÒ»ÐÐÎÄ×ֺܳ¤¡¢³¬³öÁË´°¸ñµÄ¿í¶È£¬ÏÔʾ²»ÏµIJ¿·Ö»áÔÚ½ôÁÚµÄÏÂÒ»ÐмÌÐø
-ÏÔʾ¡£Õâʱ»áÓÐÒ»¸ö·´Ð±Ïߣ¨¿ØÖÆ̨ÏÂÊÇ·´Ð±Ïߣ¬Èç¹ûÄãÓÃͼÐδ°¿Úϵͳ£¬ÔòÓ¦
-¸ÃÊÇÒ»¸öССµÄתÍä¼ýÍ·£©ÏÔʾÔÚÓÒ±ßÑØ£¬±íÃ÷ÕâÊÇijһÐеĽÓÐøÏÔʾ¡£
+ÏÔʾ¡£Õâʱ»áÓÐÒ»¸ö·´Ð±Ïߣ¨ÔÚ¿ØÖÆ̨ÏÂÊÇ·´Ð±Ïߣ¬Èç¹ûÄãÓÃͼÐδ°¿Úϵͳ£¬Ôò
+Ó¦¸ÃÊÇÒ»¸öССµÄתÍä¼ýÍ·£©ÏÔʾÔÚÓÒ±ßÑØ£¬±íÃ÷ÕâÊÇijһÐеĽÓÐøÏÔʾ¡£
 
 >> ÊäÈëÎÄ×Ö£¬Ò»Ö±µ½ÆÁÄ»µÄÓұ߽磬Ȼºó¼ÌÐø£¬Äã»á¿´µ½Ò»¸ö½ÓÐøÐгöÏÖ¡£
 
 >> Óà <Delback> ɾµôһЩÎÄ×Ö£¬Ö±µ½´ËÐ㤶ÈСÓÚ´°¸ñ¿í¶È£¬½ÓÐøÐоÍÏûʧÁË¡£
 
-Äã¿ÉÒÔÏñɾ³ýÆäËû×Ö·ûÒ»Ñùɾ³ý»»Ðзû¡£É¾³ýÁ½ÐÐÖмäµÄ»»Ðзû»á½«Á½Ðкϲ¢³É
-Ò»ÐС£Èç¹ûºÏ²¢µÄ½á¹ûʹÕâÒ»ÐÐÌ«³¤£¬³¬³öÁË´°¸ñµÄ¿í¶È£¬Ëü¾Í»áÒÔÒ»¸ö½ÓÐøÐÐ
-À´ÏÔʾ¡£
+»»Ðзû¸úÆäËû×Ö·ûÒ»Ñù¿ÉÒÔ±»É¾³ý¡£Á½ÐÐÖмäµÄ»»Ðзû±»É¾³ýºó£¬ÕâÁ½Ðн«»áºÏ
+²¢³ÉÒ»ÐС£Èç¹ûºÏ²¢ºóµÄÕâÒ»ÐÐÌ«³¤£¬³¬³öÁË´°¸ñ¿í¶È£¬Ëü¾Í»áÒÔÒ»¸ö½ÓÐøÐÐÀ´
+ÏÔʾ¡£
 
->> Òƶ¯¹â±êµ½±¾ÐеĿªÍ·²¢ÊäÈë <Delback>¡£
-   Õâʱ±¾ÐÐÓëÆäÇ°Ò»Ðн«±»ºÏ²¢ÎªÒ»ÐС£
+>> Òƶ¯¹â±êµ½Ä³ÐеĿªÍ·²¢ÊäÈë <Delback>¡£
+   Õâʱ¸ÃÐн«ÓëÆäÇ°Ò»ÐÐÒ»Æ𱻺ϲ¢ÎªÒ»ÐС£
 
 >> ÊäÈë <Return> ÖØвåÈëÄã¸Õ²Åɾ³ýµÄ»»Ðзû¡£
 
-Ç°Ãæ˵¹ý£¬´ó²¿·ÖµÄ Emacs ÃüÁ¿ÉÒÔÖ¸¶¨Öظ´´ÎÊý£¬ÕâÆäÖÐÒ²°üÀ¨ÊäÈë×Ö·ûµÄ
-ÃüÁî¡£Öظ´Ö´ÐÐÊäÈë×Ö·ûµÄÃüÁîʵ¼ÊÉϾÍÊÇÊäÈë¶à¸öÒ»ÑùµÄ×Ö·û¡£
+Ç°Ãæ½²¹ý£¬´ó²¿·ÖµÄ Emacs ÃüÁ¿ÉÒÔÖ¸¶¨Öظ´´ÎÊý£¬ÕâÆäÖÐÒ²°üÀ¨ÊäÈë×Ö·ûµÄ
+ÃüÁî¡£Öظ´Ö´ÐÐÊäÈë×Ö·ûµÄÃüÁîʵ¼ÊÉϾÍÊÇÊäÈë¶à¸öÏàͬµÄ×Ö·û¡£
 
 >>  ÊÔÊÔ C-u 8 *£¬Õ⽫»á²åÈë ********¡£
 
@@ -329,10 +329,10 @@
 ×¢Òâ,¡°ÒƳý£¨kill£©¡±ºÍ¡°É¾³ý£¨delete£©¡±µÄ²»Í¬ÔÚÓÚ±»ÒƳýµÄ¶«Î÷¿ÉÒÔÕÒ»Ø
 À´£¬¶ø±»É¾³ýµÄ¾Í²»ÐÐÁË¡£¡¾Êµ¼ÊÉÏ£¬ÒƳýµôµÄ¶«Î÷ËäÈ»¿´ÆðÀ´¡°Ïûʧ¡±ÁË£¬µ«
 ʵ¼ÊÉϱ» Emacs ¼Ç¼ÁËÏÂÀ´£¬Òò´Ë»¹¿ÉÒÔÕÒ»ØÀ´£»¶øɾ³ýµôµÄ¶«Î÷ËäȻҲ¿ÉÄÜ»¹
-ÔÚÄÚ´æÀµ«ÊÇÒѾ­±»Emacs¡°Å×Æú¡±ÁË£¬ËùÒÔ¾ÍÕÒ²»»ØÀ´ÁË¡£¡¿ÖØвåÈë±»ÒƳý
-µÄÎÄ×Ö³ÆΪ¡°Õٻأ¨yank£©¡±¡£Ò»°ã¶øÑÔ£¬ÄÇЩ»áÈ¥³ýºÜ¶àÎÄ×ÖµÄÃüÁî»á°ÑÈ¥³ý
-µôµÄÎÄ×Ö´¢´æÆðÀ´£¨ËüÃDZ»É趨³ÉÁË¡°¿ÉÕٻء±£©£¬¶øÄÇЩֻÊÇÈ¥³ýÒ»¸ö×Ö·û»ò
-ÕßÖ»ÊÇÈ¥³ý¿Õ°×µÄÃüÁî¾Í²»»á´¢´æÄÇЩ±»È¥³ýµôµÄ¶«Î÷£¨Òò´ËÄã¾ÍÎÞ·¨Õٻأ©¡£
+ÔÚÄÚ´æÀµ«ÊÇÒѾ­±» Emacs¡°Å×Æú¡±ÁË£¬ËùÒÔ¾ÍÕÒ²»»ØÀ´ÁË¡£¡¿ÖØвåÈë±»ÒÆ
+³ýµÄÎÄ×Ö³ÆΪ¡°Õٻأ¨yank£©¡±¡£Ò»°ã¶øÑÔ£¬ÄÇЩ»áÈ¥³ýºÜ¶àÎÄ×ÖµÄÃüÁî»á°ÑÈ¥
+³ýµôµÄÎÄ×Ö´¢´æÆðÀ´£¨ËüÃDZ»É趨³ÉÁË¡°¿ÉÕٻء±£©£¬¶øÄÇЩֻÊÇÈ¥³ýÒ»¸ö×Ö·û
+»òÕßÖ»ÊÇÈ¥³ý¿Õ°×µÄÃüÁî¾Í²»»á´¢´æ±»È¥³ýµôµÄ¶«Î÷£¨×ÔÈ»Äã¾ÍÎÞ·¨ÕÙ»ØÁË£©¡£
 
 >> Òƶ¯¹â±êµ½Ò»·Ç¿Õ°×ÐеÄÐÐÍ·£¬È»ºóÊäÈë C-k ÒƳýÄÇÒ»ÐÐÉϵÄÎÄ×Ö¡£
 
@@ -409,9 +409,9 @@
 ´æÅÌ£¬¾ÍÒªÔڱ༭ǰ¡°Ñ°ÕÒ¡±µ½Ò»¸ö´æÅÌÎļþ¡££¨Õâ¸ö¹ý³Ìͨ³£Ò²±»³ÆΪ¡°·ÃÎÊ¡±
 Îļþ¡££©
 
-Ñ°ÕÒµ½Ò»¸öÎļþÒâζ×ÅÄã¿ÉÒÔÔÚ Emacs Àï²é¿´Õâ¸öÎļþµÄÄÚÈÝ¡£´ÓºÜ¶à½Ç¶È½²£¬
+Ñ°ÕÒµ½Ò»¸öÎļþÒâζ×ÅÄã¿ÉÒÔÔÚ Emacs Àï²é¿´Õâ¸öÎļþµÄÄÚÈÝ¡£´ÓºÜ¶à·½Ãæ½²£¬
 Õâ¾ÍµÈÓÚÄãÔÚÖ±½Ó±à¼­Õâ¸öÎļþ¡£µ«ÊÇÄãËù×öµÄÐÞ¸ÄÖ»ÓÐÔÚ¡°´æÅÌ¡±µÄʱºò²Å»á
-±»Ð´ÈëÎļþ¡£Ò²ÕýÒòΪÈç´Ë£¬Äã¿ÉÒÔ¶ªÆúÒ»¸ö¸Äµ½Ò»°ëµÄÎļþ¶ø²»±Ø°ÑÕâ¸ö²Ð·Ï
+±»Ð´ÈëÎļþ¡£Ò²ÕýÒòΪÈç´Ë£¬Äã¿ÉÒÔ¶ªÆúÒ»¸ö¸Äµ½Ò»°ëµÄÎļþ¶ø²»±Ø°ÑÕâ¸ö²Ðȱ
 ÎļþÒ²±£´æµ½¼ÆËã»úÉÏ¡£×îºó¾ÍËãÄãÕæÕý´æÁËÅÌ£¬Emacs Ò²»á°Ñ´æÅÌÇ°µÄÎļþÖØ
 ÃüÃû±£´æ£¬ÒÔ·ÀÄã¸ÄÍêÖ®ºóÓÖÏë·´»Ú¡£
 
@@ -572,10 +572,10 @@
 ×Ö·û´®Ìæ»»ÃüÁîÐèÒªÁ½¸ö²ÎÊý¡ª¡ª±»Ìæ»»µÄ×Ö·û´®ºÍÓÃÀ´Ìæ»»ËüµÄ×Ö·û´®¡£Ã¿¸ö
 ²ÎÊýµÄÊäÈëÓû»ÐзûÀ´½áÊø¡£
 
->> ½«¹â±êÒƵ½±¾ÐеÄÏÂÁ½Ðпհף¬È»ºóÊäÈë
+>> ½«¹â±êÒƵ½±¾ÐÐÏÂÃæµÚ¶þÐеĿհ״¦£¬È»ºóÊäÈë
    M-x repl s<Return>changed<Return>altered<Return>¡£
 
-   ¡¾ÎªÁ˼ÌÐøÁ·Ï°£¬±£ÁôÒ»ÐÐÔ­ÎÄÈçÏ£º
+   ¡¾ÒÔϱ£ÁôÒ»ÐÐÔ­ÎÄ£¬ÒÔÓ¦Á·Ï°Ö®Ð裺
    Notice how this line has changed: you've replaced... ¡¿
 
 Çë×¢ÒâÕâÒ»ÐÐÊÇÔõô¸Ä±äµÄ£ºÔÚ¹â±êÖ®ºóµÄ·¶Î§ÄÚ£¬ÄãÒѾ­½«¡°changed¡±Õâ¸ö
@@ -617,7 +617,7 @@
 ¹ûλÓÚÎļþµÄĩ⣬¾ÍÏÔʾ --Bot--¡£Èç¹ûÎļþºÜС£¬Ò»ÆÁ¾Í×ãÒÔÏÔʾȫ²¿ÄÚÈÝ£¬
 ÄÇô״̬À¸»áÏÔʾ --All--¡£
 
-L ºÍÆäºóµÄÊý×Ö¸ø³öÁ˹â±êËùÔÚÐеÄÐкš£
+¡°L¡± ºÍÆäºóµÄÊý×Ö¸ø³öÁ˹â±êËùÔÚÐеÄÐкš£
 
 ×ͷµÄÐǺţ¨*£©±íʾÄãÒѾ­¶ÔÎÄ×Ö×ö¹ý¸Ä¶¯¡£¸Õ¸Õ´ò¿ªµÄÎļþ¿Ï¶¨Ã»Óб»¸Ä¶¯
 ¹ý£¬ËùÒÔ״̬À¸ÉÏÏÔʾµÄ²»ÊÇÐǺŶøÊǶÌÏߣ¨-£©¡£
@@ -690,14 +690,14 @@
 ¹¦ºó£¬¹â±ê»áÍ£ÁôÔÚËÑË÷Ä¿±ê³öÏֵĵط½¡£
 
 Emacs µÄËÑË÷ÃüÁîµÄ¶ÀÌØÖ®´¦ÔÚÓÚ£¬ËüÊÇ¡°½¥½øµÄ£¨incremental£©¡±£¬Òâ˼ÊÇËÑ
-Ë÷ÓëÊäÈëͬʱ½øÐУºÄãÔÚÕâ±ßÒ»¸ö×ÖÒ»¸ö×ÖµØÊäÈëÄãÏëËÑË÷µÄ¶«Î÷£¬Í¬Ê± Emacs
-ÔÚÄDZ߾ÍÌæÄãËÑË÷ÁË¡£
+Ë÷ÓëÊäÈëͬʱ½øÐУºÄãÔÚ¼üÅÌÉÏÒ»×ÖÒ»¾äµØÊäÈëËÑË÷´ÊµÄ¹ý³ÌÖУ¬Emacs ¾ÍÒѾ­
+¿ªÊ¼ÌæÄãËÑË÷ÁË¡£
 
 C-s ÊÇÏòÇ°ËÑË÷£¬C-r ÊÇÏòºóËÑË÷¡£²»¹ýÊÖ±ðÕâô¿ì£¡Ïȵȵȱð׿±ÊÔ¡£
 
-ÔÚÄã°´Ï C-s Ö®ºó£¬Äã»á·¢ÏÖ»ØÏÔÇøÀïÓС°I-search¡±×ÖÑù³öÏÖ£¬ÕâÊÇÔÚÌáʾ
-ÄãÄ¿Ç° Emacs Õý´¦ÓÚ¡°½¥½øËÑË÷¡±×´Ì¬£¬ÕýÔڵȴýÄãÊäÈëËÑË÷×Ö´®¡£<Return>
-»á½áÊøËÑË÷¡£
+ÔÚÄã°´Ï C-s Ö®ºó£¬Äã»á·¢ÏÖ»ØÏÔÇøÀïÓС°I-search¡±×ÖÑù³öÏÖ£¬ÌáʾÄãÄ¿Ç°
+Emacs Õý´¦ÓÚ¡°½¥½øËÑË÷¡±×´Ì¬£¬ÕýÔڵȴýÄãÊäÈëËÑË÷×Ö´®¡£°´ <Return> »á½á
+ÊøËÑË÷¡£
 
 >> ÊäÈë C-s ¿ªÊ¼Ò»¸öËÑË÷¡£×¢ÒâÇÃÂýÒ»µã£¬Ò»´ÎÊäÈëÒ»¸ö×Ö·û¡£
    ÂýÂýÊäÈë¡°cursor¡±Õû¸ö´Ê£¬Ã¿ÇÃÒ»¸ö×Ö¾ÍÔÝͣһϣ¬×¢Òâ¹Û²ì¹â±ê¡£
@@ -917,10 +917,10 @@
 
 Emacs ¿ìËÙÖ¸ÄÏ£¨Tutorial£©ÔçÓÐÁ½¸öÁõÕѺêµÄÖÐÎÄÒë±¾£¬·±¼ò¸÷Ò»¡£Æä¼òÌå°æ±¾
 £¨TUTORIAL.cn£©»ù±¾ÓÉ·±Ìå°æ±¾£¨TUTORIAL.zh£©¾­´ÊÓïÌæ»»¶øµÃ¡£È»¶ø·±¼òÖÐÎÄ
-²»½öÔÚÓôÊÏ°¹ßÉÏÓÐËù²»Í¬£¬¸üÓÐÖî¶à±í´ï·½Ê½ºÍ¾ä·¨·½ÃæµÄ²îÒì¡£Òò´ËÒ»Ö±ÒÔÀ´
-ÔĶÁ TUTORIAL.cn ¶¼ÂÔ¾õ»ÞɬºÍÉúÓ²¡£Õâ´ÎÖØз­Òë TUTORIAL.cn µÄ¶¯»úÕýÊÇÔ´
-ÓÚÕâÖÖÌåÑ飬ϣÍûÎÒÃǵŤ×÷Äܹ»Èñ¾ÎĸüºÃµÄ·¢»ÓÆäÓ¦ÓеÄ×÷Óá£TUTORIAL.zh
-µÄÒëÎÄÖÊÁ¿ºÜ¸ß£¬ÔÚ·­Òë¹ý³ÌÖиøÓè¹ýÎÒÃǺܶà½è¼øºÍ²Î¿¼£¬Ôڴ˶ÔÁõÕѺêµÄ¹¤×÷
+²»½öÔÚÓôÊÏ°¹ßÉÏÓÐËù²»Í¬£¬¸üÓÐÖî¶à±í´ï·½Ê½Óë¾ä·¨·½ÃæµÄ²îÒ죬Òò´ËÒ»Ö±ÒÔÀ´
+Óû§Ê¹Óà TUTORIAL.cn ¶¼»áÂÔ¾õÉúÓ²ºÍ»Þɬ¡£Õâ´ÎÖØз­Òë TUTORIAL.cn µÄ¶¯»ú
+ÕýÊÇÔ´ÓÚÕâÖÖÌåÑ飬ϣÍûÎÒÃǵŤ×÷Äܹ»Èñ¾ÎĸüºÃµØ·¢»ÓÆä×÷Óá£TUTORIAL.zh
+µÄÒëÎÄÖÊÁ¿ºÜ¸ß£¬ÔÚ·­Òë¹ý³ÌÖиøÓè¹ýÎÒÃÇÐí¶à½è¼øºÍ²Î¿¼£¬Ôڴ˶ÔÁõÕѺêµÄ¹¤×÷
 ±íʾ¸Ðл¡£
 
 ·­Òë¹ý³ÌÖÐ×î´óµÄÌôսĪ¹ýÓÚÊõÓïÒë´ÊµÄÑ¡ÔñÁË¡£¾­¹ýˮľÉçÇø Emacs °åÈÈÐÄÍø
@@ -954,6 +954,10 @@
     Öеġ°window¡±¾ÍÖ»ÄÜÒë³É¡°´°¸ñ¡±ÁË¡£ÎÒÃÇÈÏΪ Emacs ÖÐ window ºÍ
     frame µÄ¹ØϵÓô°¸ñºÍ´°¿ÚÀ´Àà±ÈÊÇÊ®·ÖÐÎÏóµÄ¡£
 
+    ¡¶Ñ§Ï°GNU Emacs¡·£¨µÚ¶þ°æ£©Ò»Êé¶Ô¡°window¡±ºÍ¡°frame¡±µÄ·­ÒëÓë±¾½Ì³Ì
+    ¸ÕºÃÏà·´£¨·Ö±ðÒë×÷¡°´°¿Ú¡±ºÍ¡°´°¸ñ¡±£©¡£ÔÚ´ËÌرð×¢Ã÷£¬ÒÔÏû³ý¿ÉÄܲúÉú
+    µÄÒÉ»ó¡£
+
 [2] ¶ÔÓÚ¡°delete¡±ºÍ¡°kill¡±µÄÇø±ð£¬ÕýÎÄÒѾ­¸ø³öÁËÏêϸµÄ˵Ã÷¡£¡°É¾³ý¡±ºÍ
     ¡°ÒƳý¡±Ïà±È½ÏÆðÀ´£¬Ç°Õ߸ü¶àµØÒþº¬×Å¡°ÆÆ»µ¡±ºÍ¡°²»¿É»Ö¸´¡±µÄÒâ˼£¬¶ø
     ºóÕ߸ü¶àµØÒþº¬×Å¡°±»×ªÒÆ¡±ºÍ¡°¿É»Ö¸´¡±µÄÒâ˼¡£Òò´Ë·Ö±ðÑ¡ÔñËüÃÇ×÷ΪÉÏ
--- a/etc/TUTORIAL.de	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/TUTORIAL.de	Sat Oct 14 16:56:21 2006 +0000
@@ -285,8 +285,8 @@
 einem numerischen Argument ein.
 
 Wenn Sie eine graphische Oberfläche wie X oder MS-Windows verwenden,
-dann befindet sich ein schmaler, langgezogener rechteckiger Bereich im
-Regelfall auf der linken Seite des Emacs-Fensters.  Dieser Bereich
+dann befindet sich ein schmaler, langgezogener rechteckiger Bereich auf
+der linken oder rechten Seite des Emacs-Fensters.  Dieser Bereich
 wird Scrollbar genannt (`Verschiebungsbalken').  Sie können Text
 verschieben, indem Sie mit der Maus auf den Scrollbar klicken.
 
--- a/etc/TUTORIAL.it	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/TUTORIAL.it	Sat Oct 14 16:56:21 2006 +0000
@@ -219,9 +219,9 @@
 in basso puoi usare un argomento numerico con M-v.
 
 Quando si usa un sistema a finestre, come X11 o MS-Windows, ci dovrebbe
-essere un'area rettangolare allungata chiamata barra di scorrimento sul
-lato sinistro della finestra di Emacs.  Si può far scorrere il testo con
-un click del mouse nella barra di scorrimento.
+essere un'area rettangolare allungata chiamata barra di scorrimento a
+un lato della finestra di Emacs.  Si può far scorrere il testo con un 
+click del mouse nella barra di scorrimento.
 
 >> Prova a premere il pulsante centrale del mouse sopra all'area
    evidenziata nella barra di scorrimento.  Verrà visualizzata una parte
--- a/etc/TUTORIAL.sl	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/TUTORIAL.sl	Sat Oct 14 16:56:21 2006 +0000
@@ -222,7 +222,7 @@
 premaknili nazaj, poskusite M-v z istim argumentom.
 
 Èe uporabljate grafièni vmesnik, denimo X11 ali MS Windows, imate
-verjetno ob levem robu Emacsovega okna navpièno pravokotno ploskev,
+verjetno ob robu Emacsovega okna navpièno pravokotno ploskev,
 imenovano drsnik. Pogled na besedilo lahko premikate tudi tako, da z
 mi¹ko kliknete na drsnik.
 
--- a/etc/TUTORIAL.sv	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/TUTORIAL.sv	Sat Oct 14 16:56:21 2006 +0000
@@ -224,7 +224,7 @@
 tillbaka igen är det bara att ge samma argument till M-v.
 
 Om du använder Emacs under ett fönstersystem, som X11 eller
-MS-Windows, finns det troligen ett rektangulärt område på vänster sida
+MS-Windows, finns det troligen ett rektangulärt område på sidan
 av Emacs-fönstret, en så kallad rullningslist. Genom att klicka i den
 med musen kan du rulla texten.
 
--- a/etc/emacs.py	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/emacs.py	Sat Oct 14 16:56:21 2006 +0000
@@ -1,7 +1,7 @@
 """Definitions used by commands sent to inferior Python in python.el."""
 
-# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
-# Author: Dave Love <d.love@dl.ac.uk>
+# Copyright (C) 2004, 2005, 2006  Free Software Foundation, Inc.
+# Author: Dave Love <fx@gnu.org>
 
 # This file is part of GNU Emacs.
 
@@ -20,17 +20,19 @@
 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import os, sys, traceback, inspect, rlcompleter, __main__
+import os, sys, traceback, inspect, __main__
+from sets import Set
 
-__all__ = ["eexecfile", "args", "complete", "ehelp", "eimport"]
+__all__ = ["eexecfile", "eargs", "complete", "ehelp", "eimport", "modpath"]
 
 def eexecfile (file):
     """Execute FILE and then remove it.
+    Execute the file within the __main__ namespace.
     If we get an exception, print a traceback with the top frame
-    (oursleves) excluded."""
+    (ourselves) excluded."""
     try:
-	try: execfile (file, globals (), globals ())
-	except:
+       try: execfile (file, __main__.__dict__)
+       except:
 	    (type, value, tb) = sys.exc_info ()
 	    # Lose the stack frame for this location.
 	    tb = tb.tb_next
@@ -40,9 +42,10 @@
     finally:
 	os.remove (file)
 
-def eargs (name):
+def eargs (name, imports):
     "Get arglist of NAME for Eldoc &c."
     try:
+	if imports: exec imports
 	parts = name.split ('.')
 	if len (parts) > 1:
 	    exec 'import ' + parts[0] # might fail
@@ -56,8 +59,7 @@
 	    return
 	if inspect.ismethod (func):
 	    func = func.im_func
-	if not inspect.isfunction (func):
-	    return
+	if not inspect.isfunction (func): return
 	(args, varargs, varkw, defaults) = inspect.getargspec (func)
 	# No space between name and arglist for consistency with builtins.
 	print '_emacs_out', \
@@ -65,41 +67,109 @@
 						   defaults)
     except: pass
 
-def complete (text, namespace = None):
+def all_names (object):
+    """Return (an approximation to) a list of all possible attribute
+    names reachable via the attributes of OBJECT, i.e. roughly the
+    leaves of the dictionary tree under it."""
+
+    def do_object (object, names):
+	if inspect.ismodule (object):
+	    do_module (object, names)
+	elif inspect.isclass (object):
+	    do_class (object, names)
+	# Might have an object without its class in scope.
+	elif hasattr (object, '__class__'):
+	    names.add ('__class__')
+	    do_class (object.__class__, names)
+	# Probably not a good idea to try to enumerate arbitrary
+	# dictionaries...
+	return names
+
+    def do_module (module, names):
+	if hasattr (module, '__all__'):	# limited export list
+	    names.union_update (module.__all__)
+	    for i in module.__all__:
+		do_object (getattr (module, i), names)
+	else:			# use all names
+	    names.union_update (dir (module))
+	    for i in dir (module):
+		do_object (getattr (module, i), names)
+	return names
+
+    def do_class (object, names):
+	ns = dir (object)
+	names.union_update (ns)
+	if hasattr (object, '__bases__'): # superclasses
+	    for i in object.__bases__: do_object (i, names)
+	return names
+
+    return do_object (object, Set ([]))
+
+def complete (name, imports):
     """Complete TEXT in NAMESPACE and print a Lisp list of completions.
-    NAMESPACE is currently not used."""
-    if namespace is None: namespace = __main__.__dict__
-    c = rlcompleter.Completer (namespace)
+    Exec IMPORTS first."""
+    import __main__, keyword
+
+    def class_members(object):
+	names = dir (object)
+	if hasattr (object, '__bases__'):
+	    for super in object.__bases__:
+		names = class_members (super)
+	return names	
+
+    names = Set ([])
+    base = None
     try:
-        if '.' in text:
-            matches = c.attr_matches (text)
-        else:
-            matches = c.global_matches (text)
-	print '_emacs_out (',
-        for elt in matches:
-            print '"%s"' % elt,
-        print ')'
-    except:
-        print '_emacs_out ()'
+	dict = __main__.__dict__.copy()
+	if imports: exec imports in dict
+	l = len (name)
+	if not "." in name:
+	    for list in [dir (__builtins__), keyword.kwlist, dict.keys()]:
+		for elt in list:
+		    if elt[:l] == name: names.add(elt)
+	else:
+	    base = name[:name.rfind ('.')]
+	    name = name[name.rfind('.')+1:]
+	    try:
+		object = eval (base, dict)
+		names = Set (dir (object))
+		if hasattr (object, '__class__'):
+		    names.add('__class__')
+		    names.union_update (class_members (object))
+	    except: names = all_names (dict)
+    except: return []
+    l = len(name)
+    print '_emacs_out (',
+    for n in names:
+	if name == n[:l]:
+	    if base: print '"%s.%s"' % (base, n),
+	    else: print '"%s"' % n,
+    print ')'
 
-def ehelp (name, g, l):
-    """Get help on string NAME using globals G and locals L.
+def ehelp (name, imports):
+    """Get help on string NAME.
     First try to eval name for, e.g. user definitions where we need
     the object.  Otherwise try the string form."""
-    try: help (eval (name, g, l))
+    locls = {}
+    if imports:
+	try: exec imports in locls
+	except: pass
+    try: help (eval (name, globals(), locls))
     except: help (name)
 
 def eimport (mod, dir):
     """Import module MOD with directory DIR at the head of the search path.
     NB doesn't load from DIR if MOD shadows a system module."""
+    from __main__ import __dict__
+
     path0 = sys.path[0]
     sys.path[0] = dir
     try:
 	try:
-	    if globals().has_key(mod) and inspect.ismodule (eval (mod)):
-		reload(eval (mod))
+	    if __dict__.has_key(mod) and inspect.ismodule (__dict__[mod]):
+		reload (__dict__[mod])
 	    else:
-		globals ()[mod] = __import__ (mod)
+		__dict__[mod] = __import__ (mod)
 	except:
 	    (type, value, tb) = sys.exc_info ()
 	    print "Traceback (most recent call last):"
@@ -107,6 +177,17 @@
     finally:
 	sys.path[0] = path0
 
-print '_emacs_ok'		# ready for input and can call continuation
+def modpath (module):
+    """Return the source file for the given MODULE (or None).
+Assumes that MODULE.py and MODULE.pyc are in the same directory."""
+    try:
+	path = __import__ (module).__file__
+	if path[-4:] == '.pyc' and os.path.exists (path[0:-1]):
+	    path = path[:-1]
+	print "_emacs_out", path
+    except:
+	print "_emacs_out ()"
+
+# print '_emacs_ok'		# ready for input and can call continuation
 
 # arch-tag: d90408f3-90e2-4de4-99c2-6eb9c7b9ca46
--- a/etc/orgcard.tex	Sun Jul 30 10:19:46 2006 +0000
+++ b/etc/orgcard.tex	Sat Oct 14 16:56:21 2006 +0000
@@ -1,5 +1,5 @@
 % Reference Card for Org Mode
-\def\orgversionnumber{4.43}
+\def\orgversionnumber{4.44}
 \def\year{2006}
 %
 %**start of header
--- a/lib-src/ChangeLog	Sun Jul 30 10:19:46 2006 +0000
+++ b/lib-src/ChangeLog	Sat Oct 14 16:56:21 2006 +0000
@@ -1,3 +1,29 @@
+2006-08-09  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* etags.c (readline): expect sscanf returns >= 1.
+	(readline): Change position on %n and \" in sscanf.
+
+2006-08-07  Masatake YAMATO  <jet@gyve.org>
+
+	* etags.c (readline): expect sscanf returns 2, 
+	not 1.
+	
+2006-08-07  Masatake YAMATO  <jet@gyve.org>
+
+	* etags.c (TEX_mode): Check getc retruns EOF.
+	File ended without newline causes infinite loop.
+
+2002-07-30  Adrian Aichner  <adrian@xemacs.org>  (tiny change)
+
+	* etags.c: It's XEmacs, not Xemacs: change all the occurences.
+
+2006-07-30  Francesco Potort,Al(B  <pot@gnu.org>
+
+	* etags.c [ETAGS_REGEXPS]: Now is unconditionally defined.
+	[LONG_OPTIONS]: Changed to NO_LONG_OPTIONS, which is undefined.
+	(Objc_suffixes): Suggest using --lang=c for full help.
+	(C_entries): Initialise savetoken to 0 to shut up the compiler.
+
 2006-07-20  Andreas Schwab  <schwab@suse.de>
 
 	* fakemail.c (fatal): Drop second parameter and treat first
--- a/lib-src/etags.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/lib-src/etags.c	Sat Oct 14 16:56:21 2006 +0000
@@ -41,7 +41,7 @@
  * configuration file containing regexp definitions for etags.
  */
 
-char pot_etags_version[] = "@(#) pot revision number is 17.18";
+char pot_etags_version[] = "@(#) pot revision number is 17.20";
 
 #define	TRUE	1
 #define	FALSE	0
@@ -59,12 +59,10 @@
   /* On some systems, Emacs defines static as nothing for the sake
      of unexec.  We don't want that here since we don't use unexec. */
 # undef static
-# define ETAGS_REGEXPS		/* use the regexp features */
-# define LONG_OPTIONS		/* accept long options */
-# ifndef PTR			/* for Xemacs */
+# ifndef PTR			/* for XEmacs */
 #   define PTR void *
 # endif
-# ifndef __P			/* for Xemacs */
+# ifndef __P			/* for XEmacs */
 #   define __P(args) args
 # endif
 #else  /* no config.h */
@@ -82,14 +80,7 @@
 # define _GNU_SOURCE 1		/* enables some compiler checks on GNU */
 #endif
 
-#ifdef LONG_OPTIONS
-#  undef LONG_OPTIONS
-#  define LONG_OPTIONS TRUE
-#else
-#  define LONG_OPTIONS  FALSE
-#endif
-
-/* WIN32_NATIVE is for Xemacs.
+/* WIN32_NATIVE is for XEmacs.
    MSDOS, WINDOWSNT, DOS_NT are for Emacs. */
 #ifdef WIN32_NATIVE
 # undef MSDOS
@@ -167,25 +158,25 @@
 # define S_ISREG(m)	(((m) & S_IFMT) == S_IFREG)
 #endif
 
-#if LONG_OPTIONS
-# include <getopt.h>
-#else
+#ifdef NO_LONG_OPTIONS		/* define this if you don't have GNU getopt */
+# define NO_LONG_OPTIONS TRUE
 # define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr)
   extern char *optarg;
   extern int optind, opterr;
-#endif /* LONG_OPTIONS */
-
-#ifdef ETAGS_REGEXPS
-# ifndef HAVE_CONFIG_H		/* this is a standalone compilation */
-#   ifdef __CYGWIN__         	/* compiling on Cygwin */
+#else
+# define NO_LONG_OPTIONS FALSE
+# include <getopt.h>
+#endif /* NO_LONG_OPTIONS */
+
+#ifndef HAVE_CONFIG_H		/* this is a standalone compilation */
+# ifdef __CYGWIN__         	/* compiling on Cygwin */
 			     !!! NOTICE !!!
  the regex.h distributed with Cygwin is not compatible with etags, alas!
 If you want regular expression support, you should delete this notice and
 	      arrange to use the GNU regex.h and regex.c.
-#   endif
 # endif
-# include <regex.h>
-#endif /* ETAGS_REGEXPS */
+#endif
+#include <regex.h>
 
 /* Define CTAGS to make the program "ctags" compatible with the usual one.
  Leave it undefined to make the program "etags", which makes emacs-style
@@ -312,7 +303,6 @@
   char *what;			/* the argument itself */
 } argument;
 
-#ifdef ETAGS_REGEXPS
 /* Structure defining a regular expression. */
 typedef struct regexp
 {
@@ -327,7 +317,6 @@
   bool ignore_case;		/* ignore case when matching */
   bool multi_line;		/* do a multi-line match on the whole file */
 } regexp;
-#endif /* ETAGS_REGEXPS */
 
 
 /* Many compilers barf on this:
@@ -375,11 +364,9 @@
 static bool nocase_tail __P((char *));
 static void get_tag __P((char *, char **));
 
-#ifdef ETAGS_REGEXPS
 static void analyse_regex __P((char *));
 static void free_regexps __P((void));
 static void regex_tag_multiline __P((void));
-#endif /* ETAGS_REGEXPS */
 static void error __P((const char *, const char *));
 static void suggest_asking_for_help __P((void));
 void fatal __P((char *, char *));
@@ -485,14 +472,9 @@
 #define STDIN 0x1001		/* returned by getopt_long on --parse-stdin */
 static bool parsing_stdin;	/* --parse-stdin used */
 
-#ifdef ETAGS_REGEXPS
 static regexp *p_head;		/* list of all regexps */
 static bool need_filebuf;	/* some regexes are multi-line */
-#else
-# define need_filebuf FALSE
-#endif /* ETAGS_REGEXPS */
-
-#if LONG_OPTIONS
+
 static struct option longopts[] =
 {
   { "append",		  no_argument,	     NULL,	     	 'a'   },
@@ -507,11 +489,9 @@
   { "members",		  no_argument,	     &members, 	     	 TRUE  },
   { "no-members",	  no_argument,	     &members, 	     	 FALSE },
   { "output",		  required_argument, NULL,	     	 'o'   },
-#ifdef ETAGS_REGEXPS
   { "regex",		  required_argument, NULL,	     	 'r'   },
   { "no-regex",		  no_argument,	     NULL,	     	 'R'   },
   { "ignore-case-regex",  required_argument, NULL,	     	 'c'   },
-#endif /* ETAGS_REGEXPS */
   { "parse-stdin",        required_argument, NULL,               STDIN },
   { "version",		  no_argument,	     NULL,     	     	 'V'   },
 
@@ -533,7 +513,6 @@
 #endif
   { NULL }
 };
-#endif /* LONG_OPTIONS */
 
 static compressor compressors[] =
 {
@@ -681,13 +660,15 @@
 static char Objc_help [] =
 "In Objective C code, tags include Objective C definitions for classes,\n\
 class categories, methods and protocols.  Tags for variables and\n\
-functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.";
+functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\
+(Use --help --lang=c --lang=objc --lang=java for full help.)";
 
 static char *Pascal_suffixes [] =
   { "p", "pas", NULL };
 static char Pascal_help [] =
 "In Pascal code, the tags are the functions and procedures defined\n\
 in the file.";
+/* " // this is for working around an Emacs highlighting bug... */
 
 static char *Perl_suffixes [] =
   { "pl", "pm", NULL };
@@ -885,11 +866,11 @@
   printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\
 \n\
 These are the options accepted by %s.\n", progname, progname);
-  if (LONG_OPTIONS)
-    puts ("You may use unambiguous abbreviations for the long option names.");
+  if (NO_LONG_OPTIONS)
+    puts ("WARNING: long option names do not work with this executable,\n\
+as it is not linked with GNU getopt.");
   else
-    puts ("Long option names do not work with this executable, as it is not\n\
-linked with GNU getopt.");
+    puts ("You may use unambiguous abbreviations for the long option names.");
   puts ("  A - as file name means read names from stdin (one per line).\n\
 Absolute names are stored in the output file as they are.\n\
 Relative ones are stored relative to the output file's directory.\n");
@@ -949,7 +930,6 @@
   puts ("--members\n\
 	Create tag entries for members of structures in some languages.");
 
-#ifdef ETAGS_REGEXPS
   puts ("-r REGEXP, --regex=REGEXP or --regex=@regexfile\n\
         Make a tag for each line matching a regular expression pattern\n\
 	in the following files.  {LANGUAGE}REGEXP uses REGEXP for LANGUAGE\n\
@@ -964,7 +944,6 @@
 	causes dot to match any character, including newline.");
   puts ("-R, --no-regex\n\
         Don't create tags from regexps for the following files.");
-#endif /* ETAGS_REGEXPS */
   puts ("-I, --ignore-indentation\n\
         In C and C++ do not assume that a closing brace in the first\n\
         column is the final brace of a function or structure definition.");
@@ -1194,14 +1173,8 @@
 
   /* When the optstring begins with a '-' getopt_long does not rearrange the
      non-options arguments to be at the end, but leaves them alone. */
-  optstring = "-";
-#ifdef ETAGS_REGEXPS
-  optstring = "-r:Rc:";
-#endif /* ETAGS_REGEXPS */
-  if (!LONG_OPTIONS)
-    optstring += 1;		/* remove the initial '-' */
-  optstring = concat (optstring,
-		      "aCf:Il:o:SVhH",
+  optstring = concat (NO_LONG_OPTIONS ? "" : "-",
+		      "ac:Cf:Il:o:r:RSVhH",
 		      (CTAGS) ? "BxdtTuvw" : "Di:");
 
   while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF)
@@ -1375,11 +1348,9 @@
 	case at_language:
 	  lang = argbuffer[i].lang;
 	  break;
-#ifdef ETAGS_REGEXPS
 	case at_regexp:
 	  analyse_regex (argbuffer[i].what);
 	  break;
-#endif
 	case at_filename:
 #ifdef VMS
 	  while ((this_file = gfnames (argbuffer[i].what, &got_err)) != NULL)
@@ -1419,9 +1390,7 @@
 	}
     }
 
-#ifdef ETAGS_REGEXPS
   free_regexps ();
-#endif /* ETAGS_REGEXPS */
   free (lb.buffer);
   free (filebuf.buffer);
   free (token_name.buffer);
@@ -1979,9 +1948,7 @@
 
   parser (inf);
 
-#ifdef ETAGS_REGEXPS
   regex_tag_multiline ();
-#endif /* ETAGS_REGEXPS */
 }
 
 
@@ -3239,7 +3206,7 @@
   int typdefbracelev;		/* bracelev where a typedef struct body begun */
   bool incomm, inquote, inchar, quotednl, midtoken;
   bool yacc_rules;		/* in the rules part of a yacc file */
-  struct tok savetoken;	        /* token saved during preprocessor handling */
+  struct tok savetoken = {0};	/* token saved during preprocessor handling */
 
 
   linebuffer_init (&lbs[0].lb);
@@ -5198,7 +5165,7 @@
     {
       /* Skip to next line if we hit the TeX comment char. */
       if (c == '%')
-	while (c != '\n')
+	while (c != '\n' && c != EOF)
 	  c = getc (inf);
       else if (c == TEX_LESC || c == TEX_SESC )
 	break;
@@ -5735,8 +5702,6 @@
 }
 
 
-#ifdef ETAGS_REGEXPS
-
 static char *scan_separators __P((char *));
 static void add_regex __P((char *, language *));
 static char *substitute __P((char *, char *, struct re_registers *));
@@ -6141,8 +6106,6 @@
     }
 }
 
-#endif /* ETAGS_REGEXPS */
-
 
 static bool
 nocase_tail (cp)
@@ -6296,9 +6259,10 @@
 	  int start, lno;
 
 	  if (DEBUG) start = 0;	/* shut up the compiler */
-	  if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) == 1)
+	  if (sscanf (lbp->buffer, "#line %d %n\"", &lno, &start) >= 1
+	      && lbp->buffer[start] == '"')
 	    {
-	      char *endp = lbp->buffer + start;
+	      char *endp = lbp->buffer + ++start;
 
 	      assert (start > 0);
 	      while ((endp = etags_strchr (endp, '"')) != NULL
@@ -6405,7 +6369,6 @@
 	}
     } /* if #line directives should be considered */
 
-#ifdef ETAGS_REGEXPS
   {
     int match;
     regexp *rp;
@@ -6462,7 +6425,6 @@
 	    }
 	}
   }
-#endif /* ETAGS_REGEXPS */
 }
 
 
@@ -6623,7 +6585,7 @@
 suggest_asking_for_help ()
 {
   fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n",
-	   progname, LONG_OPTIONS ? "--help" : "-h");
+	   progname, NO_LONG_OPTIONS ? "-h" : "--help");
   exit (EXIT_FAILURE);
 }
 
--- a/lisp/ChangeLog	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/ChangeLog	Sat Oct 14 16:56:21 2006 +0000
@@ -1,3 +1,707 @@
+2006-08-27  Michael Olson  <mwolson@gnu.org>
+
+	* emacs-lisp/tq.el: Small grammar fix in comments.
+	(tq-enqueue): Check for existence of queue rather than the
+	head queue item's question, which was a no-op.
+	(tq-filter, tq-process-buffer): Make sure the process buffer
+	exists before making it the current buffer.
+
+2006-08-27  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* term/mac-win.el (mac-apple-event-map): Rename hicommand to hi-command.
+	(mac-dnd-drop-data): Apply 2006-08-22 change for x-dnd-drop-data.
+	(special-event-map): Apply 2006-08-16 change for x-win.el.
+
+2006-08-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/python.el (python-send-receive): Wait in the
+	process's buffer so as to check the right buffer-local variables.
+
+2006-08-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/checkdoc.el: Remove * in defcustoms.
+	(defgroup checkdoc): Move to beginning.
+
+	* progmodes/python.el (python-preoutput-skip-next-prompt): New var.
+	(python-preoutput-continuation): Remove.
+	(python-preoutput-filter): Simplify correspondingly.
+	Remove handling of _emacs_ok.  Make sure we skip _emacs_out's prompts.
+	Loop around to catch embedded _emacs_out output.
+	(run-python): Send the import&print command on a single line.
+	(python-send-command): Send command&print on a single line.
+	(python-send-string): Only add double \n if needed.
+	(python-send-receive): Loop until the result comes.
+	(python-mode-running): Defvar it.
+	(python-setup-brm): Remove unused var `menu'.
+	Only bind py-mode-map and `features' around brm-init.
+	(python-calculate-indentation): Remove unused var `point'.
+	(python-beginning-of-defun): Remove unused var `def-line'.
+
+2006-08-25  Richard Stallman  <rms@gnu.org>
+
+	* kmacro.el (kmacro-repeat-on-last-key): Doc fix.
+
+2006-08-25  Michael Kifer  <kifer@cs.stonybrook.edu>
+
+	* viper.el (viper-set-hooks): Use frame bindings for
+	viper-vi-state-cursor-color.
+	(viper-non-hook-settings): Don't set default
+	mode-line-buffer-identification.
+
+	* viper-util.el (viper-set-cursor-color-according-to-state): New fun.
+	(viper-set-cursor-color-according-to-state)
+	(viper-get-saved-cursor-color-in-replace-mode)
+	(viper-get-saved-cursor-color-in-insert-mode): Make conditional on
+	viper-emacs-state-cursor-color.
+
+	* viper-cmd.el (viper-envelop-ESC-key): Bug fix.
+	(viper-undo): Use point if undo-beg-posn is nil.
+	(viper-insert-state-post-command-sentinel, viper-change-state-to-emacs)
+	(viper-after-change-undo-hook): Don't use
+	viper-emacs-state-cursor-color by default.
+	(viper-undo): More sensible positioning after undo.
+
+	* viper-ex.el (ex-splice-args-in-1-letr-cmd): Get rid of caddr.
+	(viper-emacs-state-cursor-color): Default to nil, since this feature
+	doesn't work well yet.
+
+	* ediff-mult.el (ediff-intersect-directories)
+	(ediff-get-directory-files-under-revision, ediff-dir-diff-copy-file):
+	always expand filenames.
+
+2006-08-24  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* tumme.el: Remove * in defcustoms's docstrings.
+
+2006-08-24  Chong Yidong  <cyd@stupidchicken.com>
+
+	* emacs-lisp/timer.el (timer-set-idle-time, run-with-idle-timer):
+	Accept internal time format for SECS arg.
+	(timer-relative-time): Doc fix.
+
+	* jit-lock.el: "Stealth fontification by requeuing timers" patch,
+	adapted from Martin Rudalics.
+	(jit-lock-stealth-repeat-timer, jit-lock-stealth-buffers): New vars.
+	(jit-lock-mode): Create jit-lock-stealth-repeat-timer.
+	(jit-lock-stealth-fontify): Reschedule as a idle timer instead of
+	using sit-for.
+
+2006-08-24  Francesc Rocher  <francesc.rocher@gmail.com>
+
+	* cus-start.el (all): Add `overline-margin' and
+	`x-underline-at-descent-line'.
+
+2006-08-24  Kim F. Storm  <storm@cua.dk>
+
+	* progmodes/grep.el (grep-find-use-xargs): Use explicit value `exec'
+	to mean "use find -exec"; nil now unambiguously means auto-detect.
+	(grep-compute-defaults): Set grep-find-use-xargs to `exec' if not `gnu'.
+	Use shell-quote-argument to build grep-find-command and grep-find-template.
+	(rgrep): Use shell-quote-argument to properly quote arguments to find.
+	Reported by Tom Seddon.
+
+2006-08-23  Chong Yidong  <cyd@stupidchicken.com>
+
+	* startup.el (fancy-splash-head): Give instructions for dismissing
+	the splash screen for default startup too.
+	(display-startup-echo-area-message, fancy-splash-screens)
+	(use-fancy-splash-screens-p): New arg hide-on-input.  If nil, show
+	all splash text at once and keep the splash buffer around.
+	(command-line-1): Give display-startup-echo-area-message a t arg.
+
+2006-08-23  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el (org-follow-gnus-link): Make sure the dedicated
+	gnus frame is selected.
+
+2006-08-23  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-starting): Reset gdb-signalled to nil.
+
+2006-08-22  Kim F. Storm  <storm@cua.dk>
+
+	* ido.el (ido-set-matches-1): Fix full matching for subdirs.
+	Add suffix matching for subdirs.
+
+2006-08-22  Jorgen Schaefer  <forcer@forcix.cx>  (tiny change)
+
+	* x-dnd.el (x-dnd-drop-data): Don't call goto-char if
+	mouse-yank-at-point is non-nil.
+
+2006-08-22  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-frame-memory-buffer): Make frame
+	a bit wider and remove fringes to fit initial output on line.
+
+2006-08-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* frame.el (blink-cursor-end): Only ignore the error we care about.
+	(blink-cursor-mode): Use blink-cursor-end to simplify the code.
+
+2006-08-21  Richard Stallman  <rms@gnu.org>
+
+	* whitespace.el (whitespace-cleanup): Doc fix.
+
+2006-08-20  Ryan Yeske  <rcyeske@gmail.com>
+
+	* net/rcirc.el (rcirc-show-maximum-output): New var.
+	(rcirc-buffer-process): If no buffer argument is supplied, use
+	current-buffer.
+	(rcirc-complete-nick): Complete to the last completed nick first.
+	(rcirc-mode): Preserve the value of `rcirc-urls' across
+	connections.  Setup scroll function.
+	(rcirc-scroll-to-bottom): New function.
+	(rcirc-print): Use nick syntax around regexp work.
+	Notice dim-nicks speaking only if they say our nick.
+	(rcirc-update-activity-string): Do not show the modeline indicator
+	if there are no live rcirc processes.
+	(rcirc-cmd-ignore): Ignore case.
+	(rcirc-browse-url-at-point): Fix off-by-one error.
+
+2006-08-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/python.el: Remove * in defcustom docstrings.
+	(run-python, python-proc, python-try-complete): Use derived-mode-p.
+	(python-mode): Set tab-width and indent-tabs-mode.
+
+2006-08-20  Dave Love  <fx@gnu.org>
+
+	* progmodes/python.el: Update to Dave Love's latest version.
+	(python-font-lock-keywords, python-mode): Don't use
+	font-lock-syntax-table, but match symbol elements explicitly instead.
+	(python-mode-map): Add help, and a few more key bindings.
+	(python-skip-comments/blanks): Move out of comments as well.
+	(python-continuation-line-p): Behave better with unbalanced parens.
+	(python-blank-line-p): New fun.
+	(python-open-block-statement-p): Don't use a heuristic.
+	(python-outdent-p): Better handle blocks-in-the-same-line.
+	(python-calculate-indentation): Misc improvements.
+	(python-comment-indent): Remove.
+	(python-block-pairs): New var.
+	(python-first-word): New fun.
+	(python-indentation-levels): Handle more common cases.
+	(python-indent-line-1): Add `leave' argument.
+	(python-indent-region): New fun.
+	(python-skip-out): New fun.
+	(python-beginning-of-statement, python-end-of-statement): Use it.
+	(python-next-statement): Return correct count even at eob.
+	(python-end-of-block): Fix paren-typo.
+	(python-imenu-create-index): Add module variables.
+	(run-python): Add `new' arg.
+	Check we're at a prompt before returning.
+	(python-send-command): Move to end of buffer.
+	Wait for prompt to return.
+	(python-set-proc): New fun.
+	(python-imports): New var.
+	(python-describe-symbol): Use it.  Adjust to new interface of `ehelp'.
+	(python-eldoc-function): Try to move out of arg list.
+	(python-outline-level): Offset by 1.
+	(python-find-imports): New fun.
+	(python-symbol-completions): Use python-imports.
+	(python-module-path, ffap-alist): Add support for ffap.
+	(python-skeletons, python-mode-abbrev-table, def-python-skeleton)
+	(pythin-insert-*, python-default-template, python-expand-template):
+	Add templates/skeletons.
+	(python-setup-brm): Support for Bicycle Repair Man.
+	(python-abbrev-syntax-table): New var.
+	(python-abbrev-pc-hook, python-pea-hook): New funs.
+
+2006-08-20  Chong Yidong  <cyd@stupidchicken.com>
+
+	* frame.el (blink-cursor-start): Set timer first.
+	(blink-cursor-end): Ignore timer cancelling errors.
+	Suggested by Ken Manheimer.
+
+2006-08-20  Juanma Barranquero  <lekktu@gmail.com>
+
+	* newcomment.el (comment-box): Call `comment-normalize-vars'.
+	Add autoload cookie.
+
+2006-08-20  Richard Stallman  <rms@gnu.org>
+
+	* simple.el (line-number-at-pos): Doc fix.
+
+	* emacs-lisp/timer.el (run-with-idle-timer): Pass t to
+	timer-activate-when-idle, so timer can run before Emacs becomes
+	non-idle again.
+
+2006-08-18  Yoni Rabkin Katzenell  <yoni-r@actcom.com>  (tiny change)
+
+	* whitespace.el (whitespace-cleanup-internal): New optional arg
+	REGION-ONLY.  If it's non-nil, modify the message to the user
+	accordingly.
+	(whitespace-cleanup-region): Call whitespace-cleanup-internal with
+	a non-nil argument.
+
+2006-08-18  Gustav H,Ae(Bllberg  <gustav@gmail.com>  (tiny change)
+
+	* rect.el (spaces-string): Simplify and add doc string.
+
+2006-08-17  Romain Francoise  <romain@orebokech.com>
+
+	* progmodes/gdb-ui.el (gdb-edit-locals-value): Balance parens.
+
+2006-08-17  Richard Stallman  <rms@gnu.org>
+
+	* compare-w.el (compare-windows): lambda's take an arg and pass
+	it to compare-windows-skip-whitespace.
+
+2006-08-17  Martin Rudalics  <rudalics@gmx.at>
+
+	* jit-lock.el (jit-lock-fontify-now): Protect the modified status of
+	the right buffer.
+
+2006-08-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* pcvs-parse.el (cvs-parse-table): Accept the new `...' format for
+	removed files.
+
+2006-08-17  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-locals-watch-map)
+	(gdb-locals-watch-map-1): Suppress keymap first.
+	(gdb-edit-locals-map-1): New variable.
+	(gdb-edit-locals-value): New function.
+	(gdb-stack-list-locals-handler): Use them.
+
+2006-08-16  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* mouse.el (global-map): Allow yanking with mouse-2 at a spot whose
+	cursor would normally be drawn in the fringe.
+
+	* font-lock.el (font-lock-extend-region-wholelines): Fix up typo.
+	Reported by Martin Rudalics <rudalics@gmx.at>.
+
+2006-08-16  Richard Stallman  <rms@gnu.org>
+
+	* term/x-win.el (x-clipboard-yank): Specify * in interactive spec.
+	(special-event-map): Process drag-n-drop events this way.
+
+	* simple.el (move-beginning-of-line): Test whether fields
+	would prevent motion back to line's first visible character.
+	If so, stop where the fields would stop the motion.
+
+	* newcomment.el (comment-indent): Fully update INDENT
+	before checking to see if it will change the text.
+
+	* cus-edit.el (custom-newline): New function.
+	(custom-mode-map): Bind newline to custom-newline.
+
+	* compare-w.el (compare-windows): Factor compare-ignore-whitespace
+	into ignore-whitespace.
+	Check each buffer for its skip-function.
+	Handle compare-windows-skip-whitespace special-case test
+	by returning t from default skip function.
+
+2006-08-15  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el (org-clock-special-range)
+	(org-clock-update-time-maybe): New functions.
+	(org-stamp-time-of-day-regexp): Allow weekday to be of word chars,
+	not only a-z.
+	(org-agenda-get-blocks): Allow multiple blocks per headline.
+	(org-timestamp-change): Call `org-clock-update-time-maybe'.
+	(org-export-html-title-format)
+	(org-export-html-toplevel-hlevel): New options.
+	(org-export-language-setup): Add support for Czech.
+	(org-mode, org-insert-todo-heading, org-find-visible)
+	(org-find-invisible, org-invisible-p, org-invisible-p2)
+	(org-back-to-heading, org-on-heading-p, org-up-heading-all)
+	(org-show-subtree, org-show-entry, org-make-options-regexp):
+	Remove compatibility support for old outline-mode.
+	(org-check-occur-regexp): Funtion removed.
+	(org-on-heading-p, org-back-to-heading): Made defalias.
+	(org-set-local): New defsubst.
+	(org-set-regexps-and-options, org-mode)
+	(org-set-font-lock-defaults, org-edit-agenda-file-list)
+	(org-timeline, org-agenda-list, org-todo-list, org-tags-view)
+	(org-remember-apply-template, org-table-edit-field)
+	(org-table-edit-formulas, orgtbl-mode, org-export-as-ascii)
+	(org-set-autofill-regexps): Use `org-set-local'.
+	(org-table-eval-formula): Fix bug with parsing of display flags.
+
+2006-08-15  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-info-stack-custom): Indicate selected
+	frame with fringe arrow.  Suggested by Simon Marshall
+	<simon.marshall@misys.com>.
+	(gdb-stack-position): New variable.
+	(gdb-starting, gdb-exited): Reset gdb-stack-position to nil.
+	(gdb-frames-mode): Set gdb-stack-position to nil.
+	Add to overlay-arrow-variable-list
+	(gdb-reset): Delete gdb-stack-position from above list.
+
+2006-08-14  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* term/x-win.el (menu-bar-edit-menu): Disable paste if buffer is
+	read only.
+
+2006-08-13  Romain Francoise  <romain@orebokech.com>
+
+	* cus-theme.el (customize-create-theme)
+	(custom-theme-visit-theme): End `y-or-n-p' prompt with a space.
+
+	* filesets.el (filesets-add-buffer): Ditto.
+
+	* pcvs.el (cvs-change-cvsroot): Ditto.
+
+2006-08-13  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-frame-separate-io-buffer)
+	(gdb-use-separate-io-buffer, menu): Avoid using `inferior' in text.
+	(gdb-memory-mode, gdb-locals-watch-map): Don't quote lambda
+	expressions.
+	(gdb-info-breakpoints-custom): Use gdb-breakpoint-regexp.
+	Only search till end of line.
+	Add face to function names in case of no filename.
+	Add face to variable names of watchpoints.
+
+2006-08-12  Robert Thorpe  <rthorpe@realworldtech.com>  (tiny change)
+
+	* cus-start.el <indent-tabs-mode>: Move to the `indent'
+	customization group.
+
+2006-08-12  Ken Manheimer  <ken.manheimer@gmail.com>
+
+	* allout.el (allout-prior-bindings, allout-added-bindings):
+	Remove, after long deprecation.
+	(allout-beginning-of-line-cycles, allout-end-of-line-cycles):
+	Add customization vars controlling allout-beginning-of-line and
+	allout-end-of-line conveniences.
+	(allout-header-prefix, allout-use-mode-specific-leader)
+	(allout-use-mode-specific-leader, allout-mode-leaders):
+	Revise docstrings.
+	(allout-infer-header-lead): Change to be an alias for
+	allout-infer-header-lead-and-primary-bullet.
+	(allout-infer-header-lead-and-primary-bullet): New version of
+	allout-infer-header-lead which assigns the primary bullet to the
+	same as the header lead, when its being changed.
+	(allout-infer-body-reindent): Apply regexp-quote instead of
+	unconditionally prepending "\\", so that all literal
+	allout-header-prefix and allout-primary-bullet strings are
+	properly handled.
+	(allout-add-resumptions): Add optional qualifier for extending or
+	appending to existing values, rather than replacing them.
+	(allout-view-change-hook): Clarify docstring.
+	(allout-exposure-change-hook): Take explicit arguments, via
+	run-hook-with-args.
+	(allout-structure-added-hook)
+	(allout-structure-deleted-hook)
+	(allout-structure-shifted-hook): New hooks analogous to
+	allout-exposure-change-hook for other kinds of structural outline
+	edits.
+	(allout-encryption-plaintext-sanitization-regexps): New encryption
+	customization variable, by which cooperating modes can provde
+	massage of the plaintext without actually being passed it.
+	(allout-encryption-ciphertext-rejection-regexps)
+	(allout-encryption-ciphertext-rejection-ceiling): New encryption
+	customization variables, by which cooperating modes can prohibit
+	rare but possible ciphertext patterns from fouling their
+	operation, with actually being passed the ciphertext.
+	(allout-mode): Run activation and deactivation hooks after the
+	minor-mode variable has been toggled, to clarify the mode
+	disposition.  The new encryption ciphertext rejection variable is
+	used to ensure that the ciphertext does not contain text that
+	would be recognized as outline structural elements by allout.
+	Substite allout-beginning-of-line and allout-end-of-line for
+	conventionall beginning-of-line and end-of-line bindings.
+	If allout-old-style-prefixes is non-nil, don't nullify it on mode
+	activation!
+	(allout-beginning-of-line): Respect `allout-beginning-of-line-cycles'.
+	(allout-end-of-line): Respect `allout-end-of-line-cycles'.
+	(allout-chart-subtree): Implement new mode, charting only the
+	visible items in the subtree, when new 'visible' parameter is non-nil.
+	(allout-end-of-subtree): Properly handle the last item in the buffer.
+	(allout-pre-command-business, allout-command-counter):
+	Increment an advertised counter so that cooperating enhancements can
+	track revisions of items.
+	(allout-open-topic): Run allout-structure-added-hook with suitable
+	arguments.
+	(allout-shift-in): Run allout-structure-shifted-hook with suitable
+	arguments.
+	(allout-shift-out): Fix doubling for negative args and ensure call
+	of allout-structure-shifted-hook by solely using allout-shift-in.
+	(allout-kill-line, allout-kill-topic):
+	Run allout-structure-deleted-hook with suitable arguments.
+	(allout-yank-processing): Run allout-structure-added-hook with
+	proper arguments.
+	(allout-yank): Enclose activity in allout-unprotected.
+	(allout-flag-region): Run allout-exposure-change-hook with
+	suitable arguments, instead of making the callee infer the arguments.
+	(allout-encrypt-string):
+	Support allout-encryption-plaintext-sanitization-regexps,
+	allout-encryption-ciphertext-rejection-regexps, and
+	allout-encryption-ciphertext-rejection-ceiling.  Indicate correct
+	en/de cryption mode in symmetric encryption failure message.
+	(allout-obtain-passphrase): Use copy-sequence to get a distinct
+	copy of the passphrase, and don't zero it or we'll corrupt the
+	stashed copy.
+	(allout-create-encryption-passphrase-verifier)
+	(allout-verify-passphrase): Respect the new signature for
+	allout-encrypt-string.
+	(allout-get-configvar-values): Convenience for getting a
+	configuration variable value and handling its absence gracefully.
+
+2006-08-11  Romain Francoise  <romain@orebokech.com>
+
+	* obsolete/zone-mode.el: Delete.
+
+2006-08-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* textmodes/dns-mode.el (dns-mode): Use before-save-hook.
+
+2006-08-11  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* emacs-lisp/bindat.el (bindat-ip-to-string):
+	Use `format-network-address' if possible.
+
+2006-08-11  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* x-dnd.el (x-dnd-init-frame): Call x-register-dnd-atom.
+
+2006-08-10  Chong Yidong  <cyd@stupidchicken.com>
+
+	* emacs-lisp/edebug.el (edebug-recursive-edit): Don't save and
+	restore unread-command-events here.
+	(edebug-display): Do it here, to detect sit-for interruptions.
+
+2006-08-10  Romain Francoise  <romain@orebokech.com>
+
+	* textmodes/dns-mode.el: Alias `zone-mode' to `dns-mode'.
+	(dns-mode-soa-auto-increment-serial): New user option.
+	(dns-mode-soa-maybe-increment-serial): New function.
+	(dns-mode): Add the latter to `write-contents-functions'.
+
+	* obsolete/zone-mode.el: Move to obsolete/ from net/.
+	Delete autoload cookies.
+
+2006-08-10  John Wiegley  <johnw@newartisans.com>
+
+	* eshell/em-glob.el (eshell-glob-chars-list)
+	(eshell-glob-translate-alist): Add support for [^g] in character globs.
+
+2006-08-10  Richard Stallman  <rms@gnu.org>
+
+	* facemenu.el (facemenu-add-face): Pass frame to facemenu-active-faces.
+	(facemenu-set-face): Doc fix.
+	(facemenu-listed-faces): Doc fix.
+
+2006-08-09  Chong Yidong  <cyd@stupidchicken.com>
+
+	* avoid.el (mouse-avoidance-animating-pointer): New var.
+	(mouse-avoidance-nudge-mouse): Use it.
+	(mouse-avoidance-banish): Rename from mouse-avoidance-banish-hook.
+	(mouse-avoidance-exile): Rename from mouse-avoidance-exile-hook
+	(mouse-avoidance-fancy): Rename from mouse-avoidance-fancy-hook.
+	Don't activate if currently animating.  All callers changed.
+
+2006-08-09  John Wiegley  <johnw@newartisans.com>
+
+	* calendar/timeclock.el (timeclock-use-elapsed): Added a new
+	variable, which causes timeclock to report elapsed time worked,
+	instead of just work remaining.
+
+2006-08-09  Kenichi Handa  <handa@m17n.org>
+
+	* international/latexenc.el (latexenc-find-file-coding-system):
+	Fix for the case that the 2nd element of arg-list is a cons.
+
+2006-08-08  Chong Yidong  <cyd@stupidchicken.com>
+
+	* info.el (Info-fontify-node): Handle preceding `in' for note
+	reference hiding rules.
+
+2006-08-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/sh-script.el (sh-quoted-subshell): Make sure we don't
+	mistake a closing " for an opening one.
+
+2006-08-07  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* term/xterm.el (terminal-init-xterm): Add more key bindings.
+
+2006-08-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* complete.el (PC-do-completion): Filter out completions matching
+	completion-ignored-extensions before checking whether there are
+	multiple completions.
+	Don't use `list' unnecessarily when building completion tables.
+
+2006-08-06  Richard Stallman  <rms@gnu.org>
+
+	* help.el (describe-mode): Make minor mode list more concise.
+
+2006-08-05  Chong Yidong  <cyd@stupidchicken.com>
+
+	* bindings.el: Give mode-line-format, mode-line-modes, and
+	mode-line-position `standard-value' properties.
+
+2006-08-05  Eli Zaretskii  <eliz@gnu.org>
+
+	* buff-menu.el (list-buffers-noselect): For Info buffers, use
+	"(file)node" instead of the file name.
+
+2006-08-05  Richard Stallman  <rms@gnu.org>
+
+	* faces.el (escape-glyph): Doc fix.
+
+2006-08-04  Kenichi Handa  <handa@m17n.org>
+
+	* international/mule-diag.el (describe-font): Improve docstring
+	and error message.  Use frame-parameter (not frame-parameters).
+
+2006-08-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/gud.el (gdb-script-font-lock-syntactic-keywords):
+	Correctly mark the end-of-docstring char.
+
+2006-08-03  Chong Yidong  <cyd@stupidchicken.com>
+
+	* simple.el (line-move-to-column): Constrain move-to-column to
+	current field.
+
+2006-08-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* font-lock.el (font-lock-beg, font-lock-end)
+	(font-lock-extend-region-functions): New vars.
+	(font-lock-extend-region-multiline)
+	(font-lock-extend-region-wholelines): New functions.
+	(font-lock-default-fontify-region): Use them.
+	(font-lock-extend-jit-lock-region-after-change): Only round up
+	if font-lock-default-fontify-region will do it as well.
+
+	* font-lock.el (font-lock-extend-after-change-region-function):
+	Rename from font-lock-extend-region-function.
+	(font-lock-extend-region): Remove by inlining at call sites.
+	(font-lock-after-change-function): Don't needlessly round up to a whole
+	number of lines.
+	(font-lock-extend-jit-lock-region-after-change): Be more careful about
+	the boundary conditions and the interactions between the various ways
+	to extend the region.
+
+2006-08-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* jit-lock.el (jit-lock-fontify-now): Preserve the buffer's
+	modification status when forcing the second redisplay.
+
+2006-08-03  Kim F. Storm  <storm@cua.dk>
+
+	* edmacro.el (edmacro-fix-menu-commands): Ignore switch-frame.
+
+2006-08-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* pcvs-util.el (cvs-get-buffer-create): Obey `noreuse' even if `name'
+	doesn't look like a file name.
+
+	* complete.el (PC-expand-many-files): Avoid signalling an error when
+	the current directory doesn't exist.  Reported by Micha,Ak(Bl Cadilhac.
+
+2006-08-02  Andreas Schwab  <schwab@suse.de>
+
+	* bindings.el (mode-line-format): Simplify reference to vc-mode.
+
+2006-08-02  Nick Roberts  <nickrob@snap.net.nz>
+
+	* bindings.el (map): Make mode-line-buffer-identification-keymap
+	before defining propertized-buffer-identification.
+
+2006-08-01  Richard Stallman  <rms@gnu.org>
+
+	* bindings.el (mode-line-format): Adjust spacing around vc-mode.
+
+2006-08-02  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-find-source-frame): Make nil the
+	default value.
+	(gdb-find-source-frame): New function.
+	(menu): Add to menu bar.
+
+2006-08-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* font-core.el (font-lock-extend-region-function)
+	(font-lock-extend-region): Move to font-lock.el.
+
+	* font-lock.el (font-lock-extend-region-function)
+	(font-lock-extend-region): Move from font-core.el.  Simplify.
+
+	* jit-lock.el (jit-lock-fontify-now): Cause a second redisplay
+	if needed.
+	(jit-lock-start, jit-lock-end): New dynamic scoped vars.
+	(jit-lock-after-change-extend-region-functions): New hook.
+	(jit-lock-after-change): Use it instead of hard-coding font-lock code.
+
+	* font-lock.el (font-lock-extend-jit-lock-region-after-change): New fun.
+	(font-lock-turn-on-thing-lock): Use it.
+
+	* longlines.el (longlines-show-region): Make it work on read-only
+	buffers as well.
+
+2006-08-01  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-set-hollow): Check for gud-last-last-frame.
+
+2006-07-31  Richard Stallman  <rms@gnu.org>
+
+	* progmodes/vhdl-mode.el (vhdl-speedbar-display-directory)
+	(vhdl-speedbar-display-projects): Update old obsolete
+	speedbar variable names.
+
+2006-07-31  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-find-source-frame): New option.
+	(gdb-stopped): Use it.
+
+	* t-mouse.el (t-mouse-mode): Use set-process-query-on-exit-flag.
+
+2006-07-29  Chong Yidong  <cyd@stupidchicken.com>
+
+	* loadhist.el (unload-feature): Handle new `(t . SYMBOL)' format
+	for load-history elements.
+
+2006-07-29  Eli Zaretskii  <eliz@gnu.org>
+
+	* files.el (convert-standard-filename): For Cygwin, replace
+	characters not allowed in Windows file names.
+	(make-auto-save-file-name): Add Cygwin to the list of systems
+	where the auto-save file name needs to be run through
+	convert-standard-filename.
+
+2006-07-29  Lennart Borgman  <lennart.borgman.073@student.lu.se>
+
+	* window.el (bw-get-tree): Don't integerp subtree if it's nil.
+
+2006-07-28  Richard Stallman  <rms@gnu.org>
+
+	* bindings.el (mode-line-frame-identification)
+	(propertized-buffer-identification): Centralize the code
+	to initialize the variable.
+
+	* progmodes/grep.el (grep-default-command): Catch errors from
+	wildcard-to-regexp.
+
+2006-07-29  Kim F. Storm  <storm@cua.dk>
+
+	* progmodes/grep.el (grep-tag-default): New function.
+	(grep-default-command, grep-read-regexp): Use it.
+	(grep-read-files): Use car of grep-files-history or grep-files-aliases
+	as default if nothing else applies.
+
+2006-07-28  Bill Atkins  <atkinw@rpi.edu>  (tiny change)
+
+	* wdired.el (wdired-change-to-wdired-mode, wdired-change-to-dired-mode):
+	Throw error if buffer is not in Dired and Wdired mode, respectively.
+
+2006-07-28  Chong Yidong  <cyd@stupidchicken.com>
+
+	* cus-edit.el (custom-no-edit): Revert 2006-07-27 change, so that
+	self-insert-command keys don't activate buttons.
+	(custom-mode-map): Just don't bind "\C-m" to `custom-no-edit'.
+
+2006-07-29  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-info-breakpoints-custom): Use different
+	faces for enable character.
+
 2006-07-28  Nick Roberts  <nickrob@snap.net.nz>
 
 	* Makefile.in (recompile): Update comment to reflect change
@@ -31,9 +735,9 @@
 
 2006-07-26  Mathias Dahl  <mathias.dahl@gmail.com>
 
-	* tumme.el (tumme-backward-image): Add prefix argument. Add error
+	* tumme.el (tumme-backward-image): Add prefix argument.  Add error
 	when at first image.
-	(tumme-forward-image): Add prefix argument. Add error when at last
+	(tumme-forward-image): Add prefix argument.  Add error when at last
 	image.
 
 2006-07-25  Stefan Monnier  <monnier@iro.umontreal.ca>
@@ -45,10 +749,10 @@
 
 	* tumme.el (tumme-track-original-file): Add `buffer-live-p' check.
 	(tumme-format-properties-string): Handle empty `buf'.
-	(tumme-get-comment): Change variable names inside `let'.  Add
-	missing `let' variable that cause font-lock problems.
-	(tumme-write-comments): Change variable names inside `let'.  Add
-	missing `let' variable that cause font-lock problems.
+	(tumme-get-comment): Change variable names inside `let'.
+	Add missing `let' variable that cause font-lock problems.
+	(tumme-write-comments): Change variable names inside `let'.
+	Add missing `let' variable that cause font-lock problems.
 	(tumme-forward-image): Rename from `tumme-forward-char'.
 	(tumme-backward-image): Rename from `tumme-backward-char'.
 
@@ -97,8 +801,8 @@
 2006-07-24  Daiki Ueno  <ueno@unixuser.org>
 
 	* pgg-def.el (pgg-truncate-key-identifier): Truncate the key ID to 8
-	letters from the end.  Thanks to "David Smith" <davidsmith@acm.org> and
-	andreas@altroot.de (Andreas V,Av(Bgele)
+	letters from the end.  Thanks to "David Smith" <davidsmith@acm.org>
+	and andreas@altroot.de (Andreas V,Av(Bgele).
 
 2006-07-23  Thien-Thi Nguyen  <ttn@gnu.org>
 
@@ -137,7 +841,7 @@
 2006-07-21  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* term/xterm.el (terminal-init-xterm): Fix key bindings
-	syntax. Bind S-return, C-M-., C-TAB, S-TAB and C-S-TAB.
+	syntax.  Bind S-return, C-M-., C-TAB, S-TAB and C-S-TAB.
 
 2006-07-21  Eli Zaretskii  <eliz@gnu.org>
 
@@ -173,7 +877,7 @@
 
 	* calc.el (calc-previous-alg-entry):  Remove variable.
 
-	* calc-aent.el  (calc-alg-entry-history, calc-quick-calc-history):
+	* calc-aent.el (calc-alg-entry-history, calc-quick-calc-history):
 	New variables.
 	(calc-alg-entry): Use `calc-alg-entry-history'.
 	(calc-do-quick-calc): Use `calc-quick-calc-history'.
@@ -497,8 +1201,8 @@
 
 2006-07-10  Chong Yidong  <cyd@stupidchicken.com>
 
-	* progmodes/cc-awk.el (defconst): Use eval-and-compile to avoid
-	compilation error.
+	* progmodes/cc-awk.el (c-awk-escaped-nls*): Use eval-and-compile to
+	avoid compilation error.
 
 	* subr.el (sit-for): New function.
 
--- a/lisp/allout.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/allout.el	Sat Oct 14 16:56:21 2006 +0000
@@ -213,15 +213,73 @@
 (put 'allout-show-bodies 'safe-local-variable
      (if (fboundp 'booleanp) 'booleanp '(lambda (x) (member x '(t nil)))))
 
+;;;_  = allout-beginning-of-line-cycles
+(defcustom allout-beginning-of-line-cycles t
+  "*If non-nil, \\[allout-beginning-of-line] will cycle through smart-placement options.
+
+Cycling only happens on when the command is repeated, not when it
+follows a different command.
+
+Smart-placement means that repeated calls to this function will
+advance as follows:
+
+ - if the cursor is on a non-headline body line and not on the first column:
+   then it goes to the first column
+ - if the cursor is on the first column of a non-headline body line:
+   then it goes to the start of the headline within the item body
+ - if the cursor is on the headline and not the start of the headline:
+   then it goes to the start of the headline
+ - if the cursor is on the start of the headline:
+   then it goes to the bullet character \(for hotspot navigation\)
+ - if the cursor is on the bullet character:
+   then it goes to the first column of that line \(the headline\)
+ - if the cursor is on the first column of the headline:
+   then it goes to the start of the headline within the item body.
+
+In this fashion, you can use the beginning-of-line command to do
+its normal job and then, when repeated, advance through the
+entry, cycling back to start.
+
+If this configuration variable is nil, then the cursor is just
+advanced to the beginning of the line and remains there on
+repeated calls."
+  :type 'boolean :group 'allout)
+;;;_  = allout-end-of-line-cycles
+(defcustom allout-end-of-line-cycles t
+  "*If non-nil, \\[allout-end-of-line] will cycle through smart-placement options.
+
+Cycling only happens on when the command is repeated, not when it
+follows a different command.
+
+Smart-placement means that repeated calls to this function will
+advance as follows:
+
+ - if the cursor is not on the end-of-line,
+   then it goes to the end-of-line
+ - if the cursor is on the end-of-line but not the end-of-entry,
+   then it goes to the end-of-entry, exposing it if necessary
+ - if the cursor is on the end-of-entry,
+   then it goes to the end of the head line
+
+In this fashion, you can use the end-of-line command to do its
+normal job and then, when repeated, advance through the entry,
+cycling back to start.
+
+If this configuration variable is nil, then the cursor is just
+advanced to the end of the line and remains there on repeated
+calls."
+  :type 'boolean :group 'allout)
+
 ;;;_  = allout-header-prefix
 (defcustom allout-header-prefix "."
+;; this string is treated as literal match.  it will be `regexp-quote'd, so
+;; one cannot use regular expressions to match varying header prefixes.
   "*Leading string which helps distinguish topic headers.
 
 Outline topic header lines are identified by a leading topic
 header prefix, which mostly have the value of this var at their front.
-\(Level 1 topics are exceptions.  They consist of only a single
-character, which is typically set to the `allout-primary-bullet'.  Many
-outlines start at level 2 to avoid this discrepancy."
+Level 1 topics are exceptions.  They consist of only a single
+character, which is typically set to the `allout-primary-bullet'."
   :type 'string
   :group 'allout)
 (make-variable-buffer-local 'allout-header-prefix)
@@ -300,11 +358,13 @@
 (defcustom allout-use-mode-specific-leader t
   "*When non-nil, use mode-specific topic-header prefixes.
 
-Allout outline mode will use the mode-specific `allout-mode-leaders'
-and/or comment-start string, if any, to lead the topic prefix string,
-so topic headers look like comments in the programming language.
-
-String values are used as they stand.
+Allout outline mode will use the mode-specific `allout-mode-leaders' or
+comment-start string, if any, to lead the topic prefix string, so topic
+headers look like comments in the programming language.  It will also use
+the comment-start string, with an '_' appended, for `allout-primary-bullet'.
+
+String values are used as literals, not regular expressions, so
+do not escape any regulare-expression characters.
 
 Value t means to first check for assoc value in `allout-mode-leaders'
 alist, then use comment-start string, if any, then use default \(`.').
@@ -313,15 +373,17 @@
 Set to the symbol for either of `allout-mode-leaders' or
 `comment-start' to use only one of them, respectively.
 
-Value nil means to always use the default \(`.').
-
-comment-start strings that do not end in spaces are tripled, and an
-`_' underscore is tacked on the end, to distinguish them from regular
-comment strings.  comment-start strings that do end in spaces are not
-tripled, but an underscore is substituted for the space. [This
-presumes that the space is for appearance, not comment syntax.  You
-can use `allout-mode-leaders' to override this behavior, when
-incorrect.]"
+Value nil means to always use the default \(`.') and leave
+`allout-primary-bullet' unaltered.
+
+comment-start strings that do not end in spaces are tripled in
+the header-prefix, and an `_' underscore is tacked on the end, to
+distinguish them from regular comment strings.  comment-start
+strings that do end in spaces are not tripled, but an underscore
+is substituted for the space. [This presumes that the space is
+for appearance, not comment syntax.  You can use
+`allout-mode-leaders' to override this behavior, when
+undesired.]"
   :type '(choice (const t) (const nil) string
 		 (const allout-mode-leaders)
 		 (const comment-start))
@@ -334,13 +396,14 @@
 (defvar allout-mode-leaders '()
   "Specific allout-prefix leading strings per major modes.
 
-Entries will be used instead or in lieu of mode-specific
-comment-start strings.  See also `allout-use-mode-specific-leader'.
+Use this if the mode's comment-start string isn't what you
+prefer, or if the mode lacks a comment-start string.  See
+`allout-use-mode-specific-leader' for more details.
 
 If you're constructing a string that will comment-out outline
 structuring so it can be included in program code, append an extra
 character, like an \"_\" underscore, to distinguish the lead string
-from regular comments that start at bol.")
+from regular comments that start at the beginning-of-line.")
 
 ;;;_  = allout-old-style-prefixes
 (defcustom allout-old-style-prefixes nil
@@ -828,9 +891,9 @@
   (setq allout-reindent-bodies nil)
   (allout-reset-header-lead header-lead)
   header-lead)
-;;;_   > allout-infer-header-lead ()
-(defun allout-infer-header-lead ()
-  "Determine appropriate `allout-header-prefix'.
+;;;_   > allout-infer-header-lead-and-primary-bullet ()
+(defun allout-infer-header-lead-and-primary-bullet ()
+  "Determine appropriate `allout-header-prefix' and `allout-primary-bullet'.
 
 Works according to settings of:
 
@@ -874,10 +937,14 @@
 			"_")))))))
     (if (not leader)
 	nil
-      (if (string= leader allout-header-prefix)
-	  nil				; no change, nothing to do.
-	(setq allout-header-prefix leader)
-	allout-header-prefix))))
+      (setq allout-header-prefix leader)
+      (if (not allout-old-style-prefixes)
+          ;; setting allout-primary-bullet makes the top level topics use -
+          ;; actually, be - the special prefix:
+          (setq allout-primary-bullet leader))
+      allout-header-prefix)))
+(defalias 'allout-infer-header-lead
+  'allout-infer-header-lead-and-primary-bullet)
 ;;;_   > allout-infer-body-reindent ()
 (defun allout-infer-body-reindent ()
   "Determine proper setting for `allout-reindent-bodies'.
@@ -930,13 +997,13 @@
   (setq allout-plain-bullets-string-len (length allout-plain-bullets-string))
   (setq allout-header-subtraction (1- (length allout-header-prefix)))
   ;; Produce the new allout-regexp:
-  (setq allout-regexp (concat "\\(\\"
-                               allout-header-prefix
-                               "[ \t]*["
-                               allout-bullets-string
-                               "]\\)\\|\\"
-                               allout-primary-bullet
-                               "+\\|\^l"))
+  (setq allout-regexp (concat "\\("
+                              (regexp-quote allout-header-prefix)
+                              "[ \t]*["
+                              allout-bullets-string
+                              "]\\)\\|"
+                              (regexp-quote allout-primary-bullet)
+                              "+\\|\^l"))
   (setq allout-line-boundary-regexp
         (concat "\\(\n\\)\\(" allout-regexp "\\)"))
   (setq allout-bob-regexp
@@ -965,16 +1032,6 @@
 			      (car (cdr cell)))))))
 	    keymap-list)
     map))
-;;;_   = allout-prior-bindings - being deprecated.
-(defvar allout-prior-bindings nil
-  "Variable for use in V18, with allout-added-bindings, for
-resurrecting, on mode deactivation, bindings that existed before
-activation.  Being deprecated.")
-;;;_   = allout-added-bindings - being deprecated
-(defvar allout-added-bindings nil
-  "Variable for use in V18, with allout-prior-bindings, for
-resurrecting, on mode deactivation, bindings that existed before
-activation.  Being deprecated.")
 ;;;_  : Menu bar
 (defvar allout-mode-exposure-menu)
 (defvar allout-mode-editing-menu)
@@ -1050,43 +1107,65 @@
 (make-variable-buffer-local 'allout-mode-prior-settings)
 ;;;_   > allout-add-resumptions (&rest pairs)
 (defun allout-add-resumptions (&rest pairs)
-  "Set name/value pairs.
+  "Set name/value PAIRS.
 
 Old settings are preserved for later resumption using `allout-do-resumptions'.
 
+The new values are set as a buffer local.  On resumption, the prior buffer
+scope of the variable is restored along with its value.  If it was a void
+buffer-local value, then it is left as nil on resumption.
+
 The pairs are lists whose car is the name of the variable and car of the
-cdr is the new value:  '(some-var some-value)'.
-
-The new value is set as a buffer local.
-
-If the variable was not previously buffer-local, then that is noted and the
-`allout-do-resumptions' will just `kill-local-variable' of that binding.
-
-If it previously was buffer-local, the old value is noted and resurrected
-by `allout-do-resumptions'.  \(If the local value was previously void, then
-it is left as nil on resumption.\)
+cdr is the new value: '(some-var some-value)'.  The pairs can actually be
+triples, where the third element qualifies the disposition of the setting,
+as described further below.
+
+If the optional third element is the symbol 'extend, then the new value
+created by `cons'ing the second element of the pair onto the front of the
+existing value.
+
+If the optional third element is the symbol 'append, then the new value is
+extended from the existing one by `append'ing a list containing the second
+element of the pair onto the end of the existing value.
+
+Extension, and resumptions in general, should not be used for hook
+functions - use the 'local mode of `add-hook' for that, instead.
 
 The settings are stored on `allout-mode-prior-settings'."
   (while pairs
     (let* ((pair (pop pairs))
            (name (car pair))
-           (value (cadr pair)))
+           (value (cadr pair))
+           (qualifier (if (> (length pair) 2)
+                          (caddr pair)))
+           prior-value)
       (if (not (symbolp name))
           (error "Pair's name, %S, must be a symbol, not %s"
                  name (type-of name)))
+      (setq prior-value (condition-case err
+                            (symbol-value name)
+                          (void-variable nil)))
       (when (not (assoc name allout-mode-prior-settings))
         ;; Not already added as a resumption, create the prior setting entry.
         (if (local-variable-p name)
             ;; is already local variable - preserve the prior value:
-            (push (list name (condition-case err
-                                 (symbol-value name)
-                               (void-variable nil)))
-                  allout-mode-prior-settings)
+            (push (list name prior-value) allout-mode-prior-settings)
           ;; wasn't local variable, indicate so for resumption by killing
           ;; local value, and make it local:
           (push (list name) allout-mode-prior-settings)
           (make-local-variable name)))
-      (set name value))))
+      (if qualifier
+          (cond ((eq qualifier 'extend)
+                 (if (not (listp prior-value))
+                     (error "extension of non-list prior value attempted")
+                   (set name (cons value prior-value))))
+                ((eq qualifier 'append)
+                 (if (not (listp prior-value))
+                     (error "appending of non-list prior value attempted")
+                   (set name (append prior-value (list value)))))
+                (t (error "unrecognized setting qualifier `%s' encountered"
+                          qualifier)))
+        (set name value)))))
 ;;;_   > allout-do-resumptions ()
 (defun allout-do-resumptions ()
   "Resume all name/value settings registered by `allout-add-resumptions'.
@@ -1121,18 +1200,67 @@
   "Symbol for use as allout invisible-text overlay category.")
 ;;;_   x allout-view-change-hook
 (defvar allout-view-change-hook nil
-  "*\(Deprecated\)  Hook that's run after allout outline exposure changes.
-
-Switch to using `allout-exposure-change-hook' instead.  Both
-variables are currently respected, but this one will be ignored
-in a subsequent allout version.")
+  "*\(Deprecated\) A hook run after allout outline exposure changes.
+
+Switch to using `allout-exposure-change-hook' instead.  Both hooks are
+currently respected, but the other conveys the details of the exposure
+change via explicit parameters, and this one will eventually be disabled in
+a subsequent allout version.")
 ;;;_   = allout-exposure-change-hook
 (defvar allout-exposure-change-hook nil
-  "*Hook that's run after allout outline exposure changes.
-
-This variable will replace `allout-view-change-hook' in a subsequent allout
-version, though both are currently respected.")
-
+  "*Hook that's run after allout outline subtree exposure changes.
+
+It is run at the conclusion of `allout-flag-region'.
+
+Functions on the hook must take three arguments:
+
+ - from - integer indicating the point at the start of the change.
+ - to - integer indicating the point of the end of the change.
+ - flag - change mode: nil for exposure, otherwise concealment.
+
+This hook might be invoked multiple times by a single command.
+
+This hook is replacing `allout-view-change-hook', which is being deprecated
+and eventually will not be invoked.")
+;;;_   = allout-structure-added-hook
+(defvar allout-structure-added-hook nil
+  "*Hook that's run after addition of items to the outline.
+
+Functions on the hook should take two arguments:
+
+ - new-start - integer indicating the point at the start of the first new item.
+ - new-end - integer indicating the point of the end of the last new item.
+
+Some edits that introduce new items may missed by this hook -
+specifically edits that native allout routines do not control.
+
+This hook might be invoked multiple times by a single command.")
+;;;_   = allout-structure-deleted-hook
+(defvar allout-structure-deleted-hook nil
+  "*Hook that's run after disciplined deletion of subtrees from the outline.
+
+Functions on the hook must take two arguments:
+
+ - depth - integer indicating the depth of the subtree that was deleted.
+ - removed-from - integer indicating the point where the subtree was removed.
+
+Some edits that remove or invalidate items may missed by this hook -
+specifically edits that native allout routines do not control.
+
+This hook might be invoked multiple times by a single command.")
+;;;_   = allout-structure-shifted-hook
+(defvar allout-structure-shifted-hook nil
+  "*Hook that's run after shifting of items in the outline.
+
+Functions on the hook should take two arguments:
+
+ - depth-change - integer indicating depth increase, negative for decrease
+ - start - integer indicating the start point of the shifted parent item.
+
+Some edits that shift items can be missed by this hook - specifically edits
+that native allout routines do not control.
+
+This hook might be invoked multiple times by a single command.")
 ;;;_   = allout-outside-normal-auto-fill-function
 (defvar allout-outside-normal-auto-fill-function nil
   "Value of normal-auto-fill-function outside of allout mode.
@@ -1186,6 +1314,42 @@
 This is used to decrypt the topic that was currently being edited, if it
 was encrypted automatically as part of a file write or autosave.")
 (make-variable-buffer-local 'allout-after-save-decrypt)
+;;;_   = allout-encryption-plaintext-sanitization-regexps
+(defvar allout-encryption-plaintext-sanitization-regexps nil
+  "List of regexps whose matches are removed from plaintext before encryption.
+
+This is for the sake of removing artifacts, like escapes, that are added on
+and not actually part of the original plaintext.  The removal is done just
+prior to encryption.
+
+Entries must be symbols that are bound to the desired values.
+
+Each value can be a regexp or a list with a regexp followed by a
+substitution string.  If it's just a regexp, all its matches are removed
+before the text is encrypted.  If it's a regexp and a substitution, the
+substition is used against the regexp matches, a la `replace-match'.")
+(make-variable-buffer-local 'allout-encryption-text-removal-regexps)
+;;;_   = allout-encryption-ciphertext-rejection-regexps
+(defvar allout-encryption-ciphertext-rejection-regexps nil
+  "Variable for regexps matching plaintext to remove before encryption.
+
+This is for the sake of redoing encryption in cases where the ciphertext
+incidentally contains strings that would disrupt mode operation -
+for example, a line that happens to look like an allout-mode topic prefix.
+
+Entries must be symbols that are bound to the desired regexp values.
+
+The encryption will be retried up to
+`allout-encryption-ciphertext-rejection-limit' times, after which an error
+is raised.")
+
+(make-variable-buffer-local 'allout-encryption-ciphertext-rejection-regexps)
+;;;_   = allout-encryption-ciphertext-rejection-ceiling
+(defvar allout-encryption-ciphertext-rejection-ceiling 5
+  "Limit on number of times encryption ciphertext is rejected.
+
+See `allout-encryption-ciphertext-rejection-regexps' for rejection reasons.")
+(make-variable-buffer-local 'allout-encryption-ciphertext-rejection-ceiling)
 ;;;_   > allout-mode-p ()
 ;; Must define this macro above any uses, or byte compilation will lack
 ;; proper def, if file isn't loaded - eg, during emacs build!
@@ -1637,16 +1801,15 @@
       (remove-overlays (point-min) (point-max)
                        'category 'allout-exposure-category)
 
-      (run-hooks 'allout-mode-deactivate-hook)
-      (setq allout-mode nil))
+      (setq allout-mode nil)
+      (run-hooks 'allout-mode-deactivate-hook))
 
      ;; Activation:
      ((not active)
       (setq allout-explicitly-deactivated nil)
       (if allout-old-style-prefixes
           ;; Inhibit all the fancy formatting:
-          (allout-add-resumptions '((allout-primary-bullet "*")
-                                    (allout-old-style-prefixes ()))))
+          (allout-add-resumptions '(allout-primary-bullet "*")))
 
       (allout-overlay-preparations)     ; Doesn't hurt to redo this.
 
@@ -1654,15 +1817,28 @@
       (allout-infer-body-reindent)
 
       (set-allout-regexp)
+      (allout-add-resumptions
+       '(allout-encryption-ciphertext-rejection-regexps
+         allout-line-boundary-regexp
+         extend)
+       '(allout-encryption-ciphertext-rejection-regexps
+         allout-bob-regexp
+         extend))
 
       ;; Produce map from current version of allout-keybindings-list:
       (setq allout-mode-map
             (produce-allout-mode-map allout-keybindings-list))
       (substitute-key-definition 'beginning-of-line
-                                 'move-beginning-of-line
+                                 'allout-beginning-of-line
+                                 allout-mode-map global-map)
+      (substitute-key-definition 'move-beginning-of-line
+                                 'allout-beginning-of-line
                                  allout-mode-map global-map)
       (substitute-key-definition 'end-of-line
-                                 'move-end-of-line
+                                 'allout-end-of-line
+                                 allout-mode-map global-map)
+      (substitute-key-definition 'move-end-of-line
+                                 'allout-end-of-line
                                  allout-mode-map global-map)
       (produce-allout-mode-menubar-entries)
       (fset 'allout-mode-map allout-mode-map)
@@ -1717,8 +1893,8 @@
       (if allout-layout
 	  (setq do-layout t))
 
-      (run-hooks 'allout-mode-hook)
-      (setq allout-mode t))
+      (setq allout-mode t)
+      (run-hooks 'allout-mode-hook))
 
      ;; Reactivation:
      ((setq do-layout t)
@@ -2044,6 +2220,52 @@
     (while (allout-hidden-p)
       (end-of-line)
       (if (allout-hidden-p) (forward-char 1)))))
+;;;_   > allout-beginning-of-line ()
+(defun allout-beginning-of-line ()
+  "Beginning-of-line with `allout-beginning-of-line-cycles' behavior, if set."
+
+  (interactive)
+
+  (if (or (not allout-beginning-of-line-cycles)
+          (not (equal last-command this-command)))
+      (move-beginning-of-line 1)
+    (let ((beginning-of-body (save-excursion
+                               (allout-beginning-of-current-entry)
+                               (point))))
+      (cond ((= (current-column) 0)
+             (allout-beginning-of-current-entry))
+            ((< (point) beginning-of-body)
+             (allout-beginning-of-current-line))
+            ((= (point) beginning-of-body)
+             (goto-char (allout-current-bullet-pos)))
+            (t (allout-beginning-of-current-line)
+               (if (< (point) beginning-of-body)
+                   ;; we were on the headline after its start:
+                   (allout-beginning-of-current-entry)))))))
+;;;_   > allout-end-of-line ()
+(defun allout-end-of-line ()
+  "End-of-line with `allout-end-of-line-cycles' behavior, if set."
+
+  (interactive)
+
+  (if (or (not allout-end-of-line-cycles)
+          (not (equal last-command this-command)))
+      (allout-end-of-current-line)
+    (let ((end-of-entry (save-excursion
+                          (allout-end-of-entry)
+                          (point))))
+      (cond ((not (eolp))
+             (allout-end-of-current-line))
+            ((or (allout-hidden-p) (save-excursion
+                                     (forward-char -1)
+                                     (allout-hidden-p)))
+             (allout-back-to-current-heading)
+             (allout-show-current-entry)
+             (allout-end-of-entry))
+            ((>= (point) end-of-entry)
+             (allout-back-to-current-heading)
+             (allout-end-of-current-line))
+            (t (allout-end-of-entry))))))
 ;;;_   > allout-next-heading ()
 (defsubst allout-next-heading ()
   "Move to the heading for the topic \(possibly invisible) after this one.
@@ -2108,13 +2330,17 @@
 ;;; for assessment or adjustment of the subtree, without redundant
 ;;; traversal of the structure.
 
-;;;_   > allout-chart-subtree (&optional levels orig-depth prev-depth)
-(defun allout-chart-subtree (&optional levels orig-depth prev-depth)
+;;;_   > allout-chart-subtree (&optional levels visible orig-depth prev-depth)
+(defun allout-chart-subtree (&optional levels visible orig-depth prev-depth)
   "Produce a location \"chart\" of subtopics of the containing topic.
 
 Optional argument LEVELS specifies the depth \(relative to start
-depth) for the chart.  Subsequent optional args are not for public
-use.
+depth) for the chart.
+
+When optional argument VISIBLE is non-nil, the chart includes
+only the visible subelements of the charted subjects.
+
+The remaining optional args are not for internal use by the function.
 
 Point is left at the end of the subtree.
 
@@ -2141,7 +2367,9 @@
 					; position to first offspring:
 	(progn (setq orig-depth (allout-depth))
 	       (or prev-depth (setq prev-depth (1+ orig-depth)))
-	       (allout-next-heading)))
+               (if visible
+                   (allout-next-visible-heading 1)
+                 (allout-next-heading))))
 
     ;; Loop over the current levels' siblings.  Besides being more
     ;; efficient than tail-recursing over a level, it avoids exceeding
@@ -2163,8 +2391,12 @@
 			       ;; next heading at lesser depth:
 			       (while (and (<= curr-depth
 					       (allout-recent-depth))
-					   (allout-next-heading))))
-			 (allout-next-heading)))
+                                           (if visible
+                                               (allout-next-visible-heading 1)
+                                             (allout-next-heading)))))
+                         (if visible
+                             (allout-next-visible-heading 1)
+                           (allout-next-heading))))
 
 		      ((and (< prev-depth curr-depth)
 			    (or (not levels)
@@ -2173,8 +2405,9 @@
 		       (setq chart
 			     (cons (allout-chart-subtree (and levels
 							       (1- levels))
-							  orig-depth
-							  curr-depth)
+                                                         visible
+                                                         orig-depth
+                                                         curr-depth)
 				   chart))
 		       ;; ... then continue with this one.
 		       )
@@ -2369,7 +2602,9 @@
     (while (and (not (eobp))
                 (> (allout-recent-depth) level))
       (allout-next-heading))
-    (and (not (eobp)) (forward-char -1))
+    (if (eobp)
+        (allout-end-of-entry)
+      (forward-char -1))
     (if (and (not include-trailing-blank) (= ?\n (preceding-char)))
          (forward-char -1))
     (setq allout-recent-end-of-subtree (point))))
@@ -2675,6 +2910,13 @@
 are mapped to the command of the corresponding control-key on the
 `allout-mode-map'.")
 (make-variable-buffer-local 'allout-post-goto-bullet)
+;;;_   = allout-command-counter
+(defvar allout-command-counter 0
+  "Counter that monotonically increases in allout-mode buffers.
+
+Set by `allout-pre-command-business', to support allout addons in
+coordinating with allout activity.")
+(make-variable-buffer-local 'allout-command-counter)
 ;;;_   > allout-post-command-business ()
 (defun allout-post-command-business ()
   "Outline `post-command-hook' function.
@@ -2692,7 +2934,7 @@
              allout-after-save-decrypt)
         (allout-after-saves-handler))
 
-    ;; Implement -post-goto-bullet, if set:
+    ;; Implement allout-post-goto-bullet, if set:
     (if (and allout-post-goto-bullet
 	     (allout-current-bullet-pos))
 	(progn (goto-char (allout-current-bullet-pos))
@@ -2701,7 +2943,9 @@
 ;;;_   > allout-pre-command-business ()
 (defun allout-pre-command-business ()
   "Outline `pre-command-hook' function for outline buffers.
-Implements special behavior when cursor is on bullet character.
+
+Among other things, implements special behavior when the cursor is on the
+topic bullet character.
 
 When the cursor is on the bullet character, self-insert characters are
 reinterpreted as the corresponding control-character in the
@@ -2709,7 +2953,7 @@
 the cursor which has moved as a result of such reinterpretation is
 positioned on the bullet character of the destination topic.
 
-The upshot is that you can get easy, single (ie, unmodified) key
+The upshot is that you can get easy, single \(ie, unmodified\) key
 outline maneuvering operations by positioning the cursor on the bullet
 char.  When in this mode you can use regular cursor-positioning
 command/keystrokes to relocate the cursor off of a bullet character to
@@ -2717,6 +2961,9 @@
 
   (if (not (allout-mode-p))
       nil
+    ;; Increment allout-command-counter
+    (setq allout-command-counter (1+ allout-command-counter))
+    ;; Do hot-spot navigation.
     (if (and (eq this-command 'self-insert-command)
 	     (eq (point)(allout-current-bullet-pos)))
         (allout-hotspot-key-handler))))
@@ -2990,6 +3237,8 @@
 
 If OFFER-RECENT-BULLET is true, offer to use the bullet of the prior sibling.
 
+Runs 
+
 Nuances:
 
 - Creation of new topics is with respect to the visible topic
@@ -3040,7 +3289,8 @@
                                        allout-numbered-bullet))))
                       (point)))
          dbl-space
-         doing-beginning)
+         doing-beginning
+         start end)
 
     (if (not opening-on-blank)
                                         ; Positioning and vertical
@@ -3141,8 +3391,10 @@
                               (not (bolp)))
                          (forward-char 1))))
           ))
+    (setq start (point))
     (insert (concat (allout-make-topic-prefix opening-numbered t depth)
                     " "))
+    (setq end (1+ (point)))
 
     (allout-rebullet-heading (and offer-recent-bullet ref-bullet)
                               depth nil nil t)
@@ -3150,6 +3402,8 @@
         (save-excursion (goto-char ref-topic)
                         (allout-show-children)))
     (end-of-line)
+
+    (run-hook-with-args 'allout-structure-added-hook start end)
     )
   )
 ;;;_   > allout-open-subtopic (arg)
@@ -3548,6 +3802,7 @@
 depth, however."
   (interactive "p")
   (if (> arg 0)
+      ;; refuse to create a containment discontinuity:
       (save-excursion
         (allout-back-to-current-heading)
         (if (not (bobp))
@@ -3564,7 +3819,20 @@
                           (1+ predecessor-depth)))
                   (error (concat "Disallowed shift deeper than"
                                  " containing topic's children.")))))))
-  (allout-rebullet-topic arg))
+  (let ((where (point))
+        has-successor)
+    (if (and (< arg 0)
+             (allout-current-topic-collapsed-p)
+             (save-excursion (allout-next-sibling)))
+        (setq has-successor t))
+    (allout-rebullet-topic arg)
+    (when (< arg 0)
+      (save-excursion
+        (if (allout-ascend)
+            (allout-show-children)))
+      (if has-successor
+          (allout-show-children)))
+    (run-hook-with-args 'allout-structure-shifted-hook arg where)))
 ;;;_    > allout-shift-out (arg)
 (defun allout-shift-out (arg)
   "Decrease depth of current heading and any topics collapsed within it.
@@ -3574,9 +3842,7 @@
 discontinuity.  The first topic in the file can be adjusted to any positive
 depth, however."
   (interactive "p")
-  (if (< arg 0)
-      (allout-shift-in (* arg -1)))
-  (allout-rebullet-topic (* arg -1)))
+  (allout-shift-in (* arg -1)))
 ;;;_   : Surgery (kill-ring) functions with special provisions for outlines:
 ;;;_    > allout-kill-line (&optional arg)
 (defun allout-kill-line (&optional arg)
@@ -3610,7 +3876,8 @@
           (save-excursion               ; Renumber subsequent topics if needed:
             (if (not (looking-at allout-regexp))
                 (allout-next-heading))
-            (allout-renumber-to-depth depth))))))
+            (allout-renumber-to-depth depth)))
+      (run-hook-with-args 'allout-structure-deleted-hook depth (point)))))
 ;;;_    > allout-kill-topic ()
 (defun allout-kill-topic ()
   "Kill topic together with subtopics.
@@ -3656,7 +3923,8 @@
     (allout-unprotected (kill-region beg (point)))
     (sit-for 0)
     (save-excursion
-      (allout-renumber-to-depth depth))))
+      (allout-renumber-to-depth depth))
+    (run-hook-with-args 'allout-structure-deleted-hook depth (point))))
 ;;;_    > allout-yank-processing ()
 (defun allout-yank-processing (&optional arg)
 
@@ -3683,112 +3951,113 @@
 					; region around subject:
   (if (< (allout-mark-marker t) (point))
       (exchange-point-and-mark))
-  (let* ((inhibit-field-text-motion t)
-         (subj-beg (point))
-         (into-bol (bolp))
-	 (subj-end (allout-mark-marker t))
-         (was-collapsed (get-text-property subj-beg 'allout-was-collapsed))
-	 ;; 'resituate' if yanking an entire topic into topic header:
-	 (resituate (and (allout-e-o-prefix-p)
-			 (looking-at (concat "\\(" allout-regexp "\\)"))
-			 (allout-prefix-data (match-beginning 1)
+  (allout-unprotected
+   (let* ((subj-beg (point))
+          (into-bol (bolp))
+          (subj-end (allout-mark-marker t))
+          (was-collapsed (get-text-property subj-beg 'allout-was-collapsed))
+          ;; 'resituate' if yanking an entire topic into topic header:
+          (resituate (and (allout-e-o-prefix-p)
+                          (looking-at (concat "\\(" allout-regexp "\\)"))
+                          (allout-prefix-data (match-beginning 1)
 					      (match-end 1))))
-	 ;; `rectify-numbering' if resituating (where several topics may
-	 ;; be resituating) or yanking a topic into a topic slot (bol):
-	 (rectify-numbering (or resituate
-				(and into-bol (looking-at allout-regexp)))))
-    (if resituate
+          ;; `rectify-numbering' if resituating (where several topics may
+          ;; be resituating) or yanking a topic into a topic slot (bol):
+          (rectify-numbering (or resituate
+                                 (and into-bol (looking-at allout-regexp)))))
+     (if resituate
                                         ; The yanked stuff is a topic:
-	(let* ((prefix-len (- (match-end 1) subj-beg))
-	       (subj-depth (allout-recent-depth))
-	       (prefix-bullet (allout-recent-bullet))
-	       (adjust-to-depth
-		;; Nil if adjustment unnecessary, otherwise depth to which
-		;; adjustment should be made:
-		(save-excursion
-		  (and (goto-char subj-end)
-		       (eolp)
-		       (goto-char subj-beg)
-		       (and (looking-at allout-regexp)
-			    (progn
-			      (beginning-of-line)
-			      (not (= (point) subj-beg)))
-			    (looking-at allout-regexp)
-			    (allout-prefix-data (match-beginning 0)
+         (let* ((prefix-len (- (match-end 1) subj-beg))
+                (subj-depth (allout-recent-depth))
+                (prefix-bullet (allout-recent-bullet))
+                (adjust-to-depth
+                 ;; Nil if adjustment unnecessary, otherwise depth to which
+                 ;; adjustment should be made:
+                 (save-excursion
+                   (and (goto-char subj-end)
+                        (eolp)
+                        (goto-char subj-beg)
+                        (and (looking-at allout-regexp)
+                             (progn
+                               (beginning-of-line)
+                               (not (= (point) subj-beg)))
+                             (looking-at allout-regexp)
+                             (allout-prefix-data (match-beginning 0)
 						 (match-end 0)))
-		       (allout-recent-depth))))
-	       (more t))
-	  (setq rectify-numbering allout-numbered-bullet)
-	  (if adjust-to-depth
+                        (allout-recent-depth))))
+                (more t))
+           (setq rectify-numbering allout-numbered-bullet)
+           (if adjust-to-depth
                                         ; Do the adjustment:
-	      (progn
-		(message "... yanking") (sit-for 0)
-		(save-restriction
-		  (narrow-to-region subj-beg subj-end)
+               (progn
+                 (message "... yanking") (sit-for 0)
+                 (save-restriction
+                   (narrow-to-region subj-beg subj-end)
                                         ; Trim off excessive blank
                                         ; line at end, if any:
-		  (goto-char (point-max))
-		  (if (looking-at "^$")
-		      (allout-unprotected (delete-char -1)))
+                   (goto-char (point-max))
+                   (if (looking-at "^$")
+                       (allout-unprotected (delete-char -1)))
                                         ; Work backwards, with each
                                         ; shallowest level,
                                         ; successively excluding the
                                         ; last processed topic from
                                         ; the narrow region:
-		  (while more
-		    (allout-back-to-current-heading)
+                   (while more
+                     (allout-back-to-current-heading)
                                         ; go as high as we can in each bunch:
-		    (while (allout-ascend-to-depth (1- (allout-depth))))
-		    (save-excursion
-		      (allout-rebullet-topic-grunt (- adjust-to-depth
+                     (while (allout-ascend-to-depth (1- (allout-depth))))
+                     (save-excursion
+                       (allout-rebullet-topic-grunt (- adjust-to-depth
 						       subj-depth))
-		      (allout-depth))
-		    (if (setq more (not (bobp)))
-			(progn (widen)
-			       (forward-char -1)
-			       (narrow-to-region subj-beg (point))))))
-		(message "")
-		;; Preserve new bullet if it's a distinctive one, otherwise
-		;; use old one:
-		(if (string-match (regexp-quote prefix-bullet)
-				  allout-distinctive-bullets-string)
+                       (allout-depth))
+                     (if (setq more (not (bobp)))
+                         (progn (widen)
+                                (forward-char -1)
+                                (narrow-to-region subj-beg (point))))))
+                 (message "")
+                 ;; Preserve new bullet if it's a distinctive one, otherwise
+                 ;; use old one:
+                 (if (string-match (regexp-quote prefix-bullet)
+                                   allout-distinctive-bullets-string)
                                         ; Delete from bullet of old to
                                         ; before bullet of new:
-		    (progn
-		      (beginning-of-line)
-		      (delete-region (point) subj-beg)
-		      (set-marker (allout-mark-marker t) subj-end)
-		      (goto-char subj-beg)
-		      (allout-end-of-prefix))
+                     (progn
+                       (beginning-of-line)
+                       (delete-region (point) subj-beg)
+                       (set-marker (allout-mark-marker t) subj-end)
+                       (goto-char subj-beg)
+                       (allout-end-of-prefix))
                                         ; Delete base subj prefix,
                                         ; leaving old one:
-		  (delete-region (point) (+ (point)
-					    prefix-len
-					    (- adjust-to-depth subj-depth)))
+                   (delete-region (point) (+ (point)
+                                             prefix-len
+                                             (- adjust-to-depth subj-depth)))
                                         ; and delete residual subj
                                         ; prefix digits and space:
-		  (while (looking-at "[0-9]") (delete-char 1))
-		  (if (looking-at " ") (delete-char 1))))
-	    (exchange-point-and-mark))))
-    (if rectify-numbering
-	(progn
-	  (save-excursion
+                   (while (looking-at "[0-9]") (delete-char 1))
+                   (if (looking-at " ") (delete-char 1))))
+             (exchange-point-and-mark))))
+     (if rectify-numbering
+         (progn
+           (save-excursion
                                         ; Give some preliminary feedback:
-	    (message "... reconciling numbers") (sit-for 0)
+             (message "... reconciling numbers") (sit-for 0)
                                         ; ... and renumber, in case necessary:
-	    (goto-char subj-beg)
-	    (if (allout-goto-prefix)
-		(allout-rebullet-heading nil	;;; solicit
+             (goto-char subj-beg)
+             (if (allout-goto-prefix)
+                 (allout-rebullet-heading nil            ;;; solicit
 					  (allout-depth) ;;; depth
-					  nil	;;; number-control
-					  nil	;;; index
+					  nil            ;;; number-control
+					  nil            ;;; index
 					  t))
-	    (message ""))))
-    (when (and (or into-bol resituate) was-collapsed)
-      (remove-text-properties subj-beg (1+ subj-beg) '(allout-was-collapsed))
-      (allout-hide-current-subtree))
-    (if (not resituate)
-      (exchange-point-and-mark))))
+             (message ""))))
+     (when (and (or into-bol resituate) was-collapsed)
+       (remove-text-properties subj-beg (1+ subj-beg) '(allout-was-collapsed))
+       (allout-hide-current-subtree))
+     (if (not resituate)
+         (exchange-point-and-mark))
+     (run-hook-with-args 'allout-structure-added-hook subj-beg subj-end))))
 ;;;_    > allout-yank (&optional arg)
 (defun allout-yank (&optional arg)
   "`allout-mode' yank, with depth and numbering adjustment of yanked topics.
@@ -3820,10 +4089,10 @@
 
   (interactive "*P")
   (setq this-command 'yank)
-  (yank arg)
+  (allout-unprotected
+   (yank arg))
   (if (allout-mode-p)
-      (allout-yank-processing))
-)
+      (allout-yank-processing)))
 ;;;_    > allout-yank-pop (&optional arg)
 (defun allout-yank-pop (&optional arg)
   "Yank-pop like `allout-yank' when popping to bare outline prefixes.
@@ -3882,9 +4151,13 @@
 ;;;_  - Fundamental
 ;;;_   > allout-flag-region (from to flag)
 (defun allout-flag-region (from to flag)
-  "Conceal text from FROM to TO if FLAG is non-nil, else reveal it.
-
-Text is shown if flag is nil and hidden otherwise."
+  "Conceal text between FROM and TO if FLAG is non-nil, else reveal it.
+
+Exposure-change hook `allout-exposure-change-hook' is run with the same
+arguments as this function, after the exposure changes are made.  \(The old
+`allout-view-change-hook' is being deprecated, and eventually will not be
+invoked.\)"
+
   ;; We use outline invisibility spec.
   (remove-overlays from to 'category 'allout-exposure-category)
   (when flag
@@ -3895,7 +4168,7 @@
           (while props
             (overlay-put o (pop props) (pop props)))))))
   (run-hooks 'allout-view-change-hook)
-  (run-hooks 'allout-exposure-change-hook))
+  (run-hook-with-args 'allout-exposure-change-hook from to flag))
 ;;;_   > allout-flag-current-subtree (flag)
 (defun allout-flag-current-subtree (flag)
   "Conceal currently-visible topic's subtree if FLAG non-nil, else reveal it."
@@ -4071,10 +4344,12 @@
 default, they are treated as being uncollapsed."
   (save-excursion
     (and
-     (= (progn (allout-back-to-current-heading)
-               (move-end-of-line 1)
-               (point))
-        (allout-end-of-current-subtree (not (looking-at "\n\n"))))
+     ;; Is the topic all on one line (allowing for trailing blank line)?
+     (>= (progn (allout-back-to-current-heading)
+                (move-end-of-line 1)
+                (point))
+         (allout-end-of-current-subtree (not (looking-at "\n\n"))))
+
      (or include-single-liners
          (progn (backward-char 1) (allout-hidden-p))))))
 ;;;_   > allout-hide-current-subtree (&optional just-close)
@@ -5097,8 +5372,8 @@
 ;;;                                  fetch-pass &optional retried verifying
 ;;;                                  passphrase)
 (defun allout-encrypt-string (text decrypt allout-buffer key-type for-key
-                                       fetch-pass &optional retried verifying
-                                       passphrase)
+                                   fetch-pass &optional retried rejected
+                                   verifying passphrase)
   "Encrypt or decrypt message TEXT.
 
 If DECRYPT is true (default false), then decrypt instead of encrypt.
@@ -5116,6 +5391,11 @@
 Optional PASSPHRASE enables explicit delivery of the decryption passphrase,
 for verification purposes.
 
+Optional REJECTED is for internal use - conveys the number of
+rejections due to matches against
+`allout-encryption-ciphertext-rejection-regexps', as limited by
+`allout-encryption-ciphertext-rejection-ceiling'.
+
 Returns the resulting string, or nil if the transformation fails."
 
   (require 'pgg)
@@ -5141,6 +5421,17 @@
                                       target-prompt-id
                                     (or (buffer-file-name allout-buffer)
                                         target-prompt-id))))
+         (strip-plaintext-regexps
+          (if (not decrypt)
+              (allout-get-configvar-values
+               'allout-encryption-plaintext-sanitization-regexps)))
+         (reject-ciphertext-regexps
+          (if (not decrypt)
+              (allout-get-configvar-values
+               'allout-encryption-ciphertext-rejection-regexps)))
+         (rejected (or rejected 0))
+         (rejections-left (- allout-encryption-ciphertext-rejection-ceiling
+                             rejected))
          result-text status)
 
     (if (and fetch-pass (not passphrase))
@@ -5161,10 +5452,19 @@
                                                        key-type
                                                        allout-buffer
                                                        retried fetch-pass)))
+
         (with-temp-buffer
 
           (insert text)
 
+          (when (and strip-plaintext-regexps (not decrypt))
+            (dolist (re strip-plaintext-regexps)
+              (let ((re (if (listp re) (car re) re))
+                    (replacement (if (listp re) (cadr re) "")))
+                (goto-char (point-min))
+                (while (re-search-forward re nil t)
+                  (replace-match replacement nil nil)))))
+
           (cond
 
            ;; symmetric:
@@ -5183,7 +5483,8 @@
               (if verifying
                   (throw 'encryption-failed nil)
                 (pgg-remove-passphrase-from-cache target-cache-id t)
-                (error "Symmetric-cipher encryption failed - %s"
+                (error "Symmetric-cipher %scryption failed - %s"
+                       (if decrypt "de" "en")
                        "try again with different passphrase."))))
 
            ;; encrypt 'keypair:
@@ -5208,48 +5509,68 @@
             (if status
                 (pgg-situate-output (point-min) (point-max))
               (error (pgg-remove-passphrase-from-cache target-cache-id t)
-                     (error "decryption failed"))))
-           )
+                     (error "decryption failed")))))
 
           (setq result-text
                 (buffer-substring 1 (- (point-max) (if decrypt 0 1))))
-
-          ;; validate result - non-empty
-          (cond ((not result-text)
-                 (if verifying
-                     nil
-                   ;; transform was fruitless, retry w/new passphrase.
-                   (pgg-remove-passphrase-from-cache target-cache-id t)
-                   (allout-encrypt-string text allout-buffer decrypt nil
-                                          (if retried (1+ retried) 1)
-                                          passphrase)))
-
-                ;; Barf if encryption yields extraordinary control chars:
-                ((and (not decrypt)
-                      (string-match "[\C-a\C-k\C-o-\C-z\C-@]"
-                                    result-text))
-                 (error (concat "encryption produced unusable"
-                                " non-armored text - reconfigure!")))
-
-                ;; valid result and just verifying or non-symmetric:
-                ((or verifying (not (equal key-type 'symmetric)))
-                 (if (or verifying decrypt)
-                     (pgg-add-passphrase-to-cache target-cache-id
-                                                  passphrase t))
-                 result-text)
-
-                ;; valid result and regular symmetric - "register"
-                ;; passphrase with mnemonic aids/cache.
-                (t
-                 (set-buffer allout-buffer)
-                 (if passphrase
-                     (pgg-add-passphrase-to-cache target-cache-id
-                                                  passphrase t))
-                 (allout-update-passphrase-mnemonic-aids for-key passphrase
-                                                         allout-buffer)
-                 result-text)
-                )
           )
+
+        ;; validate result - non-empty
+        (cond ((not result-text)
+               (if verifying
+                   nil
+                 ;; transform was fruitless, retry w/new passphrase.
+                 (pgg-remove-passphrase-from-cache target-cache-id t)
+                 (allout-encrypt-string text decrypt allout-buffer
+                                        key-type for-key nil
+                                        (if retried (1+ retried) 1)
+                                        rejected verifying nil)))
+
+              ;; Retry (within limit) if ciphertext contains rejections:
+              ((and (not decrypt)
+                    ;; Check for disqualification of this ciphertext:
+                    (let ((regexps reject-ciphertext-regexps)
+                          reject-it)
+                      (while (and regexps (not reject-it))
+                        (setq reject-it (string-match (car regexps)
+                                                      result-text))
+                        (pop regexps))
+                      reject-it))
+               (setq rejections-left (1- rejections-left))
+               (if (<= rejections-left 0)
+                   (error (concat "Ciphertext rejected too many times"
+                                  " (%s), per `%s'")
+                          allout-encryption-ciphertext-rejection-ceiling
+                          'allout-encryption-ciphertext-rejection-regexps)
+                 (allout-encrypt-string text decrypt allout-buffer
+                                        key-type for-key nil
+                                        retried (1+ rejected)
+                                        verifying passphrase)))
+              ;; Barf if encryption yields extraordinary control chars:
+              ((and (not decrypt)
+                    (string-match "[\C-a\C-k\C-o-\C-z\C-@]"
+                                  result-text))
+               (error (concat "Encryption produced non-armored text, which"
+                              "conflicts with allout mode - reconfigure!")))
+
+              ;; valid result and just verifying or non-symmetric:
+              ((or verifying (not (equal key-type 'symmetric)))
+               (if (or verifying decrypt)
+                   (pgg-add-passphrase-to-cache target-cache-id
+                                                passphrase t))
+               result-text)
+
+              ;; valid result and regular symmetric - "register"
+              ;; passphrase with mnemonic aids/cache.
+              (t
+               (set-buffer allout-buffer)
+               (if passphrase
+                   (pgg-add-passphrase-to-cache target-cache-id
+                                                passphrase t))
+               (allout-update-passphrase-mnemonic-aids for-key passphrase
+                                                       allout-buffer)
+               result-text)
+              )
         )
     )
   )
@@ -5313,7 +5634,6 @@
                           (pgg-read-passphrase-from-cache cache-id t)))
              (got-pass (or cached
                            (pgg-read-passphrase full-prompt cache-id t)))
-
              confirmation)
 
         (if (not got-pass)
@@ -5321,14 +5641,14 @@
 
           ;; Duplicate our handle on the passphrase so it's not clobbered by
           ;; deactivate-passwd memory clearing:
-          (setq got-pass (format "%s" got-pass))
+          (setq got-pass (copy-sequence got-pass))
 
           (cond (verifier-string
                  (save-window-excursion
                    (if (allout-encrypt-string verifier-string 'decrypt
                                               allout-buffer 'symmetric
-                                              for-key nil 0 'verifying
-                                              got-pass)
+                                              for-key nil 0 0 'verifying
+                                              (copy-sequence got-pass))
                        (setq confirmation (format "%s" got-pass))))
 
                  (if (and (not confirmation)
@@ -5365,15 +5685,7 @@
                          ;; recurse to this routine:
                          (pgg-read-passphrase prompt-sans-hint cache-id t))
                 (pgg-remove-passphrase-from-cache cache-id t)
-                (error "Confirmation failed.")))
-          ;; reduce opportunity for memory cherry-picking by zeroing duplicate:
-          (dotimes (i (length got-pass))
-            (aset got-pass i 0))
-          )
-        )
-      )
-    )
-  )
+                (error "Confirmation failed."))))))))
 ;;;_  > allout-encrypted-topic-p ()
 (defun allout-encrypted-topic-p ()
   "True if the current topic is encryptable and encrypted."
@@ -5426,7 +5738,7 @@
     (dotimes (i (length spew))
       (aset spew i (1+ (random 254))))
     (allout-encrypt-string spew nil (current-buffer) 'symmetric
-                           nil nil 0 passphrase))
+                           nil nil 0 0 passphrase))
   )
 ;;;_  > allout-update-passphrase-mnemonic-aids (for-key passphrase
 ;;;                                                     outline-buffer)
@@ -5505,7 +5817,7 @@
          allout-passphrase-verifier-string
          (allout-encrypt-string (allout-get-encryption-passphrase-verifier)
                                  'decrypt allout-buffer 'symmetric
-                                 key nil 0 'verifying passphrase)
+                                 key nil 0 0 'verifying passphrase)
          t)))
 ;;;_  > allout-next-topic-pending-encryption (&optional except-mark)
 (defun allout-next-topic-pending-encryption (&optional except-mark)
@@ -5808,6 +6120,25 @@
           (goto-char (1+ (match-beginning 0)))
           (setq count (1+ count)))
         count))))
+;;;_  > allout-get-configvar-values (varname)
+(defun allout-get-configvar-values (configvar-name)
+  "Return a list of values of the symbols in list bound to CONFIGVAR-NAME.
+
+The user is prompted for removal of symbols that are unbound, and they
+otherwise are ignored.
+
+CONFIGVAR-NAME should be the name of the configuration variable,
+not its value."
+
+  (let ((configvar-value (symbol-value configvar-name))
+        got)
+    (dolist (sym configvar-value)
+      (if (not (boundp sym))
+          (if (yes-or-no-p (format "%s entry `%s' is unbound - remove it? "
+                                   configvar-name sym))
+              (delq sym (symbol-value configvar-name)))
+        (push (symbol-value sym) got)))
+    (reverse got)))
 ;;;_  > allout-mark-marker to accommodate divergent emacsen:
 (defun allout-mark-marker (&optional force buffer)
   "Accommodate the different signature for `mark-marker' across Emacsen.
--- a/lisp/avoid.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/avoid.el	Sat Oct 14 16:56:21 2006 +0000
@@ -124,6 +124,7 @@
 (defvar mouse-avoidance-pointer-shapes nil)
 (defvar mouse-avoidance-n-pointer-shapes 0)
 (defvar mouse-avoidance-old-pointer-shape nil)
+(defvar mouse-avoidance-animating-pointer nil)
 
 ;; This timer is used to run something when Emacs is idle.
 (defvar mouse-avoidance-timer nil)
@@ -243,16 +244,19 @@
 		(+ (cdr mouse-avoidance-state) deltay)))
     (if (or (eq mouse-avoidance-mode 'animate)
 	    (eq mouse-avoidance-mode 'proteus))
-	(let ((i 0.0))
+	(let ((i 0.0)
+	      (incr (max .1 (/ 1.0 mouse-avoidance-nudge-dist))))
+	  (setq mouse-avoidance-animating-pointer t)
 	  (while (<= i 1)
 	    (mouse-avoidance-set-mouse-position
 	     (cons (+ (car cur-pos) (round (* i deltax)))
 		   (+ (cdr cur-pos) (round (* i deltay)))))
-    	    (setq i (+ i (max .1 (/ 1.0 mouse-avoidance-nudge-dist))))
+    	    (setq i (+ i incr))
 	    (if (eq mouse-avoidance-mode 'proteus)
 		(mouse-avoidance-set-pointer-shape
 		 (mouse-avoidance-random-shape)))
-	    (sit-for mouse-avoidance-animation-delay)))
+	    (sit-for mouse-avoidance-animation-delay))
+	  (setq mouse-avoidance-animating-pointer nil))
       (mouse-avoidance-set-mouse-position (cons (+ (car (cdr cur)) deltax)
 						(+ (cdr (cdr cur)) deltay))))))
 
@@ -294,11 +298,11 @@
 		   (memq 'drag modifiers)
 		   (memq 'down modifiers)))))))
 
-(defun mouse-avoidance-banish-hook ()
+(defun mouse-avoidance-banish ()
   (if (not (mouse-avoidance-ignore-p))
       (mouse-avoidance-banish-mouse)))
 
-(defun mouse-avoidance-exile-hook ()
+(defun mouse-avoidance-exile ()
   ;; For exile mode, the state is nil when the mouse is in its normal
   ;; position, and set to the old mouse-position when the mouse is in exile.
   (if (not (mouse-avoidance-ignore-p))
@@ -317,9 +321,10 @@
 	       ;; but clear state anyway, to be ready for another move
 	       (setq mouse-avoidance-state nil))))))
 
-(defun mouse-avoidance-fancy-hook ()
+(defun mouse-avoidance-fancy ()
   ;; Used for the "fancy" modes, ie jump et al.
-  (if (and (not (mouse-avoidance-ignore-p))
+  (if (and (not mouse-avoidance-animating-pointer)
+	   (not (mouse-avoidance-ignore-p))
 	   (mouse-avoidance-too-close-p (mouse-position)))
       (let ((old-pos (mouse-position)))
 	(mouse-avoidance-nudge-mouse)
@@ -375,14 +380,14 @@
 	     (eq mode 'animate)
 	     (eq mode 'proteus))
 	 (setq mouse-avoidance-timer
-	       (run-with-idle-timer 0.1 t 'mouse-avoidance-fancy-hook))
+	       (run-with-idle-timer 0.1 t 'mouse-avoidance-fancy))
 	 (setq mouse-avoidance-mode mode
 	       mouse-avoidance-state (cons 0 0)
 	       mouse-avoidance-old-pointer-shape
 	       (and (boundp 'x-pointer-shape) x-pointer-shape)))
 	((eq mode 'exile)
 	 (setq mouse-avoidance-timer
-	       (run-with-idle-timer 0.1 t 'mouse-avoidance-exile-hook))
+	       (run-with-idle-timer 0.1 t 'mouse-avoidance-exile))
 	 (setq mouse-avoidance-mode mode
 	       mouse-avoidance-state nil))
 	((or (eq mode 'banish)
@@ -390,7 +395,7 @@
 	     (and (null mode) (null mouse-avoidance-mode))
 	     (and mode (> (prefix-numeric-value mode) 0)))
 	 (setq mouse-avoidance-timer
-	       (run-with-idle-timer 0.1 t 'mouse-avoidance-banish-hook))
+	       (run-with-idle-timer 0.1 t 'mouse-avoidance-banish))
 	 (setq mouse-avoidance-mode 'banish))
 	(t (setq mouse-avoidance-mode nil)))
   (force-mode-line-update))
--- a/lisp/bindings.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/bindings.el	Sat Oct 14 16:56:21 2006 +0000
@@ -215,14 +215,6 @@
 
 (make-variable-buffer-local 'mode-line-mule-info)
 
-(defvar mode-line-buffer-identification (purecopy '("%12b")) "\
-Mode-line control for identifying the buffer being displayed.
-Its default value is (\"%12b\").
-Major modes that edit things other than ordinary files may change this
-\(e.g. Info, Dired,...)")
-
-(make-variable-buffer-local 'mode-line-buffer-identification)
-
 (defvar mode-line-frame-identification '(window-system "  " "-%F  ")
   "Mode-line control to describe the current frame.")
 
@@ -294,56 +286,102 @@
 	;; mouse-1: select window, mouse-2: delete others, mouse-3: delete,
 	;; drag-mouse-1: resize, C-mouse-2: split horizontally"
 	"mouse-1: select (drag to resize), mouse-2: delete others, mouse-3: delete this")
-       (dashes (propertize "--" 'help-echo help-echo)))
-  (setq-default mode-line-format
-    (list
-     "%e"
-     (propertize "-" 'help-echo help-echo)
-     'mode-line-mule-info
-     'mode-line-client
-     'mode-line-modified
-     'mode-line-frame-identification
-     'mode-line-buffer-identification
-     (propertize "   " 'help-echo help-echo)
-     'mode-line-position
-     `(vc-mode ("" vc-mode ,(propertize "   " 'help-echo help-echo)))
-     'mode-line-modes
-     `(which-func-mode ("" which-func-format ,dashes))
-     `(global-mode-string (,dashes global-mode-string))
-     (propertize "-%-" 'help-echo help-echo)))
+       (dashes (propertize "--" 'help-echo help-echo))
+       (standard-mode-line-format
+	(list
+	 "%e"
+	 (propertize "-" 'help-echo help-echo)
+	 'mode-line-mule-info
+	 'mode-line-client
+	 'mode-line-modified
+	 'mode-line-frame-identification
+	 'mode-line-buffer-identification
+	 (propertize "   " 'help-echo help-echo)
+	 'mode-line-position
+	 '(vc-mode vc-mode)
+	 (propertize "  " 'help-echo help-echo)
+	 'mode-line-modes
+	 `(which-func-mode ("" which-func-format ,dashes))
+	 `(global-mode-string (,dashes global-mode-string))
+	 (propertize "-%-" 'help-echo help-echo)))
+       (standard-mode-line-modes
+	(list
+	 (propertize "%[(" 'help-echo help-echo)
+	 `(:propertize ("" mode-name)
+		       help-echo "mouse-1: major mode, mouse-2: major mode help, mouse-3: toggle minor modes"
+		       mouse-face mode-line-highlight
+		       local-map ,mode-line-major-mode-keymap)
+	 '("" mode-line-process)
+	 `(:propertize ("" minor-mode-alist)
+		       mouse-face mode-line-highlight
+		       help-echo "mouse-2: minor mode help, mouse-3: toggle minor modes"
+		       local-map ,mode-line-minor-mode-keymap)
+	 (propertize "%n" 'help-echo "mouse-2: widen"
+		     'mouse-face 'mode-line-highlight
+		     'local-map (make-mode-line-mouse-map
+				 'mouse-2 #'mode-line-widen))
+	 (propertize ")%]--" 'help-echo help-echo)))
 
-  (setq-default mode-line-modes
-    (list
-     (propertize "%[(" 'help-echo help-echo)
-     `(:propertize ("" mode-name)
-		   help-echo "mouse-1: major mode, mouse-2: major mode help, mouse-3: toggle minor modes"
-		   mouse-face mode-line-highlight
-		   local-map ,mode-line-major-mode-keymap)
-     '("" mode-line-process)
-     `(:propertize ("" minor-mode-alist)
-		   mouse-face mode-line-highlight
-		   help-echo "mouse-2: minor mode help, mouse-3: toggle minor modes"
-		   local-map ,mode-line-minor-mode-keymap)
-     (propertize "%n" 'help-echo "mouse-2: widen"
-		 'mouse-face 'mode-line-highlight
-		 'local-map (make-mode-line-mouse-map
-			     'mouse-2 #'mode-line-widen))
-     (propertize ")%]--" 'help-echo help-echo)))
+       (standard-mode-line-position
+	`((-3 ,(propertize "%p" 'help-echo help-echo))
+	  (size-indication-mode
+	   (8 ,(propertize " of %I" 'help-echo help-echo)))
+	  (line-number-mode
+	   ((column-number-mode
+	     (10 ,(propertize " (%l,%c)" 'help-echo help-echo))
+	     (6 ,(propertize " L%l" 'help-echo help-echo))))
+	   ((column-number-mode
+	     (5 ,(propertize " C%c" 'help-echo help-echo))))))))
 
-  (setq-default mode-line-position
-    `((-3 ,(propertize "%p" 'help-echo help-echo))
-      (size-indication-mode
-       (8 ,(propertize " of %I" 'help-echo help-echo)))
-      (line-number-mode
-       ((column-number-mode
-	 (10 ,(propertize " (%l,%c)" 'help-echo help-echo))
-	 (6 ,(propertize " L%l" 'help-echo help-echo))))
-       ((column-number-mode
-	 (5 ,(propertize " C%c" 'help-echo help-echo))))))))
+  (setq-default mode-line-format standard-mode-line-format)
+  (put 'mode-line-format 'standard-value
+       (list `(quote ,standard-mode-line-format)))
+
+  (setq-default mode-line-modes standard-mode-line-modes)
+  (put 'mode-line-modes 'standard-value
+       (list `(quote ,standard-mode-line-modes)))
+
+  (setq-default mode-line-position standard-mode-line-position)
+  (put 'mode-line-position 'standard-value
+       (list `(quote ,standard-mode-line-position))))
 
 (defvar mode-line-buffer-identification-keymap nil "\
 Keymap for what is displayed by `mode-line-buffer-identification'.")
 
+;; Add menu of buffer operations to the buffer identification part
+;; of the mode line.or header line.
+;
+(let ((map (make-sparse-keymap)))
+  ;; Bind down- events so that the global keymap won't ``shine
+  ;; through''.
+  (define-key map [mode-line mouse-1] 'mode-line-previous-buffer)
+  (define-key map [header-line down-mouse-1] 'ignore)
+  (define-key map [header-line mouse-1] 'mode-line-previous-buffer)
+  (define-key map [header-line down-mouse-3] 'ignore)
+  (define-key map [mode-line mouse-3] 'mode-line-next-buffer)
+  (define-key map [header-line down-mouse-3] 'ignore)
+  (define-key map [header-line mouse-3] 'mode-line-next-buffer)
+  (setq mode-line-buffer-identification-keymap map))
+
+(defun propertized-buffer-identification (fmt)
+  "Return a list suitable for `mode-line-buffer-identification'.
+FMT is a format specifier such as \"%12b\".  This function adds
+text properties for face, help-echo, and local-map to it."
+  (list (propertize fmt
+		    'face 'mode-line-buffer-id
+		    'help-echo
+		    (purecopy "mouse-1: previous buffer, mouse-3: next buffer")
+		    'mouse-face 'mode-line-highlight
+		    'local-map mode-line-buffer-identification-keymap)))
+
+(defvar mode-line-buffer-identification (propertized-buffer-identification "%12b") "\
+Mode-line control for identifying the buffer being displayed.
+Its default value is (\"%12b\") with some text properties added.
+Major modes that edit things other than ordinary files may change this
+\(e.g. Info, Dired,...)")
+
+(make-variable-buffer-local 'mode-line-buffer-identification)
+
 (defun unbury-buffer () "\
 Switch to the last buffer in the buffer list."
   (interactive)
@@ -449,35 +487,6 @@
   (let ((indicator (car (nth 4 (car (cdr event))))))
     (describe-minor-mode-from-indicator indicator)))
 
-;; Add menu of buffer operations to the buffer identification part
-;; of the mode line.or header line.
-;
-(let ((map (make-sparse-keymap)))
-  ;; Bind down- events so that the global keymap won't ``shine
-  ;; through''.
-  (define-key map [mode-line mouse-1] 'mode-line-previous-buffer)
-  (define-key map [header-line down-mouse-1] 'ignore)
-  (define-key map [header-line mouse-1] 'mode-line-previous-buffer)
-  (define-key map [header-line down-mouse-3] 'ignore)
-  (define-key map [mode-line mouse-3] 'mode-line-next-buffer)
-  (define-key map [header-line down-mouse-3] 'ignore)
-  (define-key map [header-line mouse-3] 'mode-line-next-buffer)
-  (setq mode-line-buffer-identification-keymap map))
-
-(defun propertized-buffer-identification (fmt)
-  "Return a list suitable for `mode-line-buffer-identification'.
-FMT is a format specifier such as \"%12b\".  This function adds
-text properties for face, help-echo, and local-map to it."
-  (list (propertize fmt
-		    'face 'mode-line-buffer-id
-		    'help-echo
-		    (purecopy "mouse-1: previous buffer, mouse-3: next buffer")
-		    'mouse-face 'mode-line-highlight
-		    'local-map mode-line-buffer-identification-keymap)))
-
-(setq-default mode-line-buffer-identification
-	      (propertized-buffer-identification "%12b"))
-
 (defvar minor-mode-alist nil "\
 Alist saying how to show minor modes in the mode line.
 Each element looks like (VARIABLE STRING);
--- a/lisp/buff-menu.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/buff-menu.el	Sat Oct 14 16:56:21 2006 +0000
@@ -117,6 +117,7 @@
 Auto Revert Mode.")
 
 (defvar Info-current-file) ;; from info.el
+(defvar Info-current-node) ;; from info.el
 
 (make-variable-buffer-local 'Buffer-menu-files-only)
 
@@ -786,7 +787,12 @@
 			  ((eq file 'toc)
 			   (setq file "*Info TOC*"))
 			  ((not (stringp file))  ;; avoid errors
-			   (setq file nil))))))
+			   (setq file nil))
+			  (t
+			   (setq file (concat "("
+					      (file-name-nondirectory file)
+					      ")"
+					      Info-current-node)))))))
 		(push (list buffer bits name (buffer-size) mode file)
 		      list))))))
       ;; Preserve the original buffer-list ordering, just in case.
--- a/lisp/calendar/timeclock.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/calendar/timeclock.el	Sat Oct 14 16:56:21 2006 +0000
@@ -95,7 +95,7 @@
   :group 'timeclock)
 
 (defcustom timeclock-relative t
-  "*Whether to maken reported time relative to `timeclock-workday'.
+  "*Whether to make reported time relative to `timeclock-workday'.
 For example, if the length of a normal workday is eight hours, and you
 work four hours on Monday, then the amount of time \"remaining\" on
 Tuesday is twelve hours -- relative to an averaged work period of
@@ -251,7 +251,10 @@
 This value is not accurate enough to be useful by itself.  Rather,
 call `timeclock-workday-elapsed', to determine how much time has been
 worked so far today.  Also, if `timeclock-relative' is nil, this value
-will be the same as `timeclock-discrepancy'.") ; ? gm
+will be the same as `timeclock-discrepancy'.")
+
+(defvar timeclock-use-elapsed nil
+  "Non-nil if the modeline should display time elapsed, not remaining.")
 
 (defvar timeclock-last-period nil
   "Integer representing the number of seconds in the last period.
@@ -424,7 +427,9 @@
 If TODAY-ONLY is non-nil, the display will be relative only to time
 worked today, ignoring the time worked on previous days."
   (interactive "P")
-  (let ((remainder (timeclock-workday-remaining)) ; today-only?
+  (let ((remainder (timeclock-workday-remaining
+		    (or today-only
+			(not timeclock-relative))))
         (last-in (equal (car timeclock-last-event) "i"))
         status)
     (setq status
@@ -619,7 +624,10 @@
 The value of `timeclock-relative' affects the display as described in
 that variable's documentation."
   (interactive)
-  (let ((remainder (timeclock-workday-remaining (not timeclock-relative)))
+  (let ((remainder
+	 (if timeclock-use-elapsed
+	     (timeclock-workday-elapsed)
+	   (timeclock-workday-remaining (not timeclock-relative))))
         (last-in (equal (car timeclock-last-event) "i")))
     (when (and (< remainder 0)
 	       (not (and timeclock-day-over
--- a/lisp/compare-w.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/compare-w.el	Sat Oct 14 16:56:21 2006 +0000
@@ -167,16 +167,14 @@
 on second call it synchronizes points by skipping the difference,
 on third call it again advances points to the next difference and so on."
   (interactive "P")
+  (if compare-ignore-whitespace
+      (setq ignore-whitespace (not ignore-whitespace)))
   (let* (p1 p2 maxp1 maxp2 b1 b2 w2
 	    (progress 1)
 	    (opoint1 (point))
 	    opoint2
-	    (skip-func (if (if ignore-whitespace ; XOR
-                               (not compare-ignore-whitespace)
-                             compare-ignore-whitespace)
-                           (if (stringp compare-windows-whitespace)
-                               'compare-windows-skip-whitespace
-                             compare-windows-whitespace)))
+	    skip-func-1
+	    skip-func-2
 	    (sync-func (if (stringp compare-windows-sync)
                            'compare-windows-sync-regexp
                          compare-windows-sync)))
@@ -190,8 +188,21 @@
 	  b2 (window-buffer w2))
     (setq opoint2 p2)
     (setq maxp1 (point-max))
-    (save-excursion
-      (set-buffer b2)
+
+    (setq skip-func-1 (if ignore-whitespace
+			  (if (stringp compare-windows-whitespace)
+			      (lambda (pos)
+				(compare-windows-skip-whitespace pos)
+				t)
+			    compare-windows-whitespace)))
+
+    (with-current-buffer b2
+      (setq skip-func-2 (if ignore-whitespace
+			    (if (stringp compare-windows-whitespace)
+			      (lambda (pos)
+				(compare-windows-skip-whitespace pos)
+				t)
+			      compare-windows-whitespace)))
       (push-mark p2 t)
       (setq maxp2 (point-max)))
     (push-mark)
@@ -199,17 +210,16 @@
     (while (> progress 0)
       ;; If both windows have whitespace next to point,
       ;; optionally skip over it.
-      (and skip-func
+      (and skip-func-1
 	   (save-excursion
 	     (let (p1a p2a w1 w2 result1 result2)
-	       (setq result1 (funcall skip-func opoint1))
+	       (setq result1 (funcall skip-func-1 opoint1))
 	       (setq p1a (point))
 	       (set-buffer b2)
 	       (goto-char p2)
-	       (setq result2 (funcall skip-func opoint2))
+	       (setq result2 (funcall skip-func-2 opoint2))
 	       (setq p2a (point))
-	       (if (or (stringp compare-windows-whitespace)
-		       (and result1 result2 (eq result1 result2)))
+	       (if (and result1 result2 (eq result1 result2))
 		   (setq p1 p1a
 			 p2 p2a)))))
 
--- a/lisp/complete.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/complete.el	Sat Oct 14 16:56:21 2006 +0000
@@ -543,8 +543,8 @@
 	(let ((compl (all-completions (if env-on
 					  (file-name-nondirectory (substring str 0 p))
 					(substring str 0 p))
-                                        table
-                                        pred)))
+                                      table
+                                      pred)))
 	  (setq p compl)
 	  (while p
 	    (and (string-match regex (car p))
@@ -553,6 +553,34 @@
 		   (setq poss (cons (car p) poss))))
 	    (setq p (cdr p)))))
 
+      ;; Handle completion-ignored-extensions
+      (and filename
+           (not (eq mode 'help))
+           (let ((p2 poss))
+
+             ;; Build a regular expression representing the extensions list
+             (or (equal completion-ignored-extensions PC-ignored-extensions)
+                 (setq PC-ignored-regexp
+                       (concat "\\("
+                               (mapconcat
+                                'regexp-quote
+                                (setq PC-ignored-extensions
+                                      completion-ignored-extensions)
+                                "\\|")
+                               "\\)\\'")))
+
+             ;; Check if there are any without an ignored extension.
+             ;; Also ignore `.' and `..'.
+             (setq p nil)
+             (while p2
+               (or (string-match PC-ignored-regexp (car p2))
+                   (string-match "\\(\\`\\|/\\)[.][.]?/?\\'" (car p2))
+                   (setq p (cons (car p2) p)))
+               (setq p2 (cdr p2)))
+
+             ;; If there are "good" names, use them
+             (and p (setq poss p))))
+
       ;; Now we have a list of possible completions
       (cond
 
@@ -575,34 +603,6 @@
        ((or (cdr (setq helpposs poss))
 	    (memq mode '(help word)))
 
-	;; Handle completion-ignored-extensions
-	(and filename
-	     (not (eq mode 'help))
-	     (let ((p2 poss))
-
-	       ;; Build a regular expression representing the extensions list
-	       (or (equal completion-ignored-extensions PC-ignored-extensions)
-		   (setq PC-ignored-regexp
-			 (concat "\\("
-				 (mapconcat
-				  'regexp-quote
-				  (setq PC-ignored-extensions
-					completion-ignored-extensions)
-				  "\\|")
-				 "\\)\\'")))
-
-	       ;; Check if there are any without an ignored extension.
-	       ;; Also ignore `.' and `..'.
-	       (setq p nil)
-	       (while p2
-		 (or (string-match PC-ignored-regexp (car p2))
-		     (string-match "\\(\\`\\|/\\)[.][.]?/?\\'" (car p2))
-		     (setq p (cons (car p2) p)))
-		 (setq p2 (cdr p2)))
-
-	       ;; If there are "good" names, use them
-	       (and p (setq poss p))))
-
 	;; Is the actual string one of the possible completions?
 	(setq p (and (not (eq mode 'help)) poss))
 	(while (and p
@@ -623,7 +623,8 @@
 
 	    ;; Check if next few letters are the same in all cases
 	    (if (and (not (eq mode 'help))
-		     (setq prefix (try-completion (PC-chunk-after basestr skip) (mapcar 'list poss))))
+		     (setq prefix (try-completion (PC-chunk-after basestr skip)
+                                                  poss)))
 		(let ((first t) i)
 		  ;; Retain capitalization of user input even if
 		  ;; completion-ignore-case is set.
@@ -669,13 +670,9 @@
 					      (+ beg (length dirname)) end)
 					     skip)
 					    (mapcar
-					     (function
-					      (lambda (x)
-						(list
-						 (and (string-match skip x)
-						      (substring
-						       x
-						       (match-end 0))))))
+                                             (lambda (x)
+                                               (when (string-match skip x)
+                                                 (substring x (match-end 0))))
 					     poss)))
 			      (or (> i 0) (> (length prefix) 0))
 			      (or (not (eq mode 'word))
@@ -811,6 +808,12 @@
 (defun PC-expand-many-files (name)
   (with-current-buffer (generate-new-buffer " *Glob Output*")
     (erase-buffer)
+    (when (and (file-name-absolute-p name)
+               (not (file-directory-p default-directory)))
+      ;; If the current working directory doesn't exist `shell-command'
+      ;; signals an error.  So if the file names we're looking for don't
+      ;; depend on the working directory, switch to a valid directory first.
+      (setq default-directory "/"))
     (shell-command (concat "echo " name) t)
     (goto-char (point-min))
     ;; CSH-style shells were known to output "No match", whereas
--- a/lisp/cus-edit.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/cus-edit.el	Sat Oct 14 16:56:21 2006 +0000
@@ -4435,9 +4435,8 @@
   ;; Actually, this misfeature of dense keymaps was fixed on 2001-11-26.
   (let ((map (make-keymap)))
     (set-keymap-parent map widget-keymap)
-    (define-key map [remap self-insert-command]
-      'custom-no-edit)
-    (define-key map "\^m" 'custom-no-edit)
+    (define-key map [remap self-insert-command] 'custom-no-edit)
+    (define-key map "\^m" 'custom-newline)
     (define-key map " " 'scroll-up)
     (define-key map "\177" 'scroll-down)
     (define-key map "\C-c\C-c" 'Custom-set)
@@ -4452,6 +4451,11 @@
 (defun custom-no-edit (pos &optional event)
   "Invoke button at POS, or refuse to allow editing of Custom buffer."
   (interactive "@d")
+  (error "You can't edit this part of the Custom buffer"))
+
+(defun custom-newline (pos &optional event)
+  "Invoke button at POS, or refuse to allow editing of Custom buffer."
+  (interactive "@d")
   (let ((button (get-char-property pos 'button)))
     (if button
 	(widget-apply-action button event)
--- a/lisp/cus-start.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/cus-start.el	Sat Oct 14 16:56:21 2006 +0000
@@ -175,7 +175,7 @@
 	     ;; fringe.c
 	     (overflow-newline-into-fringe fringe boolean)
 	     ;; indent.c
-	     (indent-tabs-mode fill boolean)
+	     (indent-tabs-mode indent boolean)
 	     ;; keyboard.c
 	     (meta-prefix-char keyboard character)
 	     (auto-save-interval auto-save integer)
@@ -360,6 +360,7 @@
 					    (other :tag "Unlimited" t)))
 	     (unibyte-display-via-language-environment mule boolean)
 	     (blink-cursor-alist cursor alist "22.1")
+	     (overline-margin display integer "22.1")
 	     ;; xfaces.c
 	     (scalable-fonts-allowed display boolean)
 	     ;; xfns.c
@@ -371,6 +372,7 @@
 	     ;; xterm.c
              (mouse-autoselect-window display boolean "21.3")
 	     (x-use-underline-position-properties display boolean "21.3")
+	     (x-underline-at-descent-line display boolean "22.1")
 	     (x-stretch-cursor display boolean "21.1")))
       this symbol group type standard version native-p
       ;; This function turns a value
--- a/lisp/cus-theme.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/cus-theme.el	Sat Oct 14 16:56:21 2006 +0000
@@ -99,7 +99,7 @@
   (widget-insert "  ")
   (widget-create 'push-button
      		 :notify (lambda (&rest ignore)
-			   (when (y-or-n-p "Discard current changes?")
+			   (when (y-or-n-p "Discard current changes? ")
 			     (kill-buffer (current-buffer))
 			     (customize-create-theme)))
      		 "Reset Buffer")
@@ -137,7 +137,7 @@
   (widget-insert "\n")
   (widget-create 'push-button
      		 :notify (lambda (&rest ignore)
-			   (when (y-or-n-p "Discard current changes?")
+			   (when (y-or-n-p "Discard current changes? ")
 			     (kill-buffer (current-buffer))
 			     (customize-create-theme)))
      		 "Reset Buffer")
@@ -290,7 +290,7 @@
 (defun custom-theme-visit-theme ()
   (interactive)
   (when (or (null custom-theme-variables)
-	    (if (y-or-n-p "Discard current changes?")
+	    (if (y-or-n-p "Discard current changes? ")
 		(progn (customize-create-theme) t)))
     (let ((theme (call-interactively 'custom-theme-merge-theme)))
       (unless (eq theme 'user)
--- a/lisp/ediff-mult.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/ediff-mult.el	Sat Oct 14 16:56:21 2006 +0000
@@ -648,8 +648,8 @@
 	   (mapcar
 	    (lambda (elt)
 	      (ediff-make-new-meta-list-element
-	       (concat auxdir1 elt)
-	       (concat auxdir2 elt)
+	       (expand-file-name (concat auxdir1 elt))
+	       (expand-file-name (concat auxdir2 elt))
 	       (if lis3
 		   (progn
 		     ;; The following is done because: In merging with
@@ -660,7 +660,7 @@
 		     ;; the second case, we insert nil.
 		     (setq elt (ediff-add-slash-if-directory auxdir3 elt))
 		     (if (file-exists-p (concat auxdir3 elt))
-			 (concat auxdir3 elt))))))
+			 (expand-file-name (concat auxdir3 elt)))))))
 	    common)))
     ;; return result
     (cons common-part difflist)
@@ -716,7 +716,7 @@
 				      auxdir1 nil nil
 				      merge-autostore-dir nil)
      (mapcar (lambda (elt) (ediff-make-new-meta-list-element
-			    (concat auxdir1 elt) nil nil))
+			    (expand-file-name (concat auxdir1 elt)) nil nil))
 	     common))
     ))
 
@@ -1338,7 +1338,10 @@
 	;; update ediff-meta-list by direct modification
 	(nconc meta-list
 	       (list (ediff-make-new-meta-list-element
-		      otherfile1 otherfile2 otherfile3)))
+		      (expand-file-name otherfile1)
+		      (expand-file-name otherfile2)
+		      (if otherfile3
+			  (expand-file-name otherfile3)))))
       )
     (ediff-update-meta-buffer meta-buf 'must-redraw)
   ))
--- a/lisp/edmacro.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/edmacro.el	Sat Oct 14 16:56:21 2006 +0000
@@ -670,6 +670,7 @@
 	  (cond ((atom ev)
 		 (push ev result))
 		((eq (car ev) 'help-echo))
+		((eq (car ev) 'switch-frame))
 		((equal ev '(menu-bar))
 		 (push 'menu-bar result))
 		((equal (cadadr ev) '(menu-bar))
--- a/lisp/emacs-lisp/bindat.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/emacs-lisp/bindat.el	Sat Oct 14 16:56:21 2006 +0000
@@ -619,9 +619,12 @@
   (bindat-format-vector vect "%02x" (if (stringp sep) sep ":")))
 
 (defun bindat-ip-to-string (ip)
-  "Format vector IP as an ip address in dotted notation."
-  (format "%d.%d.%d.%d"
-	  (aref ip 0) (aref ip 1) (aref ip 2) (aref ip 3)))
+  "Format vector IP as an ip address in dotted notation.
+The port (if any) is omitted.  IP can be a string, as well."
+  (if (vectorp ip)
+      (format-network-address ip t)
+    (format "%d.%d.%d.%d"
+            (aref ip 0) (aref ip 1) (aref ip 2) (aref ip 3))))
 
 (provide 'bindat)
 
--- a/lisp/emacs-lisp/checkdoc.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/emacs-lisp/checkdoc.el	Sat Oct 14 16:56:21 2006 +0000
@@ -193,8 +193,14 @@
 (defvar compilation-error-regexp-alist)
 (defvar compilation-mode-font-lock-keywords)
 
+(defgroup checkdoc nil
+  "Support for doc string checking in Emacs Lisp."
+  :prefix "checkdoc"
+  :group 'lisp
+  :version "20.3")
+
 (defcustom checkdoc-autofix-flag 'semiautomatic
-  "*Non-nil means attempt auto-fixing of doc strings.
+  "Non-nil means attempt auto-fixing of doc strings.
 If this value is the symbol `query', then the user is queried before
 any change is made.  If the value is `automatic', then all changes are
 made without asking unless the change is very-complex.  If the value
@@ -208,37 +214,39 @@
 		 (other :tag "semiautomatic" semiautomatic)))
 
 (defcustom checkdoc-bouncy-flag t
-  "*Non-nil means to \"bounce\" to auto-fix locations.
+  "Non-nil means to \"bounce\" to auto-fix locations.
 Setting this to nil will silently make fixes that require no user
 interaction.  See `checkdoc-autofix-flag' for auto-fixing details."
   :group 'checkdoc
   :type 'boolean)
 
 (defcustom checkdoc-force-docstrings-flag t
-  "*Non-nil means that all checkable definitions should have documentation.
+  "Non-nil means that all checkable definitions should have documentation.
 Style guide dictates that interactive functions MUST have documentation,
 and that it's good but not required practice to make non user visible items
 have doc strings."
   :group 'checkdoc
   :type 'boolean)
+(put 'checkdoc-force-docstrings-flag 'safe-local-variable 'booleanp)
 
 (defcustom checkdoc-force-history-flag t
-  "*Non-nil means that files should have a History section or ChangeLog file.
+  "Non-nil means that files should have a History section or ChangeLog file.
 This helps document the evolution of, and recent changes to, the package."
   :group 'checkdoc
   :type 'boolean)
 
 (defcustom checkdoc-permit-comma-termination-flag nil
-  "*Non-nil means the first line of a docstring may end with a comma.
+  "Non-nil means the first line of a docstring may end with a comma.
 Ordinarily, a full sentence is required.  This may be misleading when
 there is a substantial caveat to the one-line description -- the comma
 should be used when the first part could stand alone as a sentence, but
 it indicates that a modifying clause follows."
   :group 'checkdoc
   :type 'boolean)
+(put 'checkdoc-permit-comma-termination-flag 'safe-local-variable 'booleanp)
 
 (defcustom checkdoc-spellcheck-documentation-flag nil
-  "*Non-nil means run Ispell on text based on value.
+  "Non-nil means run Ispell on text based on value.
 This is automatically set to nil if Ispell does not exist on your
 system.  Possible values are:
 
@@ -259,14 +267,14 @@
   "List of words that are correct when spell-checking Lisp documentation.")
 
 (defcustom checkdoc-max-keyref-before-warn 10
-  "*The number of \\ [command-to-keystroke] tokens allowed in a doc string.
+  "The number of \\ [command-to-keystroke] tokens allowed in a doc string.
 Any more than this and a warning is generated suggesting that the construct
 \\ {keymap} be used instead."
   :group 'checkdoc
   :type 'integer)
 
 (defcustom checkdoc-arguments-in-order-flag t
-  "*Non-nil means warn if arguments appear out of order.
+  "Non-nil means warn if arguments appear out of order.
 Setting this to nil will mean only checking that all the arguments
 appear in the proper form in the documentation, not that they are in
 the same order as they appear in the argument list.  No mention is
@@ -298,7 +306,7 @@
 A search leaves the cursor in front of the parameter list.")
 
 (defcustom checkdoc-verb-check-experimental-flag t
-  "*Non-nil means to attempt to check the voice of the doc string.
+  "Non-nil means to attempt to check the voice of the doc string.
 This check keys off some words which are commonly misused.  See the
 variable `checkdoc-common-verbs-wrong-voice' if you wish to add your own."
   :group 'checkdoc
@@ -2633,12 +2641,6 @@
 	(setq checkdoc-pending-errors nil)
 	nil)))
 
-(defgroup checkdoc nil
-  "Support for doc string checking in Emacs Lisp."
-  :prefix "checkdoc"
-  :group 'lisp
-  :version "20.3")
-
 (custom-add-option 'emacs-lisp-mode-hook
 		   (lambda () (checkdoc-minor-mode 1)))
 
@@ -2650,5 +2652,5 @@
 
 (provide 'checkdoc)
 
-;;; arch-tag: c49a7ec8-3bb7-46f2-bfbc-d5f26e033b26
+;; arch-tag: c49a7ec8-3bb7-46f2-bfbc-d5f26e033b26
 ;;; checkdoc.el ends here
--- a/lisp/emacs-lisp/edebug.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/emacs-lisp/edebug.el	Sat Oct 14 16:56:21 2006 +0000
@@ -2556,6 +2556,7 @@
 	(edebug-outside-buffer (current-buffer))
 	(edebug-outside-point (point))
  	(edebug-outside-mark (edebug-mark))
+	(edebug-outside-unread-command-events unread-command-events)
 	edebug-outside-windows		; window or screen configuration
 	edebug-buffer-points
 
@@ -2574,6 +2575,7 @@
 	      (overlay-arrow-string overlay-arrow-string)
 	      (cursor-in-echo-area nil)
 	      (default-cursor-in-non-selected-windows t)
+	      (unread-command-events unread-command-events)
 	      ;; any others??
 	      )
 	  (if (not (buffer-name edebug-buffer))
@@ -2662,6 +2664,7 @@
 
 	   (t (message "")))
 
+	  (setq unread-command-events nil)
 	  (if (eq 'after edebug-arg-mode)
 	      (progn
 		;; Display result of previous evaluation.
@@ -2681,8 +2684,7 @@
 	   ((eq edebug-execution-mode 'trace)
 	    (edebug-sit-for edebug-sit-for-seconds)) ; Force update and pause.
 	   ((eq edebug-execution-mode 'Trace-fast)
-	    (edebug-sit-for 0))		; Force update and continue.
-	   )
+	    (edebug-sit-for 0)))		; Force update and continue.
 
 	  (unwind-protect
 	      (if (or edebug-stop
@@ -2778,6 +2780,7 @@
       (with-timeout-unsuspend edebug-with-timeout-suspend)
       ;; Reset global variables to outside values in case they were changed.
       (setq
+       unread-command-events edebug-outside-unread-command-events
        overlay-arrow-position edebug-outside-o-a-p
        overlay-arrow-string edebug-outside-o-a-s
        cursor-in-echo-area edebug-outside-c-i-e-a
@@ -2868,7 +2871,6 @@
 
 	(edebug-outside-last-input-event last-input-event)
 	(edebug-outside-last-command-event last-command-event)
-	(edebug-outside-unread-command-events unread-command-events)
 	(edebug-outside-last-event-frame last-event-frame)
 	(edebug-outside-last-nonmenu-event last-nonmenu-event)
 	(edebug-outside-track-mouse track-mouse)
@@ -2890,7 +2892,6 @@
 	      ;; More for Emacs 19
 	      (last-input-event nil)
 	      (last-command-event nil)
-	      (unread-command-events nil)
 	      (last-event-frame nil)
 	      (last-nonmenu-event nil)
 	      (track-mouse nil)
@@ -2950,7 +2951,6 @@
        last-command edebug-outside-last-command
        this-command edebug-outside-this-command
        unread-command-char edebug-outside-unread-command-char
-       unread-command-events edebug-outside-unread-command-events
        current-prefix-arg edebug-outside-current-prefix-arg
        last-input-char edebug-outside-last-input-char
        last-input-event edebug-outside-last-input-event
--- a/lisp/emacs-lisp/timer.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/emacs-lisp/timer.el	Sat Oct 14 16:56:21 2006 +0000
@@ -60,14 +60,22 @@
 
 (defun timer-set-idle-time (timer secs &optional repeat)
   "Set the trigger idle time of TIMER to SECS.
+SECS may be an integer, floating point number, or the internal
+time format (HIGH LOW USECS) returned by, e.g., `current-idle-time'.
 If optional third argument REPEAT is non-nil, make the timer
 fire each time Emacs is idle for that many seconds."
   (or (timerp timer)
       (error "Invalid timer"))
-  (aset timer 1 0)
-  (aset timer 2 0)
-  (aset timer 3 0)
-  (timer-inc-time timer secs)
+  (if (consp secs)
+      (progn (aset timer 1 (car secs))
+	     (aset timer 2 (if (consp (cdr secs)) (car (cdr secs)) (cdr secs)))
+	     (aset timer 3 (or (and (consp (cdr secs)) (consp (cdr (cdr secs)))
+				    (nth 2 secs))
+			       0)))
+    (aset timer 1 0)
+    (aset timer 2 0)
+    (aset timer 3 0)
+    (timer-inc-time timer secs))
   (aset timer 4 repeat)
   timer)
 
@@ -104,7 +112,7 @@
 
 (defun timer-relative-time (time secs &optional usecs)
   "Advance TIME by SECS seconds and optionally USECS microseconds.
-SECS may be a fraction."
+SECS may be either an integer or a floating point number."
   (let ((high (car time))
 	(low (if (consp (cdr time)) (nth 1 time) (cdr time)))
 	(micro (if (numberp (car-safe (cdr-safe (cdr time))))
@@ -412,7 +420,10 @@
 (defun run-with-idle-timer (secs repeat function &rest args)
   "Perform an action the next time Emacs is idle for SECS seconds.
 The action is to call FUNCTION with arguments ARGS.
-SECS may be an integer or a floating point number.
+SECS may be an integer, a floating point number, or the internal
+time format (HIGH LOW USECS) returned by, e.g., `current-idle-time'.
+If Emacs is currently idle, and has been idle for N seconds (N < SECS),
+then it will call FUNCTION in SECS - N seconds from now.
 
 If REPEAT is non-nil, do the action each time Emacs has been idle for
 exactly SECS seconds (that is, only once for each time Emacs becomes idle).
@@ -425,7 +436,7 @@
   (let ((timer (timer-create)))
     (timer-set-function timer function args)
     (timer-set-idle-time timer secs repeat)
-    (timer-activate-when-idle timer)
+    (timer-activate-when-idle timer t)
     timer))
 
 (defun with-timeout-handler (tag)
--- a/lisp/emacs-lisp/tq.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/emacs-lisp/tq.el	Sat Oct 14 16:56:21 2006 +0000
@@ -66,7 +66,7 @@
 ;; regexp: regular expression that matches the end of a response from
 ;; the process
 (defun tq-queue-head-regexp   (tq) (car (cdr (car (tq-queue tq)))))
-;; closure: additional data to pass to function
+;; closure: additional data to pass to the function
 (defun tq-queue-head-closure  (tq) (car (cdr (cdr (car (tq-queue tq))))))
 ;; fn: function to call upon receiving a complete response from the
 ;; process
@@ -119,7 +119,7 @@
 the process has finished replying to any previous questions.
 This produces more reliable results with some processes."
   (let ((sendp (or (not delay-question)
-		   (not (tq-queue-head-question tq)))))
+		   (not (tq-queue tq)))))
     (tq-queue-add tq (unless sendp question) regexp closure fn)
     (when sendp
       (process-send-string (tq-process tq) question))))
@@ -131,35 +131,39 @@
 
 (defun tq-filter (tq string)
   "Append STRING to the TQ's buffer; then process the new data."
-  (with-current-buffer (tq-buffer tq)
-    (goto-char (point-max))
-    (insert string)
-    (tq-process-buffer tq)))
+  (let ((buffer (tq-buffer tq)))
+    (when (buffer-live-p buffer)
+      (with-current-buffer buffer
+	(goto-char (point-max))
+	(insert string)
+	(tq-process-buffer tq)))))
 
 (defun tq-process-buffer (tq)
   "Check TQ's buffer for the regexp at the head of the queue."
-  (set-buffer (tq-buffer tq))
-  (if (= 0 (buffer-size)) ()
-    (if (tq-queue-empty tq)
-	(let ((buf (generate-new-buffer "*spurious*")))
-	  (copy-to-buffer buf (point-min) (point-max))
-	  (delete-region (point-min) (point))
-	  (pop-to-buffer buf nil)
-	  (error "Spurious communication from process %s, see buffer %s"
-		 (process-name (tq-process tq))
-		 (buffer-name buf)))
-      (goto-char (point-min))
-      (if (re-search-forward (tq-queue-head-regexp tq) nil t)
-	  (let ((answer (buffer-substring (point-min) (point))))
-	    (delete-region (point-min) (point))
-	    (unwind-protect
-		(condition-case nil
-		    (funcall (tq-queue-head-fn tq)
-			     (tq-queue-head-closure tq)
-			     answer)
-		  (error nil))
-	      (tq-queue-pop tq))
-	    (tq-process-buffer tq))))))
+  (let ((buffer (tq-buffer tq)))
+    (when (buffer-live-p buffer)
+      (set-buffer buffer)
+      (if (= 0 (buffer-size)) ()
+	(if (tq-queue-empty tq)
+	    (let ((buf (generate-new-buffer "*spurious*")))
+	      (copy-to-buffer buf (point-min) (point-max))
+	      (delete-region (point-min) (point))
+	      (pop-to-buffer buf nil)
+	      (error "Spurious communication from process %s, see buffer %s"
+		     (process-name (tq-process tq))
+		     (buffer-name buf)))
+	  (goto-char (point-min))
+	  (if (re-search-forward (tq-queue-head-regexp tq) nil t)
+	      (let ((answer (buffer-substring (point-min) (point))))
+		(delete-region (point-min) (point))
+		(unwind-protect
+		    (condition-case nil
+			(funcall (tq-queue-head-fn tq)
+				 (tq-queue-head-closure tq)
+				 answer)
+		      (error nil))
+		  (tq-queue-pop tq))
+		(tq-process-buffer tq))))))))
 
 (provide 'tq)
 
--- a/lisp/emulation/viper-cmd.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/emulation/viper-cmd.el	Sat Oct 14 16:56:21 2006 +0000
@@ -46,6 +46,8 @@
 (defvar mark-even-if-inactive)
 (defvar init-message)
 (defvar initial)
+(defvar undo-beg-posn)
+(defvar undo-end-posn)
 
 ;; loading happens only in non-interactive compilation
 ;; in order to spare non-viperized emacs from being viperized
@@ -196,7 +198,7 @@
 	    (viper-save-cursor-color 'before-insert-mode))
 	;; set insert mode cursor color
 	(viper-change-cursor-color viper-insert-state-cursor-color)))
-  (if (eq viper-current-state 'emacs-state)
+  (if (and viper-emacs-state-cursor-color (eq viper-current-state 'emacs-state))
       (let ((has-saved-cursor-color-in-emacs-mode
 	     (stringp (viper-get-saved-cursor-color-in-emacs-mode))))
 	(or has-saved-cursor-color-in-emacs-mode
@@ -722,12 +724,13 @@
       (viper-set-replace-overlay (point-min) (point-min)))
   (viper-hide-replace-overlay)
 
-  (let ((has-saved-cursor-color-in-emacs-mode
-	 (stringp (viper-get-saved-cursor-color-in-emacs-mode))))
-    (or has-saved-cursor-color-in-emacs-mode
-	(string= (viper-get-cursor-color) viper-emacs-state-cursor-color)
-	(viper-save-cursor-color 'before-emacs-mode))
-    (viper-change-cursor-color viper-emacs-state-cursor-color))
+  (if viper-emacs-state-cursor-color
+      (let ((has-saved-cursor-color-in-emacs-mode
+	     (stringp (viper-get-saved-cursor-color-in-emacs-mode))))
+	(or has-saved-cursor-color-in-emacs-mode
+	    (string= (viper-get-cursor-color) viper-emacs-state-cursor-color)
+	    (viper-save-cursor-color 'before-emacs-mode))
+	(viper-change-cursor-color viper-emacs-state-cursor-color)))
 
   (viper-change-state 'emacs-state)
 
@@ -1030,10 +1033,13 @@
 	(inhibit-quit t))
     (if (viper-ESC-event-p event)
 	(progn
-	  ;; Emacs 22.50.8 introduced a bug, which makes even a single ESC into
-	  ;; a fast keyseq. To guard against this, we added a check if there
-	  ;; are other events as well
-	  (if (and (viper-fast-keysequence-p) unread-command-events)
+	  ;; Some versions of Emacs (eg., 22.50.8 have a bug, which makes even
+	  ;; a single ESC into ;; a fast keyseq. To guard against this, we
+	  ;; added a check if there are other events as well. Keep the next
+	  ;; line for the next time the bug reappears, so that will remember to
+	  ;; report it.
+	  ;;(if (and (viper-fast-keysequence-p) unread-command-events)
+	  (if (viper-fast-keysequence-p) ;; for Emacsen without the above bug
 	      (progn
 		(let (minor-mode-map-alist emulation-mode-map-alists)
 		  (viper-set-unread-command-events event)
@@ -1744,12 +1750,14 @@
 
 ;; Hook used in viper-undo
 (defun viper-after-change-undo-hook (beg end len)
-  (setq undo-beg-posn beg
-	undo-end-posn (or end beg))
-  ;; some other hooks may be changing various text properties in
-  ;; the buffer in response to 'undo'; so remove this hook to avoid
-  ;; its repeated invocation
-  (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local))
+  (if undo-in-progress
+      (setq undo-beg-posn beg
+	    undo-end-posn (or end beg))
+    ;; some other hooks may be changing various text properties in
+    ;; the buffer in response to 'undo'; so remove this hook to avoid
+    ;; its repeated invocation
+    (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local)
+  ))
 
 (defun viper-undo ()
   "Undo previous change."
@@ -1764,25 +1772,29 @@
 
     (undo-start)
     (undo-more 2)
-    (setq undo-beg-posn (or undo-beg-posn before-undo-pt)
-	  undo-end-posn (or undo-end-posn undo-beg-posn))
-
-    (goto-char undo-beg-posn)
-    (sit-for 0)
-    (if (and viper-keep-point-on-undo
-	     (pos-visible-in-window-p before-undo-pt))
+    ;;(setq undo-beg-posn (or undo-beg-posn (point))
+    ;;    undo-end-posn (or undo-end-posn (point)))
+    ;;(setq undo-beg-posn (or undo-beg-posn before-undo-pt)
+    ;;      undo-end-posn (or undo-end-posn undo-beg-posn))
+
+    (if (and undo-beg-posn undo-end-posn)
 	(progn
-	  (push-mark (point-marker) t)
-	  (viper-sit-for-short 300)
-	  (goto-char undo-end-posn)
-	  (viper-sit-for-short 300)
-	  (if (and (> (viper-chars-in-region undo-beg-posn before-undo-pt) 1)
-		   (> (viper-chars-in-region undo-end-posn before-undo-pt) 1))
-	      (goto-char before-undo-pt)
-	    (goto-char undo-beg-posn)))
-      (push-mark before-undo-pt t))
+	  (goto-char undo-beg-posn)
+	  (sit-for 0)
+	  (if (and viper-keep-point-on-undo
+		   (pos-visible-in-window-p before-undo-pt))
+	      (progn
+		(push-mark (point-marker) t)
+		(viper-sit-for-short 300)
+		(goto-char undo-end-posn)
+		(viper-sit-for-short 300)
+		(if (pos-visible-in-window-p undo-beg-posn)
+		    (goto-char before-undo-pt)
+		  (goto-char undo-beg-posn)))
+	    (push-mark before-undo-pt t))
+	  ))
+
     (if (and (eolp) (not (bolp))) (backward-char 1))
-    ;;(if (not modified) (set-buffer-modified-p t))
     )
   (setq this-command 'viper-undo))
 
@@ -3952,7 +3964,8 @@
   (let ((val (viper-p-val arg))
 	(com (viper-getcom arg))
 	debug-on-error)
-    (if (null viper-s-string) (error viper-NoPrevSearch))
+    (if (or (null viper-s-string) (string= viper-s-string ""))
+	(error viper-NoPrevSearch))
     (viper-search viper-s-string viper-s-forward arg)
     (if com
 	(progn
--- a/lisp/emulation/viper-ex.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/emulation/viper-ex.el	Sat Oct 14 16:56:21 2006 +0000
@@ -208,12 +208,12 @@
 
 ;; If this is a one-letter magic command, splice in args.
 (defun ex-splice-args-in-1-letr-cmd (key list)
-  (let ((onelet (ex-cmd-is-one-letter (assoc (substring key 0 1) list))))
-    (if onelet
+  (let ((oneletter (ex-cmd-is-one-letter (assoc (substring key 0 1) list))))
+    (if oneletter
 	(list key
-	      (append (cadr onelet)
+	      (append (cadr oneletter)
 		      (if (< 1 (length key)) (list (substring key 1))))
-	      (caddr onelet)))
+	      (car (cdr (cdr oneletter))) ))
 	))
 
 
--- a/lisp/emulation/viper-init.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/emulation/viper-init.el	Sat Oct 14 16:56:21 2006 +0000
@@ -434,7 +434,10 @@
 (if (fboundp 'make-variable-frame-local)
     (make-variable-frame-local 'viper-insert-state-cursor-color))
 
-(defcustom viper-emacs-state-cursor-color "Magenta"
+;; viper-emacs-state-cursor-color doesn't work well. Causes cursor colors to be
+;; confused in some cases. So, this var is nulled for now.
+;; (defcustom viper-emacs-state-cursor-color "Magenta"
+(defcustom viper-emacs-state-cursor-color nil
   "Cursor color when Viper is in emacs state."
   :type 'string
   :group 'viper)
--- a/lisp/emulation/viper-util.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/emulation/viper-util.el	Sat Oct 14 16:56:21 2006 +0000
@@ -137,10 +137,10 @@
    (x-display-color-p)  ; emacs
    ))
 
-(defsubst viper-get-cursor-color ()
+(defun viper-get-cursor-color (&optional frame)
   (viper-cond-compile-for-xemacs-or-emacs
    (color-instance-name
-    (frame-property (selected-frame) 'cursor-color)) ; xemacs
+    (frame-property (or frame (selected-frame)) 'cursor-color)) ; xemacs
    (cdr (assoc 'cursor-color (frame-parameters))) ; emacs
    ))
 
@@ -152,18 +152,31 @@
 
 
 ;; cursor colors
-(defun viper-change-cursor-color (new-color)
+(defun viper-change-cursor-color (new-color &optional frame)
   (if (and (viper-window-display-p)  (viper-color-display-p)
 	   (stringp new-color) (viper-color-defined-p new-color)
 	   (not (string= new-color (viper-get-cursor-color))))
       (viper-cond-compile-for-xemacs-or-emacs
        (set-frame-property
-	(selected-frame) 'cursor-color (make-color-instance new-color))
+	(or frame (selected-frame))
+	'cursor-color (make-color-instance new-color))
        (modify-frame-parameters
-	(selected-frame) (list (cons 'cursor-color new-color)))
+	(or frame (selected-frame))
+	(list (cons 'cursor-color new-color)))
        )
     ))
 
+(defun viper-set-cursor-color-according-to-state (&optional frame)
+  (cond ((eq viper-current-state 'replace-state)
+	 (viper-change-cursor-color viper-replace-state-cursor-color frame))
+	((and (eq viper-current-state 'emacs-state)
+	      viper-emacs-state-cursor-color)
+	 (viper-change-cursor-color viper-emacs-state-cursor-color frame))
+	((eq viper-current-state 'insert-state)
+	 (viper-change-cursor-color viper-insert-state-cursor-color frame))
+	(t
+	 (viper-change-cursor-color viper-vi-state-cursor-color frame))))
+
 ;; By default, saves current frame cursor color in the
 ;; viper-saved-cursor-color-in-replace-mode property of viper-replace-overlay
 (defun viper-save-cursor-color (before-which-mode)
@@ -191,7 +204,7 @@
     (if viper-emacs-p 'frame-parameter 'frame-property)
     (selected-frame)
     'viper-saved-cursor-color-in-replace-mode)
-   (if (eq viper-current-state 'emacs-mode)
+   (if (and (eq viper-current-state 'emacs-mode) viper-emacs-state-cursor-color)
        viper-emacs-state-cursor-color
      viper-vi-state-cursor-color)))
 
@@ -201,7 +214,7 @@
     (if viper-emacs-p 'frame-parameter 'frame-property)
     (selected-frame)
     'viper-saved-cursor-color-in-insert-mode)
-   (if (eq viper-current-state 'emacs-mode)
+   (if (and (eq viper-current-state 'emacs-mode) viper-emacs-state-cursor-color)
        viper-emacs-state-cursor-color
      viper-vi-state-cursor-color)))
 
--- a/lisp/emulation/viper.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/emulation/viper.el	Sat Oct 14 16:56:21 2006 +0000
@@ -534,10 +534,6 @@
 (defun viper-mode ()
   "Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Viper'."
   (interactive)
-  (if (null viper-vi-state-cursor-color)
-      (modify-frame-parameters
-	(selected-frame)
-	(list (cons 'viper-vi-state-cursor-color (viper-get-cursor-color)))))
   (if (not noninteractive)
       (progn
 	;; if the user requested viper-mode explicitly
@@ -618,7 +614,8 @@
 
 	(or (memq major-mode viper-emacs-state-mode-list) ; don't switch to Vi
 	    (memq major-mode viper-insert-state-mode-list) ; don't switch
-	    (viper-change-state-to-vi)))))
+	    (viper-change-state-to-vi))
+	)))
 
 
 ;; Apply a little heuristic to invoke vi state on major-modes
@@ -862,8 +859,11 @@
   ;; info about the display and windows until emacs initialization is complete
   ;; So do it via the window-setup-hook
   (add-hook 'window-setup-hook
-	    '(lambda ()
-	       (setq viper-vi-state-cursor-color (viper-get-cursor-color))))
+  	    '(lambda ()
+	       (modify-frame-parameters
+		(selected-frame)
+		(list (cons 'viper-vi-state-cursor-color
+			    (viper-get-cursor-color))))))
 
   ;; Tell vc-diff to put *vc* in Vi mode
   (if (featurep 'vc)
@@ -903,7 +903,6 @@
 
   (defadvice set-cursor-color (after viper-set-cursor-color-ad activate)
     "Change cursor color in VI state."
-    ;;(setq viper-vi-state-cursor-color (ad-get-arg 0))
     (modify-frame-parameters
 	(selected-frame)
 	(list (cons 'viper-vi-state-cursor-color (ad-get-arg 0))))
@@ -1008,8 +1007,8 @@
 ;; these are primarily advices and Vi-ish variable settings
 (defun viper-non-hook-settings ()
 
-  ;; Viper changes the default mode-line-buffer-identification
-  (setq-default mode-line-buffer-identification '(" %b"))
+  ;;;; Viper changes the default mode-line-buffer-identification
+  ;;(setq-default mode-line-buffer-identification '(" %b"))
 
   ;; setup emacs-supported vi-style feel
   (setq next-line-add-newlines nil
--- a/lisp/erc/ChangeLog	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/erc/ChangeLog	Sat Oct 14 16:56:21 2006 +0000
@@ -1,3 +1,78 @@
+2006-08-13  Romain Francoise  <romain@orebokech.com>
+
+	* erc-match.el (erc-log-matches-make-buffer): End `y-or-n-p'
+	prompt with a space.
+
+2006-08-07  Michael Olson  <mwolson@gnu.org>
+
+	* erc-backend.el (erc-process-sentinel-1): Use erc-display-message
+	in several places instead of inserting text.
+	(erc-process-sentinel): Move to the input-marker before removing
+	the prompt.
+
+	* erc.el (erc-port): Fix customization options.
+	(erc-display-message): Handle null type explicitly.  Previously,
+	this was relying on a chance side-effect.  Cosmetic indentation
+	tweak.
+	(english): Add 'finished and 'terminated entries to the catalog.
+	Add initial and terminal newlines to 'disconnected and
+	'disconnected-noreconnect entries.  Avoid long lines.
+
+2006-08-06  Michael Olson  <mwolson@gnu.org>
+
+	* erc.el (erc-arrange-session-in-multiple-windows): Fix bug with
+	multi-tty Emacs.
+	(erc-select-startup-file): Fix bug introduced by recent change.
+
+2006-08-05  Michael Olson  <mwolson@gnu.org>
+
+	* erc-log.el (erc-log-standardize-name): New function that returns
+	a filename that is safe for use for a log file.
+	(erc-current-logfile): Use it.
+
+	* erc.el (erc-startup-file-list): Search in ~/.emacs.d first,
+	since that is a fairly standard directory.
+	(erc-select-startup-file): Re-write to use
+	convert-standard-filename, which will ensure that MS-DOS systems
+	look for the _ercrc.el file.
+
+2006-08-02  Michael Olson  <mwolson@gnu.org>
+
+	* erc.el (erc-version-string): Release ERC 5.1.4.
+
+	* Makefile, NEWS, erc.texi: Update for the 5.1.4 release.
+
+	* erc.el (erc-active-buffer): Fix bug that caused messages to go
+	to the wrong buffer.  Thanks to offby1 for the report.
+
+	* erc-backend.el (erc-coding-system-for-target): Handle case where
+	target is nil.  Thanks to Kai Fan for the patch.
+
+2006-07-29  Michael Olson  <mwolson@gnu.org>
+
+	* erc-log.el (erc-log-setup-logging): Don't offer to save the
+	buffer.  It will be saved automatically killed.  Thanks to Johan
+	Bockgård and Tassilo Horn for pointing this out.
+
+2006-07-27  Johan Bockgård  <bojohan@users.sourceforge.net>
+
+	* erc.el (define-erc-module): Make find-function and find-variable
+	find the names constructed by `define-erc-module' in Emacs 22.
+
+2006-07-14  Michael Olson  <mwolson@gnu.org>
+
+	* erc-log.el (log): Make sure that we enable logging on
+	already-opened buffers as well, in case the user toggles this
+	module after loading ERC.  Also be sure to remove logging ability
+	from all ERC buffers when the module is disabled.
+	(erc-log-setup-logging): Set buffer-file-name to nil rather than
+	the empty string.  This should fix some errors that occur when
+	quitting Emacs without first killing all ERC buffers.
+	(erc-log-disable-logging): New function that removes the logging
+	ability from the current buffer.
+
+	* erc-spelling.el (spelling): Use dolist and buffer-live-p.
+
 2006-07-12  Michael Olson  <mwolson@gnu.org>
 
 	* erc-match.el (erc-log-matches): Bind inhibit-read-only rather
--- a/lisp/erc/erc-backend.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/erc/erc-backend.el	Sat Oct 14 16:56:21 2006 +0000
@@ -493,11 +493,7 @@
   (if erc-server-quitting
       ;; normal quit
       (progn
-        (let ((string "\n\n*** ERC finished ***\n")
-              (inhibit-read-only t))
-          (erc-put-text-property 0 (length string)
-                                 'face 'erc-error-face string)
-          (insert string))
+        (erc-display-message nil 'error (current-buffer) 'finished)
         (when erc-kill-server-buffer-on-quit
           (set-buffer-modified-p nil)
           (kill-buffer (current-buffer))))
@@ -519,12 +515,8 @@
         (erc erc-session-server erc-session-port erc-server-current-nick
              erc-session-user-full-name t erc-session-password)
       ;; terminate, do not reconnect
-      (let ((string (concat "\n\n*** ERC terminated: " event
-                            "\n"))
-            (inhibit-read-only t))
-        (erc-put-text-property 0 (length string)
-                               'face 'erc-error-face string)
-        (insert string)))))
+      (erc-display-message nil 'error (current-buffer)
+                           'terminated ?e event))))
 
 (defun erc-process-sentinel (cproc event)
   "Sentinel function for ERC process."
@@ -545,6 +537,7 @@
         (run-hook-with-args 'erc-disconnected-hook
                             (erc-current-nick) (system-name) "")
         ;; Remove the prompt
+        (goto-char (or (marker-position erc-input-marker) (point-max)))
         (forward-line 0)
         (erc-remove-text-properties-region (point) (point-max))
         (delete-region (point) (point-max))
@@ -563,11 +556,12 @@
   "Return the coding system or cons cell appropriate for TARGET.
 This is determined via `erc-encoding-coding-alist' or
 `erc-server-coding-system'."
-  (or (let ((case-fold-search t))
-        (catch 'match
-          (dolist (pat erc-encoding-coding-alist)
-            (when (string-match (car pat) target)
-              (throw 'match (cdr pat))))))
+  (or (when target
+        (let ((case-fold-search t))
+          (catch 'match
+            (dolist (pat erc-encoding-coding-alist)
+              (when (string-match (car pat) target)
+                (throw 'match (cdr pat)))))))
       (and (functionp erc-server-coding-system)
            (funcall erc-server-coding-system))
       erc-server-coding-system))
--- a/lisp/erc/erc-log.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/erc/erc-log.el	Sat Oct 14 16:56:21 2006 +0000
@@ -71,8 +71,6 @@
 ;; markers.
 
 ;;; TODO:
-;; * Erc needs a generalised make-safe-file-name function, so that
-;;   generated file names don't contain any invalid file characters.
 ;;
 ;; * Really, we need to lock the logfiles somehow, so that if a user
 ;;   is running multiple emacsen and/or on the same channel as more
@@ -218,7 +216,10 @@
    (add-hook 'erc-quit-hook 'erc-conditional-save-queries)
    (add-hook 'erc-part-hook 'erc-conditional-save-buffer)
    ;; append, so that 'erc-initialize-log-marker runs first
-   (add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append))
+   (add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append)
+   (dolist (buffer (erc-buffer-list))
+     (when (buffer-live-p buffer)
+       (with-current-buffer buffer (erc-log-setup-logging)))))
   ;; disable
   ((remove-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs)
    (remove-hook 'erc-send-post-hook 'erc-save-buffer-in-logs)
@@ -226,7 +227,10 @@
    (remove-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs)
    (remove-hook 'erc-quit-hook 'erc-conditional-save-queries)
    (remove-hook 'erc-part-hook 'erc-conditional-save-buffer)
-   (remove-hook 'erc-connect-pre-hook 'erc-log-setup-logging)))
+   (remove-hook 'erc-connect-pre-hook 'erc-log-setup-logging)
+   (dolist (buffer (erc-buffer-list))
+     (when (buffer-live-p buffer)
+       (with-current-buffer buffer (erc-log-disable-logging))))))
 
 (define-key erc-mode-map "\C-c\C-l" 'erc-save-buffer-in-logs)
 
@@ -236,8 +240,7 @@
 This function is destined to be run from `erc-connect-pre-hook'."
   (when (erc-logging-enabled)
     (auto-save-mode -1)
-    (setq buffer-offer-save t
-	  buffer-file-name "")
+    (setq buffer-file-name nil)
     (set (make-local-variable 'write-file-functions)
 	 '(erc-save-buffer-in-logs))
     (when erc-log-insert-log-on-open
@@ -245,6 +248,12 @@
 		     (move-marker erc-last-saved-position
 				  (1- (point-max)))))))
 
+(defun erc-log-disable-logging ()
+  "Disable logging in the current buffer."
+  (when (erc-logging-enabled)
+    (setq buffer-offer-save nil
+	  erc-enable-logging nil)))
+
 (defun erc-log-all-but-server-buffers (buffer)
   "Returns t if logging should be enabled in BUFFER.
 Returns nil iff `erc-server-buffer-p' returns t."
@@ -282,17 +291,27 @@
 	   (funcall erc-enable-logging (or buffer (current-buffer)))
 	 erc-enable-logging)))
 
+(defun erc-log-standardize-name (filename)
+  "Make FILENAME safe to use as the name of an ERC log.
+This will not work with full paths, only names.
+
+Any unsafe characters in the name are replaced with \"!\".  The
+filename is downcased."
+  (downcase (erc-replace-regexp-in-string
+	     "[/\\]" "!" (convert-standard-filename filename))))
+
 (defun erc-current-logfile (&optional buffer)
   "Return the logfile to use for BUFFER.
 If BUFFER is nil, the value of `current-buffer' is used.
 This is determined by `erc-generate-log-file-name-function'.
 The result is converted to lowercase, as IRC is case-insensitive"
   (expand-file-name
-   (downcase (funcall erc-generate-log-file-name-function
-		      (or buffer (current-buffer))
-		      (or (erc-default-target) (buffer-name buffer))
-		      (erc-current-nick)
-		      erc-session-server erc-session-port))
+   (erc-log-standardize-name
+    (funcall erc-generate-log-file-name-function
+	     (or buffer (current-buffer))
+	     (or (erc-default-target) (buffer-name buffer))
+	     (erc-current-nick)
+	     erc-session-server erc-session-port))
    erc-log-channels-directory))
 
 (defun erc-generate-log-file-name-with-date (buffer &rest ignore)
--- a/lisp/erc/erc-match.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/erc/erc-match.el	Sat Oct 14 16:56:21 2006 +0000
@@ -566,7 +566,7 @@
       (unless buffer-already
 	(insert " == Type \"q\" to dismiss messages ==\n")
 	(erc-view-mode-enter nil (lambda (buffer)
-				   (when (y-or-n-p "Discard messages?")
+				   (when (y-or-n-p "Discard messages? ")
 				     (kill-buffer buffer)))))
       buffer)))
 
--- a/lisp/erc/erc-spelling.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/erc/erc-spelling.el	Sat Oct 14 16:56:21 2006 +0000
@@ -40,15 +40,13 @@
   ;; Use erc-connect-pre-hook instead of erc-mode-hook as pre-hook is
   ;; called AFTER the server buffer is initialized.
   ((add-hook 'erc-connect-pre-hook 'erc-spelling-init)
-   (mapc (lambda (buffer)
-           (when buffer
-             (with-current-buffer buffer (erc-spelling-init))))
-         (erc-buffer-list)))
+   (dolist (buffer (erc-buffer-list))
+     (when (buffer-live-p buffer)
+       (with-current-buffer buffer (erc-spelling-init)))))
   ((remove-hook 'erc-connect-pre-hook 'erc-spelling-init)
-   (mapc (lambda (buffer)
-           (when buffer
-             (with-current-buffer buffer (flyspell-mode 0))))
-         (erc-buffer-list))))
+   (dolist (buffer (erc-buffer-list))
+     (when (buffer-live-p buffer)
+       (with-current-buffer buffer (flyspell-mode 0))))))
 
 (defcustom erc-spelling-dictionaries nil
   "An alist mapping buffer names to dictionaries.
--- a/lisp/erc/erc.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/erc/erc.el	Sat Oct 14 16:56:21 2006 +0000
@@ -67,7 +67,7 @@
 
 ;;; Code:
 
-(defconst erc-version-string "Version 5.1.3"
+(defconst erc-version-string "Version 5.1.4"
   "ERC version.  This is used by function `erc-version'.")
 
 (eval-when-compile (require 'cl))
@@ -157,8 +157,8 @@
 This can be either a string or a number."
   :group 'erc
   :type '(choice (const :tag "None" nil)
-		 (const :tag "Port number" number)
-		 (const :tag "Port string" string)))
+		 (integer :tag "Port number")
+		 (string :tag "Port string")))
 
 (defcustom erc-nick nil
   "Nickname to use if one is not provided.
@@ -822,7 +822,8 @@
 ;; Script parameters
 
 (defcustom erc-startup-file-list
-  '("~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc")
+  '("~/.emacs.d/.ercrc.el" "~/.emacs.d/.ercrc"
+    "~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc")
   "List of files to try for a startup script.
 The first existent and readable one will get executed.
 
@@ -1243,7 +1244,11 @@
 		(format "erc-%s-mode"
 			(downcase (symbol-name alias)))))
 	     (quote
-	      ,mode))))))
+	      ,mode)))
+       ;; For find-function and find-variable.
+       (put ',mode    'definition-name ',name)
+       (put ',enable  'definition-name ',name)
+       (put ',disable 'definition-name ',name))))
 
 (put 'define-erc-module 'doc-string-elt 3)
 
@@ -1388,8 +1393,8 @@
 Defaults to the server buffer."
   (with-current-buffer (erc-server-buffer)
     (if (buffer-live-p erc-active-buffer)
-	erc-active-buffer)
-    (setq erc-active-buffer (current-buffer))))
+	erc-active-buffer
+      (setq erc-active-buffer (current-buffer)))))
 
 (defun erc-set-active-buffer (buffer)
   "Set the value of `erc-active-buffer' to BUFFER."
@@ -2358,6 +2363,8 @@
 		  msg)))
     (setq string
 	  (cond
+	   ((null type)
+	    string)
 	   ((listp type)
 	    (mapc (lambda (type)
 		    (setq string
@@ -2370,7 +2377,7 @@
     (if (not (erc-response-p parsed))
 	(erc-display-line string buffer)
       (unless (member (erc-response.command parsed) erc-hide-list)
-      (erc-put-text-property 0 (length string) 'erc-parsed parsed string)
+	(erc-put-text-property 0 (length string) 'erc-parsed parsed string)
 	(erc-put-text-property 0 (length string) 'rear-sticky t string)
 	(erc-display-line string buffer)))))
 
@@ -5237,13 +5244,11 @@
 (defun erc-select-startup-file ()
   "Select an ERC startup file.
 See also `erc-startup-file-list'."
-  (let ((l erc-startup-file-list)
-	(f nil))
-    (while (and (not f) l)
-      (if (file-readable-p (car l))
-	  (setq f (car l)))
-      (setq l (cdr l)))
-    f))
+  (catch 'found
+    (dolist (f erc-startup-file-list)
+      (setq f (convert-standard-filename f))
+      (when (file-readable-p f)
+	(throw 'found f)))))
 
 (defun erc-find-script-file (file)
   "Search for FILE in `default-directory', and any in `erc-script-path'."
@@ -5890,7 +5895,8 @@
       (setq bufs (cdr bufs))
       (while bufs
 	(split-window)
-	(switch-to-buffer-other-window (car bufs))
+	(other-window 1)
+	(switch-to-buffer (car bufs))
 	(setq bufs (cdr bufs))
 	(balance-windows)))))
 
@@ -5942,12 +5948,17 @@
    (ctcp-request-to . "==> CTCP request from %n (%u@%h) to %t: %r")
    (ctcp-too-many . "Too many CTCP queries in single message. Ignoring")
    (flood-ctcp-off . "FLOOD PROTECTION: Automatic CTCP responses turned off.")
-   (flood-strict-mode . "FLOOD PROTECTION: Switched to Strict Flood Control mode.")
-   (disconnected . "Connection failed!  Re-establishing connection...")
-   (disconnected-noreconnect . "Connection failed!  Not re-establishing connection.")
+   (flood-strict-mode
+    . "FLOOD PROTECTION: Switched to Strict Flood Control mode.")
+   (disconnected . "\n\nConnection failed!  Re-establishing connection...\n")
+   (disconnected-noreconnect
+    . "\n\nConnection failed!  Not re-establishing connection.\n")
+   (finished . "\n\n*** ERC finished ***\n")
+   (terminated . "\n\n*** ERC terminated: %e\n")
    (login . "Logging in as \'%n\'...")
    (nick-in-use . "%n is in use. Choose new nickname: ")
-   (nick-too-long . "WARNING: Nick length (%i) exceeds max NICKLEN(%l) defined by server")
+   (nick-too-long
+    . "WARNING: Nick length (%i) exceeds max NICKLEN(%l) defined by server")
    (no-default-channel . "No default channel")
    (no-invitation . "You've got no invitation")
    (no-target . "No target")
--- a/lisp/eshell/em-glob.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/eshell/em-glob.el	Sat Oct 14 16:56:21 2006 +0000
@@ -97,7 +97,7 @@
   :type 'boolean
   :group 'eshell-glob)
 
-(defcustom eshell-glob-chars-list '(?\] ?\[ ?* ?? ?~ ?\( ?\) ?| ?#)
+(defcustom eshell-glob-chars-list '(?\] ?\[ ?* ?? ?~ ?\( ?\) ?| ?# ?^)
   "*List of additional characters used in extended globbing."
   :type '(repeat character)
   :group 'eshell-glob)
@@ -105,6 +105,7 @@
 (defcustom eshell-glob-translate-alist
   '((?\] . "]")
     (?\[ . "[")
+    (?^  . "^")
     (??  . ".")
     (?*  . ".*")
     (?~  . "~")
--- a/lisp/facemenu.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/facemenu.el	Sat Oct 14 16:56:21 2006 +0000
@@ -134,18 +134,24 @@
 
 (defcustom facemenu-listed-faces nil
   "*List of faces to include in the Face menu.
-Each element should be a symbol, which is the name of a face.
+Each element should be a symbol, the name of a face.
 The \"basic \" faces in `facemenu-keybindings' are automatically
-added to the Face menu, and are not included in this list.
+added to the Face menu, and need not be in this list.
 
-You can set this list before loading facemenu.el, or add a face to it before
-creating that face if you want it to be listed.  If you change the
-variable so as to eliminate faces that have already been added to the menu,
-call `facemenu-update' to recalculate the menu contents.
+This value takes effect when you load facemenu.el.  If the
+list includes symbols which are not defined as faces, they
+are ignored; however, subsequently defining or creating
+those faces adds them to the menu then.  You can call
+`facemenu-update' to recalculate the menu contents, such as
+if you change the value of this variable,
 
-If this variable is t, all faces will be added to the menu.  This
-is useful for setting temporarily if you want to add faces to the
-menu when they are created."
+If this variable is t, all faces that you apply to text
+using the face menu commands (even by name), and all faces
+that you define or create, are added to the menu.  You may
+find it useful to set this variable to t temporarily while
+you define some faces, so that they will be added.  However,
+if the value is no longer t and you call `facemenu-update',
+it will remove any faces not explicitly in the list."
   :type '(choice (const :tag "List all faces" t)
 		 (const :tag "None" nil)
 		 (repeat symbol))
@@ -320,19 +326,24 @@
 
 ;;;###autoload
 (defun facemenu-set-face (face &optional start end)
-  "Add FACE to the region or next character typed.
-This adds FACE to the top of the face list; any faces lower on the list that
-will not show through at all will be removed.
+  "Apply FACE to the region or next character typed.
 
-Interactively, reads the face name with the minibuffer.
+If the region is active (normally true except in Transient
+Mark mode) and nonempty, and there is no prefix argument,
+this command applies FACE to the region.  Otherwise, it applies FACE
+to the faces to use for the next character
+inserted.  (Moving point or switching buffers before typing
+a character to insert cancels the specification.)
 
-If the region is active (normally true except in Transient Mark mode)
-and there is no prefix argument, this command sets the region to the
-requested face.
+If FACE is `default', to \"apply\" it means clearing
+the list of faces to be used.  For any other value of FACE,
+to \"apply\" it means putting FACE at the front of the list
+of faces to be used, and removing any faces further
+along in the list that would be completely overridden by
+preceding faces (including FACE).
 
-Otherwise, this command specifies the face for the next character
-inserted.  Moving point or switching buffers before
-typing a character to insert cancels the specification."
+This command can also add FACE to the menu of faces,
+if `facemenu-listed-faces' says to do that."
   (interactive (list (progn
 		       (barf-if-buffer-read-only)
 		       (read-face-name "Use face"))
@@ -612,7 +623,12 @@
 				      (cons face
 					    (if (listp prev)
 						prev
-					      (list prev)))))))
+					      (list prev)))
+				      ;; Specify the selected frame
+				      ;; because nil would mean to use
+				      ;; the new-frame default settings,
+				      ;; and those are usually nil.
+				      (selected-frame)))))
 	      (setq part-start part-end)))
 	(setq self-insert-face (if (eq last-command self-insert-face-command)
 				   (cons face (if (listp self-insert-face)
@@ -655,9 +671,8 @@
     (nreverse active-list)))
 
 (defun facemenu-add-new-face (face)
-  "Add FACE (a face) to the Face menu.
-
-This is called whenever you create a new face."
+  "Add FACE (a face) to the Face menu if `facemenu-listed-faces' says so.
+This is called whenever you create a new face, and at other times."
   (let* (name
 	 symbol
 	 menu docstring
--- a/lisp/faces.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/faces.el	Sat Oct 14 16:56:21 2006 +0000
@@ -2075,7 +2075,7 @@
     ;; red4 is too dark, but some say blue is too loud.
     ;; brown seems to work ok. -- rms.
     (t :foreground "brown"))
-  "Face for characters displayed as ^-sequences or \-sequences."
+  "Face for characters displayed as sequences using `^' or `\\'."
   :group 'basic-faces
   :version "22.1")
 
--- a/lisp/files.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/files.el	Sat Oct 14 16:56:21 2006 +0000
@@ -540,13 +540,21 @@
 
 This function's standard definition is trivial; it just returns
 the argument.  However, on Windows and DOS, replace invalid
-characters.  On DOS, make sure to obey the 8.3 limitations.  On
-Windows, turn Cygwin names into native names, and also turn
-slashes into backslashes if the shell requires it (see
+characters.  On DOS, make sure to obey the 8.3 limitations.
+In the native Windows build, turn Cygwin names into native names,
+and also turn slashes into backslashes if the shell requires it (see
 `w32-shell-dos-semantics').
 
 See Info node `(elisp)Standard File Names' for more details."
-  filename)
+  (if (eq system-type 'cygwin)
+      (let ((name (copy-sequence filename))
+	    (start 0))
+	;; Replace invalid filename characters with !
+	(while (string-match "[?*:<>|\"\000-\037]" name start)
+	  (aset name (match-beginning 0) ?!)
+	  (setq start (match-end 0)))
+	name)
+    filename))
 
 (defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
@@ -4369,7 +4377,7 @@
 			    "#")))
 	    ;; Make sure auto-save file names don't contain characters
 	    ;; invalid for the underlying filesystem.
-	    (if (and (memq system-type '(ms-dos windows-nt))
+	    (if (and (memq system-type '(ms-dos windows-nt cygwin))
 		     ;; Don't modify remote (ange-ftp) filenames
 		     (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result)))
 		(convert-standard-filename result)
@@ -4404,7 +4412,7 @@
 		      ((file-writable-p default-directory) default-directory)
 		      ((file-writable-p "/var/tmp/") "/var/tmp/")
 		      ("~/")))))
-	       (if (and (memq system-type '(ms-dos windows-nt))
+	       (if (and (memq system-type '(ms-dos windows-nt cygwin))
 			;; Don't modify remote (ange-ftp) filenames
 			(not (string-match "^/\\w+@[-A-Za-z0-9._]+:" fname)))
 		   ;; The call to convert-standard-filename is in case
--- a/lisp/filesets.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/filesets.el	Sat Oct 14 16:56:21 2006 +0000
@@ -1798,7 +1798,7 @@
 		      filesets-data nil)))
          (entry  (or (assoc name filesets-data)
                      (when (y-or-n-p
-                            (format "Fileset %s does not exist. Create it?"
+                            (format "Fileset %s does not exist. Create it? "
                                     name))
                        (progn
       (add-to-list 'filesets-data (list name '(:files)))
--- a/lisp/font-core.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/font-core.el	Sat Oct 14 16:56:21 2006 +0000
@@ -83,34 +83,6 @@
 settings.  See the variable `font-lock-defaults', which takes precedence.")
 (make-obsolete-variable 'font-lock-defaults-alist 'font-lock-defaults)
 
-(defvar font-lock-extend-region-function nil
-  "A function that determines the region to fontify after a change.
-
-This buffer-local variable is either nil, or is a function that determines the
-region to fontify.  It is usually set by the major mode.  The currently active
-font-lock after-change function calls this function after each buffer change.
-
-The function is given three parameters, the standard BEG, END, and OLD-LEN
-from after-change-functions.  It should return either a cons of the beginning
-and end buffer positions \(in that order) of the region to fontify, or nil
-\(which directs the caller to fontify a default region).  This function need
-not preserve point or the match-data, but must preserve the current
-restriction.  The region it returns may start or end in the middle of a
-line.")
-(make-variable-buffer-local 'font-lock-extend-region-function)
-
-(defun font-lock-extend-region (beg end old-len)
-  "Determine the region to fontify after a buffer change.
-
-BEG END and OLD-LEN are the standard parameters from after-change-functions.
-The return value is either nil \(which directs the caller to chose the region
-itself), or a cons of the beginning and end \(in that order) of the region.
-The region returned may start or end in the middle of a line."
-  (if font-lock-extend-region-function
-      (save-match-data
-	(save-excursion
-	  (funcall font-lock-extend-region-function beg end old-len)))))
-
 (defvar font-lock-function 'font-lock-default-function
   "A function which is called when `font-lock-mode' is toggled.
 It will be passed one argument, which is the current value of
--- a/lisp/font-lock.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/font-lock.el	Sat Oct 14 16:56:21 2006 +0000
@@ -893,7 +893,11 @@
 	   (set (make-local-variable 'font-lock-fontified) t)
 	   ;; Use jit-lock.
 	   (jit-lock-register 'font-lock-fontify-region
-			      (not font-lock-keywords-only))))))
+			      (not font-lock-keywords-only))
+           ;; Tell jit-lock how we extend the region to refontify.
+           (add-hook 'jit-lock-after-change-extend-region-functions
+                     'font-lock-extend-jit-lock-region-after-change
+                     nil t)))))
 
 (defun font-lock-turn-off-thing-lock ()
   (cond ((and (boundp 'fast-lock-mode) fast-lock-mode)
@@ -971,6 +975,21 @@
 ;; directives correctly and cleanly.  (It is the same problem as fontifying
 ;; multi-line strings and comments; regexps are not appropriate for the job.)
 
+(defvar font-lock-extend-after-change-region-function nil
+  "A function that determines the region to refontify after a change.
+
+This variable is either nil, or is a function that determines the
+region to refontify after a change.
+It is usually set by the major mode via `font-lock-defaults'.
+Font-lock calls this function after each buffer change.
+
+The function is given three parameters, the standard BEG, END, and OLD-LEN
+from `after-change-functions'.  It should return either a cons of the beginning
+and end buffer positions \(in that order) of the region to refontify, or nil
+\(which directs the caller to fontify a default region).
+This function should preserve the match-data.
+The region it returns may start or end in the middle of a line.")
+
 (defun font-lock-fontify-buffer ()
   "Fontify the current buffer the way the function `font-lock-mode' would."
   (interactive)
@@ -1021,6 +1040,59 @@
 Useful for things like RMAIL and Info where the whole buffer is not
 a very meaningful entity to highlight.")
 
+
+(defvar font-lock-beg) (defvar font-lock-end)
+(defvar font-lock-extend-region-functions
+  '(font-lock-extend-region-wholelines
+    ;; This use of font-lock-multiline property is unreliable but is just
+    ;; a handy heuristic: in case you don't have a function that does
+    ;; /identification/ of multiline elements, you may still occasionally
+    ;; discover them by accident (or you may /identify/ them but not in all
+    ;; cases), in which case the font-lock-multiline property can help make
+    ;; sure you will properly *re*identify them during refontification.
+    font-lock-extend-region-multiline)
+  "Special hook run just before proceeding to fontify a region.
+This is used to allow major modes to help font-lock find safe buffer positions
+as beginning and end of the fontified region.  Its most common use is to solve
+the problem of /identification/ of multiline elements by providing a function
+that tries to find such elements and move the boundaries such that they do
+not fall in the middle of one.
+Each function is called with no argument; it is expected to adjust the
+dynamically bound variables `font-lock-beg' and `font-lock-end'; and return
+non-nil iff it did make such an adjustment.
+These functions are run in turn repeatedly until they all return nil.
+Put first the functions more likely to cause a change and cheaper to compute.")
+;; Mark it as a special hook which doesn't use any global setting
+;; (i.e. doesn't obey the element t in the buffer-local value).
+(make-variable-buffer-local 'font-lock-extend-region-functions)
+
+(defun font-lock-extend-region-multiline ()
+  "Move fontification boundaries away from any `font-lock-multiline' property."
+  (let ((changed nil))
+    (when (and (> font-lock-beg (point-min))
+               (get-text-property (1- font-lock-beg) 'font-lock-multiline))
+      (setq changed t)
+      (setq font-lock-beg (or (previous-single-property-change
+                               font-lock-beg 'font-lock-multiline)
+                              (point-min))))
+    ;; 
+    (when (get-text-property font-lock-end 'font-lock-multiline)
+      (setq changed t)
+      (setq font-lock-end (or (text-property-any font-lock-end (point-max)
+                                                 'font-lock-multiline nil)
+                              (point-max))))
+    changed))
+  
+  
+(defun font-lock-extend-region-wholelines ()
+  "Move fontification boundaries to beginning of lines."
+  (let ((changed nil))
+    (goto-char font-lock-beg)
+    (unless (bolp) (setq changed t font-lock-beg (line-beginning-position)))
+    (goto-char font-lock-end)
+    (unless (bolp) (setq changed t font-lock-end (line-beginning-position 2)))
+    changed))
+
 (defun font-lock-default-fontify-region (beg end loudly)
   (save-buffer-state
       ((parse-sexp-lookup-properties
@@ -1032,24 +1104,21 @@
 	  ;; Use the fontification syntax table, if any.
 	  (when font-lock-syntax-table
 	    (set-syntax-table font-lock-syntax-table))
-          (goto-char beg)
-	  (setq beg (line-beginning-position))
-	  ;; check to see if we should expand the beg/end area for
-	  ;; proper multiline matches
-	  (when (and (> beg (point-min))
-		     (get-text-property (1- beg) 'font-lock-multiline))
-	    ;; We are just after or in a multiline match.
-	    (setq beg (or (previous-single-property-change
-			   beg 'font-lock-multiline)
-			  (point-min)))
-	    (goto-char beg)
-	    (setq beg (line-beginning-position)))
-          (setq end (or (text-property-any end (point-max)
-                                           'font-lock-multiline nil)
-                        (point-max)))
-	  (goto-char end)
-	  ;; Round up to a whole line.
-          (unless (bolp) (setq end (line-beginning-position 2)))
+          ;; Extend the region to fontify so that it starts and ends at
+          ;; safe places.
+          (let ((funs font-lock-extend-region-functions)
+                (font-lock-beg beg)
+                (font-lock-end end))
+            (while funs
+              (setq funs (if (or (not (funcall (car funs)))
+                                 (eq funs font-lock-extend-region-functions))
+                             (cdr funs)
+                           ;; If there's been a change, we should go through
+                           ;; the list again since this new position may
+                           ;; warrant a different answer from one of the fun
+                           ;; we've already seen.
+                           font-lock-extend-region-functions)))
+            (setq beg font-lock-beg end font-lock-end))
 	  ;; Now do the fontification.
 	  (font-lock-unfontify-region beg end)
 	  (when font-lock-syntactic-keywords
@@ -1083,19 +1152,77 @@
 
 ;; Called when any modification is made to buffer text.
 (defun font-lock-after-change-function (beg end old-len)
-  (let ((inhibit-point-motion-hooks t)
-	(inhibit-quit t)
-	(region (font-lock-extend-region beg end old-len)))
-    (save-excursion
+  (save-excursion
+    (let ((inhibit-point-motion-hooks t)
+          (inhibit-quit t)
+          (region (if font-lock-extend-after-change-region-function
+                      (funcall font-lock-extend-after-change-region-function
+                               beg end old-len))))
       (save-match-data
 	(if region
 	    ;; Fontify the region the major mode has specified.
 	    (setq beg (car region) end (cdr region))
 	  ;; Fontify the whole lines which enclose the region.
-	  (setq beg (progn (goto-char beg) (line-beginning-position))
-		end (progn (goto-char end) (line-beginning-position 2))))
+          ;; Actually, this is not needed because
+          ;; font-lock-default-fontify-region already rounds up to a whole
+          ;; number of lines.
+	  ;; (setq beg (progn (goto-char beg) (line-beginning-position))
+	  ;;       end (progn (goto-char end) (line-beginning-position 2)))
+          )
 	(font-lock-fontify-region beg end)))))
 
+(defvar jit-lock-start) (defvar jit-lock-end)
+(defun font-lock-extend-jit-lock-region-after-change (beg end old-len)
+  "Function meant for `jit-lock-after-change-extend-region-functions'.
+This function does 2 things:
+- extend the region so that it not only includes the part that was modified
+  but also the surrounding text whose highlighting may change as a consequence.
+- anticipate (part of) the region extension that will happen later in
+  `font-lock-default-fontify-region', in order to avoid the need for
+  double-redisplay in `jit-lock-fontify-now'."
+  (save-excursion
+    ;; First extend the region as font-lock-after-change-function would.
+    (let ((region (if font-lock-extend-after-change-region-function
+                      (funcall font-lock-extend-after-change-region-function
+                               beg end old-len))))
+      (if region
+          (setq beg (min jit-lock-start (car region))
+                end (max jit-lock-end (cdr region))))
+      ;; Then extend the region obeying font-lock-multiline properties,
+      ;; indicating which part of the buffer needs to be refontified.
+      ;; !!! This is the *main* user of font-lock-multiline property !!!
+      ;; font-lock-after-change-function could/should also do that, but it
+      ;; doesn't need to because font-lock-default-fontify-region does
+      ;; it anyway.  Here OTOH we have no guarantee that
+      ;; font-lock-default-fontify-region will be executed on this region
+      ;; any time soon.
+      ;; Note: contrary to font-lock-default-fontify-region, we do not do
+      ;; any loop here because we are not looking for a safe spot: we just
+      ;; mark the text whose appearance may need to change as a result of
+      ;; the buffer modification.
+      (when (and (> beg (point-min))
+                 (get-text-property (1- beg) 'font-lock-multiline))
+        (setq beg (or (previous-single-property-change
+                       beg 'font-lock-multiline)
+                      (point-min))))
+      (setq end (or (text-property-any end (point-max)
+                                       'font-lock-multiline nil)
+                    (point-max)))
+      ;; Finally, pre-enlarge the region to a whole number of lines, to try
+      ;; and anticipate what font-lock-default-fontify-region will do, so as to
+      ;; avoid double-redisplay.
+      ;; We could just run `font-lock-extend-region-functions', but since
+      ;; the only purpose is to avoid the double-redisplay, we prefer to
+      ;; do here only the part that is cheap and most likely to be useful.
+      (when (memq 'font-lock-extend-region-wholelines
+                  font-lock-extend-region-functions)
+        (goto-char beg)
+        (forward-line 0)
+        (setq jit-lock-start (min jit-lock-start (point)))
+        (goto-char end)
+        (forward-line 1)
+        (setq jit-lock-end (max jit-lock-end (point)))))))
+
 (defun font-lock-fontify-block (&optional arg)
   "Fontify some lines the way `font-lock-fontify-buffer' would.
 The lines could be a function or paragraph, or a specified number of lines.
--- a/lisp/format.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/format.el	Sat Oct 14 16:56:21 2006 +0000
@@ -117,17 +117,17 @@
 
 REGEXP  is a regular expression to match against the beginning of the file;
         it should match only files in that format.  Use nil to avoid
-        matching at all for formats for which this isn't appropriate to
+        matching at all for formats for which it isn't appropriate to
         require explicit encoding/decoding.
 
-FROM-FN is called to decode files in that format; it gets two args, BEGIN
+FROM-FN is called to decode files in that format; it takes two args, BEGIN
         and END, and can make any modifications it likes, returning the new
         end.  It must make sure that the beginning of the file no longer
         matches REGEXP, or else it will get called again.
 	Alternatively, FROM-FN can be a string, which specifies a shell command
 	(including options) to be used as a filter to perform the conversion.
 
-TO-FN   is called to encode a region into that format; it is passed three
+TO-FN   is called to encode a region into that format; it takes three
         arguments: BEGIN, END, and BUFFER.  BUFFER is the original buffer that
         the data being written came from, which the function could use, for
         example, to find the values of local variables.  TO-FN should either
@@ -142,7 +142,7 @@
 
 MODE-FN, if specified, is called when visiting a file with that format.
          It is called with a single positive argument, on the assumption
-         that it turns on some Emacs mode.
+         that this would turn on some minor mode.
 
 PRESERVE, if non-nil, means that `format-write-file' should not remove
           this format from `buffer-file-formats'.")
@@ -150,8 +150,8 @@
 ;;; Basic Functions (called from Lisp)
 
 (defun format-encode-run-method (method from to &optional buffer)
-  "Translate using function or shell script METHOD the text from FROM to TO.
-If METHOD is a string, it is a shell command;
+  "Translate using METHOD the text from FROM to TO.
+If METHOD is a string, it is a shell command (including options);
 otherwise, it should be a Lisp function.
 BUFFER should be the buffer that the output originally came from."
   (if (stringp method)
@@ -173,9 +173,9 @@
     (funcall method from to buffer)))
 
 (defun format-decode-run-method (method from to &optional buffer)
-  "Decode using function or shell script METHOD the text from FROM to TO.
-If METHOD is a string, it is a shell command; otherwise, it should be
-a Lisp function.  Decoding is done for the given BUFFER."
+  "Decode using METHOD the text from FROM to TO.
+If METHOD is a string, it is a shell command (including options); otherwise,
+it should be a Lisp function.  Decoding is done for the given BUFFER."
   (if (stringp method)
       (let ((error-buff (get-buffer-create "*Format Errors*"))
 	    (coding-system-for-write 'no-conversion)
@@ -200,15 +200,15 @@
 
 (defun format-annotate-function (format from to orig-buf format-count)
   "Return annotations for writing region as FORMAT.
-FORMAT is a symbol naming one of the formats defined in `format-alist',
-it must be a single symbol, not a list like `buffer-file-format'.
+FORMAT is a symbol naming one of the formats defined in `format-alist'.
+It must be a single symbol, not a list like `buffer-file-format'.
 FROM and TO delimit the region to be operated on in the current buffer.
 ORIG-BUF is the original buffer that the data came from.
 
 FORMAT-COUNT is an integer specifying how many times this function has
 been called in the process of decoding ORIG-BUF.
 
-This function works like a function on `write-region-annotate-functions':
+This function works like a function in `write-region-annotate-functions':
 it either returns a list of annotations, or returns with a different buffer
 current, which contains the modified text to write.  In the latter case,
 this function's value is nil.
@@ -253,7 +253,7 @@
 to the reverted list of formats used, and call any mode functions defined
 for those formats.
 
-Returns the new length of the decoded region.
+Return the new length of the decoded region.
 
 For most purposes, consider using `format-decode-region' instead."
   (let ((mod (buffer-modified-p))
@@ -312,9 +312,9 @@
 
 (defun format-decode-buffer (&optional format)
   "Translate the buffer from some FORMAT.
-If the format is not specified, this function attempts to guess.
-`buffer-file-format' is set to the format used, and any mode-functions
-for the format are called."
+If the format is not specified, attempt a regexp-based guess.
+Set `buffer-file-format' to the format used, and call any
+format-specific mode functions."
   (interactive
    (list (format-read "Translate buffer from format (default guess): ")))
   (save-excursion
@@ -343,7 +343,7 @@
 
 (defun format-encode-region (beg end &optional format)
   "Translate the region into some FORMAT.
-FORMAT defaults to `buffer-file-format', it is a symbol naming
+FORMAT defaults to `buffer-file-format'.  It is a symbol naming
 one of the formats defined in `format-alist', or a list of such symbols."
   (interactive
    (list (region-beginning) (region-end)
@@ -374,9 +374,9 @@
 saves.  If the buffer is already visiting a file, you can specify a directory
 name as FILENAME, to write a file of the same old name in that directory.
 
-If optional third arg CONFIRM is non-nil, this function asks for
-confirmation before overwriting an existing file.  Interactively,
-confirmation is required unless you supply a prefix argument."
+If optional third arg CONFIRM is non-nil, ask for confirmation before
+overwriting an existing file.  Interactively, confirmation is required
+unless you supply a prefix argument."
   (interactive
    ;; Same interactive spec as write-file, plus format question.
    (let* ((file (if buffer-file-name
@@ -419,7 +419,7 @@
   "Insert the contents of file FILENAME using data format FORMAT.
 If FORMAT is nil then do not do any format conversion.
 The optional third and fourth arguments BEG and END specify
-the part of the file to read.
+the part (in bytes) of the file to read.
 
 The return value is like the value of `insert-file-contents':
 a list (ABSOLUTE-FILE-NAME SIZE)."
@@ -456,10 +456,10 @@
 (defun format-replace-strings (alist &optional reverse beg end)
   "Do multiple replacements on the buffer.
 ALIST is a list of (FROM . TO) pairs, which should be proper arguments to
-`search-forward' and `replace-match' respectively.
-Optional 2nd arg REVERSE, if non-nil, means the pairs are (TO . FROM), so that
-you can use the same list in both directions if it contains only literal
-strings.
+`search-forward' and `replace-match', respectively.
+Optional second arg REVERSE, if non-nil, means the pairs are (TO . FROM),
+so that you can use the same list in both directions if it contains only
+literal strings.
 Optional args BEG and END specify a region of the buffer on which to operate."
   (save-excursion
     (save-restriction
@@ -497,7 +497,7 @@
 
 (defun format-make-relatively-unique (a b)
   "Delete common elements of lists A and B, return as pair.
-Compares using `equal'."
+Compare using `equal'."
   (let* ((acopy (copy-sequence a))
 	 (bcopy (copy-sequence b))
 	 (tail acopy))
@@ -511,9 +511,9 @@
 
 (defun format-common-tail (a b)
   "Given two lists that have a common tail, return it.
-Compares with `equal', and returns the part of A that is equal to the
+Compare with `equal', and return the part of A that is equal to the
 equivalent part of B.  If even the last items of the two are not equal,
-returns nil."
+return nil."
   (let ((la (length a))
 	(lb (length b)))
     ;; Make sure they are the same length
@@ -534,9 +534,9 @@
     (null list)))
 
 (defun format-reorder (items order)
-  "Arrange ITEMS to following partial ORDER.
-Elements of ITEMS equal to elements of ORDER will be rearranged to follow the
-ORDER.  Unmatched items will go last."
+  "Arrange ITEMS to follow partial ORDER.
+Elements of ITEMS equal to elements of ORDER will be rearranged
+to follow the ORDER.  Unmatched items will go last."
   (if order
       (let ((item (member (car order) items)))
 	(if item
@@ -793,7 +793,7 @@
 ;; next-single-property-change instead of text-property-not-all, but then
 ;; we have to see if we passed TO.
 (defun format-property-increment-region (from to prop delta default)
-  "Over the region between FROM and TO increment property PROP by amount DELTA.
+  "In the region from FROM to TO increment property PROP by amount DELTA.
 DELTA may be negative.  If property PROP is nil anywhere
 in the region, it is treated as though it were DEFAULT."
   (let ((cur from) val newval next)
@@ -810,7 +810,7 @@
 
 (defun format-insert-annotations (list &optional offset)
   "Apply list of annotations to buffer as `write-region' would.
-Inserts each element of the given LIST of buffer annotations at its
+Insert each element of the given LIST of buffer annotations at its
 appropriate place.  Use second arg OFFSET if the annotations' locations are
 not relative to the beginning of the buffer: annotations will be inserted
 at their location-OFFSET+1 \(ie, the offset is treated as the position of
@@ -834,7 +834,7 @@
 
 (defun format-annotate-region (from to translations format-fn ignore)
   "Generate annotations for text properties in the region.
-Searches for changes between FROM and TO, and describes them with a list of
+Search for changes between FROM and TO, and describe them with a list of
 annotations as defined by alist TRANSLATIONS and FORMAT-FN.  IGNORE lists text
 properties not to consider; any text properties that are neither ignored nor
 listed in TRANSLATIONS are warned about.
@@ -975,9 +975,9 @@
   "Return annotations for property PROP changing from OLD to NEW.
 These are searched for in the translations alist TRANSLATIONS
  (see `format-annotate-region' for the format).
-If NEW does not appear in the list, but there is a default function, then that
-function is called.
-Returns a cons of the form (CLOSE . OPEN)
+If NEW does not appear in the list, but there is a default function,
+then call that function.
+Return a cons of the form (CLOSE . OPEN)
 where CLOSE is a list of annotations to close
 and OPEN is a list of annotations to open.
 
@@ -1016,7 +1016,7 @@
 	(format-annotate-atomic-property-change prop-alist old new)))))
 
 (defun format-annotate-atomic-property-change (prop-alist old new)
-  "Internal function annotate a single property change.
+  "Internal function to annotate a single property change.
 PROP-ALIST is the relevant element of a TRANSLATIONS list.
 OLD and NEW are the values."
   (let (num-ann)
--- a/lisp/frame.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/frame.el	Sat Oct 14 16:56:21 2006 +0000
@@ -1362,6 +1362,35 @@
 This timer calls `blink-cursor-timer-function' every
 `blink-cursor-interval' seconds.")
 
+(defun blink-cursor-start ()
+  "Timer function called from the timer `blink-cursor-idle-timer'.
+This starts the timer `blink-cursor-timer', which makes the cursor blink
+if appropriate.  It also arranges to cancel that timer when the next
+command starts, by installing a pre-command hook."
+  (when (null blink-cursor-timer)
+    ;; Set up the timer first, so that if this signals an error,
+    ;; blink-cursor-end is not added to pre-command-hook.
+    (setq blink-cursor-timer
+	  (run-with-timer blink-cursor-interval blink-cursor-interval
+			  'blink-cursor-timer-function))
+    (add-hook 'pre-command-hook 'blink-cursor-end)
+    (internal-show-cursor nil nil)))
+
+(defun blink-cursor-timer-function ()
+  "Timer function of timer `blink-cursor-timer'."
+  (internal-show-cursor nil (not (internal-show-cursor-p))))
+
+(defun blink-cursor-end ()
+  "Stop cursor blinking.
+This is installed as a pre-command hook by `blink-cursor-start'.
+When run, it cancels the timer `blink-cursor-timer' and removes
+itself as a pre-command hook."
+  (remove-hook 'pre-command-hook 'blink-cursor-end)
+  (internal-show-cursor nil t)
+  (when blink-cursor-timer
+    (cancel-timer blink-cursor-timer)
+    (setq blink-cursor-timer nil)))
+
 (define-minor-mode blink-cursor-mode
   "Toggle blinking cursor mode.
 With a numeric argument, turn blinking cursor mode on iff ARG is positive.
@@ -1374,53 +1403,22 @@
   :init-value (not (or noninteractive
 		       no-blinking-cursor
 		       (eq system-type 'ms-dos)
-		       (not (memq initial-window-system '(x w32 mac)))))
+		       (not (memq window-system '(x w32 mac)))))
   :initialize 'custom-initialize-safe-default
   :group 'cursor
   :global t
   (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer))
-  (if blink-cursor-timer (cancel-timer blink-cursor-timer))
-  (setq blink-cursor-idle-timer nil
-	blink-cursor-timer nil)
-  (if blink-cursor-mode
-      (progn
-	;; Hide the cursor.
-	;;(internal-show-cursor nil nil)
-	(setq blink-cursor-idle-timer
-	      (run-with-idle-timer blink-cursor-delay
-				   blink-cursor-delay
-				   'blink-cursor-start)))
-    (internal-show-cursor nil t)))
+  (setq blink-cursor-idle-timer nil)
+  (blink-cursor-end)
+  (when blink-cursor-mode
+    ;; Hide the cursor.
+    ;;(internal-show-cursor nil nil)
+    (setq blink-cursor-idle-timer
+          (run-with-idle-timer blink-cursor-delay
+                               blink-cursor-delay
+                               'blink-cursor-start))))
 
 (define-obsolete-variable-alias 'blink-cursor 'blink-cursor-mode "22.1")
-
-(defun blink-cursor-start ()
-  "Timer function called from the timer `blink-cursor-idle-timer'.
-This starts the timer `blink-cursor-timer', which makes the cursor blink
-if appropriate.  It also arranges to cancel that timer when the next
-command starts, by installing a pre-command hook."
-  (when (null blink-cursor-timer)
-    (add-hook 'pre-command-hook 'blink-cursor-end)
-    (internal-show-cursor nil nil)
-    (setq blink-cursor-timer
-	  (run-with-timer blink-cursor-interval blink-cursor-interval
-			  'blink-cursor-timer-function))))
-
-(defun blink-cursor-timer-function ()
-  "Timer function of timer `blink-cursor-timer'."
-  (internal-show-cursor nil (not (internal-show-cursor-p))))
-
-(defun blink-cursor-end ()
-  "Stop cursor blinking.
-This is installed as a pre-command hook by `blink-cursor-start'.
-When run, it cancels the timer `blink-cursor-timer' and removes
-itself as a pre-command hook."
-  (remove-hook 'pre-command-hook 'blink-cursor-end)
-  (internal-show-cursor nil t)
-  (cancel-timer blink-cursor-timer)
-  (setq blink-cursor-timer nil))
-
-
 
 ;; Hourglass pointer
 
--- a/lisp/gnus/ChangeLog	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/gnus/ChangeLog	Sat Oct 14 16:56:21 2006 +0000
@@ -1,3 +1,47 @@
+2006-08-23  Andreas Seltenreich  <uwi7@rz.uni-karlsruhe.de>
+
+	[ Backported bug fix from No Gnus. ]
+
+	* gnus.el (gnus-find-method-for-group): On killed/unknown groups, try
+	looking up the method using GROUP's prefix before inventing a new one.
+	It is used on killed/unknown groups in various places where returning
+	an all-new method isn't expected by the caller.
+
+	* gnus-util.el (gnus-group-server): Copy required macro from No Gnus.
+
+2006-08-13  Romain Francoise  <romain@orebokech.com>
+
+	* mm-extern.el (mm-extern-mail-server): End `y-or-n-p' prompt with a
+	space.
+
+2006-08-09  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* compface.el (uncompface): Use binary rather than raw-text-unix.
+
+2006-08-09  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* compface.el (uncompface): Make sure the eol conversion doesn't take
+	place when communicating with the external programs.  Reported by
+	ARISAWA Akihiro <ari@mbf.ocn.ne.jp>.
+
+2006-07-31  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* nnheader.el (nnheader-insert-head): Fix typo in comment.
+
+2006-07-31  Andreas Seltenreich  <uwi7@rz.uni-karlsruhe.de>
+
+	* nnweb.el (nnweb-google-parse-1): Update regexp for author and date.
+	Make it more robust by parsing author and date independently.
+
+2006-07-28  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* nnheader.el (nnheader-insert-head): Make it work with Mac as well.
+
+2006-07-27  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* nnheader.el (nnheader-insert-head): Make it work even if the file
+	uses CRLF for the line-break code.
+
 2006-07-19  Andreas Seltenreich  <uwi7@rz.uni-karlsruhe.de>
 
 	* mm-url.el (mm-url-insert-file-contents): Inhibit Connection: close
--- a/lisp/gnus/compface.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/gnus/compface.el	Sat Oct 14 16:56:21 2006 +0000
@@ -34,24 +34,28 @@
 or `faces-xface' and `netpbm' or `libgr-progs', for instance."
   (with-temp-buffer
     (insert face)
-    (and (eq 0 (apply 'call-process-region (point-min) (point-max)
-		      "uncompface"
-		      'delete '(t nil) nil))
-	 (progn
-	   (goto-char (point-min))
-	   (insert "/* Width=48, Height=48 */\n")
-	   ;; I just can't get "icontopbm" to work correctly on its
-	   ;; own in XEmacs.  And Emacs doesn't understand un-raw pbm
-	   ;; files.
-	   (if (not (featurep 'xemacs))
-	       (eq 0 (call-process-region (point-min) (point-max)
-					  "icontopbm"
-					  'delete '(t nil)))
-	     (shell-command-on-region (point-min) (point-max)
-				      "icontopbm | pnmnoraw"
-				      (current-buffer) t)
-	     t))
-	 (buffer-string))))
+    (let ((coding-system-for-read 'raw-text)
+	  ;; At least "icontopbm" doesn't work with Windows because
+	  ;; the line-break code is converted into CRLF by default.
+	  (coding-system-for-write 'binary))
+      (and (eq 0 (apply 'call-process-region (point-min) (point-max)
+			"uncompface"
+			'delete '(t nil) nil))
+	   (progn
+	     (goto-char (point-min))
+	     (insert "/* Width=48, Height=48 */\n")
+	     ;; I just can't get "icontopbm" to work correctly on its
+	     ;; own in XEmacs.  And Emacs doesn't understand un-raw pbm
+	     ;; files.
+	     (if (not (featurep 'xemacs))
+		 (eq 0 (call-process-region (point-min) (point-max)
+					    "icontopbm"
+					    'delete '(t nil)))
+	       (shell-command-on-region (point-min) (point-max)
+					"icontopbm | pnmnoraw"
+					(current-buffer) t)
+	       t))
+	   (buffer-string)))))
 
 (provide 'compface)
 
--- a/lisp/gnus/gnus-util.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/gnus/gnus-util.el	Sat Oct 14 16:56:21 2006 +0000
@@ -607,6 +607,17 @@
 	 (substring gname (match-end 0))
        gname)))
 
+(defmacro gnus-group-server (group)
+  "Find the server name of a foreign newsgroup.
+For example, (gnus-group-server \"nnimap+yxa:INBOX.foo\") would
+yield \"nnimap:yxa\"."
+  `(let ((gname ,group))
+     (if (string-match "^\\([^:+]+\\)\\(?:\\+\\([^:]*\\)\\)?:" gname)
+	 (format "%s:%s" (match-string 1 gname) (or
+						 (match-string 2 gname)
+						 ""))
+       (format "%s:%s" (car gnus-select-method) (cadr gnus-select-method)))))
+
 (defun gnus-make-sort-function (funs)
   "Return a composite sort condition based on the functions in FUNS."
   (cond
--- a/lisp/gnus/gnus.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/gnus/gnus.el	Sat Oct 14 16:56:21 2006 +0000
@@ -4079,8 +4079,13 @@
   (or gnus-override-method
       (and (not group)
 	   gnus-select-method)
-      (and (not (gnus-group-entry group)) ;; a new group
-	   (gnus-group-name-to-method group))
+      (and (not (gnus-group-entry group))
+ 	   ;; Killed or otherwise unknown group.
+ 	   (or
+ 	    ;; If we know a virtual server by that name, return its method.
+ 	    (gnus-server-to-method (gnus-group-server group))
+ 	    ;; Guess a new method as last resort.
+ 	    (gnus-group-name-to-method group)))
       (let ((info (or info (gnus-get-info group)))
 	    method)
 	(if (or (not info)
--- a/lisp/gnus/mm-extern.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/gnus/mm-extern.el	Sat Oct 14 16:56:21 2006 +0000
@@ -97,7 +97,7 @@
 	 (subject (or (cdr (assq 'subject params)) "none"))
 	 (buf (current-buffer))
 	 info)
-    (if (y-or-n-p (format "Send a request message to %s?" server))
+    (if (y-or-n-p (format "Send a request message to %s? " server))
 	(save-window-excursion
 	  (message-mail server subject)
 	  (message-goto-body)
--- a/lisp/gnus/nnheader.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/gnus/nnheader.el	Sat Oct 14 16:56:21 2006 +0000
@@ -586,17 +586,27 @@
     (if (eq nnheader-max-head-length t)
 	;; Just read the entire file.
 	(nnheader-insert-file-contents file)
-      ;; Read 1K blocks until we find a separator.
+      ;; Read blocks of the size specified by `nnheader-head-chop-length'
+      ;; until we find a separator.
       (let ((beg 0)
-	    format-alist)
+	    (start (point))
+	    ;; Use `binary' to prevent the contents from being decoded,
+	    ;; or it will change the number of characters that
+	    ;; `insert-file-contents' returns.
+	    (coding-system-for-read 'binary))
 	(while (and (eq nnheader-head-chop-length
-			(nth 1 (nnheader-insert-file-contents
+			(nth 1 (mm-insert-file-contents
 				file nil beg
 				(incf beg nnheader-head-chop-length))))
-		    (prog1 (not (search-forward "\n\n" nil t))
+		    ;; CRLF or CR might be used for the line-break code.
+		    (prog1 (not (re-search-forward "\n\r?\n\\|\r\r" nil t))
 		      (goto-char (point-max)))
 		    (or (null nnheader-max-head-length)
-			(< beg nnheader-max-head-length))))))
+			(< beg nnheader-max-head-length))))
+	;; Finally decode the contents.
+	(when (mm-coding-system-p nnheader-file-coding-system)
+	  (mm-decode-coding-region start (point-max)
+				   nnheader-file-coding-system))))
     t))
 
 (defun nnheader-article-p ()
--- a/lisp/gnus/nnweb.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/gnus/nnweb.el	Sat Oct 14 16:56:21 2006 +0000
@@ -366,14 +366,15 @@
       (mm-url-decode-entities)
       (search-backward " - ")
       (when (looking-at
-	     " - \\([a-zA-Z]+\\) \\([0-9]+\\)\\(?: \\([0-9]\\{4\\}\\)\\)?[^\n]+by ?\n?\\([^<\n]+\\)\n")
-	(setq From (match-string 4)
-	      Date (format "%s %s 00:00:00 %s"
+	     "\\W+\\(\\w+\\) \\([0-9]+\\)\\(?: \\([0-9]\\{4\\}\\)\\)?")
+	(setq Date (format "%s %s 00:00:00 %s"
 			   (match-string 1)
 			   (match-string 2)
 			   (or (match-string 3)
-			       (substring (current-time-string) -4)))))
-
+			       (substring (current-time-string) -4))))
+	(goto-char (match-end 0)))
+      (when (looking-at "[^b]+by\\W+\\([^<\n]+\\)")
+	(setq From (match-string 1)))
       (widen)
       (forward-line 1)
       (incf i)
--- a/lisp/help.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/help.el	Sat Oct 14 16:56:21 2006 +0000
@@ -822,16 +822,13 @@
 	      (sort minor-modes
 		    (lambda (a b) (string-lessp (cadr a) (cadr b)))))
 	(when minor-modes
-	  (princ "Summary of minor modes:\n")
+	  (princ "Enabled minor modes:\n")
 	  (make-local-variable 'help-button-cache)
 	  (with-current-buffer standard-output
 	    (dolist (mode minor-modes)
 	      (let ((mode-function (nth 0 mode))
 		    (pretty-minor-mode (nth 1 mode))
 		    (indicator (nth 2 mode)))
-		(setq indicator (if (zerop (length indicator))
-				    "no indicator"
-				  (format "indicator%s" indicator)))
 		(add-text-properties 0 (length pretty-minor-mode)
 				     '(face bold) pretty-minor-mode)
 		(save-excursion
@@ -840,16 +837,22 @@
 		  (push (point-marker) help-button-cache)
 		  ;; Document the minor modes fully.
 		  (insert pretty-minor-mode)
-		  (princ (format " minor mode (%s):\n" indicator))
+		  (princ (format " minor mode (%s):\n"
+				 (if (zerop (length indicator))
+				     "no indicator"
+				   (format "indicator%s"
+					   indicator))))
 		  (princ (documentation mode-function)))
-		(princ "  ")
 		(insert-button pretty-minor-mode
 			       'action (car help-button-cache)
 			       'follow-link t
 			       'help-echo "mouse-2, RET: show full information")
-		(princ (format " minor mode (%s):\n" indicator)))))
-	  (princ "\n(Full information about these minor modes
-follows the description of the major mode.)\n\n"))
+		(newline)))
+	    (forward-line -1)
+	    (fill-paragraph nil)
+	    (forward-line 1))
+
+	  (princ "\n(Information about these minor modes follows the major mode info.)\n\n"))
 	;; Document the major mode.
 	(let ((mode mode-name))
 	  (with-current-buffer standard-output
--- a/lisp/ido.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/ido.el	Sat Oct 14 16:56:21 2006 +0000
@@ -1840,6 +1840,7 @@
 		       (and d (cdr d)))))))
 	(if (member ido-default-item ido-ignore-item-temp-list)
 	    (setq ido-default-item nil))
+	(ido-trace "new default" ido-default-item)
 	(setq ido-set-default-item nil))
 
       (if ido-process-ignore-lists-inhibit
@@ -3528,37 +3529,40 @@
   (let* ((case-fold-search  ido-case-fold)
 	 (slash (and (not ido-enable-prefix) (ido-final-slash ido-text)))
 	 (text (if slash (substring ido-text 0 -1) ido-text))
-	 (rexq (concat (if ido-enable-regexp text (regexp-quote text)) (if slash ".*/" "")))
+	 (rex0 (if ido-enable-regexp text (regexp-quote text)))
+	 (rexq (concat rex0 (if slash ".*/" "")))
 	 (re (if ido-enable-prefix (concat "\\`" rexq) rexq))
-	 (full-re (and do-full (not ido-enable-regexp) (not (string-match "\$\\'" re))
-		       (concat "\\`" re "\\'")))
+	 (full-re (and do-full (not ido-enable-regexp) (not (string-match "\$\\'" rex0))
+		       (concat "\\`" rex0 (if slash "/" "") "\\'")))
+	 (suffix-re (and do-full slash
+			 (not ido-enable-regexp) (not (string-match "\$\\'" rex0))
+			 (concat rex0 "/\\'")))
 	 (prefix-re (and full-re (not ido-enable-prefix)
 			 (concat "\\`" rexq)))
 	 (non-prefix-dot (or (not ido-enable-dot-prefix)
 			     (not ido-process-ignore-lists)
 			     ido-enable-prefix
 			     (= (length ido-text) 0)))
-
-	 full-matches
-	 prefix-matches
-	 matches)
+	 full-matches suffix-matches prefix-matches matches)
     (setq ido-incomplete-regexp nil)
     (condition-case error
         (mapcar
          (lambda (item)
            (let ((name (ido-name item)))
-             (if (and (or non-prefix-dot
-                          (if (= (aref ido-text 0) ?.)
-                              (= (aref name 0) ?.)
-                            (/= (aref name 0) ?.)))
-                      (string-match re name))
-                 (cond
-                  ((and full-re (string-match full-re name))
-                   (setq full-matches (cons item full-matches)))
-                  ((and prefix-re (string-match prefix-re name))
-                   (setq prefix-matches (cons item prefix-matches)))
-                  (t (setq matches (cons item matches))))))
-           t)
+	     (if (and (or non-prefix-dot
+			  (if (= (aref ido-text 0) ?.)
+			      (= (aref name 0) ?.)
+			    (/= (aref name 0) ?.)))
+		      (string-match re name))
+		 (cond
+		  ((and full-re (string-match full-re name))
+		   (setq full-matches (cons item full-matches)))
+		  ((and suffix-re (string-match suffix-re name))
+		   (setq suffix-matches (cons item suffix-matches)))
+		  ((and prefix-re (string-match prefix-re name))
+		   (setq prefix-matches (cons item prefix-matches)))
+		  (t (setq matches (cons item matches))))))
+	   t)
          items)
       (invalid-regexp
        (setq ido-incomplete-regexp t
@@ -3566,10 +3570,15 @@
              ;; special-case single match, and handle appropriately
              ;; elsewhere.
              matches (cdr error))))
-    (if prefix-matches
-	(setq matches (nconc prefix-matches matches)))
-    (if full-matches
-	(setq matches (nconc full-matches matches)))
+    (when prefix-matches
+      (ido-trace "prefix match" prefix-matches)
+      (setq matches (nconc prefix-matches matches)))
+    (when suffix-matches
+      (ido-trace "suffix match" (list text suffix-re suffix-matches))
+      (setq matches (nconc suffix-matches matches)))
+    (when full-matches
+      (ido-trace "full match" (list text full-re full-matches))
+      (setq matches (nconc full-matches matches)))
     (when (and (null matches)
 	       ido-enable-flex-matching
 	       (> (length ido-text) 1)
@@ -4096,12 +4105,13 @@
 	  try-single-dir-match
 	  refresh)
 
-      (ido-trace "\nexhibit" this-command)
-      (ido-trace "dir" ido-current-directory)
-      (ido-trace "contents" contents)
-      (ido-trace "list" ido-cur-list)
-      (ido-trace "matches" ido-matches)
-      (ido-trace "rescan" ido-rescan)
+      (when ido-trace-enable
+	(ido-trace "\nexhibit" this-command)
+	(ido-trace "dir" ido-current-directory)
+	(ido-trace "contents" contents)
+	(ido-trace "list" ido-cur-list)
+	(ido-trace "matches" ido-matches)
+	(ido-trace "rescan" ido-rescan))
 
       (save-excursion
 	(goto-char (point-max))
--- a/lisp/info.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/info.el	Sat Oct 14 16:56:21 2006 +0000
@@ -3805,6 +3805,8 @@
                   (setq other-tag
 			(cond ((save-match-data (looking-back "\\<see"))
 			       "")
+			      ((save-match-data (looking-back "\\<in"))
+			       "")
 			      ((memq (char-before) '(nil ?\. ?! ??))
                                "See ")
 			      ((save-match-data
--- a/lisp/international/latexenc.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/international/latexenc.el	Sat Oct 14 16:56:21 2006 +0000
@@ -138,8 +138,14 @@
                ((and (require 'code-pages nil t) (coding-system-p sym)) sym)
                (t 'undecided)))
           ;; else try to find it in the master/main file
-          (let ((default-directory (file-name-directory (nth 1 arg-list)))
-                latexenc-main-file)
+
+	  ;; Fixme: If the current file is in an archive (e.g. tar,
+	  ;; zip), we should find the master file in that archive.
+	  ;; But, that is not yet implemented.   -- K.Handa
+          (let ((default-directory (if (stringp (nth 1 arg-list))
+				       (file-name-directory (nth 1 arg-list))
+				     default-directory))
+		latexenc-main-file)
             ;; Is there a TeX-master or tex-main-file in the local variables
             ;; section?
             (unless latexenc-dont-use-TeX-master-flag
--- a/lisp/international/mule-diag.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/international/mule-diag.el	Sat Oct 14 16:56:21 2006 +0000
@@ -1039,18 +1039,28 @@
 
 ;;;###autoload
 (defun describe-font (fontname)
-  "Display information about fonts which partially match FONTNAME."
-  (interactive "sFontname (default current choice for ASCII chars): ")
+  "Display information about a font whose name is FONTNAME.
+The font must be already used by Emacs."
+  (interactive "sFont name (default current choice for ASCII chars): ")
   (or (and window-system (fboundp 'fontset-list))
-      (error "No fontsets being used"))
-  (when (or (not fontname) (= (length fontname) 0))
-    (setq fontname (cdr (assq 'font (frame-parameters))))
-    (if (query-fontset fontname)
-	(setq fontname
-	      (nth 1 (assq 'ascii (aref (fontset-info fontname) 2))))))
-  (let ((font-info (font-info fontname)))
+      (error "No fonts being used"))
+  (let (fontset font-info)
+    (when (or (not fontname) (= (length fontname) 0))
+      (setq fontname (frame-parameter nil 'font))
+      ;; Check if FONTNAME is a fontset.
+      (if (query-fontset fontname)
+	  (setq fontset fontname
+		fontname (nth 1 (assq 'ascii
+				      (aref (fontset-info fontname) 2))))))
+    (setq font-info (font-info fontname))
     (if (null font-info)
-	(message "No matching font")
+	(if fontset
+	    ;; The font should be surely used.  So, there's some
+	    ;; problem about getting information about it.  It is
+	    ;; better to print the fontname to show which font has
+	    ;; this problem.
+	    (message "No information about \"%s\"" fontname)
+	  (message "No matching font being used"))
       (with-output-to-temp-buffer "*Help*"
 	(describe-font-internal font-info 'verbose)))))
 
--- a/lisp/jit-lock.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/jit-lock.el	Sat Oct 14 16:56:21 2006 +0000
@@ -31,6 +31,8 @@
 
 
 (eval-when-compile
+  (require 'cl)
+
   (defmacro with-buffer-unmodified (&rest body)
     "Eval BODY, preserving the current buffer's modified state."
     (declare (debug t))
@@ -169,6 +171,8 @@
 
 (defvar jit-lock-stealth-timer nil
   "Timer for stealth fontification in Just-in-time Lock mode.")
+(defvar jit-lock-stealth-repeat-timer nil
+  "Timer for repeated stealth fontification in Just-in-time Lock mode.")
 (defvar jit-lock-context-timer nil
   "Timer for context fontification in Just-in-time Lock mode.")
 (defvar jit-lock-defer-timer nil
@@ -176,6 +180,8 @@
 
 (defvar jit-lock-defer-buffers nil
   "List of buffers with pending deferred fontification.")
+(defvar jit-lock-stealth-buffers nil
+  "List of buffers that are being fontified stealthily.")
 
 ;;; JIT lock mode
 
@@ -223,6 +229,13 @@
 		 (run-with-idle-timer jit-lock-stealth-time t
 				      'jit-lock-stealth-fontify)))
 
+	 ;; Create, but do not activate, the idle timer for repeated
+	 ;; stealth fontification.
+	 (when (and jit-lock-stealth-time (null jit-lock-stealth-repeat-timer))
+	   (setq jit-lock-stealth-repeat-timer (timer-create))
+	   (timer-set-function jit-lock-stealth-repeat-timer
+			       'jit-lock-stealth-fontify '(t)))
+
 	 ;; Init deferred fontification timer.
 	 (when (and jit-lock-defer-time (null jit-lock-defer-timer))
 	   (setq jit-lock-defer-timer
@@ -331,7 +344,7 @@
      ;; from the end of a buffer to its start, can do repeated
      ;; `parse-partial-sexp' starting from `point-min', which can
      ;; take a long time in a large buffer.
-     (let (next)
+     (let ((orig-start start) next)
        (save-match-data
 	 ;; Fontify chunks beginning at START.  The end of a
 	 ;; chunk is either `end', or the start of a region
@@ -374,6 +387,26 @@
 	     (quit (put-text-property start next 'fontified nil)
 		   (funcall 'signal (car err) (cdr err))))
 
+           ;; The redisplay engine has already rendered the buffer up-to
+           ;; `orig-start' and won't notice if the above jit-lock-functions
+           ;; changed the appearance of any part of the buffer prior
+           ;; to that.  So if `start' is before `orig-start', we need to
+           ;; cause a new redisplay cycle after this one so that any changes
+           ;; are properly reflected on screen.
+           ;; To make such repeated redisplay happen less often, we can
+           ;; eagerly extend the refontified region with
+           ;; jit-lock-after-change-extend-region-functions.
+           (when (< start orig-start)
+             (lexical-let ((start start)
+                           (orig-start orig-start)
+                           (buf (current-buffer)))
+               (run-with-timer
+                0 nil (lambda ()
+                        (with-current-buffer buf
+                          (with-buffer-prepared-for-jit-lock
+                              (put-text-property start orig-start
+                                                 'fontified t)))))))
+
 	   ;; Find the start of the next chunk, if any.
 	   (setq start (text-property-any next end 'fontified nil))))))))
 
@@ -421,71 +454,55 @@
 			   (t next))))
 	result))))
 
-
-(defun jit-lock-stealth-fontify ()
+(defun jit-lock-stealth-fontify (&optional repeat)
   "Fontify buffers stealthily.
-This functions is called after Emacs has been idle for
-`jit-lock-stealth-time' seconds."
-  ;; I used to check `inhibit-read-only' here, but I can't remember why.  -stef
+This function is called repeatedly after Emacs has become idle for
+`jit-lock-stealth-time' seconds.  Optional argument REPEAT is expected
+non-nil in a repeated invocation of this function."
+  ;; Cancel timer for repeated invocations.
+  (unless repeat
+    (cancel-timer jit-lock-stealth-repeat-timer))
   (unless (or executing-kbd-macro
 	      memory-full
-	      (window-minibuffer-p (selected-window)))
-    (let ((buffers (buffer-list))
-	  (outer-buffer (current-buffer))
+	      (window-minibuffer-p (selected-window))
+	      ;; For first invocation set up `jit-lock-stealth-buffers'.
+	      ;; In repeated invocations it's already been set up.
+	      (null (if repeat
+			jit-lock-stealth-buffers
+		      (setq jit-lock-stealth-buffers (buffer-list)))))
+    (let ((buffer (car jit-lock-stealth-buffers))
+	  (delay 0)
 	  minibuffer-auto-raise
-	  message-log-max)
-      (with-local-quit
-	(while (and buffers (not (input-pending-p)))
-	  (with-current-buffer (pop buffers)
-	    (when jit-lock-mode
-	      ;; This is funny.  Calling sit-for with 3rd arg non-nil
-	      ;; so that it doesn't redisplay, internally calls
-	      ;; wait_reading_process_input also with a parameter
-	      ;; saying "don't redisplay."  Since this function here
-	      ;; is called periodically, this effectively leads to
-	      ;; process output not being redisplayed at all because
-	      ;; redisplay_internal is never called.  (That didn't
-	      ;; work in the old redisplay either.)  So, we learn that
-	      ;; we mustn't call sit-for that way here.  But then, we
-	      ;; have to be cautious not to call sit-for in a widened
-	      ;; buffer, since this could display hidden parts of that
-	      ;; buffer.  This explains the seemingly weird use of
-	      ;; save-restriction/widen here.
-
-	      (with-temp-message (if jit-lock-stealth-verbose
-				     (concat "JIT stealth lock "
-					     (buffer-name)))
-
-		;; In the following code, the `sit-for' calls cause a
-		;; redisplay, so it's required that the
-		;; buffer-modified flag of a buffer that is displayed
-		;; has the right value---otherwise the mode line of
-		;; an unmodified buffer would show a `*'.
-		(let (start
-		      (nice (or jit-lock-stealth-nice 0))
-		      (point (point-min)))
-		  (while (and (setq start
-				    (jit-lock-stealth-chunk-start point))
-			      ;; In case sit-for runs any timers,
-			      ;; give them the expected current buffer.
-			      (with-current-buffer outer-buffer
-				(sit-for nice)))
-
-		    ;; fontify a block.
-		    (jit-lock-fontify-now start (+ start jit-lock-chunk-size))
-		    ;; If stealth jit-locking is done backwards, this leads to
-		    ;; excessive O(n^2) refontification.   -stef
-		    ;; (when (>= jit-lock-context-unfontify-pos start)
-		    ;;   (setq jit-lock-context-unfontify-pos end))
-
-		    ;; Wait a little if load is too high.
-		    (when (and jit-lock-stealth-load
-			       (> (car (load-average)) jit-lock-stealth-load))
-		      ;; In case sit-for runs any timers,
-		      ;; give them the expected current buffer.
-		      (with-current-buffer outer-buffer
-			(sit-for (or jit-lock-stealth-time 30))))))))))))))
-
+	  message-log-max
+	  start)
+      (if (and jit-lock-stealth-load
+	       (> (car (load-average)) jit-lock-stealth-load))
+	  ;; Wait a little if load is too high.
+	  (setq delay jit-lock-stealth-time)
+	(if (buffer-live-p buffer)
+	    (with-current-buffer buffer
+	      (if (and jit-lock-mode
+		       (setq start (jit-lock-stealth-chunk-start (point))))
+		  ;; Fontify one block of at most `jit-lock-chunk-size'
+		  ;; characters.
+		  (with-temp-message (if jit-lock-stealth-verbose
+					 (concat "JIT stealth lock "
+						 (buffer-name)))
+		    (jit-lock-fontify-now start
+					  (+ start jit-lock-chunk-size))
+		    ;; Run again after `jit-lock-stealth-nice' seconds.
+		    (setq delay (or jit-lock-stealth-nice 0)))
+		;; Nothing to fontify here.  Remove this buffer from
+		;; `jit-lock-stealth-buffers' and run again immediately.
+		(setq jit-lock-stealth-buffers (cdr jit-lock-stealth-buffers))))
+	  ;; Buffer is no longer live.  Remove it from
+	  ;; `jit-lock-stealth-buffers' and run again immediately.
+	  (setq jit-lock-stealth-buffers (cdr jit-lock-stealth-buffers))))
+      ;; Call us again.
+      (when jit-lock-stealth-buffers
+	(timer-set-idle-time jit-lock-stealth-repeat-timer (current-idle-time))
+	(timer-inc-time jit-lock-stealth-repeat-timer delay)
+	(timer-activate-when-idle jit-lock-stealth-repeat-timer t)))))
 
 
 ;;; Deferred fontification.
@@ -548,6 +565,19 @@
 		'(fontified nil jit-lock-defer-multiline nil)))
 	      (setq jit-lock-context-unfontify-pos (point-max)))))))))
 
+(defvar jit-lock-start) (defvar jit-lock-end) ; Dynamically scoped variables.
+(defvar jit-lock-after-change-extend-region-functions nil
+  "Hook that can extend the text to refontify after a change.
+This is run after every buffer change.  The functions are called with
+the three arguments of `after-change-functions': START END OLD-LEN.
+The extended region to refontify is returned indirectly by modifying
+the variables `jit-lock-start' and `jit-lock-end'.
+
+Note that extending the region this way is not strictly necessary, except
+that the nature of the redisplay code tends to otherwise leave some of
+the rehighlighted text displayed with the old highlight until the next
+redisplay (see comment about repeated redisplay in `jit-lock-fontify-now').")
+
 (defun jit-lock-after-change (start end old-len)
   "Mark the rest of the buffer as not fontified after a change.
 Installed on `after-change-functions'.
@@ -557,44 +587,24 @@
 in case the syntax of those lines has changed.  Refontification
 will take place when text is fontified stealthily."
   (when (and jit-lock-mode (not memory-full))
-    (let ((region (font-lock-extend-region start end old-len)))
-      (save-excursion
-	(with-buffer-prepared-for-jit-lock
-	 ;; It's important that the `fontified' property be set from the
-	 ;; beginning of the line, else font-lock will properly change the
-	 ;; text's face, but the display will have been done already and will
-	 ;; be inconsistent with the buffer's content.
-	 ;; 
-	 ;; FIXME!!! (Alan Mackenzie, 2006-03-14): If start isn't at a BOL,
-	 ;; expanding the region to BOL might mis-fontify, should the BOL not
-	 ;; be at a "safe" position.
-	 (setq start (if region
-			 (car region)
-		       (goto-char start)
-		       (line-beginning-position)))
-
-	 ;; If we're in text that matches a multi-line font-lock pattern,
-	 ;; make sure the whole text will be redisplayed.
-	 ;; I'm not sure this is ever necessary and/or sufficient.  -stef
-	 (when (get-text-property start 'font-lock-multiline)
-	   (setq start (or (previous-single-property-change
-			    start 'font-lock-multiline)
-			   (point-min))))
-
-	 (if region (setq end (cdr region)))
-	 ;; Make sure we change at least one char (in case of deletions).
-	 (setq end (min (max end (1+ start)) (point-max)))
-	 ;; Request refontification.
-	 (put-text-property start end 'fontified nil))
-	;; Mark the change for deferred contextual refontification.
-	(when jit-lock-context-unfontify-pos
-	  (setq jit-lock-context-unfontify-pos
-		;; Here we use `start' because nothing guarantees that the
-		;; text between start and end will be otherwise refontified:
-		;; usually it will be refontified by virtue of being
-		;; displayed, but if it's outside of any displayed area in the
-		;; buffer, only jit-lock-context-* will re-fontify it.
-		(min jit-lock-context-unfontify-pos start)))))))
+    (let ((jit-lock-start start)
+          (jit-lock-end end))
+      (with-buffer-prepared-for-jit-lock
+          (run-hook-with-args 'jit-lock-after-change-extend-region-functions
+                              start end old-len)
+          ;; Make sure we change at least one char (in case of deletions).
+          (setq jit-lock-end (min (max jit-lock-end (1+ start)) (point-max)))
+          ;; Request refontification.
+          (put-text-property jit-lock-start jit-lock-end 'fontified nil))
+      ;; Mark the change for deferred contextual refontification.
+      (when jit-lock-context-unfontify-pos
+        (setq jit-lock-context-unfontify-pos
+              ;; Here we use `start' because nothing guarantees that the
+              ;; text between start and end will be otherwise refontified:
+              ;; usually it will be refontified by virtue of being
+              ;; displayed, but if it's outside of any displayed area in the
+              ;; buffer, only jit-lock-context-* will re-fontify it.
+              (min jit-lock-context-unfontify-pos jit-lock-start))))))
 
 (provide 'jit-lock)
 
--- a/lisp/kmacro.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/kmacro.el	Sat Oct 14 16:56:21 2006 +0000
@@ -409,7 +409,7 @@
 
 
 (defun kmacro-repeat-on-last-key (keys)
-  "Process kmacro commands keys immidiately after cycling the ring."
+  "Process kmacro commands keys immediately after cycling the ring."
   (setq keys (vconcat keys))
   (let ((n (1- (length keys)))
 	cmd done repeat)
--- a/lisp/loadhist.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/loadhist.el	Sat Oct 14 16:56:21 2006 +0000
@@ -222,8 +222,8 @@
 		  (if aload
                       (fset fun (cons 'autoload aload))
                     (fmakunbound fun))))))
-           (require nil)
-           (t (message "Unexpected element %s in load-history" x)))
+           ((t require) nil)
+	   (t (message "Unexpected element %s in load-history" x)))
 	;; Kill local values as much as possible.
 	(dolist (buf (buffer-list))
 	  (with-current-buffer buf
--- a/lisp/longlines.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/longlines.el	Sat Oct 14 16:56:21 2006 +0000
@@ -44,7 +44,7 @@
   :group 'fill)
 
 (defcustom longlines-auto-wrap t
-  "*Non-nil means long lines are automatically wrapped after each command.
+  "Non-nil means long lines are automatically wrapped after each command.
 Otherwise, you can perform filling using `fill-paragraph' or
 `auto-fill-mode'.  In any case, the soft newlines will be removed
 when the file is saved to disk."
@@ -52,7 +52,7 @@
   :type 'boolean)
 
 (defcustom longlines-wrap-follows-window-size nil
-  "*Non-nil means wrapping and filling happen at the edge of the window.
+  "Non-nil means wrapping and filling happen at the edge of the window.
 Otherwise, `fill-column' is used, regardless of the window size.  This
 does not work well when the buffer is displayed in multiple windows
 with differing widths."
@@ -60,7 +60,7 @@
   :type 'boolean)
 
 (defcustom longlines-show-hard-newlines nil
-  "*Non-nil means each hard newline is marked on the screen.
+  "Non-nil means each hard newline is marked on the screen.
 \(The variable `longlines-show-effect' controls what they look like.)
 You can also enable the display temporarily, using the command
 `longlines-show-hard-newlines'"
@@ -68,7 +68,7 @@
   :type 'boolean)
 
 (defcustom longlines-show-effect (propertize "|\n" 'face 'escape-glyph)
-  "*A string to display when showing hard newlines.
+  "A string to display when showing hard newlines.
 This is used when `longlines-show-hard-newlines' is on."
   :group 'longlines
   :type 'string)
@@ -202,7 +202,8 @@
   "Make hard newlines between BEG and END visible."
   (let* ((pmin (min beg end))
          (pmax (max beg end))
-         (pos (text-property-not-all pmin pmax 'hard nil)))
+         (pos (text-property-not-all pmin pmax 'hard nil))
+         (inhibit-read-only t))
     (while pos
       (put-text-property pos (1+ pos) 'display
                          (copy-sequence longlines-show-effect))
--- a/lisp/mouse.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/mouse.el	Sat Oct 14 16:56:21 2006 +0000
@@ -2398,6 +2398,8 @@
 (global-set-key [right-fringe mouse-1]	'mouse-set-point)
 
 (global-set-key [mouse-2]	'mouse-yank-at-click)
+;; Allow yanking also when the corresponding cursor is "in the fringe".
+(global-set-key [right-fringe mouse-2] [mouse-2])
 (global-set-key [mouse-3]	'mouse-save-then-kill)
 
 ;; By binding these to down-going events, we let the user use the up-going
--- a/lisp/net/rcirc.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/net/rcirc.el	Sat Oct 14 16:56:21 2006 +0000
@@ -40,6 +40,8 @@
 ;; Open a new irc connection with:
 ;; M-x irc RET
 
+;;; Todo:
+
 ;;; Code:
 
 (require 'ring)
@@ -140,6 +142,10 @@
 		 (integer :tag "Number of lines"))
   :group 'rcirc)
 
+(defcustom rcirc-show-maximum-output t
+  "*If non-nil, scroll buffer to keep the point at the bottom of
+the window.")
+
 (defcustom rcirc-authinfo nil
   "List of authentication passwords.
 Each element of the list is a list with a SERVER-REGEXP string
@@ -297,6 +303,7 @@
 
 (defvar rcirc-urls nil
   "List of urls seen in the current buffer.")
+(put 'rcirc-urls 'permanent-local t)
 
 (defvar rcirc-keepalive-seconds 60
   "Number of seconds between keepalive pings.
@@ -539,7 +546,10 @@
 (defun rcirc-buffer-process (&optional buffer)
   "Return the process associated with channel BUFFER.
 With no argument or nil as argument, use the current buffer."
-  (get-buffer-process (or buffer rcirc-server-buffer)))
+  (get-buffer-process (if buffer
+			  (with-current-buffer buffer
+			    rcirc-server-buffer)
+			rcirc-server-buffer)))
 
 (defun rcirc-server-name (process)
   "Return PROCESS server name, given by the 001 response."
@@ -601,10 +611,11 @@
 
 (defvar rcirc-nick-completions nil)
 (defvar rcirc-nick-completion-start-offset nil)
+
 (defun rcirc-complete-nick ()
   "Cycle through nick completions from list of nicks in channel."
   (interactive)
-  (if (eq last-command 'rcirc-complete-nick)
+  (if (eq last-command this-command)
       (setq rcirc-nick-completions
             (append (cdr rcirc-nick-completions)
                     (list (car rcirc-nick-completions))))
@@ -626,9 +637,10 @@
 					  rcirc-target))))))
   (let ((completion (car rcirc-nick-completions)))
     (when completion
+      (rcirc-put-nick-channel (rcirc-buffer-process) completion rcirc-target)
       (delete-region (+ rcirc-prompt-end-marker
-                        rcirc-nick-completion-start-offset)
-                     (point))
+			rcirc-nick-completion-start-offset)
+		     (point))
       (insert (concat completion
                       (if (= (+ rcirc-prompt-end-marker
                                 rcirc-nick-completion-start-offset)
@@ -709,7 +721,6 @@
   (make-local-variable 'rcirc-short-buffer-name)
   (setq rcirc-short-buffer-name nil)
   (make-local-variable 'rcirc-urls)
-  (setq rcirc-urls nil)
   (setq use-hard-newlines t)
 
   (make-local-variable 'rcirc-decode-coding-system)
@@ -742,6 +753,9 @@
   (make-local-variable 'kill-buffer-hook)
   (add-hook 'kill-buffer-hook 'rcirc-kill-buffer-hook)
 
+  (make-local-variable 'window-scroll-functions)
+  (add-hook 'window-scroll-functions 'rcirc-scroll-to-bottom)
+
   ;; add to buffer list, and update buffer abbrevs
   (when target				; skip server buffer
     (let ((buffer (current-buffer)))
@@ -1144,6 +1158,15 @@
 (make-variable-buffer-local 'rcirc-last-sender)
 (defvar rcirc-gray-toggle nil)
 (make-variable-buffer-local 'rcirc-gray-toggle)
+
+(defun rcirc-scroll-to-bottom (window display-start)
+  "Scroll window to show maximum output if `rcirc-show-maximum-output' is
+non-nil."
+  (when rcirc-show-maximum-output
+    (with-selected-window window
+      (when (>= (window-point) rcirc-prompt-end-marker)
+	(recenter -1)))))
+
 (defun rcirc-print (process sender response target text &optional activity)
   "Print TEXT in the buffer associated with TARGET.
 Format based on SENDER and RESPONSE.  If ACTIVITY is non-nil,
@@ -1240,16 +1263,19 @@
 	;; record modeline activity
 	(when activity
 	  (let ((nick-match
-		 (string-match (concat "\\b"
-				       (regexp-quote (rcirc-nick process))
-				       "\\b")
-			       text)))
+		 (with-syntax-table rcirc-nick-syntax-table		 
+		   (string-match (concat "\\b"
+					 (regexp-quote (rcirc-nick process))
+					 "\\b")
+				 text))))
 	    (when (if rcirc-ignore-buffer-activity-flag
 		      ;; - Always notice when our nick is mentioned
 		      nick-match
-		    ;; - Never bother us if a dim-nick spoke
-		    (not (and rcirc-dim-nick-regexp sender
-			      (string-match rcirc-dim-nick-regexp sender))))
+		    ;; - unless our nick is mentioned, don't bother us
+		    ;; - with dim-nicks
+		    (or nick-match
+			(not (and rcirc-dim-nick-regexp sender
+				  (string-match rcirc-dim-nick-regexp sender)))))
 	      (rcirc-record-activity
 	       (current-buffer)
 	       (when (or nick-match (and (not (rcirc-channel-p rcirc-target))
@@ -1504,18 +1530,20 @@
 	 (lopri (car pair))
 	 (hipri (cdr pair)))
     (setq rcirc-activity-string
-	  (if (or hipri lopri)
-	      (concat "-"
-		      (and hipri "[")
-		      (rcirc-activity-string hipri)
-		      (and hipri lopri ",")
-		      (and lopri
-			   (concat "("
-				   (rcirc-activity-string lopri)
-				   ")"))
-		      (and hipri "]")
-		      "-")
-	    "-[]-"))))
+	  (cond ((or hipri lopri)
+		 (concat "-"
+			 (and hipri "[")
+			 (rcirc-activity-string hipri)
+			 (and hipri lopri ",")
+			 (and lopri
+			      (concat "("
+				      (rcirc-activity-string lopri)
+				      ")"))
+			 (and hipri "]")
+			 "-"))
+		((not (null (rcirc-process-list)))
+		 "-[]-")
+		(t "")))))
 
 (defun rcirc-activity-string (buffers)
   (mapconcat (lambda (b)
@@ -1771,7 +1799,7 @@
 ones added to the list automatically are marked with an asterisk."
   (interactive "sToggle ignoring of nick: ")
   (when (not (string= "" nick))
-    (if (member nick rcirc-ignore-list)
+    (if (member-ignore-case nick rcirc-ignore-list)
 	(setq rcirc-ignore-list (delete nick rcirc-ignore-list))
       (setq rcirc-ignore-list (cons nick rcirc-ignore-list))))
   (rcirc-print process (rcirc-nick process) "IGNORE" target 
@@ -1800,6 +1828,7 @@
 		       "://")
 		  "www.")
 	      (1+ (char "-a-zA-Z0-9_."))
+	      (1+ (char "-a-zA-Z0-9_"))
 	      (optional ":" (1+ (char "0-9"))))
 	     (and (1+ (char "-a-zA-Z0-9_."))
 		  (or ".com" ".net" ".org")
@@ -1823,7 +1852,7 @@
 (defun rcirc-browse-url-at-point (point)
   "Send URL at point to `browse-url'."
   (interactive "d")
-  (let ((beg (previous-single-property-change point 'mouse-face))
+  (let ((beg (previous-single-property-change (1+ point) 'mouse-face))
 	(end (next-single-property-change point 'mouse-face)))
     (browse-url (buffer-substring-no-properties beg end))))
 
--- a/lisp/net/zone-mode.el	Sun Jul 30 10:19:46 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-;;; zone-mode.el --- major mode for editing DNS zone files
-
-;; Copyright (C) 1998, 2002, 2003, 2004, 2005,
-;;   2006 Free Software Foundation, Inc.
-
-;; Author: John Heidemann <johnh@isi.edu>
-;; Keywords: DNS, languages
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Commentary:
-
-;;;
-;;; See the comments in ``define-derived-mode zone-mode''
-;;; (the last function in this file)
-;;; for what this mode is and how to use it automatically.
-;;;
-
-;;;
-;;; Credits:
-;;; Zone-mode was written by John Heidemann <johnh@isi.edu>,
-;;; with bug fixes from Simon Leinen <simon@limmat.switch.ch>.
-;;;
-
-;;; Code:
-
-(defun zone-mode-update-serial ()
-  "Update the serial number in a zone."
-  (interactive)
-  (save-excursion
-    (goto-char (point-min))
-    (while (re-search-forward "\\b\\([0-9]+\\)\\([0-9][0-9]\\)\\([ \t]+;[ \t]+[Ss]erial\\)" (point-max) t)
-      (let* ((old-date (match-string 1))
-	     (old-seq (match-string 2))
-	     (old-seq-num (string-to-number (match-string 2)))
-	     (old-flag (match-string 3))
-	     (cur-date (format-time-string "%Y%m%d"))
-	     (new-seq
-	      (cond
-	       ((not (string= old-date cur-date))
-		"00") ;; reset sequence number
-	       ((>= old-seq-num 99)
-		(error "Serial number's sequence cannot increment beyond 99"))
-	       (t
-		(format "%02d" (1+ old-seq-num)))))
-	     (old-serial (concat old-date old-seq))
-	     (new-serial (concat cur-date new-seq)))
-	(if (string-lessp new-serial old-serial)
-	    (error "Serial numbers want to move backwards from %s to %s" old-serial new-serial)
-	  (replace-match (concat cur-date new-seq old-flag) t t))))))
-
-;;;###autoload
-(defun zone-mode-update-serial-hook ()
-  "Update the serial number in a zone if the file was modified."
-  (interactive)
-  (if (buffer-modified-p (current-buffer))
-      (zone-mode-update-serial))
-  nil ;; so we can run from write-file-hooks
-  )
-
-(defvar zone-mode-syntax-table nil
-  "Zone-mode's syntax table.")
-
-(defun zone-mode-load-time-setup ()
-  "Initialize `zone-mode' stuff."
-  (setq zone-mode-syntax-table (make-syntax-table))
-  (modify-syntax-entry ?\; "<" zone-mode-syntax-table)
-  (modify-syntax-entry ?\n ">" zone-mode-syntax-table))
-
-;;;###autoload
-(define-derived-mode zone-mode fundamental-mode "zone"
-  "A mode for editing DNS zone files.
-
-Zone-mode does two things:
-
-	- automatically update the serial number for a zone
-		when saving the file
-
-	- fontification"
-
-  (add-hook 'write-file-functions 'zone-mode-update-serial-hook nil t)
-
-  (if (null zone-mode-syntax-table)
-      (zone-mode-load-time-setup)) ;; should have been run at load-time
-
-  ;; font-lock support:
-  (set-syntax-table zone-mode-syntax-table)
-  (make-local-variable 'comment-start)
-  (setq comment-start ";")
-  (make-local-variable 'comment-start-skip)
-  ;; Look within the line for a ; following an even number of backslashes
-  ;; after either a non-backslash or the line beginning.
-  (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+[ \t]*")
-  (make-local-variable 'comment-column)
-  (setq comment-column 40)
-  (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults
-	'(nil nil nil nil beginning-of-line)))
-
-(zone-mode-load-time-setup)
-
-(provide 'zone-mode)
-
-;;; arch-tag: 6a2940ef-fd4f-4de7-b979-b027b09821fe
-;;; zone-mode.el ends here
--- a/lisp/newcomment.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/newcomment.el	Sat Oct 14 16:56:21 2006 +0000
@@ -299,7 +299,7 @@
 		   (substring comment-start 1)))
       ;; Hasn't been necessary yet.
       ;; (unless (string-match comment-start-skip comment-continue)
-      ;; 	(kill-local-variable 'comment-continue))
+      ;;	(kill-local-variable 'comment-continue))
       )
     ;; comment-skip regexps
     (unless (and comment-start-skip
@@ -599,11 +599,16 @@
 		    (if (and other (<= other max) (> other min))
 			;; There is a comment and it's in the range: bingo.
 			(setq indent other))))))))
+	;; Update INDENT to leave at least one space
+	;; after other nonwhite text on the line.
+	(save-excursion
+	  (skip-chars-backward " \t")
+	  (unless (bolp)
+	    (setq indent (max indent (1+ (current-column))))))
+	;; If that's different from comment's current position, change it.
 	(unless (= (current-column) indent)
-	  ;; If that's different from current, change it.
 	  (delete-region (point) (progn (skip-chars-backward " \t") (point)))
-	  (indent-to (if (bolp) indent
-		       (max indent (1+ (current-column)))))))
+	  (indent-to indent)))
       (goto-char cpos)
       (set-marker cpos nil))))
 
@@ -764,7 +769,7 @@
 	    (box-equal nil))	   ;Whether we might be using `=' for boxes.
 	(save-restriction
 	  (narrow-to-region spt ept)
-		
+
 	  ;; Remove the comment-start.
 	  (goto-char ipt)
 	  (skip-syntax-backward " ")
@@ -793,7 +798,7 @@
 	      ;; If there's something left but it doesn't look like
 	      ;; a comment-start any more, just remove it.
 	      (delete-region (point-min) (point))))
-		
+
 	  ;; Remove the end-comment (and leading padding and such).
 	  (goto-char (point-max)) (comment-enter-backward)
 	  ;; Check for special `=' used sometimes in comment-box.
@@ -1057,11 +1062,13 @@
        lines
        (nth 3 style))))))
 
+;;;###autoload
 (defun comment-box (beg end &optional arg)
   "Comment out the BEG .. END region, putting it inside a box.
 The numeric prefix ARG specifies how many characters to add to begin- and
 end- comment markers additionally to what `comment-add' already specifies."
   (interactive "*r\np")
+  (comment-normalize-vars)
   (let ((comment-style (if (cadr (assoc comment-style comment-styles))
 			   'box-multi 'box)))
     (comment-region beg end (+ comment-add arg))))
--- a/lisp/pcvs-parse.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/pcvs-parse.el	Sat Oct 14 16:56:21 2006 +0000
@@ -285,7 +285,8 @@
        (and
 	(cvs-or
 	 (cvs-match "warning: \\(.*\\) is not (any longer) pertinent$" (file 1))
-	 (cvs-match "\\(.*\\) is no longer in the repository$" (file 1)))
+	 (cvs-match "`\\(.*\\)' is no longer in the repository$" (file 1))
+         (cvs-match "\\(.*\\) is no longer in the repository$" (file 1)))
 	(cvs-parsed-fileinfo
 	 (if dont-change-disc '(NEED-UPDATE . REMOVED) 'DEAD) file))
 
--- a/lisp/pcvs-util.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/pcvs-util.el	Sat Oct 14 16:56:21 2006 +0000
@@ -126,7 +126,9 @@
 In such a case, the search for another buffer with the same name doesn't
 use the buffer name but the buffer's `list-buffers-directory' variable.
 If NOREUSE is non-nil, always return a new buffer."
-  (or (and (not (file-name-absolute-p name)) (get-buffer-create name))
+  (or (and (not (file-name-absolute-p name))
+           (if noreuse (generate-new-buffer name)
+             (get-buffer-create name)))
       (unless noreuse
 	(dolist (buf (buffer-list))
 	  (with-current-buffer buf
--- a/lisp/pcvs.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/pcvs.el	Sat Oct 14 16:56:21 2006 +0000
@@ -2287,7 +2287,7 @@
   (interactive "DNew repository: ")
   (if (or (file-directory-p (expand-file-name "CVSROOT" newroot))
 	  (y-or-n-p (concat "Warning: no CVSROOT found inside repository."
-			    " Change cvs-cvsroot anyhow?")))
+			    " Change cvs-cvsroot anyhow? ")))
       (setq cvs-cvsroot newroot)))
 
 ;;;;
--- a/lisp/progmodes/gdb-ui.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/progmodes/gdb-ui.el	Sat Oct 14 16:56:21 2006 +0000
@@ -115,6 +115,7 @@
 (defvar gdb-main-file nil "Source file from which program execution begins.")
 (defvar gud-old-arrow nil)
 (defvar gdb-overlay-arrow-position nil)
+(defvar gdb-stack-position nil)
 (defvar gdb-server-prefix nil)
 (defvar gdb-flush-pending-output nil)
 (defvar gdb-location-alist nil
@@ -314,14 +315,14 @@
   "Nil means just pop up the GUD buffer unless `gdb-show-main' is t.
 In this case it starts with two windows: one displaying the GUD
 buffer and the other with the source file with the main routine
-of the inferior.  Non-nil means display the layout shown for
+of the debugged program.  Non-nil means display the layout shown for
 `gdba'."
   :type 'boolean
   :group 'gud
   :version "22.1")
 
 (defcustom gdb-use-separate-io-buffer nil
-  "Non-nil means display output from the inferior in a separate buffer."
+  "Non-nil means display output from the debugged program in a separate buffer."
   :type 'boolean
   :group 'gud
   :version "22.1")
@@ -353,14 +354,14 @@
 	(error nil))))
 
 (defun gdb-use-separate-io-buffer (arg)
-  "Toggle separate IO for inferior.
+  "Toggle separate IO for debugged program.
 With arg, use separate IO iff arg is positive."
   (interactive "P")
   (setq gdb-use-separate-io-buffer
 	(if (null arg)
 	    (not gdb-use-separate-io-buffer)
 	  (> (prefix-numeric-value arg) 0)))
-  (message (format "Separate inferior IO %sabled"
+  (message (format "Separate IO %sabled"
 		   (if gdb-use-separate-io-buffer "en" "dis")))
   (if (and gud-comint-buffer
 	   (buffer-name gud-comint-buffer))
@@ -383,8 +384,7 @@
 			    (list t nil) nil "-c"
 			    (concat gdb-cpp-define-alist-program " "
 				    gdb-cpp-define-alist-flags)))))
-	(define-list (split-string output "\n" t))
-	(name))
+	(define-list (split-string output "\n" t)) (name))
     (setq gdb-define-alist nil)
     (dolist (define define-list)
       (setq name (nth 1 (split-string define "[( ]")))
@@ -1030,7 +1030,7 @@
     (minibuffer . nil)))
 
 (defun gdb-frame-separate-io-buffer ()
-  "Display IO of inferior in a new frame."
+  "Display IO of debugged program in a new frame."
   (interactive)
   (if gdb-use-separate-io-buffer
       (let ((special-display-regexps (append special-display-regexps '(".*")))
@@ -1290,12 +1290,14 @@
       (progn
 	(setq gud-running t)
 	(setq gdb-inferior-status "running")
+	(setq gdb-signalled nil)
 	(gdb-force-mode-line-update
 	 (propertize gdb-inferior-status 'face font-lock-type-face))
 	(gdb-remove-text-properties)
 	(setq gud-old-arrow gud-overlay-arrow-position)
 	(setq gud-overlay-arrow-position nil)
 	(setq gdb-overlay-arrow-position nil)
+	(setq gdb-stack-position nil)
 	(if gdb-use-separate-io-buffer
 	    (setq gdb-output-sink 'inferior))))
      (t
@@ -1330,6 +1332,7 @@
   (setq gdb-active-process nil)
   (setq gud-overlay-arrow-position nil)
   (setq gdb-overlay-arrow-position nil)
+  (setq gdb-stack-position nil)
   (setq gud-old-arrow nil)
   (setq gdb-inferior-status "exited")
   (gdb-force-mode-line-update
@@ -1358,6 +1361,23 @@
   :type 'boolean
   :version "22.1")
 
+(defcustom gdb-find-source-frame nil
+  "Non-nil means try to find a source frame further up stack e.g after signal."
+  :group 'gud
+  :type 'boolean
+  :version "22.1")
+
+(defun gdb-find-source-frame (arg)
+  "Toggle trying to find a source frame further up stack.
+With arg, look for a source frame further up stack iff arg is positive."
+  (interactive "P")
+  (setq gdb-find-source-frame
+	(if (null arg)
+	    (not gdb-find-source-frame)
+	  (> (prefix-numeric-value arg) 0)))
+  (message (format "Looking for source frame %sabled"
+		   (if gdb-find-source-frame "en" "dis"))))
+
 (defun gdb-stopped (ignored)
   "An annotation handler for `stopped'.
 It is just like `gdb-stopping', except that if we already set the output
@@ -1371,14 +1391,15 @@
     (if gdb-same-frame
 	(gdb-display-gdb-buffer)
       (gdb-frame-gdb-buffer))
+    (if gdb-find-source-frame
     ;;Try to find source further up stack e.g after signal.
-    (setq gdb-look-up-stack
-	  (if (gdb-get-buffer 'gdb-stack-buffer)
-	      'keep
-	    (progn
-	      (gdb-get-buffer-create 'gdb-stack-buffer)
-	      (gdb-invalidate-frames)
-	      'delete)))))
+	(setq gdb-look-up-stack
+	      (if (gdb-get-buffer 'gdb-stack-buffer)
+		  'keep
+		(progn
+		  (gdb-get-buffer-create 'gdb-stack-buffer)
+		  (gdb-invalidate-frames)
+		  'delete))))))
   (unless (member gdb-inferior-status '("exited" "signal"))
     (setq gdb-inferior-status "stopped")
     (gdb-force-mode-line-update
@@ -1754,52 +1775,69 @@
 	    (gdb-remove-breakpoint-icons (point-min) (point-max)))))
     (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
       (save-excursion
+	(let ((buffer-read-only nil))
 	(goto-char (point-min))
 	(while (< (point) (- (point-max) 1))
 	  (forward-line 1)
-	  (if (looking-at "[^\t].*?breakpoint")
+	  (if (looking-at gdb-breakpoint-regexp)
 	      (progn
-		(looking-at "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)")
 		(setq bptno (match-string 1))
 		(setq flag (char-after (match-beginning 2)))
-		(beginning-of-line)
-		(if (re-search-forward " in \\(.*\\) at\\s-+" nil t)
-		    (progn
-		      (let ((buffer-read-only nil))
-			(add-text-properties (match-beginning 1) (match-end 1)
-					     '(face font-lock-function-name-face)))
-		      (looking-at "\\(\\S-+\\):\\([0-9]+\\)")
-		      (let ((line (match-string 2)) (buffer-read-only nil)
-			    (file (match-string 1)))
-			(add-text-properties (line-beginning-position)
-					     (line-end-position)
-			 '(mouse-face highlight
-			   help-echo "mouse-2, RET: visit breakpoint"))
-			(unless (file-exists-p file)
-			   (setq file (cdr (assoc bptno gdb-location-alist))))
-			(if (and file
-				 (not (string-equal file "File not found")))
-			    (with-current-buffer
-				(find-file-noselect file 'nowarn)
-			      (set (make-local-variable 'gud-minor-mode)
-				   'gdba)
-			      (set (make-local-variable 'tool-bar-map)
-				   gud-tool-bar-map)
-			      ;; Only want one breakpoint icon at each
-			      ;; location.
-			      (save-excursion
-				(goto-line (string-to-number line))
-				(gdb-put-breakpoint-icon (eq flag ?y) bptno)))
-			  (gdb-enqueue-input
-			   (list
-			    (concat gdb-server-prefix "list "
-				    (match-string-no-properties 1) ":1\n")
-			    'ignore))
-			  (gdb-enqueue-input
-			   (list (concat gdb-server-prefix "info source\n")
-				 `(lambda () (gdb-get-location
-					      ,bptno ,line ,flag))))))))))
-	  (end-of-line)))))
+		(add-text-properties
+		 (match-beginning 2) (match-end 2)
+		 (if (eq flag ?y)
+		     '(face font-lock-warning-face)
+		   '(face font-lock-type-face)))
+		(let ((bl (point))
+		      (el (line-end-position)))
+		  (if (re-search-forward " in \\(.*\\) at\\s-+" el t)
+		      (progn
+			(add-text-properties
+			 (match-beginning 1) (match-end 1)
+			 '(face font-lock-function-name-face))
+			(looking-at "\\(\\S-+\\):\\([0-9]+\\)")
+			(let ((line (match-string 2))
+			      (file (match-string 1)))
+			  (add-text-properties bl el
+			   '(mouse-face highlight
+			     help-echo "mouse-2, RET: visit breakpoint"))
+			  (unless (file-exists-p file)
+			    (setq file (cdr (assoc bptno gdb-location-alist))))
+			  (if (and file
+				   (not (string-equal file "File not found")))
+			      (with-current-buffer
+				  (find-file-noselect file 'nowarn)
+				(set (make-local-variable 'gud-minor-mode)
+				     'gdba)
+				(set (make-local-variable 'tool-bar-map)
+				     gud-tool-bar-map)
+				;; Only want one breakpoint icon at each
+				;; location.
+				(save-excursion
+				  (goto-line (string-to-number line))
+				  (gdb-put-breakpoint-icon (eq flag ?y) bptno)))
+			    (gdb-enqueue-input
+			     (list
+			      (concat gdb-server-prefix "list "
+				      (match-string-no-properties 1) ":1\n")
+			      'ignore))
+			    (gdb-enqueue-input
+			     (list (concat gdb-server-prefix "info source\n")
+				   `(lambda () (gdb-get-location
+						,bptno ,line ,flag)))))))
+		    (if (re-search-forward
+			 "<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>"
+			 el t)
+			(add-text-properties
+			 (match-beginning 1) (match-end 1)
+			 '(face font-lock-function-name-face))
+		      (end-of-line)
+		      (re-search-backward "\\s-\\(\\S-*\\)"
+					  bl t)
+		      (add-text-properties
+		       (match-beginning 1) (match-end 1)
+		       '(face font-lock-variable-name-face)))))))
+	  (end-of-line))))))
   (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom)))
 
 (defun gdb-mouse-set-clear-breakpoint (event)
@@ -2002,8 +2040,14 @@
 	    (goto-char bl)
 	    (when (looking-at "^#\\([0-9]+\\)")
 	      (when (string-equal (match-string 1) gdb-frame-number)
-		(put-text-property bl (+ bl 4)
-				   'face '(:inverse-video t)))
+		(if (> (car (window-fringes)) 0)
+		    (progn
+		      (or gdb-stack-position
+			  (setq gdb-stack-position (make-marker)))
+		      (set-marker gdb-stack-position (point)))
+		  (set-marker gdb-stack-position nil)
+		  (put-text-property bl (+ bl 4)
+				     'face '(:inverse-video t))))
 	      (when (re-search-forward
 		     (concat
 		      (if (string-equal (match-string 1) "0") "" " in ")
@@ -2036,9 +2080,10 @@
   (setq gdb-look-up-stack nil))
 
 (defun gdb-set-hollow ()
-  (with-current-buffer (gud-find-file (car gud-last-last-frame))
-    (setq fringe-indicator-alist
-	  '((overlay-arrow . hollow-right-triangle)))))
+  (if gud-last-last-frame
+      (with-current-buffer (gud-find-file (car gud-last-last-frame))
+	(setq fringe-indicator-alist
+	      '((overlay-arrow . hollow-right-triangle))))))
 
 (defun gdb-stack-buffer-name ()
   (with-current-buffer gud-comint-buffer
@@ -2073,6 +2118,8 @@
   (kill-all-local-variables)
   (setq major-mode 'gdb-frames-mode)
   (setq mode-name "Frames")
+  (setq gdb-stack-position nil)
+  (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position)
   (setq buffer-read-only t)
   (use-local-map gdb-frames-mode-map)
   (run-mode-hooks 'gdb-frames-mode-hook)
@@ -2524,18 +2571,18 @@
 	    'local-map
 	    (gdb-make-header-line-mouse-map
 	     'mouse-1
-	     #'(lambda () (interactive)
-		 (let ((gdb-memory-address
-			;; Let GDB do the arithmetic.
-			(concat
-			 gdb-memory-address " - "
-			 (number-to-string
-			  (* gdb-memory-repeat-count
-			     (cond ((string= gdb-memory-unit "b") 1)
-				   ((string= gdb-memory-unit "h") 2)
-				   ((string= gdb-memory-unit "w") 4)
-				   ((string= gdb-memory-unit "g") 8)))))))
-		       (gdb-invalidate-memory)))))
+	     (lambda () (interactive)
+	       (let ((gdb-memory-address
+		      ;; Let GDB do the arithmetic.
+		      (concat
+		       gdb-memory-address " - "
+		       (number-to-string
+			(* gdb-memory-repeat-count
+			   (cond ((string= gdb-memory-unit "b") 1)
+				 ((string= gdb-memory-unit "h") 2)
+				 ((string= gdb-memory-unit "w") 4)
+				 ((string= gdb-memory-unit "g") 8)))))))
+		 (gdb-invalidate-memory)))))
 	   "|"
 	   (propertize "+"
 		       'face font-lock-warning-face
@@ -2543,9 +2590,9 @@
 		       'mouse-face 'mode-line-highlight
 		       'local-map (gdb-make-header-line-mouse-map
 				   'mouse-1
-				   #'(lambda () (interactive)
-				       (let ((gdb-memory-address nil))
-					 (gdb-invalidate-memory)))))
+				   (lambda () (interactive)
+				     (let ((gdb-memory-address nil))
+				       (gdb-invalidate-memory)))))
 	   "]: "
 	   (propertize gdb-memory-address
 		       'face font-lock-warning-face
@@ -2592,8 +2639,11 @@
 (defun gdb-frame-memory-buffer ()
   "Display memory contents in a new frame."
   (interactive)
-  (let ((special-display-regexps (append special-display-regexps '(".*")))
-	(special-display-frame-alist gdb-frame-parameters))
+  (let* ((special-display-regexps (append special-display-regexps '(".*")))
+	 (special-display-frame-alist
+	  (cons '(left-fringe . 0)
+		(cons '(right-fringe . 0)
+		      (cons '(width . 83) gdb-frame-parameters)))))
     (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer))))
 
 
@@ -2610,13 +2660,14 @@
 
 (defvar gdb-locals-watch-map
   (let ((map (make-sparse-keymap)))
-    (define-key map "\r" '(lambda () (interactive)
-			    (beginning-of-line)
-			    (gud-watch)))
-    (define-key map [mouse-2] '(lambda (event) (interactive "e")
-				 (mouse-set-point event)
-				 (beginning-of-line)
-				 (gud-watch)))
+    (suppress-keymap map)
+    (define-key map "\r" (lambda () (interactive)
+			   (beginning-of-line)
+			   (gud-watch)))
+    (define-key map [mouse-2] (lambda (event) (interactive "e")
+				(mouse-set-point event)
+				(beginning-of-line)
+				(gud-watch)))
     map)
  "Keymap to create watch expression of a complex data type local variable.")
 
@@ -2739,7 +2790,7 @@
   (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer))
   (define-key menu [threads] '("Threads" . gdb-display-threads-buffer))
   (define-key menu [inferior]
-    '(menu-item "Inferior IO" gdb-display-separate-io-buffer
+    '(menu-item "Separate IO" gdb-display-separate-io-buffer
 		:enable gdb-use-separate-io-buffer))
   (define-key menu [memory] '("Memory" . gdb-display-memory-buffer))
   (define-key menu [registers] '("Registers" . gdb-display-registers-buffer))
@@ -2758,7 +2809,7 @@
   (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer))
   (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer))
   (define-key menu [inferior]
-    '(menu-item "Inferior IO" gdb-frame-separate-io-buffer
+    '(menu-item "Separate IO" gdb-frame-separate-io-buffer
 		:enable gdb-use-separate-io-buffer))
   (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer))
   (define-key menu [disassembly] '("Disassembly" . gdb-frame-assembler-buffer))
@@ -2771,10 +2822,15 @@
   (define-key gud-menu-map [ui]
     `(menu-item (if (eq gud-minor-mode 'gdba) "GDB-UI" "GDB-MI")
 		,menu :visible (memq gud-minor-mode '(gdbmi gdba))))
+  (define-key menu [gdb-find-source-frame]
+  '(menu-item "Look For Source Frame" gdb-find-source-frame
+	      :visible (eq gud-minor-mode 'gdba)
+	      :help "Toggle look for source frame."
+	      :button (:toggle . gdb-find-source-frame)))
   (define-key menu [gdb-use-separate-io]
-  '(menu-item "Separate inferior IO" gdb-use-separate-io-buffer
+  '(menu-item "Separate IO" gdb-use-separate-io-buffer
 	      :visible (eq gud-minor-mode 'gdba)
-	      :help "Toggle separate IO for inferior."
+	      :help "Toggle separate IO for debugged program."
 	      :button (:toggle . gdb-use-separate-io-buffer)))
   (define-key menu [gdb-many-windows]
   '(menu-item "Display Other Windows" gdb-many-windows
@@ -2871,12 +2927,13 @@
 	      (setq gud-minor-mode nil)
 	      (kill-local-variable 'tool-bar-map)
 	      (kill-local-variable 'gdb-define-alist))))))
-  (when (markerp gdb-overlay-arrow-position)
-    (move-marker gdb-overlay-arrow-position nil)
-    (setq gdb-overlay-arrow-position nil))
+  (setq gdb-overlay-arrow-position nil)
   (setq overlay-arrow-variable-list
 	(delq 'gdb-overlay-arrow-position overlay-arrow-variable-list))
   (setq fringe-indicator-alist '((overlay-arrow . right-triangle)))
+  (setq gdb-stack-position nil)
+  (setq overlay-arrow-variable-list
+	(delq 'gdb-stack-position overlay-arrow-variable-list))
   (if (boundp 'speedbar-frame) (speedbar-timer-fn))
   (setq gud-running nil)
   (setq gdb-active-process nil)
@@ -3098,8 +3155,7 @@
 			    '((overlay-arrow . hollow-right-triangle))))
 		    (or gdb-overlay-arrow-position
 			(setq gdb-overlay-arrow-position (make-marker)))
-		    (set-marker gdb-overlay-arrow-position
-				(point) (current-buffer))))))
+		    (set-marker gdb-overlay-arrow-position (point))))))
 	;; remove all breakpoint-icons in assembler buffer before updating.
 	(gdb-remove-breakpoint-icons (point-min) (point-max))))
     (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
@@ -3460,10 +3516,32 @@
 
 (defvar gdb-locals-watch-map-1
   (let ((map (make-sparse-keymap)))
+    (suppress-keymap map)
+    (define-key map "\r" 'gud-watch)
     (define-key map [mouse-2] 'gud-watch)
     map)
  "Keymap to create watch expression of a complex data type local variable.")
 
+(defvar gdb-edit-locals-map-1
+  (let ((map (make-sparse-keymap)))
+    (suppress-keymap map)
+    (define-key map "\r" 'gdb-edit-locals-value)
+    (define-key map [mouse-2] 'gdb-edit-locals-value)
+    map)
+ "Keymap to edit value of a simple data type local variable.")
+
+(defun gdb-edit-locals-value (&optional event)
+  "Assign a value to a variable displayed in the locals buffer."
+  (interactive (list last-input-event))
+  (save-excursion
+    (if event (posn-set-point (event-end event)))
+    (beginning-of-line)
+    (let* ((var (current-word))
+	   (value (read-string (format "New value (%s): " var))))
+      (gdb-enqueue-input
+       (list (concat  gdb-server-prefix"set variable " var " = " value "\n")
+	     'ignore)))))
+
 ;; Dont display values of arrays or structures.
 ;; These can be expanded using gud-watch.
 (defun gdb-stack-list-locals-handler ()
@@ -3491,20 +3569,26 @@
 		   (let* ((window (get-buffer-window buf 0))
 			  (start (window-start window))
 			  (p (window-point window))
-			  (buffer-read-only nil))
+			  (buffer-read-only nil) (name) (value))
 		     (erase-buffer)
 		     (dolist (local locals-list)
 		       (setq name (car local))
-		       (if (or (not (nth 2 local))
-			       (string-match "^\\0x" (nth 2 local)))
+		       (setq value (nth 2 local))
+		       (if (or (not value)
+			       (string-match "^\\0x" value))
 			   (add-text-properties 0 (length name)
 			        `(mouse-face highlight
 			          help-echo "mouse-2: create watch expression"
 			          local-map ,gdb-locals-watch-map-1)
-				name))
+				name)
+			 (add-text-properties 0 (length value)
+			      `(mouse-face highlight
+			        help-echo "mouse-2: edit value"
+			        local-map ,gdb-edit-locals-map-1)
+			      value))
 		       (insert
 			(concat name "\t" (nth 1 local)
-				"\t" (nth 2 local) "\n")))
+				"\t" value "\n")))
 		     (set-window-start window start)
 		     (set-window-point window p))))))))
 
--- a/lisp/progmodes/grep.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/progmodes/grep.el	Sat Oct 14 16:56:21 2006 +0000
@@ -335,7 +335,7 @@
 (defvar grep-find-use-xargs nil
   "Whether \\[grep-find] uses the `xargs' utility by default.
 
-If nil, it uses `find -exec'; if `gnu', it uses `find -print0' and `xargs -0';
+If `exec', it uses `find -exec'; if `gnu', it uses `find -print0' and `xargs -0';
 if not nil and not `gnu', it uses `find -print' and `xargs'.
 
 This variable's value takes effect when `grep-compute-defaults' is called.")
@@ -419,21 +419,29 @@
 	      (format "%s <C> %s <R> <F>" grep-program grep-options)))
       (unless grep-find-use-xargs
 	(setq grep-find-use-xargs
-	      (if (and
-		   (grep-probe find-program `(nil nil nil ,null-device "-print0"))
-		   (grep-probe "xargs" `(nil nil nil "-0" "-e" "echo")))
-		  'gnu)))
+	      (cond
+	       ((and
+		 (grep-probe find-program `(nil nil nil ,null-device "-print0"))
+		 (grep-probe "xargs" `(nil nil nil "-0" "-e" "echo")))
+		'gnu)
+	       (t
+		'exec))))
       (unless grep-find-command
 	(setq grep-find-command
 	      (cond ((eq grep-find-use-xargs 'gnu)
 		     (format "%s . -type f -print0 | xargs -0 -e %s"
 			     find-program grep-command))
-		    (grep-find-use-xargs
+		    ((eq grep-find-use-xargs 'exec)
+		     (let ((cmd0 (format "%s . -type f -exec %s"
+					 find-program grep-command)))
+		       (cons
+			(format "%s {} %s %s"
+				cmd0 null-device
+				(shell-quote-argument ";"))
+			(1+ (length cmd0)))))
+		    (t
 		     (format "%s . -type f -print | xargs %s"
-			     find-program grep-command))
-		    (t (cons (format "%s . -type f -exec %s {} %s \\;"
-				     find-program grep-command null-device)
-			     (+ 22 (length grep-command)))))))
+			     find-program grep-command)))))
       (unless grep-find-template
 	(setq grep-find-template
 	      (let ((gcmd (format "%s <C> %s <R>"
@@ -441,11 +449,13 @@
 		(cond ((eq grep-find-use-xargs 'gnu)
 		       (format "%s . <X> -type f <F> -print0 | xargs -0 -e %s"
 			       find-program gcmd))
-		      (grep-find-use-xargs
+		      ((eq grep-find-use-xargs 'exec)
+		       (format "%s . <X> -type f <F> -exec %s {} %s %s"
+			       find-program gcmd null-device
+			       (shell-quote-argument ";")))
+		      (t
 		       (format "%s . <X> -type f <F> -print | xargs %s"
-			       find-program gcmd))
-		      (t (format "%s . <X> -type f <F> -exec %s {} %s \\;"
-				 find-program gcmd null-device))))))))
+			       find-program gcmd))))))))
   (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t))
     (setq grep-highlight-matches
 	  (with-temp-buffer
@@ -455,34 +465,48 @@
 		   (search-forward "--color" nil t))
 		 t)))))
 
+(defun grep-tag-default ()
+  (or (and transient-mark-mode mark-active
+	   (/= (point) (mark))
+	   (buffer-substring-no-properties (point) (mark)))
+      (funcall (or find-tag-default-function
+		   (get major-mode 'find-tag-default-function)
+		   'find-tag-default))
+      ""))
+
 (defun grep-default-command ()
-  (let ((tag-default
-         (shell-quote-argument
-          (or (funcall (or find-tag-default-function
-                           (get major-mode 'find-tag-default-function)
-                           'find-tag-default))
-              "")))
+  "Compute the default grep command for C-u M-x grep to offer."
+  (let ((tag-default (shell-quote-argument (grep-tag-default)))
+	;; This a regexp to match single shell arguments.
+	;; Could someone please add comments explaining it?
 	(sh-arg-re "\\(\\(?:\"\\(?:[^\"]\\|\\\\\"\\)+\"\\|'[^']+'\\|[^\"' \t\n]\\)+\\)")
 	(grep-default (or (car grep-history) grep-command)))
-    ;; Replace the thing matching for with that around cursor.
+    ;; In the default command, find the arg that specifies the pattern.
     (when (or (string-match
 	       (concat "[^ ]+\\s +\\(?:-[^ ]+\\s +\\)*"
 		       sh-arg-re "\\(\\s +\\(\\S +\\)\\)?")
 	       grep-default)
 	      ;; If the string is not yet complete.
 	      (string-match "\\(\\)\\'" grep-default))
-      (unless (or (not (stringp buffer-file-name))
-		  (when (match-beginning 2)
-		    (save-match-data
-		      (string-match
-		       (wildcard-to-regexp
-			(file-name-nondirectory
-			 (match-string 3 grep-default)))
-		       (file-name-nondirectory buffer-file-name)))))
-	(setq grep-default (concat (substring grep-default
-					      0 (match-beginning 2))
-				   " *."
-				   (file-name-extension buffer-file-name))))
+      ;; Maybe we will replace the pattern with the default tag.
+      ;; But first, maybe replace the file name pattern.
+      (condition-case nil
+	  (unless (or (not (stringp buffer-file-name))
+		      (when (match-beginning 2)
+			(save-match-data
+			  (string-match
+			   (wildcard-to-regexp
+			    (file-name-nondirectory
+			     (match-string 3 grep-default)))
+			   (file-name-nondirectory buffer-file-name)))))
+	    (setq grep-default (concat (substring grep-default
+						  0 (match-beginning 2))
+				       " *."
+				       (file-name-extension buffer-file-name))))
+	;; In case wildcard-to-regexp gets an error
+	;; from invalid data.
+	(error nil))
+      ;; Now replace the pattern with the default tag.
       (replace-match tag-default t t grep-default 1))))
 
 
@@ -590,15 +614,11 @@
 
 (defun grep-read-regexp ()
   "Read regexp arg for interactive grep."
-  (let ((default
-	  (or (funcall (or find-tag-default-function
-			   (get major-mode 'find-tag-default-function)
-			   'find-tag-default))
-	      "")))
+  (let ((default (grep-tag-default)))
     (read-string
      (concat "Search for"
 	     (if (and default (> (length default) 0))
-		 (format " (default %s): " default) ": "))
+		 (format " (default \"%s\"): " default) ": "))
      nil 'grep-regexp-history default)))
 
 (defun grep-read-files (regexp)
@@ -620,7 +640,9 @@
 		      (cdr alias)))
 	       (and fn
 		    (let ((ext (file-name-extension fn)))
-		      (and ext (concat "*." ext))))))
+		      (and ext (concat "*." ext))))
+	       (car grep-files-history)
+	       (car (car grep-files-aliases))))
 	 (files (read-string
 		 (concat "Search for \"" regexp
 			 "\" in files"
@@ -724,18 +746,26 @@
       (let ((command (grep-expand-template
 		      grep-find-template
 		      regexp
-		      (concat "\\( -name "
+		      (concat (shell-quote-argument "(")
+			      " -name "
 			      (mapconcat #'shell-quote-argument
 					 (split-string files)
 					 " -o -name ")
-			      " \\)")
+			      " "
+			      (shell-quote-argument ")"))
 		       dir
 		       (and grep-find-ignored-directories
-			    (concat "\\( -path '*/"
-				    (mapconcat #'identity
+			    (concat (shell-quote-argument "(")
+				    ;; we should use shell-quote-argument here
+				    " -path "
+				    (mapconcat #'(lambda (dir)
+						   (shell-quote-argument
+						    (concat "*/" dir)))
 					       grep-find-ignored-directories
-					       "' -o -path '*/")
-				    "' \\) -prune -o ")))))
+					       " -o -path ")
+				    " "
+				    (shell-quote-argument ")")
+				    " -prune -o ")))))
 	(when command
 	  (if current-prefix-arg
 	      (setq command
--- a/lisp/progmodes/gud.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/progmodes/gud.el	Sat Oct 14 16:56:21 2006 +0000
@@ -3180,7 +3180,15 @@
 (defvar gdb-script-font-lock-syntactic-keywords
   '(("^document\\s-.*\\(\n\\)" (1 "< b"))
     ;; It would be best to change the \n in front, but it's more difficult.
-    ("^en\\(d\\)\\>" (1 "> b"))))
+    ("^end\\>"
+     (0 (progn
+          (unless (eq (match-beginning 0) (point-min))
+            (put-text-property (1- (match-beginning 0)) (match-beginning 0)
+                               'syntax-table (eval-when-compile
+                                               (string-to-syntax "> b")))
+            (put-text-property (1- (match-beginning 0)) (match-end 0)
+                               'font-lock-multiline t)
+            nil))))))
 
 (defun gdb-script-font-lock-syntactic-face (state)
   (cond
--- a/lisp/progmodes/python.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/progmodes/python.el	Sat Oct 14 16:56:21 2006 +0000
@@ -9,19 +9,19 @@
 
 ;; This file is part of GNU Emacs.
 
-;; This file is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation; either version 2, or (at your option)
 ;; any later version.
 
-;; This file is distributed in the hope that it will be useful,
+;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 ;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
@@ -32,41 +32,44 @@
 ;; maintained with Python.  That isn't covered by an FSF copyright
 ;; assignment, unlike this code, and seems not to be well-maintained
 ;; for Emacs (though I've submitted fixes).  This mode is rather
-;; simpler and is, perhaps, better in other ways.  In particular,
-;; using the syntax functions with text properties maintained by
-;; font-lock should make it more correct with arbitrary string and
-;; comment contents.
+;; simpler and is better in other ways.  In particular, using the
+;; syntax functions with text properties maintained by font-lock makes
+;; it more correct with arbitrary string and comment contents.
 
 ;; This doesn't implement all the facilities of python-mode.el.  Some
 ;; just need doing, e.g. catching exceptions in the inferior Python
 ;; buffer (but see M-x pdb for debugging).  [Actually, the use of
-;; `compilation-minor-mode' now is probably enough for that.]  Others
-;; don't seem appropriate.  For instance, `forward-into-nomenclature'
-;; should be done separately, since it's not specific to Python, and
-;; I've installed a minor mode to do the job properly in Emacs 22.
+;; `compilation-shell-minor-mode' now is probably enough for that.]
+;; Others don't seem appropriate.  For instance,
+;; `forward-into-nomenclature' should be done separately, since it's
+;; not specific to Python, and I've installed a minor mode to do the
+;; job properly in Emacs 23.  [CC mode 5.31 contains an incompatible
+;; feature, `c-subword-mode' which is intended to have a similar
+;; effect, but actually only affects word-oriented keybindings.]
+
 ;; Other things seem more natural or canonical here, e.g. the
 ;; {beginning,end}-of-defun implementation dealing with nested
-;; definitions, and the inferior mode following `cmuscheme'.  The
+;; definitions, and the inferior mode following `cmuscheme'.  (The
 ;; inferior mode can find the source of errors from
-;; `python-send-region' & al via `compilation-minor-mode'.  Successive
-;; TABs cycle between possible indentations for the line.  There is
-;; symbol completion using lookup in Python.
+;; `python-send-region' & al via `compilation-shell-minor-mode'.)
+;; There is (limited) symbol completion using lookup in Python and
+;; Eldoc support also using the inferior process.  Successive TABs
+;; cycle between possible indentations for the line.
 
-;; Even where it has similar facilities, this is incompatible with
-;; python-mode.el in various respects.  For instance, various key
-;; bindings are changed to obey Emacs conventions, and things like
-;; marking blocks and `beginning-of-defun' behave differently.
+;; Even where it has similar facilities, this mode is incompatible
+;; with python-mode.el in some respects.  For instance, various key
+;; bindings are changed to obey Emacs conventions.
 
 ;; TODO: See various Fixmes below.
 
 ;;; Code:
 
-;; It's messy to autoload the relevant comint functions so that comint
-;; is only required when inferior Python is used.
-(require 'comint)
 (eval-when-compile
+  (require 'cl)
   (require 'compile)
-  (autoload 'info-lookup-maybe-add-help "info-look"))
+  (require 'comint))
+
+(autoload 'comint-mode "comint")
 
 (defgroup python nil
   "Silly walks in the Python language."
@@ -84,31 +87,37 @@
 ;;;; Font lock
 
 (defvar python-font-lock-keywords
-  `(,(rx (and word-start
-	      ;; From v 2.3 reference.
-	      ;; def and class dealt with separately below
-	      (or "and" "assert" "break" "continue" "del" "elif" "else"
-		  "except" "exec" "finally" "for" "from" "global" "if"
-		  "import" "in" "is" "lambda" "not" "or" "pass" "print"
-		  "raise" "return" "try" "while" "yield"
-		  ;; Future keywords
-		  "as" "None")
-	      word-end))
-   (,(rx (and word-start (group "class") (1+ space) (group (1+ word))))
-    (1 font-lock-keyword-face) (2 font-lock-type-face))
-   (,(rx (and word-start (group "def") (1+ space) (group (1+ word))))
-    (1 font-lock-keyword-face) (2 font-lock-function-name-face))))
+  `(,(rx symbol-start
+	 ;; From v 2.4 reference.
+	 ;; def and class dealt with separately below
+	 (or "and" "assert" "break" "continue" "del" "elif" "else"
+	     "except" "exec" "finally" "for" "from" "global" "if"
+	     "import" "in" "is" "lambda" "not" "or" "pass" "print"
+	     "raise" "return" "try" "while" "yield"
+	     ;; Future keywords
+	     "as" "None")
+	 symbol-end)
+    ;; Definitions
+    (,(rx symbol-start (group "class") (1+ space) (group (1+ (or word ?_))))
+     (1 font-lock-keyword-face) (2 font-lock-type-face))
+    (,(rx symbol-start (group "def") (1+ space) (group (1+ (or word ?_))))
+     (1 font-lock-keyword-face) (2 font-lock-function-name-face))
+    ;; Top-level assignments are worth highlighting.
+    (,(rx line-start (group (1+ (or word ?_))) (0+ space) "=")
+     (1 font-lock-variable-name-face))
+    (,(rx "@" (1+ (or word ?_))) ; decorators
+    (0 font-lock-preprocessor-face))))
 
 (defconst python-font-lock-syntactic-keywords
   ;; Make outer chars of matching triple-quote sequences into generic
   ;; string delimiters.  Fixme: Is there a better way?
-  `((,(rx (and (or line-start buffer-start (not (syntax escape))) ; avoid escaped
-						       ; leading quote
-	       (group (optional (any "uUrR"))) ; prefix gets syntax property
-	       (optional (any "rR"))	; possible second prefix
-	       (group (syntax string-quote))	; maybe gets property
-	       (backref 2)			; per first quote
-	       (group (backref 2))))		; maybe gets property
+  `((,(rx (or line-start buffer-start
+	      (not (syntax escape)))	; avoid escaped leading quote
+	  (group (optional (any "uUrR"))) ; prefix gets syntax property
+	  (optional (any "rR"))		  ; possible second prefix
+	  (group (syntax string-quote))   ; maybe gets property
+	  (backref 2)			  ; per first quote
+	  (group (backref 2)))		  ; maybe gets property
      (1 (python-quote-syntax 1))
      (2 (python-quote-syntax 2))
      (3 (python-quote-syntax 3)))
@@ -132,6 +141,8 @@
   ;; x = ''' """ ' a
   ;; '''
   ;; x '"""' x """ \"""" x
+  ;; Fixme:  """""" goes wrong (due to syntax-ppss not getting the string
+  ;; fence context).
   (save-excursion
     (goto-char (match-beginning 0))
     (cond
@@ -140,19 +151,17 @@
       (let ((syntax (syntax-ppss)))
 	(when (eq t (nth 3 syntax))	; after unclosed fence
 	  (goto-char (nth 8 syntax))	; fence position
-	  ;; Skip any prefix.
-	  (if (memq (char-after) '(?u ?U ?R ?r))
-	      (skip-chars-forward "uUrR"))
+	  (skip-chars-forward "uUrR")	; skip any prefix
 	  ;; Is it a matching sequence?
 	  (if (eq (char-after) (char-after (match-beginning 2)))
 	      (eval-when-compile (string-to-syntax "|"))))))
      ;; Consider property for initial char, accounting for prefixes.
-     ((or (and (= n 2)			; not prefix
+     ((or (and (= n 2)			; leading quote (not prefix)
 	       (= (match-beginning 1) (match-end 1))) ; prefix is null
 	  (and (= n 1)			; prefix
 	       (/= (match-beginning 1) (match-end 1)))) ; non-empty
       (unless (eq 'string (syntax-ppss-context (syntax-ppss)))
-	(eval-when-compile (string-to-syntax "|"))))
+        (eval-when-compile (string-to-syntax "|"))))
      ;; Otherwise (we're in a non-matching string) the property is
      ;; nil, which is OK.
      )))
@@ -204,23 +213,37 @@
     (define-key map "\C-c\C-l" 'python-load-file) ; a la cmuscheme
     (substitute-key-definition 'complete-symbol 'python-complete-symbol
 			       map global-map)
-    ;; Fixme: Add :help to menu.
+    (define-key map "\C-c\C-i" 'python-find-imports)
+    (define-key map "\C-c\C-t" 'python-expand-template)
     (easy-menu-define python-menu map "Python Mode menu"
-      '("Python"
-	["Shift region left" python-shift-left :active mark-active]
-	["Shift region right" python-shift-right :active mark-active]
+      `("Python"
+	:help "Python-specific Features"
+	["Shift region left" python-shift-left :active mark-active
+	 :help "Shift by a single indentation step"]
+	["Shift region right" python-shift-right :active mark-active
+	 :help "Shift by a single indentation step"]
 	"-"
-	["Mark block" python-mark-block]
+	["Mark block" python-mark-block
+	 :help "Mark innermost block around point"]
 	["Mark def/class" mark-defun
 	 :help "Mark innermost definition around point"]
 	"-"
-	["Start of block" python-beginning-of-block]
-	["End of block" python-end-of-block]
+	["Start of block" python-beginning-of-block
+	 :help "Go to start of innermost definition around point"]
+	["End of block" python-end-of-block
+	 :help "Go to end of innermost definition around point"]
 	["Start of def/class" beginning-of-defun
 	 :help "Go to start of innermost definition around point"]
 	["End of def/class" end-of-defun
 	 :help "Go to end of innermost definition around point"]
 	"-"
+	("Templates..."
+	 :help "Expand templates for compound statements"
+	 :filter (lambda (&rest junk)
+		   (mapcar (lambda (elt)
+			     (vector (car elt) (cdr elt) t))
+			   python-skeletons))) ; defined later
+	"-"
 	["Start interpreter" run-python
 	 :help "Run `inferior' Python in separate buffer"]
 	["Import/reload file" python-load-file
@@ -233,12 +256,23 @@
 	 :help "Evaluate current definition in inferior Python session"]
 	["Switch to interpreter" python-switch-to-python
 	 :help "Switch to inferior Python buffer"]
+	["Set default process" python-set-proc
+	 :help "Make buffer's inferior process the default"
+	 :active (buffer-live-p python-buffer)]
 	["Check file" python-check :help "Run pychecker"]
 	["Debugger" pdb :help "Run pdb under GUD"]
 	"-"
 	["Help on symbol" python-describe-symbol
-	 :help "Use pydoc on symbol at point"]))
+	 :help "Use pydoc on symbol at point"]
+	["Complete symbol" python-complete-symbol
+	 :help "Complete (qualified) symbol before point"]
+	["Update imports" python-find-imports
+	 :help "Update list of top-level imports for completion"]))
     map))
+;; Fixme: add toolbar stuff for useful things like symbol help, send
+;; region, at least.  (Shouldn't be specific to Python, obviously.)
+;; eric has items including: (un)indent, (un)comment, restart script,
+;; run script, debug script; also things for profiling, unit testing.
 
 (defvar python-mode-syntax-table
   (let ((table (make-syntax-table)))
@@ -263,7 +297,8 @@
 
 (defsubst python-in-string/comment ()
   "Return non-nil if point is in a Python literal (a comment or string)."
-  (syntax-ppss-context (syntax-ppss)))
+  ;; We don't need to save the match data.
+  (nth 8 (syntax-ppss)))
 
 (defconst python-space-backslash-table
   (let ((table (copy-syntax-table python-mode-syntax-table)))
@@ -273,13 +308,21 @@
 
 (defun python-skip-comments/blanks (&optional backward)
   "Skip comments and blank lines.
-BACKWARD non-nil means go backwards, otherwise go forwards.  Backslash is
-treated as whitespace so that continued blank lines are skipped.
-Doesn't move out of comments -- should be outside or at end of line."
-  (with-syntax-table python-space-backslash-table
-    (forward-comment (if backward
-			 most-negative-fixnum
-		       most-positive-fixnum))))
+BACKWARD non-nil means go backwards, otherwise go forwards.
+Backslash is treated as whitespace so that continued blank lines
+are skipped.  Doesn't move out of comments -- should be outside
+or at end of line."
+  (let ((arg (if backward
+		 ;; If we're in a comment (including on the trailing
+		 ;; newline), forward-comment doesn't move backwards out
+		 ;; of it.  Don't set the syntax table round this bit!
+		 (let ((syntax (syntax-ppss)))
+		   (if (nth 4 syntax)
+		       (goto-char (nth 8 syntax)))
+		   (- (point-max)))
+	       (point-max))))
+    (with-syntax-table python-space-backslash-table
+      (forward-comment arg))))
 
 (defun python-backslash-continuation-line-p ()
   "Non-nil if preceding line ends with backslash that is not in a comment."
@@ -289,12 +332,17 @@
 (defun python-continuation-line-p ()
   "Return non-nil if current line continues a previous one.
 The criteria are that the previous line ends in a backslash outside
-comments and strings, or that the bracket/paren nesting depth is nonzero."
-  (or (and (eq ?\\ (char-before (line-end-position 0)))
-	   (not (syntax-ppss-context (syntax-ppss))))
-      (< 0 (syntax-ppss-depth
-            (save-excursion	  ; syntax-ppss with arg changes point
-              (syntax-ppss (line-beginning-position)))))))
+comments and strings, or that point is within brackets/parens."
+  (or (python-backslash-continuation-line-p)
+      (let ((depth (syntax-ppss-depth
+		    (save-excursion ; syntax-ppss with arg changes point
+		      (syntax-ppss (line-beginning-position))))))
+	(or (> depth 0)
+	    (if (< depth 0)	  ; Unbalanced brackets -- act locally
+		(save-excursion
+		  (condition-case ()
+		      (progn (backward-up-list) t) ; actually within brackets
+		    (error nil))))))))
 
 (defun python-comment-line-p ()
   "Return non-nil iff current line has only a comment."
@@ -304,6 +352,12 @@
       (back-to-indentation)
       (looking-at (rx (or (syntax comment-start) line-end))))))
 
+(defun python-blank-line-p ()
+  "Return non-nil iff current line is blank."
+  (save-excursion
+    (beginning-of-line)
+    (looking-at "\\s-*$")))
+
 (defun python-beginning-of-string ()
   "Go to beginning of string around point.
 Do nothing if not in string."
@@ -316,83 +370,70 @@
 BOS non-nil means point is known to be at beginning of statement."
   (save-excursion
     (unless bos (python-beginning-of-statement))
-    (and (not (python-comment-line-p))
-	 (re-search-forward (rx (and ?: (0+ space)
-				     (optional (and (syntax comment-start)
-						    (0+ not-newline)))
-				     line-end))
-			    (save-excursion (python-end-of-statement))
-			    t)
-	 (not (progn (goto-char (match-beginning 0))
-		     (python-in-string/comment))))))
+    (looking-at (rx (and (or "if" "else" "elif" "while" "for" "def"
+			     "class" "try" "except" "finally")
+			 symbol-end)))))
 
 (defun python-close-block-statement-p (&optional bos)
   "Return non-nil if current line is a statement closing a block.
 BOS non-nil means point is at beginning of statement.
-The criteria are that the line isn't a comment or in string and starts with
-keyword `raise', `break', `continue' or `pass'."
+The criteria are that the line isn't a comment or in string and
+ starts with keyword `raise', `break', `continue' or `pass'."
   (save-excursion
     (unless bos (python-beginning-of-statement))
     (back-to-indentation)
-    (looking-at (rx (and (or "return" "raise" "break" "continue" "pass")
-			 symbol-end)))))
+    (looking-at (rx (or "return" "raise" "break" "continue" "pass")
+		    symbol-end))))
 
 (defun python-outdent-p ()
   "Return non-nil if current line should outdent a level."
   (save-excursion
     (back-to-indentation)
-    (and (looking-at (rx (and (or (and (or "else" "finally") symbol-end)
-				  (and (or "except" "elif") symbol-end
-				       (1+ (not (any ?:)))))
-			      (optional space) ":" (optional space)
-			      (or (syntax comment-start) line-end))))
-	 (progn (end-of-line)
-		(not (python-in-string/comment)))
+    (and (looking-at (rx (and (or "else" "finally" "except" "elif")
+			      symbol-end)))
+	 (not (python-in-string/comment))
 	 ;; Ensure there's a previous statement and move to it.
 	 (zerop (python-previous-statement))
 	 (not (python-close-block-statement-p t))
 	 ;; Fixme: check this
-	 (not (looking-at (rx (and (or (and (or "if" "elif" "except"
-						"for" "while")
-					    symbol-end (1+ (not (any ?:))))
-				       (and "try" symbol-end))
-				   (optional space) ":" (optional space)
-				   (or (syntax comment-start) line-end)))))
-	 (progn (end-of-line)
-		(not (python-in-string/comment))))))
+	 (not (python-open-block-statement-p)))))
 
 ;;;; Indentation.
 
 (defcustom python-indent 4
-  "*Number of columns for a unit of indentation in Python mode.
+  "Number of columns for a unit of indentation in Python mode.
 See also `\\[python-guess-indent]'"
   :group 'python
   :type 'integer)
 
 (defcustom python-guess-indent t
-  "*Non-nil means Python mode guesses `python-indent' for the buffer."
+  "Non-nil means Python mode guesses `python-indent' for the buffer."
   :type 'boolean
   :group 'python)
 
 (defcustom python-indent-string-contents t
-  "*Non-nil means indent contents of multi-line strings together.
+  "Non-nil means indent contents of multi-line strings together.
 This means indent them the same as the preceding non-blank line.
-Otherwise indent them to column zero."
+Otherwise preserve their indentation.
+
+This only applies to `doc' strings, i.e. those that form statements;
+the indentation is preserved in others."
   :type '(choice (const :tag "Align with preceding" t)
-		 (const :tag "Indent to column 0" nil))
+		 (const :tag "Preserve indentation" nil))
   :group 'python)
 
 (defcustom python-honour-comment-indentation nil
   "Non-nil means indent relative to preceding comment line.
-Only do this for comments where the leading comment character is followed
-by space.  This doesn't apply to comment lines, which are always indented
-in lines with preceding comments."
+Only do this for comments where the leading comment character is
+followed by space.  This doesn't apply to comment lines, which
+are always indented in lines with preceding comments."
   :type 'boolean
   :group 'python)
 
 (defcustom python-continuation-offset 4
-  "*Number of columns of additional indentation for continuation lines.
-Continuation lines follow a backslash-terminated line starting a statement."
+  "Number of columns of additional indentation for continuation lines.
+Continuation lines follow a backslash-terminated line starting a
+statement."
   :group 'python
   :type 'integer)
 
@@ -406,9 +447,9 @@
       (goto-char (point-min))
       (let (done indent)
 	(while (and (not done) (not (eobp)))
-	  (when (and (re-search-forward (rx (and ?: (0+ space)
-						 (or (syntax comment-start)
-						     line-end)))
+	  (when (and (re-search-forward (rx ?: (0+ space)
+					    (or (syntax comment-start)
+						line-end))
 					nil 'move)
 		     (python-open-block-statement-p))
 	    (save-excursion
@@ -425,8 +466,21 @@
 	      (setq indent-tabs-mode nil)))
 	  indent)))))
 
+;; Alist of possible indentations and start of statement they would
+;; close.  Used in indentation cycling (below).
+(defvar python-indent-list nil
+  "Internal use.")
+;; Length of the above
+(defvar python-indent-list-length nil
+  "Internal use.")
+;; Current index into the alist.
+(defvar python-indent-index nil
+  "Internal use.")
+
 (defun python-calculate-indentation ()
   "Calculate Python indentation for line at point."
+  (setq python-indent-list nil
+	python-indent-list-length 1)
   (save-excursion
     (beginning-of-line)
     (let ((syntax (syntax-ppss))
@@ -434,17 +488,25 @@
       (cond
        ((eq 'string (syntax-ppss-context syntax)) ; multi-line string
 	(if (not python-indent-string-contents)
-	    0
-	  (save-excursion
+	    (current-indentation)
+	  ;; Only respect `python-indent-string-contents' in doc
+	  ;; strings (defined as those which form statements).
+	  (if (not (save-excursion
+		     (python-beginning-of-statement)
+		     (looking-at (rx (or (syntax string-delimiter)
+					 (syntax string-quote))))))
+	      (current-indentation)
 	    ;; Find indentation of preceding non-blank line within string.
 	    (setq start (nth 8 syntax))
 	    (forward-line -1)
 	    (while (and (< start (point)) (looking-at "\\s-*$"))
 	      (forward-line -1))
 	    (current-indentation))))
-       ((python-continuation-line-p)
+       ((python-continuation-line-p)   ; after backslash, or bracketed
 	(let ((point (point))
-	      (open-start (cadr syntax)))
+	      (open-start (cadr syntax))
+	      (backslash (python-backslash-continuation-line-p))
+	      (colon (eq ?: (char-before (1- (line-beginning-position))))))
 	  (if open-start
 	      ;; Inside bracketed expression.
 	      (progn
@@ -458,7 +520,11 @@
 				   (backward-sexp)
 				   (< (point) point))
 			  (error nil))))
-		    (current-column)
+		    ;; Extra level if we're backslash-continued or
+		    ;; following a key.
+		    (if (or backslash colon)
+			(+ python-indent (current-column))
+			(current-column))
 		  ;; Otherwise indent relative to statement start, one
 		  ;; level per bracketing level.
 		  (goto-char (1+ open-start))
@@ -472,112 +538,153 @@
 		(current-indentation)
 	      ;; First continuation line.  Indent one step, with an
 	      ;; extra one if statement opens a block.
-	      (save-excursion
-		(python-beginning-of-statement)
-		(+ (current-indentation) python-continuation-offset
-		   (if (python-open-block-statement-p t)
-		       python-indent
-		     0)))))))
+	      (python-beginning-of-statement)
+	      (+ (current-indentation) python-continuation-offset
+		 (if (python-open-block-statement-p t)
+		     python-indent
+		   0))))))
        ((bobp) 0)
        ;; Fixme: Like python-mode.el; not convinced by this.
-       ((looking-at (rx (and (0+ space) (syntax comment-start)
-			     (not (any " \t\n"))))) ; non-indentable comment
+       ((looking-at (rx (0+ space) (syntax comment-start)
+			(not (any " \t\n")))) ; non-indentable comment
 	(current-indentation))
-       (t (let ((point (point)))
-	    (if python-honour-comment-indentation
-		;; Back over whitespace, newlines, non-indentable comments.
-		(catch 'done
-		  (while t
-		    (if (cond ((bobp))
-			      ;; not at comment start
-			      ((not (forward-comment -1))
-			       (python-beginning-of-statement)
-			       t)
-			      ;; trailing comment
-			      ((/= (current-column) (current-indentation))
-			       (python-beginning-of-statement)
-			       t)
-			      ;; indentable comment like python-mode.el
-			      ((and (looking-at (rx (and (syntax comment-start)
-							 (or space line-end))))
-				    (/= 0 (current-column)))))
-			(throw 'done t))))
-	      ;; Else back over all comments.
-	      (python-skip-comments/blanks t)
-	      (python-beginning-of-statement))
-	    ;; don't lose on bogus outdent
-	    (max 0 (+ (current-indentation)
-		      (or (cond ((python-open-block-statement-p t)
-				 python-indent)
-				((python-close-block-statement-p t)
-				 (- python-indent)))
-			  (progn (goto-char point)
-				 (if (python-outdent-p)
-				     (- python-indent)))
-			  0)))))))))
-
-(defun python-comment-indent ()
-  "`comment-indent-function' for Python."
-  ;; If previous non-blank line was a comment, use its indentation.
-  ;; FIXME: This seems unnecessary since the default code delegates to
-  ;; indent-according-to-mode.  --Stef
-  (unless (bobp)
-    (save-excursion
-      (forward-comment -1)
-      (if (eq ?# (char-after)) (current-column)))))
+       (t (if python-honour-comment-indentation
+              ;; Back over whitespace, newlines, non-indentable comments.
+              (catch 'done
+                (while t
+                  (if (cond ((bobp))
+                            ;; not at comment start
+                            ((not (forward-comment -1))
+                             (python-beginning-of-statement)
+                             t)
+                            ;; trailing comment
+                            ((/= (current-column) (current-indentation))
+                             (python-beginning-of-statement)
+                             t)
+                            ;; indentable comment like python-mode.el
+                            ((and (looking-at (rx (syntax comment-start)
+                                                  (or space line-end)))
+                                  (/= 0 (current-column)))))
+                      (throw 'done t)))))
+          (python-indentation-levels)
+          ;; Prefer to indent comments with an immediately-following
+          ;; statement, e.g.
+          ;;       ...
+          ;;   # ...
+          ;;   def ...
+          (when (and (> python-indent-list-length 1)
+                     (python-comment-line-p))
+            (forward-line)
+            (unless (python-comment-line-p)
+              (let ((elt (assq (current-indentation) python-indent-list)))
+                (setq python-indent-list
+                      (nconc (delete elt python-indent-list)
+                             (list elt))))))
+          (caar (last python-indent-list)))))))
 
 ;;;; Cycling through the possible indentations with successive TABs.
 
 ;; These don't need to be buffer-local since they're only relevant
 ;; during a cycle.
 
-;; Alist of possible indentations and start of statement they would close.
-(defvar python-indent-list nil
-  "Internal use.")
-;; Length of the above
-(defvar python-indent-list-length nil
-  "Internal use.")
-;; Current index into the alist.
-(defvar python-indent-index nil
-  "Internal use.")
-
 (defun python-initial-text ()
   "Text of line following indentation and ignoring any trailing comment."
-  (buffer-substring (+ (line-beginning-position) (current-indentation))
-		    (save-excursion
-		      (end-of-line)
-		      (forward-comment -1)
-		      (point))))
+  (save-excursion
+    (buffer-substring (progn
+			(back-to-indentation)
+			(point))
+		      (progn
+			(end-of-line)
+			(forward-comment -1)
+			(point)))))
+
+(defconst python-block-pairs
+  '(("else" "if" "elif" "while" "for" "try" "except")
+    ("elif" "if" "elif")
+    ("except" "try" "except")
+    ("finally" "try"))
+  "Alist of keyword matches.
+The car of an element is a keyword introducing a statement which
+can close a block opened by a keyword in the cdr.")
+
+(defun python-first-word ()
+  "Return first word (actually symbol) on the line."
+  (save-excursion
+    (back-to-indentation)
+    (current-word t)))
 
 (defun python-indentation-levels ()
   "Return a list of possible indentations for this line.
+It is assumed not to be a continuation line or in a multi-line string.
 Includes the default indentation and those which would close all
-enclosing blocks.  Assumes the line has already been indented per
-`python-indent-line'.  Elements of the list are actually pairs:
+enclosing blocks.  Elements of the list are actually pairs:
 \(INDENTATION . TEXT), where TEXT is the initial text of the
 corresponding block opening (or nil)."
   (save-excursion
-    (let ((levels (list (cons (current-indentation)
-			      (save-excursion
-				(if (python-beginning-of-block)
-				    (python-initial-text)))))))
-      ;; Only one possibility if we immediately follow a block open or
-      ;; are in a continuation line.
-      (unless (or (python-continuation-line-p)
-		  (save-excursion (and (python-previous-statement)
-				       (python-open-block-statement-p t))))
-	(while (python-beginning-of-block)
-	  (push (cons (current-indentation) (python-initial-text))
-		levels)))
-      levels)))
+    (let ((initial "")
+	  levels indent)
+      ;; Only one possibility immediately following a block open
+      ;; statement, assuming it doesn't have a `suite' on the same line.
+      (cond
+       ((save-excursion (and (python-previous-statement)
+			     (python-open-block-statement-p t)
+			     (setq indent (current-indentation))
+			     ;; Check we don't have something like:
+			     ;;   if ...: ...
+			     (if (progn (python-end-of-statement)
+					(python-skip-comments/blanks t)
+					(eq ?: (char-before)))
+				 (setq indent (+ python-indent indent)))))
+	(push (cons indent initial) levels))
+       ;; Only one possibility for comment line immediately following
+       ;; another.
+       ((save-excursion
+	  (when (python-comment-line-p)
+	    (forward-line -1)
+	    (if (python-comment-line-p)
+		(push (cons (current-indentation) initial) levels)))))
+       ;; Fixme: Maybe have a case here which indents (only) first
+       ;; line after a lambda.
+       (t
+	(let ((start (car (assoc (python-first-word) python-block-pairs))))
+	  (python-previous-statement)
+	  ;; Is this a valid indentation for the line of interest?
+	  (unless (or (if start		; potentially only outdentable
+			  ;; Check for things like:
+			  ;;   if ...: ...
+			  ;;   else ...:
+			  ;; where the second line need not be outdented.
+			  (not (member (python-first-word)
+				       (cdr (assoc start
+						   python-block-pairs)))))
+		      ;; Not sensible to indent to the same level as
+		      ;; previous `return' &c.
+		      (python-close-block-statement-p))
+	    (push (cons (current-indentation) (python-initial-text))
+		  levels))
+	  (while (python-beginning-of-block)
+	    (when (or (not start)
+		      (member (python-first-word)
+			      (cdr (assoc start python-block-pairs))))
+	      (push (cons (current-indentation) (python-initial-text))
+		    levels))))))
+      (prog1 (or levels (setq levels '((0 . ""))))
+	(setq python-indent-list levels
+	      python-indent-list-length (length python-indent-list))))))
 
 ;; This is basically what `python-indent-line' would be if we didn't
 ;; do the cycling.
-(defun python-indent-line-1 ()
-  "Subroutine of `python-indent-line'."
+(defun python-indent-line-1 (&optional leave)
+  "Subroutine of `python-indent-line'.
+Does non-repeated indentation.  LEAVE non-nil means leave
+indentation if it is valid, i.e. one of the positions returned by
+`python-calculate-indentation'."
   (let ((target (python-calculate-indentation))
 	(pos (- (point-max) (point))))
-    (if (= target (current-indentation))
+    (if (or (= target (current-indentation))
+	    ;; Maybe keep a valid indentation.
+	    (and leave python-indent-list
+		 (assq (current-indentation) python-indent-list)))
 	(if (< (current-column) (current-indentation))
 	    (back-to-indentation))
       (beginning-of-line)
@@ -589,29 +696,41 @@
 (defun python-indent-line ()
   "Indent current line as Python code.
 When invoked via `indent-for-tab-command', cycle through possible
-indentations for current line.  The cycle is broken by a command different
-from `indent-for-tab-command', i.e. successive TABs do the cycling."
+indentations for current line.  The cycle is broken by a command
+different from `indent-for-tab-command', i.e. successive TABs do
+the cycling."
   (interactive)
-  ;; Don't do extra work if invoked via `indent-region', for instance.
-  (if (not (eq this-command 'indent-for-tab-command))
-      (python-indent-line-1)
-    (if (eq last-command this-command)
-	(if (= 1 python-indent-list-length)
-	    (message "Sole indentation")
-	  (progn (setq python-indent-index (% (1+ python-indent-index)
-					      python-indent-list-length))
-		 (beginning-of-line)
-		 (delete-horizontal-space)
-		 (indent-to (car (nth python-indent-index python-indent-list)))
-		 (if (python-block-end-p)
-		     (let ((text (cdr (nth python-indent-index
-					   python-indent-list))))
-		       (if text
-			   (message "Closes: %s" text))))))
-      (python-indent-line-1)
-      (setq python-indent-list (python-indentation-levels)
-	    python-indent-list-length (length python-indent-list)
-	    python-indent-index (1- python-indent-list-length)))))
+  (if (and (eq this-command 'indent-for-tab-command)
+	   (eq last-command this-command))
+      (if (= 1 python-indent-list-length)
+	  (message "Sole indentation")
+	(progn (setq python-indent-index
+		     (% (1+ python-indent-index) python-indent-list-length))
+	       (beginning-of-line)
+	       (delete-horizontal-space)
+	       (indent-to (car (nth python-indent-index python-indent-list)))
+	       (if (python-block-end-p)
+		   (let ((text (cdr (nth python-indent-index
+					 python-indent-list))))
+		     (if text
+			 (message "Closes: %s" text))))))
+    (python-indent-line-1)
+    (setq python-indent-index (1- python-indent-list-length))))
+
+(defun python-indent-region (start end)
+  "`indent-region-function' for Python.
+Leaves validly-indented lines alone, i.e. doesn't indent to
+another valid position."
+  (save-excursion
+    (goto-char end)
+    (setq end (point-marker))
+    (goto-char start)
+    (or (bolp) (forward-line 1))
+    (while (< (point) end)
+      (or (and (bolp) (eolp))
+	  (python-indent-line-1 t))
+      (forward-line 1))
+    (move-marker end nil)))
 
 (defun python-block-end-p ()
   "Non-nil if this is a line in a statement closing a block,
@@ -622,40 +741,41 @@
 	      (save-excursion
 		(python-previous-statement)
 		(current-indentation))))))
-
-;; Fixme: Define an indent-region-function.  It should probably leave
-;; lines alone if the indentation is already at one of the allowed
-;; levels.  Otherwise, M-C-\ typically keeps indenting more deeply
-;; down a function.
 
 ;;;; Movement.
 
+;; Fixme:  Define {for,back}ward-sexp-function?  Maybe skip units like
+;; block, statement, depending on context.
+
 (defun python-beginning-of-defun ()
   "`beginning-of-defun-function' for Python.
 Finds beginning of innermost nested class or method definition.
-Returns the name of the definition found at the end, or nil if reached
-start of buffer."
+Returns the name of the definition found at the end, or nil if
+reached start of buffer."
   (let ((ci (current-indentation))
-	(def-re (rx (and line-start (0+ space) (or "def" "class")
-			 (1+ space)
-			 (group (1+ (or word (syntax symbol)))))))
-	found lep def-line)
+	(def-re (rx line-start (0+ space) (or "def" "class") (1+ space)
+		    (group (1+ (or word (syntax symbol))))))
+	found lep) ;; def-line
     (if (python-comment-line-p)
 	(setq ci most-positive-fixnum))
     (while (and (not (bobp)) (not found))
       ;; Treat bol at beginning of function as outside function so
       ;; that successive C-M-a makes progress backwards.
-      (setq def-line (looking-at def-re))
+      ;;(setq def-line (looking-at def-re))
       (unless (bolp) (end-of-line))
       (setq lep (line-end-position))
       (if (and (re-search-backward def-re nil 'move)
 	       ;; Must be less indented or matching top level, or
 	       ;; equally indented if we started on a definition line.
 	       (let ((in (current-indentation)))
-	       (or (and (zerop ci) (zerop in))
-		   (= lep (line-end-position)) ; on initial line
-		   (and def-line (= in ci))
-		   (< in ci)))
+		 (or (and (zerop ci) (zerop in))
+		     (= lep (line-end-position)) ; on initial line
+		     ;; Not sure why it was like this -- fails in case of
+		     ;; last internal function followed by first
+		     ;; non-def statement of the main body.
+                     ;;(and def-line (= in ci))
+		     (= in ci)
+		     (< in ci)))
 	       (not (python-in-string/comment)))
 	  (setq found t)))))
 
@@ -663,7 +783,7 @@
   "`end-of-defun-function' for Python.
 Finds end of innermost nested class or method definition."
   (let ((orig (point))
-	(pattern (rx (and line-start (0+ space) (or "def" "class") space))))
+	(pattern (rx line-start (0+ space) (or "def" "class") space)))
     ;; Go to start of current block and check whether it's at top
     ;; level.  If it is, and not a block start, look forward for
     ;; definition statement.
@@ -692,8 +812,9 @@
       (python-end-of-block)
       ;; Count trailing space in defun (but not trailing comments).
       (skip-syntax-forward " >")
-      (beginning-of-line))
-    ;; Catch pathological case like this, where the beginning-of-defun
+      (unless (eobp)			; e.g. missing final newline
+	(beginning-of-line)))
+    ;; Catch pathological cases like this, where the beginning-of-defun
     ;; skips to a definition we're not in:
     ;; if ...:
     ;;     ...
@@ -706,26 +827,43 @@
 
 (defun python-beginning-of-statement ()
   "Go to start of current statement.
-Accounts for continuation lines, multi-line strings, and multi-line bracketed
-expressions."
+Accounts for continuation lines, multi-line strings, and
+multi-line bracketed expressions."
   (beginning-of-line)
   (python-beginning-of-string)
-  (catch 'foo
-    (while (python-continuation-line-p)
-      (beginning-of-line)
-      (if (python-backslash-continuation-line-p)
+  (while (python-continuation-line-p)
+    (beginning-of-line)
+    (if (python-backslash-continuation-line-p)
+	(progn
+	  (forward-line -1)
 	  (while (python-backslash-continuation-line-p)
-	    (forward-line -1))
-	(python-beginning-of-string)
-	;; Skip forward out of nested brackets.
-	(condition-case ()		; beware invalid syntax
-	    (let ((depth (syntax-ppss-depth (syntax-ppss))))
-              ;; Beware negative depths.
-              (if (> depth 0) (backward-up-list depth))
-              t)
-	  (error (throw 'foo nil))))))
+	    (forward-line -1)))
+      (python-beginning-of-string)
+      (python-skip-out)))
   (back-to-indentation))
 
+(defun python-skip-out (&optional forward syntax)
+  "Skip out of any nested brackets.
+Skip forward if FORWARD is non-nil, else backward.
+If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point.
+Return non-nil iff skipping was done."
+  (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss))))
+	(forward (if forward -1 1)))
+    (unless (zerop depth)
+      (if (> depth 0)
+	  ;; Skip forward out of nested brackets.
+	  (condition-case ()		; beware invalid syntax
+	      (progn (backward-up-list (* forward depth)) t)
+	    (error nil))
+	;; Invalid syntax (too many closed brackets).
+	;; Skip out of as many as possible.
+	(let (done)
+	  (while (condition-case ()
+		     (progn (backward-up-list forward)
+			    (setq done t))
+		   (error nil)))
+	  done)))))
+
 (defun python-end-of-statement ()
   "Go to the end of the current statement and return point.
 Usually this is the start of the next line, but if this is a
@@ -745,13 +883,7 @@
 			   (condition-case () ; beware invalid syntax
 			       (progn (forward-sexp) t)
 			     (error (end-of-line))))
-			  ((> (syntax-ppss-depth s) 0)
-			   ;; Skip forward out of nested brackets.
-			   (condition-case () ; beware invalid syntax
-			       (progn (backward-up-list
-				       (- (syntax-ppss-depth s)))
-				      t)
-			     (error (end-of-line))))))
+			  ((python-skip-out t s))))
 	     (end-of-line))
 	   (unless comment
 	     (eq ?\\ (char-before))))	; Line continued?
@@ -785,7 +917,8 @@
     (while (and (> count 0) (not (eobp)))
       (python-end-of-statement)
       (python-skip-comments/blanks)
-      (setq count (1- count)))
+      (unless (eobp)
+	(setq count (1- count))))
     count))
 
 (defun python-beginning-of-block (&optional arg)
@@ -802,7 +935,8 @@
    ((< arg 0) (python-end-of-block (- arg)))
    (t
     (let ((point (point)))
-      (if (python-comment-line-p)
+      (if (or (python-comment-line-p)
+	      (python-blank-line-p))
 	  (python-skip-comments/blanks t))
       (python-beginning-of-statement)
       (let ((ci (current-indentation)))
@@ -830,32 +964,31 @@
 
 (defun python-end-of-block (&optional arg)
   "Go to end of current block.
-With numeric arg, do it that many times.  If ARG is negative, call
-`python-beginning-of-block' instead.
-If current statement is in column zero and doesn't open a block, don't
-move and return nil.  Otherwise return t."
+With numeric arg, do it that many times.  If ARG is negative,
+call `python-beginning-of-block' instead.
+If current statement is in column zero and doesn't open a block,
+don't move and return nil.  Otherwise return t."
   (interactive "p")
   (unless arg (setq arg 1))
   (if (< arg 0)
-      (python-beginning-of-block (- arg)))
-  (while (and (> arg 0)
-	      (let* ((point (point))
-		     (_ (if (python-comment-line-p)
-			    (python-skip-comments/blanks t)))
-		     (ci (current-indentation))
-		     (open (python-open-block-statement-p)))
-		(if (and (zerop ci) (not open))
-		    (not (goto-char point))
-		  (catch 'done
-		    (while (zerop (python-next-statement))
-		      (when (or (and open (<= (current-indentation) ci))
-				(< (current-indentation) ci))
-			(python-skip-comments/blanks t)
-			(beginning-of-line 2)
-			(throw 'done t)))
-		    (not (goto-char point))))))
-    (setq arg (1- arg)))
-  (zerop arg))
+      (python-beginning-of-block (- arg))
+    (while (and (> arg 0)
+		(let* ((point (point))
+		       (_ (if (python-comment-line-p)
+			      (python-skip-comments/blanks t)))
+		       (ci (current-indentation))
+		       (open (python-open-block-statement-p)))
+		  (if (and (zerop ci) (not open))
+		      (not (goto-char point))
+		    (catch 'done
+		      (while (zerop (python-next-statement))
+			(when (or (and open (<= (current-indentation) ci))
+				  (< (current-indentation) ci))
+			  (python-skip-comments/blanks t)
+			  (beginning-of-line 2)
+			  (throw 'done t)))))))
+      (setq arg (1- arg)))
+    (zerop arg)))
 
 ;;;; Imenu.
 
@@ -868,14 +1001,23 @@
 definition; it has a space prepended to the name so that it sorts
 first with `imenu--sort-by-name' (though, unfortunately, sub-menus
 precede it)."
-  (unless (boundp 'python-recursing)		; dynamically bound below
-    (goto-char (point-min)))		; normal call from Imenu
-  (let (index-alist			; accumulated value to return
-	name)
+  (unless (boundp 'python-recursing)	; dynamically bound below
+    ;; Normal call from Imenu.
+    (goto-char (point-min))
+    ;; Without this, we can get an infloop if the buffer isn't all
+    ;; fontified.  I guess this is really a bug in syntax.el.  OTOH,
+    ;; _with_ this, imenu doesn't immediately work; I can't figure out
+    ;; what's going on, but it must be something to do with timers in
+    ;; font-lock.
+    ;; This can't be right, especially not when jit-lock is not used.  --Stef
+    ;; (unless (get-text-property (1- (point-max)) 'fontified)
+    ;;   (font-lock-fontify-region (point-min) (point-max)))
+    )
+  (let (index-alist)			; accumulated value to return
     (while (re-search-forward
-	    (rx (and line-start (0+ space) ; leading space
-		     (or (group "def") (group "class"))	    ; type
-		     (1+ space) (group (1+ (or word ?_))))) ; name
+	    (rx line-start (0+ space)	; leading space
+		(or (group "def") (group "class"))	   ; type
+		(1+ space) (group (1+ (or word ?_))))	   ; name
 	    nil t)
       (unless (python-in-string/comment)
 	(let ((pos (match-beginning 0))
@@ -890,7 +1032,22 @@
 		  (progn (push (cons (concat " " name) pos) sublist)
 			 (push (cons name sublist) index-alist))
 		(push (cons name pos) index-alist)))))))
-    (nreverse index-alist)))
+    (unless (boundp 'python-recursing)
+      ;; Look for module variables.
+      (let (vars)
+	(goto-char (point-min))
+	(while (re-search-forward
+		(rx line-start (group (1+ (or word ?_))) (0+ space) "=")
+		nil t)
+	  (unless (python-in-string/comment)
+	    (push (cons (match-string 1) (match-beginning 1))
+		  vars)))
+	(setq index-alist (nreverse index-alist))
+	(if vars
+	    (push (cons "Module variables"
+			(nreverse vars))
+		  index-alist))))
+    index-alist))
 
 ;;;; `Electric' commands.
 
@@ -910,20 +1067,26 @@
 
 (defun python-backspace (arg)
   "Maybe delete a level of indentation on the current line.
-If not at the end of line's indentation, or on a comment line, just call
-`backward-delete-char-untabify'.  With ARG, repeat that many times."
+Do so if point is at the end of the line's indentation.
+Otherwise just call `backward-delete-char-untabify'.
+Repeat ARG times."
   (interactive "*p")
   (if (or (/= (current-indentation) (current-column))
 	  (bolp)
 	  (python-continuation-line-p))
       (backward-delete-char-untabify arg)
-    (let ((indent 0))
-      (save-excursion
-	(while (and (> arg 0) (python-beginning-of-block))
-	  (setq arg (1- arg)))
-	(when (zerop arg)
-	  (setq indent (current-indentation))
-	  (message "Closes %s" (python-initial-text))))
+    ;; Look for the largest valid indentation which is smaller than
+    ;; the current indentation.
+    (let ((indent 0)
+	  (ci (current-indentation))
+	  (indents (python-indentation-levels))
+	  initial)
+      (dolist (x indents)
+	(if (< (car x) ci)
+	    (setq indent (max indent (car x)))))
+      (setq initial (cdr (assq indent indents)))
+      (if (> (length initial) 0)
+	  (message "Closes %s" initial))
       (delete-horizontal-space)
       (indent-to indent))))
 (put 'python-backspace 'delete-selection 'supersede)
@@ -931,7 +1094,7 @@
 ;;;; pychecker
 
 (defcustom python-check-command "pychecker --stdlib"
-  "*Command used to check a Python file."
+  "Command used to check a Python file."
   :type 'string
   :group 'python)
 
@@ -963,66 +1126,54 @@
 ;; Fixme: Make sure we can work with IPython.
 
 (defcustom python-python-command "python"
-  "*Shell command to run Python interpreter.
+  "Shell command to run Python interpreter.
 Any arguments can't contain whitespace.
-Note that IPython may not work properly; it must at least be used with the
-`-cl' flag, i.e. use `ipython -cl'."
+Note that IPython may not work properly; it must at least be used
+with the `-cl' flag, i.e. use `ipython -cl'."
   :group 'python
   :type 'string)
 
 (defcustom python-jython-command "jython"
-  "*Shell command to run Jython interpreter.
+  "Shell command to run Jython interpreter.
 Any arguments can't contain whitespace."
   :group 'python
   :type 'string)
 
 (defvar python-command python-python-command
   "Actual command used to run Python.
-May be `python-python-command' or `python-jython-command'.
-Additional arguments are added when the command is used by `run-python'
-et al.")
+May be `python-python-command' or `python-jython-command', possibly
+modified by the user.  Additional arguments are added when the command
+is used by `run-python' et al.")
 
 (defvar python-buffer nil
-  "The current python process buffer."
-  ;; Fixme: a single process is currently assumed, so that this doc
-  ;; is misleading.
+  "*The current python process buffer.
 
-;;   "*The current python process buffer.
-;; To run multiple Python processes, start the first with \\[run-python].
-;; It will be in a buffer named *Python*.  Rename that with
-;; \\[rename-buffer].  Now start a new process with \\[run-python].  It
-;; will be in a new buffer, named *Python*.  Switch between the different
-;; process buffers with \\[switch-to-buffer].
+Commands that send text from source buffers to Python processes have
+to choose a process to send to.  This is determined by buffer-local
+value of `python-buffer'.  If its value in the current buffer,
+i.e. both any local value and the default one, is nil, `run-python'
+and commands that send to the Python process will start a new process.
 
-;; Commands that send text from source buffers to Python processes have
-;; to choose a process to send to.  This is determined by global variable
-;; `python-buffer'.  Suppose you have three inferior Pythons running:
-;;     Buffer	Process
-;;     foo		python
-;;     bar		python<2>
-;;     *Python*    python<3>
-;; If you do a \\[python-send-region-and-go] command on some Python source
-;; code, what process does it go to?
+Whenever \\[run-python] starts a new process, it resets the default
+value of `python-buffer' to be the new process's buffer and sets the
+buffer-local value similarly if the current buffer is in Python mode
+or Inferior Python mode, so that source buffer stays associated with a
+specific sub-process.
 
-;; - In a process buffer (foo, bar, or *Python*), send it to that process.
-;; - In some other buffer (e.g. a source file), send it to the process
-;;   attached to `python-buffer'.
-;; Process selection is done by function `python-proc'.
-
-;; Whenever \\[run-python] starts a new process, it resets `python-buffer'
-;; to be the new process's buffer.  If you only run one process, this will
-;; do the right thing.  If you run multiple processes, you can change
-;; `python-buffer' to another process buffer with \\[set-variable]."
-  )
+Use \\[python-set-proc] to set the default value from a buffer with a
+local value.")
+(make-variable-buffer-local 'python-buffer)
 
 (defconst python-compilation-regexp-alist
   ;; FIXME: maybe these should move to compilation-error-regexp-alist-alist.
-  `((,(rx (and line-start (1+ (any " \t")) "File \""
-	       (group (1+ (not (any "\"<")))) ; avoid `<stdin>' &c
-	       "\", line " (group (1+ digit))))
+  ;;   The first already is (for CAML), but the second isn't.  Anyhow,
+  ;;   these are specific to the inferior buffer.  -- fx
+  `((,(rx line-start (1+ (any " \t")) "File \""
+	  (group (1+ (not (any "\"<")))) ; avoid `<stdin>' &c
+	  "\", line " (group (1+ digit)))
      1 2)
-    (,(rx (and " in file " (group (1+ not-newline)) " on line "
-	       (group (1+ digit))))
+    (,(rx " in file " (group (1+ not-newline)) " on line "
+	  (group (1+ digit)))
      1 2))
   "`compilation-error-regexp-alist' for inferior Python.")
 
@@ -1040,9 +1191,9 @@
     ;; (define-key map "\C-c\C-f" 'python-describe-symbol)
     map))
 
-;; Fixme: This should inherit some stuff from python-mode, but I'm not
-;; sure how much: at least some keybindings, like C-c C-f; syntax?;
-;; font-locking, e.g. for triple-quoted strings?
+;; Fixme: This should inherit some stuff from `python-mode', but I'm
+;; not sure how much: at least some keybindings, like C-c C-f;
+;; syntax?; font-locking, e.g. for triple-quoted strings?
 (define-derived-mode inferior-python-mode comint-mode "Inferior Python"
   "Major mode for interacting with an inferior Python process.
 A Python process can be started with \\[run-python].
@@ -1050,14 +1201,15 @@
 Hooks `comint-mode-hook' and `inferior-python-mode-hook' are run in
 that order.
 
-You can send text to the inferior Python process from other buffers containing
-Python source.
- * `python-switch-to-python' switches the current buffer to the Python
+You can send text to the inferior Python process from other buffers
+containing Python source.
+ * \\[python-switch-to-python] switches the current buffer to the Python
     process buffer.
- * `python-send-region' sends the current region to the Python process.
- * `python-send-region-and-go' switches to the Python process buffer
+ * \\[python-send-region] sends the current region to the Python process.
+ * \\[python-send-region-and-go] switches to the Python process buffer
     after sending the text.
-For running multiple processes in multiple buffers, see `python-buffer'.
+For running multiple processes in multiple buffers, see `run-python' and
+`python-buffer'.
 
 \\{inferior-python-mode-map}"
   :group 'python
@@ -1069,13 +1221,13 @@
   ;; Still required by `comint-redirect-send-command', for instance
   ;; (and we need to match things like `>>> ... >>> '):
   (set (make-local-variable 'comint-prompt-regexp)
-       (rx (and line-start (1+ (and (repeat 3 (any ">.")) ?\s)))))
+       (rx line-start (1+ (and (repeat 3 (any ">.")) " "))))
   (set (make-local-variable 'compilation-error-regexp-alist)
        python-compilation-regexp-alist)
   (compilation-shell-minor-mode 1))
 
 (defcustom inferior-python-filter-regexp "\\`\\s-*\\S-?\\S-?\\s-*\\'"
-  "*Input matching this regexp is not saved on the history list.
+  "Input matching this regexp is not saved on the history list.
 Default ignores all inputs of 0, 1, or 2 non-blank characters."
   :type 'regexp
   :group 'python)
@@ -1098,98 +1250,134 @@
 (defvar python-preoutput-result nil
   "Data from last `_emacs_out' line seen by the preoutput filter.")
 
-(defvar python-preoutput-continuation nil
-  "If non-nil, funcall this when `python-preoutput-filter' sees `_emacs_ok'.")
-
 (defvar python-preoutput-leftover nil)
+(defvar python-preoutput-skip-next-prompt nil)
 
 ;; Using this stops us getting lines in the buffer like
 ;; >>> ... ... >>>
-;; Also look for (and delete) an `_emacs_ok' string and call
-;; `python-preoutput-continuation' if we get it.
 (defun python-preoutput-filter (s)
   "`comint-preoutput-filter-functions' function: ignore prompts not at bol."
   (when python-preoutput-leftover
     (setq s (concat python-preoutput-leftover s))
     (setq python-preoutput-leftover nil))
-  (cond ((and (string-match (rx (and string-start (repeat 3 (any ".>"))
-                                     " " string-end))
-                            s)
-              (/= (let ((inhibit-field-text-motion t))
-                    (line-beginning-position))
-                  (point)))
-         "")
-        ((string= s "_emacs_ok\n")
-         (when python-preoutput-continuation
-           (funcall python-preoutput-continuation)
-           (setq python-preoutput-continuation nil))
-         "")
-        ((string-match "_emacs_out \\(.*\\)\n" s)
-         (setq python-preoutput-result (match-string 1 s))
-         "")
-	((string-match ".*\n" s)
-	 s)
-	((or (eq t (compare-strings s nil nil "_emacs_ok\n" nil (length s)))
-	     (let ((end (min (length "_emacs_out ") (length s))))
-	       (eq t (compare-strings s nil end "_emacs_out " nil end))))
-	 (setq python-preoutput-leftover s)
-	 "")
-        (t s)))
+  (let ((start 0)
+        (res ""))
+    ;; First process whole lines.
+    (while (string-match "\n" s start)
+      (let ((line (substring s start (setq start (match-end 0)))))
+        ;; Skip prompt if needed.
+        (when (and python-preoutput-skip-next-prompt
+                   (string-match comint-prompt-regexp line))
+          (setq python-preoutput-skip-next-prompt nil)
+          (setq line (substring line (match-end 0))))
+        ;; Recognize special _emacs_out lines.
+        (if (and (string-match "\\`_emacs_out \\(.*\\)\n\\'" line)
+                 (local-variable-p 'python-preoutput-result))
+            (progn
+              (setq python-preoutput-result (match-string 1 line))
+              (set (make-local-variable 'python-preoutput-skip-next-prompt) t))
+          (setq res (concat res line)))))
+    ;; Then process the remaining partial line.
+    (unless (zerop start) (setq s (substring s start)))
+    (cond ((and (string-match comint-prompt-regexp s)
+                ;; Drop this prompt if it follows an _emacs_out...
+                (or python-preoutput-skip-next-prompt
+                    ;; ... or if it's not gonna be inserted at BOL.
+                    ;; Maybe we could be more selective here.
+                    (if (zerop (length res))
+                        (not (bolp))
+                      (string-match res ".\\'"))))
+           ;; The need for this seems to be system-dependent:
+           ;; What is this all about, exactly?  --Stef
+           ;; (if (and (eq ?. (aref s 0)))
+           ;;     (accept-process-output (get-buffer-process (current-buffer)) 1))
+           (setq python-preoutput-skip-next-prompt nil)
+           res)
+          ((let ((end (min (length "_emacs_out ") (length s))))
+             (eq t (compare-strings s nil end "_emacs_out " nil end)))
+           ;; The leftover string is a prefix of _emacs_out so we don't know
+           ;; yet whether it's an _emacs_out or something else: wait until we
+           ;; get more output so we can resolve this ambiguity.
+           (set (make-local-variable 'python-preoutput-leftover) s)
+           res)
+          (t (concat res s)))))
+
+(autoload 'comint-check-proc "comint")
 
 ;;;###autoload
-(defun run-python (&optional cmd noshow)
+(defun run-python (&optional cmd noshow new)
   "Run an inferior Python process, input and output via buffer *Python*.
 CMD is the Python command to run.  NOSHOW non-nil means don't show the
 buffer automatically.
-If there is a process already running in `*Python*', switch to
-that buffer.  Interactively, a prefix arg allows you to edit the initial
-command line (default is `python-command'); `-i' etc.  args will be added
-to this as appropriate.  Runs the hook `inferior-python-mode-hook'
-\(after the `comint-mode-hook' is run).
-\(Type \\[describe-mode] in the process buffer for a list of commands.)"
-  (interactive (list (if current-prefix-arg
-			 (read-string "Run Python: " python-command)
-		       python-command)))
+
+Normally, if there is a process already running in `python-buffer',
+switch to that buffer.  Interactively, a prefix arg allows you to edit
+the initial command line (default is `python-command'); `-i' etc. args
+will be added to this as appropriate.  A new process is started if:
+one isn't running attached to `python-buffer', or interactively the
+default `python-command', or argument NEW is non-nil.  See also the
+documentation for `python-buffer'.
+
+Runs the hook `inferior-python-mode-hook' \(after the
+`comint-mode-hook' is run).  \(Type \\[describe-mode] in the process
+buffer for a list of commands.)"
+  (interactive (if current-prefix-arg
+		   (list (read-string "Run Python: " python-command) nil t)
+		 (list python-command)))
   (unless cmd (setq cmd python-python-command))
   (setq python-command cmd)
   ;; Fixme: Consider making `python-buffer' buffer-local as a buffer
   ;; (not a name) in Python buffers from which `run-python' &c is
   ;; invoked.  Would support multiple processes better.
-  (unless (comint-check-proc python-buffer)
-    (let* ((cmdlist (append (python-args-to-list cmd) '("-i")))
-	   (path (getenv "PYTHONPATH"))
-	   (process-environment		; to import emacs.py
-	    (cons (concat "PYTHONPATH=" data-directory
-			  (if path (concat ":" path)))
-		  process-environment)))
-      (set-buffer (apply 'make-comint "Python" (car cmdlist) nil
-			 (cdr cmdlist)))
-      (setq python-buffer (buffer-name)))
-    (inferior-python-mode)
-    ;; Load function defintions we need.
-    ;; Before the preoutput function was used, this was done via -c in
-    ;; cmdlist, but that loses the banner and doesn't run the startup
-    ;; file.  The code might be inline here, but there's enough that it
-    ;; seems worth putting in a separate file, and it's probably cleaner
-    ;; to put it in a module.
-    (python-send-string "import emacs"))
-  (unless noshow (pop-to-buffer python-buffer)))
+  (when (or new (not (comint-check-proc python-buffer)))
+    (save-current-buffer
+      (let* ((cmdlist (append (python-args-to-list cmd) '("-i")))
+	     (path (getenv "PYTHONPATH"))
+	     (process-environment	; to import emacs.py
+	      (cons (concat "PYTHONPATH=" data-directory
+			    (if path (concat ":" path)))
+		    process-environment)))
+	(set-buffer (apply 'make-comint-in-buffer "Python"
+			   (generate-new-buffer "*Python*")
+			   (car cmdlist) nil (cdr cmdlist)))
+	(setq-default python-buffer (current-buffer))
+	(setq python-buffer (current-buffer)))
+      (accept-process-output (get-buffer-process python-buffer) 5)
+      (inferior-python-mode)))
+  (if (derived-mode-p 'python-mode)
+      (setq python-buffer (default-value 'python-buffer))) ; buffer-local
+  ;; Load function definitions we need.
+  ;; Before the preoutput function was used, this was done via -c in
+  ;; cmdlist, but that loses the banner and doesn't run the startup
+  ;; file.  The code might be inline here, but there's enough that it
+  ;; seems worth putting in a separate file, and it's probably cleaner
+  ;; to put it in a module.
+  ;; Ensure we're at a prompt before doing anything else.
+  (python-send-receive "import emacs; print '_emacs_out ()'")
+  ;; Without this, help output goes into the inferior python buffer if
+  ;; the process isn't already running.
+  (sit-for 1 t)        ;Should we use accept-process-output instead?  --Stef
+  (unless noshow (pop-to-buffer python-buffer t)))
 
 ;; Fixme: We typically lose if the inferior isn't in the normal REPL,
 ;; e.g. prompt is `help> '.  Probably raise an error if the form of
-;; the prompt is unexpected; actually, it needs to be `>>> ', not
+;; the prompt is unexpected.  Actually, it needs to be `>>> ', not
 ;; `... ', i.e. we're not inputting a block &c.  However, this may not
-;; be the place to do it, e.g. we might actually want to send commands
-;; having set up such a state.
+;; be the place to check it, e.g. we might actually want to send
+;; commands having set up such a state.
 
 (defun python-send-command (command)
-  "Like `python-send-string' but resets `compilation-minor-mode'."
-  (goto-char (point-max))
+  "Like `python-send-string' but resets `compilation-shell-minor-mode'.
+COMMAND should be a single statement."
+  (assert (not (string-match "\n" command)))
   (let ((end (marker-position (process-mark (python-proc)))))
+    (with-current-buffer python-buffer (goto-char (point-max)))
     (compilation-forget-errors)
-    (python-send-string command)
-    (set-marker compilation-parsing-end end)
-    (setq compilation-last-buffer (current-buffer))))
+    ;; Must wait until this has completed before re-setting variables below.
+    (python-send-receive (concat command "; print '_emacs_out ()'"))
+    (with-current-buffer python-buffer
+      (set-marker compilation-parsing-end end)
+      (setq compilation-last-buffer (current-buffer)))))
 
 (defun python-send-region (start end)
   "Send the region to the inferior Python process."
@@ -1202,8 +1390,8 @@
   ;; filter).  This function also catches exceptions and truncates
   ;; tracebacks not to mention the frame of the function itself.
   ;;
-  ;; The compilation-minor-mode parsing takes care of relating the
-  ;; reference to the temporary file to the source.
+  ;; The `compilation-shell-minor-mode' parsing takes care of relating
+  ;; the reference to the temporary file to the source.
   ;;
   ;; Fixme: Write a `coding' header to the temp file if the region is
   ;; non-ASCII.
@@ -1220,18 +1408,22 @@
 	(set-marker orig-start (line-beginning-position 0)))
       (write-region "if True:\n" nil f nil 'nomsg))
     (write-region start end f t 'nomsg)
-    (with-current-buffer (process-buffer (python-proc))	;Runs python if needed.
-      (python-send-command command)
+    (python-send-command command)
+    (with-current-buffer (process-buffer (python-proc))
       ;; Tell compile.el to redirect error locations in file `f' to
       ;; positions past marker `orig-start'.  It has to be done *after*
-      ;; python-send-command's call to compilation-forget-errors.
+      ;; `python-send-command''s call to `compilation-forget-errors'.
       (compilation-fake-loc orig-start f))))
 
 (defun python-send-string (string)
   "Evaluate STRING in inferior Python process."
   (interactive "sPython command: ")
   (comint-send-string (python-proc) string)
-  (comint-send-string (python-proc) "\n\n"))
+  (comint-send-string (python-proc)
+                      ;; If the string is single-line or if it ends with \n,
+                      ;; only add a single \n, otherwise add 2, so as to
+                      ;; make sure we terminate the multiline instruction.
+                      (if (string-match "\n.+\\'" string) "\n\n" "\n")))
 
 (defun python-send-buffer ()
   "Send the current buffer to the inferior Python process."
@@ -1247,10 +1439,10 @@
 				      (progn (end-of-defun) (point)))))
 
 (defun python-switch-to-python (eob-p)
-  "Switch to the Python process buffer.
+  "Switch to the Python process buffer, maybe starting new process.
 With prefix arg, position cursor at end of buffer."
   (interactive "P")
-  (pop-to-buffer (process-buffer (python-proc))) ;Runs python if needed.
+  (pop-to-buffer (process-buffer (python-proc)) t) ;Runs python if needed.
   (when eob-p
     (push-mark)
     (goto-char (point-max))))
@@ -1263,10 +1455,10 @@
   (python-switch-to-python t))
 
 (defcustom python-source-modes '(python-mode jython-mode)
-  "*Used to determine if a buffer contains Python source code.
-If it's loaded into a buffer that is in one of these major modes, it's
-considered a Python source file by `python-load-file'.
-Used by these commands to determine defaults."
+  "Used to determine if a buffer contains Python source code.
+If a file is loaded into a buffer that is in one of these major modes,
+it is considered Python source by `python-load-file', which uses the
+value to determine defaults."
   :type '(repeat function)
   :group 'python)
 
@@ -1274,6 +1466,8 @@
   "Caches (directory . file) pair used in the last `python-load-file' command.
 Used for determining the default in the next one.")
 
+(autoload 'comint-get-source "comint")
+
 (defun python-load-file (file-name)
   "Load a Python file FILE-NAME into the inferior Python process.
 If the file has extension `.py' import or reload it as a module.
@@ -1297,17 +1491,27 @@
        (format "execfile(%S)" file-name)))
     (message "%s loaded" file-name)))
 
-;; Fixme: If we need to start the process, wait until we've got the OK
-;; from the startup.
 (defun python-proc ()
   "Return the current Python process.
 See variable `python-buffer'.  Starts a new process if necessary."
-  (or (if python-buffer
-	  (get-buffer-process (if (eq major-mode 'inferior-python-mode)
-				  (current-buffer)
-				python-buffer)))
-      (progn (run-python nil t)
-	     (python-proc))))
+  ;; Fixme: Maybe should look for another active process if there
+  ;; isn't one for `python-buffer'.
+  (unless (comint-check-proc python-buffer)
+    (run-python nil t))
+  (get-buffer-process (or (if (derived-mode-p 'inferior-python-mode)
+                              (current-buffer)
+                            python-buffer))))
+
+(defun python-set-proc ()
+  "Set the default value of `python-buffer' to correspond to this buffer.
+If the current buffer has a local value of `python-buffer', set the
+default (global) value to that.  The associated Python process is
+the one that gets input from \\[python-send-region] et al when used
+in a buffer that doesn't have a local value of `python-buffer'."
+  (interactive)
+  (if (local-variable-p 'python-buffer)
+      (setq-default python-buffer python-buffer)
+    (error "No local value of `python-buffer'")))
 
 ;;;; Context-sensitive help.
 
@@ -1322,16 +1526,22 @@
 (defvar view-return-to-alist)
 (eval-when-compile (autoload 'help-buffer "help-fns"))
 
+(defvar python-imports)			; forward declaration
+
 ;; Fixme: Should this actually be used instead of info-look, i.e. be
-;; bound to C-h S?  Can we use other pydoc stuff before python 2.2?
+;; bound to C-h S?  [Probably not, since info-look may work in cases
+;; where this doesn't.]
 (defun python-describe-symbol (symbol)
   "Get help on SYMBOL using `help'.
 Interactively, prompt for symbol.
 
-Symbol may be anything recognized by the interpreter's `help' command --
-e.g. `CALLS' -- not just variables in scope.
-This only works for Python version 2.2 or newer since earlier interpreters
-don't support `help'."
+Symbol may be anything recognized by the interpreter's `help'
+command -- e.g. `CALLS' -- not just variables in scope in the
+interpreter.  This only works for Python version 2.2 or newer
+since earlier interpreters don't support `help'.
+
+In some cases where this doesn't find documentation, \\[info-lookup-symbol]
+will."
   ;; Note that we do this in the inferior process, not a separate one, to
   ;; ensure the environment is appropriate.
   (interactive
@@ -1343,53 +1553,65 @@
 			  "Describe symbol: ")
 			nil nil symbol))))
   (if (equal symbol "") (error "No symbol"))
-  (let* ((func `(lambda ()
-		  (comint-redirect-send-command
-		   (format "emacs.ehelp(%S, globals(), locals())\n" ,symbol)
-		   "*Help*" nil))))
-    ;; Ensure we have a suitable help buffer.
-    ;; Fixme: Maybe process `Related help topics' a la help xrefs and
-    ;; allow C-c C-f in help buffer.
-    (let ((temp-buffer-show-hook	; avoid xref stuff
-	   (lambda ()
-	     (toggle-read-only 1)
-	     (setq view-return-to-alist
-		   (list (cons (selected-window) help-return-method))))))
-      (help-setup-xref (list 'python-describe-symbol symbol) (interactive-p))
-      (with-output-to-temp-buffer (help-buffer)
-	(with-current-buffer standard-output
-	  (set (make-local-variable 'comint-redirect-subvert-readonly) t)
-	  (print-help-return-message))))
-    (if (and python-buffer (get-buffer python-buffer))
-	(with-current-buffer python-buffer
-	  (funcall func))
-      (setq python-preoutput-continuation func)
-      (run-python nil t))))
+  ;; Ensure we have a suitable help buffer.
+  ;; Fixme: Maybe process `Related help topics' a la help xrefs and
+  ;; allow C-c C-f in help buffer.
+  (let ((temp-buffer-show-hook		; avoid xref stuff
+	 (lambda ()
+	   (toggle-read-only 1)
+	   (setq view-return-to-alist
+		 (list (cons (selected-window) help-return-method))))))
+    (with-output-to-temp-buffer (help-buffer)
+      (with-current-buffer standard-output
+ 	;; Fixme: Is this actually useful?
+	(help-setup-xref (list 'python-describe-symbol symbol) (interactive-p))
+	(set (make-local-variable 'comint-redirect-subvert-readonly) t)
+	(print-help-return-message))))
+  (comint-redirect-send-command-to-process (format "emacs.ehelp(%S, %s)"
+						   symbol python-imports)
+   "*Help*" (python-proc) nil nil))
 
 (add-to-list 'debug-ignored-errors "^No symbol")
 
 (defun python-send-receive (string)
   "Send STRING to inferior Python (if any) and return result.
-The result is what follows `_emacs_out' in the output (or nil)."
+The result is what follows `_emacs_out' in the output."
+  (python-send-string string)
   (let ((proc (python-proc)))
-    (python-send-string string)
-    (setq python-preoutput-result nil)
-    (while (progn
-	     (accept-process-output proc 5)
-	     python-preoutput-leftover))
-    python-preoutput-result))
+    (with-current-buffer (process-buffer proc)
+      (set (make-local-variable 'python-preoutput-result) nil)
+      (while (progn
+               (accept-process-output proc 5)
+               (null python-preoutput-result)))
+      (prog1 python-preoutput-result
+        (kill-local-variable 'python-preoutput-result)))))
 
-;; Fixme: try to make it work with point in the arglist.  Also, is
-;; there anything reasonable we can do with random methods?
+;; Fixme:  Is there anything reasonable we can do with random methods?
 ;; (Currently only works with functions.)
 (defun python-eldoc-function ()
   "`eldoc-print-current-symbol-info' for Python.
-Only works when point is in a function name, not its arglist, for instance.
-Assumes an inferior Python is running."
+Only works when point is in a function name, not its arg list, for
+instance.  Assumes an inferior Python is running."
   (let ((symbol (with-syntax-table python-dotty-syntax-table
 		  (current-word))))
-    (when symbol
-      (python-send-receive (format "emacs.eargs(%S)" symbol)))))
+    ;; First try the symbol we're on.
+    (or (and symbol
+	     (python-send-receive (format "emacs.eargs(%S, %s)"
+					  symbol python-imports)))
+	;; Try moving to symbol before enclosing parens.
+	(let ((s (syntax-ppss)))
+	  (unless (zerop (car s))
+	    (when (eq ?\( (char-after (nth 1 s)))
+	      (save-excursion
+		(goto-char (nth 1 s))
+		(skip-syntax-backward "-")
+		(let ((point (point)))
+		  (skip-chars-backward "a-zA-Z._")
+		  (if (< (point) point)
+		      (python-send-receive
+		       (format "emacs.eargs(%S, %s)"
+			       (buffer-substring-no-properties (point) point)
+			       python-imports)))))))))))
 
 ;;;; Info-look functionality.
 
@@ -1443,7 +1665,7 @@
 	 ("(python-lib)Miscellaneous Index" nil ""))))))
 (eval-after-load "info-look" '(python-after-info-look))
 
-;;;; Miscellancy.
+;;;; Miscellany.
 
 (defcustom python-jython-packages '("java" "javax" "org" "com")
   "Packages implying `jython-mode'.
@@ -1473,8 +1695,8 @@
 	    (jython-mode)
 	  (if (catch 'done
 		(while (re-search-forward
-			(rx (and line-start (or "import" "from") (1+ space)
-				 (group (1+ (not (any " \t\n."))))))
+			(rx line-start (or "import" "from") (1+ space)
+			    (group (1+ (not (any " \t\n.")))))
 			(+ (point-min) 10000) ; Probably not worth customizing.
 			t)
 		  (if (member (match-string 1) python-jython-packages)
@@ -1562,7 +1784,7 @@
   "`outline-level' function for Python mode.
 The level is the number of `python-indent' steps of indentation
 of current line."
-  (/ (current-indentation) python-indent))
+  (1+ (/ (current-indentation) python-indent)))
 
 ;; Fixme: Consider top-level assignments, imports, &c.
 (defun python-current-defun ()
@@ -1577,10 +1799,8 @@
 	(python-beginning-of-block)
 	(end-of-line)
 	(beginning-of-defun)
-	(if (looking-at (rx (and (0+ space) (or "def" "class") (1+ space)
-				 (group (1+ (or word (syntax symbol))))
-				 ;; Greediness makes this unnecessary?  --Stef
-				 symbol-end)))
+	(if (looking-at (rx (0+ space) (or "def" "class") (1+ space)
+			    (group (1+ (or word (syntax symbol))))))
 	    (push (match-string 1) accum)))
       (if accum (mapconcat 'identity accum ".")))))
 
@@ -1593,17 +1813,68 @@
   (push-mark (point) nil t)
   (python-end-of-block)
   (exchange-point-and-mark))
+
+;; Fixme:  Provide a find-function-like command to find source of a
+;; definition (separate from BicycleRepairMan).  Complicated by
+;; finding the right qualified name.
 
 ;;;; Completion.
 
+(defvar python-imports nil
+  "String of top-level import statements updated by `python-find-imports'.")
+(make-variable-buffer-local 'python-imports)
+
+;; Fixme: Should font-lock try to run this when it deals with an import?
+;; Maybe not a good idea if it gets run multiple times when the
+;; statement is being edited, and is more likely to end up with
+;; something syntactically incorrect.
+;; However, what we should do is to trundle up the block tree from point
+;; to extract imports that appear to be in scope, and add those.
+(defun python-find-imports ()
+  "Find top-level imports, updating `python-imports'."
+  (interactive)
+  (save-excursion
+      (let (lines)
+	(goto-char (point-min))
+	(while (re-search-forward "^import\\>\\|^from\\>" nil t)
+	  (unless (syntax-ppss-context (syntax-ppss))
+	    (push (buffer-substring (line-beginning-position)
+				    (line-beginning-position 2))
+		  lines)))
+	(setq python-imports
+	      (if lines
+		  (apply #'concat
+;; This is probably best left out since you're unlikely to need the
+;; doc for a function in the buffer and the import will lose if the
+;; Python sub-process' working directory isn't the same as the
+;; buffer's.
+;; 			 (if buffer-file-name
+;; 			     (concat
+;; 			      "import "
+;; 			      (file-name-sans-extension
+;; 			       (file-name-nondirectory buffer-file-name))))
+			 (nreverse lines))
+		"None"))
+	(when lines
+	  (set-text-properties 0 (length python-imports) nil python-imports)
+	  ;; The output ends up in the wrong place if the string we
+	  ;; send contains newlines (from the imports).
+	  (setq python-imports
+		(replace-regexp-in-string "\n" "\\n"
+					  (format "%S" python-imports) t t))))))
+
+;; Fixme: This fails the first time if the sub-process isn't already
+;; running.  Presumably a timing issue with i/o to the process.
 (defun python-symbol-completions (symbol)
   "Return a list of completions of the string SYMBOL from Python process.
-The list is sorted."
+The list is sorted.
+Uses `python-imports' to load modules against which to complete."
   (when symbol
     (let ((completions
 	   (condition-case ()
-	       (car (read-from-string (python-send-receive
-				       (format "emacs.complete(%S)" symbol))))
+	       (car (read-from-string
+		     (python-send-receive
+		      (format "emacs.complete(%S,%s)" symbol python-imports))))
 	     (error nil))))
       (sort
        ;; We can get duplicates from the above -- don't know why.
@@ -1615,15 +1886,12 @@
   (let ((end (point))
 	(start (save-excursion
 		 (and (re-search-backward
-		       (rx (and (or buffer-start (regexp "[^[:alnum:]._]"))
-				(group (1+ (regexp "[[:alnum:]._]")))
-				point))
+		       (rx (or buffer-start (regexp "[^[:alnum:]._]"))
+			   (group (1+ (regexp "[[:alnum:]._]"))) point)
 		       nil t)
 		      (match-beginning 1)))))
     (if start (buffer-substring-no-properties start end))))
 
-;; Fixme: We should have an abstraction of this sort of thing in the
-;; core.
 (defun python-complete-symbol ()
   "Perform completion on the Python symbol preceding point.
 Repeating the command scrolls the completion window."
@@ -1658,11 +1926,9 @@
 		   (display-completion-list completions symbol))
 		 (message "Making completion list...%s" "done"))))))))
 
-(eval-when-compile (require 'hippie-exp))
-
 (defun python-try-complete (old)
   "Completion function for Python for use with `hippie-expand'."
-  (when (eq major-mode 'python-mode)	; though we only add it locally
+  (when (derived-mode-p 'python-mode)	; though we only add it locally
     (unless old
       (let ((symbol (python-partial-symbol)))
 	(he-init-string (- (point) (length symbol)) (point))
@@ -1680,16 +1946,212 @@
       (if old (he-reset-string))
       nil)))
 
+;;;; FFAP support
+
+(defun python-module-path (module)
+  "Function for `ffap-alist' to return path to MODULE."
+  (python-send-receive (format "emacs.modpath (%S)" module)))
+
+(eval-after-load "ffap"
+  '(push '(python-mode . python-module-path) ffap-alist))
+
+;;;; Skeletons
+
+(defvar python-skeletons nil
+  "Alist of named skeletons for Python mode.
+Elements are of the form (NAME . EXPANDER-FUNCTION).")
+
+(defvar python-mode-abbrev-table nil
+  "Abbrev table for Python mode.
+The default contents correspond to the elements of `python-skeletons'.")
+(define-abbrev-table 'python-mode-abbrev-table ())
+
+(eval-when-compile
+  ;; Define a user-level skeleton and add it to `python-skeletons' and
+  ;; the abbrev table.
+(defmacro def-python-skeleton (name &rest elements)
+  (let* ((name (symbol-name name))
+	 (function (intern (concat "python-insert-" name))))
+    `(progn
+       (add-to-list 'python-skeletons ',(cons name function))
+       (define-abbrev python-mode-abbrev-table ,name "" ',function nil t)
+       (define-skeleton ,function
+	 ,(format "Insert Python \"%s\" template." name)
+	 ,@elements)))))
+(put 'def-python-skeleton 'lisp-indent-function 2)
+
+;; From `skeleton-further-elements':
+;;  `<': outdent a level;
+;;  `^': delete indentation on current line and also previous newline.
+;;       Not quote like `delete-indentation'.  Assumes point is at
+;;       beginning of indentation.
+
+(def-python-skeleton if
+  "Condition: "
+  "if " str ":" \n
+  > _ \n
+  ("other condition, %s: "
+   <			; Avoid wrong indentation after block opening.
+   "elif " str ":" \n
+   > _ \n nil)
+  (python-else) | ^)
+
+(define-skeleton python-else
+  "Auxiliary skeleton."
+  nil
+  (unless (eq ?y (read-char "Add `else' clause? (y for yes or RET for no) "))
+    (signal 'quit t))
+  < "else:" \n
+  > _ \n)
+
+(def-python-skeleton while
+  "Condition: "
+  "while " str ":" \n
+  > _ \n
+  (python-else) | ^)
+
+(def-python-skeleton for
+  "Target, %s: "
+  "for " str " in " (skeleton-read "Expression, %s: ") ":" \n
+  > _ \n
+  (python-else) | ^)
+
+(def-python-skeleton try/except
+  nil
+  "try:" \n
+  > _ \n
+  ("Exception, %s: "
+   < "except " str (python-target) ":" \n
+   > _ \n nil)
+  < "except:" \n
+  > _ \n
+  (python-else) | ^)
+
+(define-skeleton python-target
+  "Auxiliary skeleton."
+  "Target, %s: " ", " str | -2)
+
+(def-python-skeleton try/finally
+  nil
+  "try:" \n
+  > _ \n
+  < "finally:" \n
+  > _ \n)
+
+(def-python-skeleton def
+  "Name: "
+  "def " str " (" ("Parameter, %s: " (unless (equal ?\( (char-before)) ", ")
+		     str) "):" \n
+  "\"\"\"" @ " \"\"\"" \n	    ; Fixme: syntaxification wrong for """"""
+  > _ \n)
+
+(def-python-skeleton class
+  "Name: "
+  "class " str " (" ("Inheritance, %s: "
+		     (unless (equal ?\( (char-before)) ", ")
+		     str)
+  & ")" | -2				; close list or remove opening
+  ":" \n
+  "\"\"\"" @ " \"\"\"" \n
+  > _ \n)
+
+(defvar python-default-template "if"
+  "Default template to expand by `python-insert-template'.
+Updated on each expansion.")
+
+(defun python-expand-template (name)
+  "Expand template named NAME.
+Interactively, prompt for the name with completion."
+  (interactive
+   (list (completing-read (format "Template to expand (default %s): "
+				  python-default-template)
+			  python-skeletons nil t)))
+  (if (equal "" name)
+      (setq name python-default-template)
+    (setq python-default-template name))
+  (let ((func (cdr (assoc name python-skeletons))))
+    (if func
+	(funcall func)
+      (error "Undefined template: %s" name))))
+
+;;;; Bicycle Repair Man support
+
+(autoload 'pymacs-load "pymacs" nil t)
+(autoload 'brm-init "bikemacs")
+
+;; I'm not sure how useful BRM really is, and it's certainly dangerous
+;; the way it modifies files outside Emacs...  Also note that the
+;; current BRM loses with tabs used for indentation -- I submitted a
+;; fix <URL:http://www.loveshack.ukfsn.org/emacs/bikeemacs.py.diff>.
+(defun python-setup-brm ()
+  "Set up Bicycle Repair Man refactoring tool (if available).
+
+Note that the `refactoring' features change files independently of
+Emacs and may modify and save the contents of the current buffer
+without confirmation."
+  (interactive)
+  (condition-case data
+      (unless (fboundp 'brm-rename)
+	(pymacs-load "bikeemacs" "brm-") ; first line of normal recipe
+	(let ((py-mode-map (make-sparse-keymap)) ; it assumes this
+	      (features (cons 'python-mode features))) ; and requires this
+	  (brm-init))			; second line of normal recipe
+        (remove-hook 'python-mode-hook ; undo this from `brm-init'
+                     '(lambda () (easy-menu-add brm-menu)))
+        (easy-menu-define
+          python-brm-menu python-mode-map
+          "Bicycle Repair Man"
+          '("BicycleRepairMan"
+            :help "Interface to navigation and refactoring tool"
+            "Queries"
+            ["Find References" brm-find-references
+             :help "Find references to name at point in compilation buffer"]
+            ["Find Definition" brm-find-definition
+             :help "Find definition of name at point"]
+            "-"
+            "Refactoring"
+            ["Rename" brm-rename
+             :help "Replace name at point with a new name everywhere"]
+            ["Extract Method" brm-extract-method
+             :active (and mark-active (not buffer-read-only))
+             :help "Replace statements in region with a method"]
+            ["Extract Local Variable" brm-extract-local-variable
+             :active (and mark-active (not buffer-read-only))
+             :help "Replace expression in region with an assignment"]
+            ["Inline Local Variable" brm-inline-local-variable
+             :help
+             "Substitute uses of variable at point with its definition"]
+            ;; Fixme:  Should check for anything to revert.
+            ["Undo Last Refactoring" brm-undo :help ""])))
+    (error (error "Bicyclerepairman setup failed: %s" data))))
+
 ;;;; Modes.
 
 (defvar outline-heading-end-regexp)
 (defvar eldoc-documentation-function)
 
+;; Stuff to allow expanding abbrevs with non-word constituents.
+(defun python-abbrev-pc-hook ()
+  "Set the syntax table before possibly expanding abbrevs."
+  (remove-hook 'post-command-hook 'python-abbrev-pc-hook t)
+  (set-syntax-table python-mode-syntax-table))
+
+(defvar python-abbrev-syntax-table
+  (copy-syntax-table python-mode-syntax-table)
+  "Syntax table used when expanding abbrevs.")
+
+(defun python-pea-hook ()
+  "Reset the syntax table after possibly expanding abbrevs."
+  (set-syntax-table python-abbrev-syntax-table)
+  (add-hook 'post-command-hook 'python-abbrev-pc-hook nil t))
+(modify-syntax-entry ?/ "w" python-abbrev-syntax-table)
+
+(defvar python-mode-running)            ;Dynamically scoped var.
+
 ;;;###autoload
 (define-derived-mode python-mode fundamental-mode "Python"
   "Major mode for editing Python files.
-Turns on Font Lock mode unconditionally since it is required for correct
-parsing of the source.
+Font Lock mode is currently required for correct parsing of the source.
 See also `jython-mode', which is actually invoked if the buffer appears to
 contain Jython code.  See also `run-python' and associated Python mode
 commands for running Python under Emacs.
@@ -1703,21 +2165,27 @@
 Colon is electric: it outdents the line if appropriate, e.g. for
 an else statement.  \\[python-backspace] at the beginning of an indented statement
 deletes a level of indentation to close the current block; otherwise it
-deletes a charcter backward.  TAB indents the current line relative to
+deletes a character backward.  TAB indents the current line relative to
 the preceding code.  Successive TABs, with no intervening command, cycle
 through the possibilities for indentation on the basis of enclosing blocks.
 
-\\[fill-paragraph] fills comments and multiline strings appropriately, but has no
+\\[fill-paragraph] fills comments and multi-line strings appropriately, but has no
 effect outside them.
 
 Supports Eldoc mode (only for functions, using a Python process),
 Info-Look and Imenu.  In Outline minor mode, `class' and `def'
-lines count as headers.
+lines count as headers.  Symbol completion is available in the
+same way as in the Python shell using the `rlcompleter' module
+and this is added to the Hippie Expand functions locally if
+Hippie Expand mode is turned on.  Completion of symbols of the
+form x.y only works if the components are literal
+module/attribute names, not variables.  An abbrev table is set up
+with skeleton expansions for compound statement templates.
 
 \\{python-mode-map}"
   :group 'python
   (set (make-local-variable 'font-lock-defaults)
-       '(python-font-lock-keywords nil nil ((?_ . "w")) nil
+       '(python-font-lock-keywords nil nil nil nil
 				   (font-lock-syntactic-keywords
 				    . python-font-lock-syntactic-keywords)
 				   ;; This probably isn't worth it.
@@ -1726,15 +2194,17 @@
 				   ))
   (set (make-local-variable 'parse-sexp-lookup-properties) t)
   (set (make-local-variable 'comment-start) "# ")
-  (set (make-local-variable 'comment-indent-function) #'python-comment-indent)
   (set (make-local-variable 'indent-line-function) #'python-indent-line)
+  (set (make-local-variable 'indent-region-function) #'python-indent-region)
   (set (make-local-variable 'paragraph-start) "\\s-*$")
   (set (make-local-variable 'fill-paragraph-function) 'python-fill-paragraph)
   (set (make-local-variable 'require-final-newline) mode-require-final-newline)
   (set (make-local-variable 'add-log-current-defun-function)
        #'python-current-defun)
-  ;; Fixme: Generalize to do all blocks?
-  (set (make-local-variable 'outline-regexp) "\\s-*\\(def\\|class\\)\\>")
+  (set (make-local-variable 'outline-regexp)
+       (rx (* space) (or "class" "def" "elif" "else" "except" "finally"
+			 "for" "if" "try" "while")
+	   symbol-end))
   (set (make-local-variable 'outline-heading-end-regexp) ":\\s-*\n")
   (set (make-local-variable 'outline-level) #'python-outline-level)
   (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil)
@@ -1746,30 +2216,45 @@
   (set (make-local-variable 'eldoc-documentation-function)
        #'python-eldoc-function)
   (add-hook 'eldoc-mode-hook
-	    '(lambda () (run-python nil t)) nil t) ; need it running
-  (unless (assoc 'python-mode hs-special-modes-alist)
-    (setq 
-     hs-special-modes-alist 
-     (cons (list 
-	    'python-mode "^\\s-*def\\>" nil "#" 
-	    (lambda (arg)(python-end-of-defun)(skip-chars-backward " \t\n")) 
-	    nil)
-    hs-special-modes-alist)))
+	    (lambda () (run-python nil t)) ; need it running
+	    nil t)
+  ;; Fixme: should be in hideshow.  This seems to be of limited use
+  ;; since it isn't (can't be) indentation-based.  Also hide-level
+  ;; doesn't seem to work properly.
+  (add-to-list 'hs-special-modes-alist
+	       `(python-mode "^\\s-*def\\>" nil "#"
+		 ,(lambda (arg)
+		   (python-end-of-defun)
+		   (skip-chars-backward " \t\n"))
+		 nil))
+  (set (make-local-variable 'skeleton-further-elements)
+       '((< '(backward-delete-char-untabify (min python-indent
+						 (current-column))))
+	 (^ '(- (1+ (current-indentation))))))
+  (add-hook 'pre-abbrev-expand-hook 'python-pea-hook nil t)
   (if (featurep 'hippie-exp)
       (set (make-local-variable 'hippie-expand-try-functions-list)
 	   (cons 'python-try-complete hippie-expand-try-functions-list)))
+  ;; Python defines TABs as being 8-char wide.
+  (set (make-local-variable 'tab-width) 8)
   (when python-guess-indent (python-guess-indent))
+  ;; Let's make it harder for the user to shoot himself in the foot.
+  (unless (= tab-width python-indent)
+    (setq indent-tabs-mode nil))
   (set (make-local-variable 'python-command) python-python-command)
+  (python-find-imports)
   (unless (boundp 'python-mode-running)	; kill the recursion from jython-mode
     (let ((python-mode-running t))
       (python-maybe-jython))))
 
 (custom-add-option 'python-mode-hook 'imenu-add-menubar-index)
 (custom-add-option 'python-mode-hook
-		   '(lambda ()
-		      "Turn on Indent Tabs mode."
-		      (set (make-local-variable 'indent-tabs-mode) t)))
+		   (lambda ()
+                     "Turn off Indent Tabs mode."
+                     (set (make-local-variable 'indent-tabs-mode) nil)))
 (custom-add-option 'python-mode-hook 'turn-on-eldoc-mode)
+(custom-add-option 'python-mode-hook 'abbrev-mode)
+(custom-add-option 'python-mode-hook 'python-setup-brm)
 
 ;;;###autoload
 (define-derived-mode jython-mode python-mode  "Jython"
@@ -1780,5 +2265,6 @@
   (set (make-local-variable 'python-command) python-jython-command))
 
 (provide 'python)
+(provide 'python-21)
 ;; arch-tag: 6fce1d99-a704-4de9-ba19-c6e4912b0554
 ;;; python.el ends here
--- a/lisp/progmodes/sh-script.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/progmodes/sh-script.el	Sat Oct 14 16:56:21 2006 +0000
@@ -986,7 +986,9 @@
   ;; FIXME: This can (and often does) match multiple lines, yet it makes no
   ;; effort to handle multiline cases correctly, so it ends up being
   ;; rather flakey.
-  (when (re-search-forward "\"\\(?:\\(?:.\\|\n\\)*?[^\\]\\(?:\\\\\\\\\\)*\\)??\\(\\$(\\|`\\)" limit t)
+  (when (and (re-search-forward "\"\\(?:\\(?:.\\|\n\\)*?[^\\]\\(?:\\\\\\\\\\)*\\)??\\(\\$(\\|`\\)" limit t)
+             ;; Make sure the " we matched is an opening quote.
+	     (eq ?\" (nth 3 (syntax-ppss))))
     ;; bingo we have a $( or a ` inside a ""
     (let ((char (char-after (point)))
           (continue t)
@@ -1081,9 +1083,6 @@
     ("\\(\\\\\\)'" 1 ,sh-st-punc)
     ;; Make sure $@ and @? are correctly recognized as sexps.
     ("\\$\\([?@]\\)" 1 ,sh-st-symbol)
-    ;; highlight (possibly nested) subshells inside "" quoted regions correctly.
-    (sh-quoted-subshell
-     (1 (sh-apply-quoted-subshell) t t))
     ;; Find HEREDOC starters and add a corresponding rule for the ender.
     (sh-font-lock-here-doc
      (2 (sh-font-lock-open-heredoc
@@ -1093,7 +1092,11 @@
          (and (match-beginning 3) (/= (match-beginning 3) (match-end 3))))
       nil t))
     ;; Distinguish the special close-paren in `case'.
-    (")" 0 (sh-font-lock-paren (match-beginning 0)))))
+    (")" 0 (sh-font-lock-paren (match-beginning 0)))
+    ;; highlight (possibly nested) subshells inside "" quoted regions correctly.
+    ;; This should be at the very end because it uses syntax-ppss.
+    (sh-quoted-subshell
+     (1 (sh-apply-quoted-subshell) t t))))
 
 (defun sh-font-lock-syntactic-face-function (state)
   (let ((q (nth 3 state)))
--- a/lisp/progmodes/vhdl-mode.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/progmodes/vhdl-mode.el	Sat Oct 14 16:56:21 2006 +0000
@@ -14112,8 +14112,8 @@
 (defun vhdl-speedbar-display-directory (directory depth &optional rescan)
   "Display directory and hierarchy information in speedbar."
   (setq vhdl-speedbar-show-projects nil)
-  (setq speedbar-ignored-path-regexp
-	(speedbar-extension-list-to-regex speedbar-ignored-path-expressions))
+  (setq speedbar-ignored-directory-regexp
+	(speedbar-extension-list-to-regex speedbar-ignored-directory-expressions))
   (setq directory (abbreviate-file-name (file-name-as-directory directory)))
   (setq speedbar-last-selected-file nil)
   (speedbar-with-writable
@@ -14133,7 +14133,7 @@
 (defun vhdl-speedbar-display-projects (project depth &optional rescan)
   "Display projects and hierarchy information in speedbar."
   (setq vhdl-speedbar-show-projects t)
-  (setq speedbar-ignored-path-regexp ".")
+  (setq speedbar-ignored-directory-regexp ".")
   (setq speedbar-last-selected-file nil)
   (setq vhdl-speedbar-last-selected-project nil)
   (speedbar-with-writable
--- a/lisp/rect.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/rect.el	Sat Oct 14 16:56:21 2006 +0000
@@ -181,12 +181,9 @@
 
 ;; this one is untouched --dv
 (defun spaces-string (n)
+  "Returns a string with N spaces."
   (if (<= n 8) (aref spaces-strings n)
-    (let ((val ""))
-      (while (> n 8)
-	(setq val (concat "        " val)
-	      n (- n 8)))
-      (concat val (aref spaces-strings n)))))
+    (make-string n ? )))
 
 ;;;###autoload
 (defun delete-rectangle (start end &optional fill)
--- a/lisp/simple.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/simple.el	Sat Oct 14 16:56:21 2006 +0000
@@ -887,7 +887,9 @@
 
 (defun line-number-at-pos (&optional pos)
   "Return (narrowed) buffer line number at position POS.
-If POS is nil, use current buffer location."
+If POS is nil, use current buffer location.
+Counting starts at (point-min), so the value refers
+to the contents of the accessible portion of the buffer."
   (let ((opoint (or pos (point))) start)
     (save-excursion
       (goto-char (point-min))
@@ -3689,7 +3691,10 @@
 and `current-column' to be able to ignore invisible text."
   (if (zerop col)
       (beginning-of-line)
-    (move-to-column col))
+    (let ((opoint (point)))
+      (move-to-column col)
+      ;; move-to-column doesn't respect field boundaries.
+      (goto-char (constrain-to-field (point) opoint))))
 
   (when (and line-move-ignore-invisible
 	     (not (bolp)) (line-move-invisible-p (1- (point))))
@@ -3759,7 +3764,8 @@
   (interactive "p")
   (or arg (setq arg 1))
 
-  (let ((orig (point)))
+  (let ((orig (point))
+	start first-vis first-vis-field-value)
 
     ;; Move by lines, if ARG is not 1 (the default).
     (if (/= arg 1)
@@ -3770,10 +3776,24 @@
     (while (and (not (bobp)) (line-move-invisible-p (1- (point))))
       (goto-char (previous-char-property-change (point)))
       (skip-chars-backward "^\n"))
-
-    ;; Take care of fields.
-    (goto-char (constrain-to-field (point) orig
-				   (/= arg 1) t nil))))
+    (setq start (point))
+
+    ;; Now find first visible char in the line
+    (while (and (not (eobp)) (line-move-invisible-p (point)))
+      (goto-char (next-char-property-change (point))))
+    (setq first-vis (point))
+
+    ;; See if fields would stop us from reaching FIRST-VIS.
+    (setq first-vis-field-value
+	  (constrain-to-field first-vis orig (/= arg 1) t nil))
+
+    (goto-char (if (/= first-vis-field-value first-vis)
+		   ;; If yes, obey them.
+		   first-vis-field-value
+		 ;; Otherwise, move to START with attention to fields.
+		 ;; (It is possible that fields never matter in this case.)
+		 (constrain-to-field (point) orig
+				     (/= arg 1) t nil)))))
 
 
 ;;; Many people have said they rarely use this feature, and often type
--- a/lisp/startup.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/startup.el	Sat Oct 14 16:56:21 2006 +0000
@@ -1249,11 +1249,16 @@
        "GNU Emacs is one component of the GNU/Linux operating system."
      "GNU Emacs is one component of the GNU operating system."))
   (insert "\n")
-  (unless (equal (buffer-name fancy-splash-outer-buffer) "*scratch*")
-    (fancy-splash-insert :face 'variable-pitch
-			 (substitute-command-keys
-			  "Type \\[recenter] to begin editing your file.\n"))))
-
+  (if fancy-splash-outer-buffer
+      (fancy-splash-insert
+       :face 'variable-pitch
+       (substitute-command-keys
+	(concat
+	 "Type \\[recenter] to begin editing"
+	 (if (equal (buffer-name fancy-splash-outer-buffer)
+		    "*scratch*")
+	     ".\n"
+	   " your file.\n"))))))
 
 (defun fancy-splash-tail ()
   "Insert the tail part of the splash screen into the current buffer."
@@ -1333,55 +1338,74 @@
   (if (frame-live-p frame)
       (run-at-time 0 nil 'fancy-splash-exit)))
 
-(defun fancy-splash-screens ()
+(defun fancy-splash-screens (&optional hide-on-input)
   "Display fancy splash screens when Emacs starts."
   (setq fancy-splash-help-echo (startup-echo-area-message))
-  (let ((old-hourglass display-hourglass)
-	(fancy-splash-outer-buffer (current-buffer))
-	splash-buffer
-	(old-minor-mode-map-alist minor-mode-map-alist)
-	(old-emulation-mode-map-alists emulation-mode-map-alists)
-	(frame (fancy-splash-frame))
-	timer)
-    (save-selected-window
-      (select-frame frame)
-      (switch-to-buffer "GNU Emacs")
-      (setq tab-width 20)
-      (setq splash-buffer (current-buffer))
-      (catch 'stop-splashing
-	(unwind-protect
-	    (let* ((map (make-sparse-keymap))
-		   (overriding-local-map map)
-		   ;; Catch if our frame is deleted; the delete-frame
-		   ;; event is unreliable and is handled by
-		   ;; `special-event-map' anyway.
-		   (delete-frame-functions (cons 'fancy-splash-delete-frame
-						 delete-frame-functions)))
-	      (define-key map [t] 'fancy-splash-default-action)
-	      (define-key map [mouse-movement] 'ignore)
-	      (define-key map [mode-line t] 'ignore)
-	      (define-key map [select-window] 'ignore)
-	      (setq cursor-type nil
-		    display-hourglass nil
-		    minor-mode-map-alist nil
-		    emulation-mode-map-alists nil
-		    buffer-undo-list t
-		    mode-line-format (propertize "---- %b %-"
-						 'face 'mode-line-buffer-id)
-		    fancy-splash-stop-time (+ (float-time)
-					      fancy-splash-max-time)
-		    timer (run-with-timer 0 fancy-splash-delay
-					  #'fancy-splash-screens-1
-					  splash-buffer))
-	      (recursive-edit))
-	  (cancel-timer timer)
-	  (setq display-hourglass old-hourglass
-		minor-mode-map-alist old-minor-mode-map-alist
-		emulation-mode-map-alists old-emulation-mode-map-alists)
-	  (kill-buffer splash-buffer)
-	  (when (frame-live-p frame)
-	    (select-frame frame)
-	    (switch-to-buffer fancy-splash-outer-buffer)))))))
+  (if hide-on-input
+      (let ((old-hourglass display-hourglass)
+	    (fancy-splash-outer-buffer (current-buffer))
+	    splash-buffer
+	    (old-minor-mode-map-alist minor-mode-map-alist)
+	    (old-emulation-mode-map-alists emulation-mode-map-alists)
+	    (frame (fancy-splash-frame))
+	    timer)
+	(save-selected-window
+	  (select-frame frame)
+	  (switch-to-buffer "GNU Emacs")
+	  (setq tab-width 20)
+	  (setq splash-buffer (current-buffer))
+	  (catch 'stop-splashing
+	    (unwind-protect
+		(let* ((map (make-sparse-keymap))
+		       (overriding-local-map map)
+		       ;; Catch if our frame is deleted; the delete-frame
+		       ;; event is unreliable and is handled by
+		       ;; `special-event-map' anyway.
+		       (delete-frame-functions (cons 'fancy-splash-delete-frame
+						     delete-frame-functions)))
+		  (define-key map [t] 'fancy-splash-default-action)
+		  (define-key map [mouse-movement] 'ignore)
+		  (define-key map [mode-line t] 'ignore)
+		  (define-key map [select-window] 'ignore)
+		  (setq cursor-type nil
+			display-hourglass nil
+			minor-mode-map-alist nil
+			emulation-mode-map-alists nil
+			buffer-undo-list t
+			mode-line-format (propertize "---- %b %-"
+						     'face 'mode-line-buffer-id)
+			fancy-splash-stop-time (+ (float-time)
+						  fancy-splash-max-time)
+			timer (run-with-timer 0 fancy-splash-delay
+					      #'fancy-splash-screens-1
+					      splash-buffer))
+		  (recursive-edit))
+	      (cancel-timer timer)
+	      (setq display-hourglass old-hourglass
+		    minor-mode-map-alist old-minor-mode-map-alist
+		    emulation-mode-map-alists old-emulation-mode-map-alists)
+	      (kill-buffer splash-buffer)
+	      (when (frame-live-p frame)
+		(select-frame frame)
+		(switch-to-buffer fancy-splash-outer-buffer))))))
+    ;; If hide-on-input is non-nil, don't hide the buffer on input.
+    (if (or (window-minibuffer-p)
+	    (window-dedicated-p (selected-window)))
+	(pop-to-buffer (current-buffer))
+      (switch-to-buffer "GNU Emacs"))
+    (erase-buffer)
+    (if pure-space-overflow
+	(insert "\
+Warning Warning!!!  Pure space overflow    !!!Warning Warning
+\(See the node Pure Storage in the Lisp manual for details.)\n"))
+    (let (fancy-splash-outer-buffer)
+      (fancy-splash-head)
+      (dolist (text fancy-splash-text)
+	(apply #'fancy-splash-insert text))
+      (fancy-splash-tail)
+      (set-buffer-modified-p nil)
+      (goto-char (point-min)))))
+
 
 (defun fancy-splash-frame ()
   "Return the frame to use for the fancy splash screen.
@@ -1412,14 +1436,16 @@
 	  (> window-height (+ image-height 19)))))))
 
 
-(defun normal-splash-screen ()
+(defun normal-splash-screen (&optional hide-on-input)
   "Display splash screen when Emacs starts."
   (let ((prev-buffer (current-buffer)))
     (unwind-protect
 	(with-current-buffer (get-buffer-create "GNU Emacs")
+	  (erase-buffer)
 	  (set (make-local-variable 'tab-width) 8)
-          (set (make-local-variable 'mode-line-format)
-               (propertize "---- %b %-" 'face 'mode-line-buffer-id))
+	  (if hide-on-input
+	      (set (make-local-variable 'mode-line-format)
+		   (propertize "---- %b %-" 'face 'mode-line-buffer-id)))
 
           (if pure-space-overflow
               (insert "\
@@ -1435,9 +1461,13 @@
                ", one component of the GNU/Linux operating system.\n"
              ", a part of the GNU operating system.\n"))
 
-          (unless (equal (buffer-name prev-buffer) "*scratch*")
-            (insert (substitute-command-keys
-                     "\nType \\[recenter] to begin editing your file.\n")))
+	  (if hide-on-input
+	      (insert (substitute-command-keys
+		       (concat
+			"\nType \\[recenter] to begin editing"
+			(if (equal (buffer-name prev-buffer) "*scratch*")
+			    ".\n"
+			  " your file.\n")))))
 
           (if (display-mouse-p)
               ;; The user can use the mouse to activate menus
@@ -1548,20 +1578,23 @@
 		       "type M-x recover-session RET\nto recover"
 		       " the files you were editing."))
 
-	  ;; Display the input that we set up in the buffer.
-	  (set-buffer-modified-p nil)
-	  (goto-char (point-min))
-          (if (or (window-minibuffer-p)
-                  (window-dedicated-p (selected-window)))
-              ;; There's no point is using pop-to-buffer since creating
-              ;; a new frame will generate enough events that the
-              ;; subsequent `sit-for' will immediately return anyway.
-              nil ;; (pop-to-buffer (current-buffer))
-            (save-window-excursion
-              (switch-to-buffer (current-buffer))
-              (sit-for 120))))
-    ;; Unwind ... ensure splash buffer is killed
-    (kill-buffer "GNU Emacs"))))
+          ;; Display the input that we set up in the buffer.
+          (set-buffer-modified-p nil)
+          (goto-char (point-min))
+	  (if (or (window-minibuffer-p)
+		  (window-dedicated-p (selected-window)))
+	      ;; If hide-on-input is nil, creating a new frame will
+	      ;; generate enough events that the subsequent `sit-for'
+	      ;; will immediately return anyway.
+	      (pop-to-buffer (current-buffer))
+	    (if hide-on-input
+		(save-window-excursion
+		  (switch-to-buffer (current-buffer))
+		  (sit-for 120))
+	      (switch-to-buffer (current-buffer)))))
+      ;; Unwind ... ensure splash buffer is killed
+      (if hide-on-input
+	  (kill-buffer "GNU Emacs")))))
 
 
 (defun startup-echo-area-message ()
@@ -1615,7 +1648,7 @@
 	  (message "%s" (startup-echo-area-message))))))
 
 
-(defun display-splash-screen ()
+(defun display-splash-screen (&optional hide-on-input)
   "Display splash screen according to display.
 Fancy splash screens are used on graphic displays,
 normal otherwise."
@@ -1623,8 +1656,8 @@
   ;; Prevent recursive calls from server-process-filter.
   (if (not (get-buffer "GNU Emacs"))
       (if (use-fancy-splash-screens-p)
-	  (fancy-splash-screens)
-	(normal-splash-screen))))
+	  (fancy-splash-screens hide-on-input)
+	(normal-splash-screen hide-on-input))))
 
 (defun command-line-1 (command-line-args-left)
   (display-startup-echo-area-message)
@@ -1888,7 +1921,7 @@
     ;; If user typed input during all that work,
     ;; abort the startup screen.  Otherwise, display it now.
     (unless (input-pending-p)
-      (display-splash-screen))))
+      (display-splash-screen t))))
 
 
 (defun command-line-normalize-file-name (file)
--- a/lisp/t-mouse.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/t-mouse.el	Sat Oct 14 16:56:21 2006 +0000
@@ -292,9 +292,7 @@
 				"-f")))
 	 (setq t-mouse-filter-accumulator "")
 	 (set-process-filter t-mouse-process 't-mouse-process-filter)
-; use commented line instead for emacs 21.4 onwards
-	 (process-kill-without-query t-mouse-process)))
-;	 (set-process-query-on-exit-flag t-mouse-process nil)))
+	 (set-process-query-on-exit-flag t-mouse-process nil)))
     ;; Turn it off
     (setq mouse-position-function nil)
     (delete-process t-mouse-process)
--- a/lisp/term/mac-win.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/term/mac-win.el	Sat Oct 14 16:56:21 2006 +0000
@@ -1539,7 +1539,7 @@
 (put 'autosave-now       'mac-apple-event-id "asav") ; kAEAutosaveNow
 ;; kAEInternetEventClass
 (put 'get-url            'mac-apple-event-id "GURL") ; kAEGetURL
-;; Converted HICommand events
+;; Converted HI command events
 (put 'about              'mac-apple-event-id "abou") ; kHICommandAbout
 
 (defmacro mac-event-spec (event)
@@ -1739,7 +1739,7 @@
 
 (define-key mac-apple-event-map [internet-event get-url] 'mac-ae-get-url)
 
-(define-key mac-apple-event-map [hicommand about] 'display-splash-screen)
+(define-key mac-apple-event-map [hi-command about] 'display-splash-screen)
 
 ;;; Converted Carbon Events
 (defun mac-handle-toolbar-switch-mode (event)
@@ -2208,7 +2208,8 @@
 	  ;; If dropping in an ordinary window which we could use,
 	  ;; let dnd-open-file-other-window specify what to do.
 	  (progn
-	    (goto-char (posn-point (event-start event)))
+	    (when (not mouse-yank-at-point)
+	      (goto-char (posn-point (event-start event))))
 	    (funcall handler window action data))
 	;; If we can't display the file here,
 	;; make a new window for it.
@@ -2561,8 +2562,8 @@
 
 ;; Initiate drag and drop
 
-(global-set-key [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event)
-(global-set-key [M-drag-n-drop] 'mac-dnd-handle-drag-n-drop-event)
+(define-key special-event-map [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event)
+(define-key special-event-map [M-drag-n-drop] 'mac-dnd-handle-drag-n-drop-event)
 
 
 ;;;; Non-toolkit Scroll bars
--- a/lisp/term/x-win.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/term/x-win.el	Sat Oct 14 16:56:21 2006 +0000
@@ -2386,7 +2386,7 @@
 
 (defun x-clipboard-yank ()
   "Insert the clipboard contents, or the last stretch of killed text."
-  (interactive)
+  (interactive "*")
   (let ((clipboard-text (x-selection-value 'CLIPBOARD))
 	(x-select-enable-clipboard t))
     (if (and clipboard-text (> (length clipboard-text) 0))
@@ -2518,8 +2518,9 @@
 
   ;; Override Paste so it looks at CLIPBOARD first.
   (define-key menu-bar-edit-menu [paste]
-    (cons "Paste" (cons "Paste text from clipboard or kill ring"
-			'x-clipboard-yank)))
+    '(menu-item "Paste" x-clipboard-yank
+		:enable (not buffer-read-only)
+		:help "Paste (yank) text most recently cut/copied"))
 
   (setq x-initialized t))
 
@@ -2531,7 +2532,7 @@
 
 ;; Initiate drag and drop
 (add-hook 'after-make-frame-functions 'x-dnd-init-frame)
-(global-set-key [drag-n-drop] 'x-dnd-handle-drag-n-drop-event)
+(define-key special-event-map [drag-n-drop] 'x-dnd-handle-drag-n-drop-event)
 
 ;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
 ;;; x-win.el ends here
--- a/lisp/term/xterm.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/term/xterm.el	Sat Oct 14 16:56:21 2006 +0000
@@ -159,8 +159,37 @@
 (define-key xterm-function-map "\e[4~" [select])
 (define-key xterm-function-map "\e[29~" [print])
 
-;; These keys are available in xterm starting from version 214
+;; These keys are available in xterm starting from version 216
 ;; if the modifyOtherKeys resource is set to 1.
+
+(define-key xterm-function-map "\e[27;5;39~"  [?\C-\'])
+(define-key xterm-function-map "\e[27;5;45~"  [?\C--])
+
+(define-key xterm-function-map "\e[27;5;48~"  [?\C-0])
+(define-key xterm-function-map "\e[27;5;49~"  [?\C-1])
+;; Not all C-DIGIT keys have a distinct binding.
+(define-key xterm-function-map "\e[27;5;57~"  [?\C-9])
+
+(define-key xterm-function-map "\e[27;5;59~"  [?\C-\;])
+(define-key xterm-function-map "\e[27;5;61~"  [?\C-=])
+
+
+(define-key xterm-function-map "\e[27;6;33~"  [?\C-!])
+(define-key xterm-function-map "\e[27;6;34~"  [?\C-\"])
+(define-key xterm-function-map "\e[27;6;35~"  [?\C-#])
+(define-key xterm-function-map "\e[27;6;36~"  [?\C-$])
+(define-key xterm-function-map "\e[27;6;37~"  [?\C-%])
+(define-key xterm-function-map "\e[27;6;38~"  [(C-&)])
+(define-key xterm-function-map "\e[27;6;40~"  [?\C-(])
+(define-key xterm-function-map "\e[27;6;41~"  [?\C-)])
+(define-key xterm-function-map "\e[27;6;42~"  [?\C-*])
+(define-key xterm-function-map "\e[27;6;43~"  [?\C-+])
+
+(define-key xterm-function-map "\e[27;6;58~"  [?\C-:])
+(define-key xterm-function-map "\e[27;6;60~"  [?\C-<])
+(define-key xterm-function-map "\e[27;6;62~"  [?\C->])
+(define-key xterm-function-map "\e[27;6;63~"  [(C-\?)])
+
 (define-key xterm-function-map "\e[27;5;9~"  [C-tab])
 (define-key xterm-function-map "\e[27;5;13~" [C-return])
 (define-key xterm-function-map "\e[27;5;44~" [?\C-,])
--- a/lisp/textmodes/dns-mode.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/textmodes/dns-mode.el	Sat Oct 14 16:56:21 2006 +0000
@@ -90,6 +90,18 @@
   :type 'sexp
   :group 'dns-mode)
 
+(defcustom dns-mode-soa-auto-increment-serial t
+  "Whether to increment the SOA serial number automatically.
+
+If this variable is t, the serial number is incremented upon each save of
+the file.  If it is `ask', Emacs asks for confirmation whether it should
+increment the serial upon saving.  If nil, serials must be incremented
+manually with \\[dns-mode-soa-increment-serial]."
+  :type '(choice (const :tag "Always" t)
+		 (const :tag "Ask" ask)
+		 (const :tag "Never" nil))
+  :group 'dns-mode)
+
 ;; Syntax table.
 
 (defvar dns-mode-syntax-table
@@ -135,8 +147,12 @@
   (unless (featurep 'xemacs)
     (set (make-local-variable 'font-lock-defaults)
 	 '(dns-mode-font-lock-keywords nil nil ((?_ . "w")))))
+  (add-hook 'before-save-hook 'dns-mode-soa-maybe-increment-serial
+	    nil t)
   (easy-menu-add dns-mode-menu dns-mode-map))
 
+;;;###autoload (defalias 'zone-mode 'dns-mode)
+
 ;; Tools.
 
 ;;;###autoload
@@ -192,6 +208,21 @@
 	      (message "Replaced old serial %s with %s" serial new))
 	  (error "Cannot locate serial number in SOA record"))))))
 
+(defun dns-mode-soa-maybe-increment-serial ()
+  "Increment SOA serial if needed.
+
+This function is run from `before-save-hook'."
+  (when (and (buffer-modified-p)
+	     dns-mode-soa-auto-increment-serial
+	     (or (eq dns-mode-soa-auto-increment-serial t)
+		 (y-or-n-p "Increment SOA serial? ")))
+    ;; If `dns-mode-soa-increment-serial' signals an error saving will
+    ;; fail but that probably means that the serial should be fixed to
+    ;; comply with the RFC anyway! -rfr
+    (progn (dns-mode-soa-increment-serial)
+	   ;; We return nil in case this is used in write-contents-functions.
+	   nil)))
+
 ;;;###autoload(add-to-list 'auto-mode-alist '("\\.soa\\'" . dns-mode))
 
 (provide 'dns-mode)
--- a/lisp/textmodes/org.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/textmodes/org.el	Sat Oct 14 16:56:21 2006 +0000
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <dominik at science dot uva dot nl>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
-;; Version: 4.43
+;; Version: 4.44
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -90,10 +90,12 @@
 ;;
 ;; Recent changes
 ;; --------------
+;; Version 4.44
+;;    - Clock table can be done for a limited time interval.
+;;    - Obsolete support for the old outline mode has been removed.
+;;    - Bug fixes and code cleaning.
+;;
 ;; Version 4.43
-;;    - Big fixes
-;;
-;; Version 4.42
 ;;    - Bug fixes
 ;;    - `s' key in the agenda saves all org-mode buffers.
 ;;
@@ -212,16 +214,13 @@
 
 ;;; Customization variables
 
-(defvar org-version "4.43"
+(defvar org-version "4.44"
   "The version number of the file org.el.")
 (defun org-version ()
   (interactive)
   (message "Org-mode version %s" org-version))
 
-;; The following constant is for compatibility with different versions
-;; of outline.el.
-(defconst org-noutline-p (featurep 'noutline)
-  "Are we using the new outline mode?")
+;; Compatibility constants
 (defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself
 (defconst org-format-transports-properties-p
   (let ((x "a"))
@@ -1132,7 +1131,7 @@
 file identifier are
  \"ext\"         A string identifying an extension
  `directory'   Matches a directory
- `remote'      Matches a remove file, accessible through tramp or efs.
+ `remote'      Matches a remote file, accessible through tramp or efs.
                Remote files most likely should be visited through emacs
                because external applications cannot handle such paths.
  t             Default for all remaining files
@@ -1831,6 +1830,7 @@
 
 (defcustom org-export-language-setup
   '(("en"  "Author"          "Date"  "Table of Contents")
+    ("cs"  "Autor"           "Datum" "Obsah")
     ("da"  "Ophavsmand"      "Dato"  "Indhold")
     ("de"  "Autor"           "Datum" "Inhaltsverzeichnis")
     ("es"  "Autor"           "Fecha" "\xccndice")
@@ -2150,6 +2150,16 @@
   :group 'org-export-html
   :type 'string)
 
+(defcustom org-export-html-title-format "<h1 class=\"title\">%s</h1>\n"
+  "Format for typesetting the document title in HTML export."
+  :group 'org-export-html
+  :type 'string)
+
+(defcustom org-export-html-toplevel-hlevel 2
+  "The <H> level for level 1 headings in HTML export."
+  :group 'org-export-html
+  :type 'string)
+
 (defcustom org-export-html-link-org-files-as-html t
   "Non-nil means, make file links to `file.org' point to `file.html'.
 When org-mode is exporting an org-mode file to HTML, links to
@@ -2694,6 +2704,10 @@
   (remove-text-properties 0 (length s) org-rm-props s)
   s)
 
+(defsubst org-set-local (var value)
+  "Make VAR local in current buffer and set it to VALUE."
+  (set (make-variable-buffer-local var) value))
+
 (defsubst org-mode-p ()
   "Check if the current buffer is in Org-mode."
   (eq major-mode 'org-mode))
@@ -2703,7 +2717,7 @@
   (when (org-mode-p)
     (let ((re (org-make-options-regexp
 	       '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
-		 "STARTUP" "ARCHIVE" "TAGS")))
+		 "STARTUP" "ARCHIVE" "TAGS" "CALC")))
 	  (splitre "[ \t]+")
 	  kwds int key value cat arch tags)
       (save-excursion
@@ -2755,10 +2769,10 @@
 	      (remove-text-properties 0 (length arch)
 				      '(face t fontified t) arch)))
 	    )))
-      (and cat (set (make-local-variable 'org-category) cat))
-      (and kwds (set (make-local-variable 'org-todo-keywords) kwds))
-      (and arch (set (make-local-variable 'org-archive-location) arch))
-      (and int (set (make-local-variable 'org-todo-interpretation) int))
+      (and cat (org-set-local 'org-category cat))
+      (and kwds (org-set-local 'org-todo-keywords kwds))
+      (and arch (org-set-local 'org-archive-location arch))
+      (and int (org-set-local 'org-todo-interpretation int))
       (when tags
 	(let (e tgs)
 	  (while (setq e (pop tags))
@@ -2770,7 +2784,7 @@
 			  (string-to-char (match-string 2 e)))
 		    tgs))
 	     (t (push (list e) tgs))))
-	  (set (make-local-variable 'org-tag-alist) nil)
+	  (org-set-local 'org-tag-alist nil)
 	  (while (setq e (pop tgs))
 	    (or (and (stringp (car e))
 		     (assoc (car e) org-tag-alist))
@@ -2928,15 +2942,11 @@
   ;; Need to do this here because define-derived-mode sets up
   ;; the keymap so late.
   (if (featurep 'xemacs)
-      (if org-noutline-p
-	  (progn
-	    (easy-menu-remove outline-mode-menu-heading)
-	    (easy-menu-remove outline-mode-menu-show)
-	    (easy-menu-remove outline-mode-menu-hide))
-	(delete-menu-item '("Headings"))
-	(delete-menu-item '("Show"))
-	(delete-menu-item '("Hide"))
-	(set-menubar-dirty-flag))
+      (progn
+	;; Assume this is Greg's port, it used easymenu
+	(easy-menu-remove outline-mode-menu-heading)
+	(easy-menu-remove outline-mode-menu-show)
+	(easy-menu-remove outline-mode-menu-hide))
     (define-key org-mode-map [menu-bar headings] 'undefined)
     (define-key org-mode-map [menu-bar hide] 'undefined)
     (define-key org-mode-map [menu-bar show] 'undefined))
@@ -2947,7 +2957,7 @@
   (if org-descriptive-links (org-add-to-invisibility-spec '(org-link)))
   (org-add-to-invisibility-spec '(org-cwidth))
   (when (featurep 'xemacs)
-    (set (make-local-variable 'line-move-ignore-invisible) t))
+    (org-set-local 'line-move-ignore-invisible t))
   (setq outline-regexp "\\*+")
   ;;(setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)")
   (setq outline-level 'org-outline-level)
@@ -2958,12 +2968,14 @@
 			    4 (string-to-vector org-ellipsis))
     (setq buffer-display-table org-display-table))
   (org-set-regexps-and-options)
+  ;; Calc embedded
+  (org-set-local 'calc-embedded-open-mode "# ")
   (modify-syntax-entry ?# "<")
   (if org-startup-truncated (setq truncate-lines t))
-  (set (make-local-variable 'font-lock-unfontify-region-function)
-       'org-unfontify-region)
+  (org-set-local 'font-lock-unfontify-region-function
+		 'org-unfontify-region)
   ;; Activate before-change-function
-  (set (make-local-variable 'org-table-may-need-update) t)
+  (org-set-local 'org-table-may-need-update t)
   (org-add-hook 'before-change-functions 'org-before-change-function nil
 		'local)
   ;; Check for running clock before killing a buffer
@@ -3107,7 +3119,7 @@
 				 org-ts-regexp "\\)?")
   "Regular expression matching a time stamp or time stamp range.")
 
-(defvar org-§emph-face nil)
+(defvar org-§emph-face nil)
 
 (defun org-do-emphasis-faces (limit)
   "Run through the buffer and add overlays to links."
@@ -3340,10 +3352,9 @@
 	   )))
     (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
     ;; Now set the full font-lock-keywords
-    (set (make-local-variable 'org-font-lock-keywords)
-	 org-font-lock-extra-keywords)
-    (set (make-local-variable 'font-lock-defaults)
-	 '(org-font-lock-keywords t nil nil backward-paragraph))
+    (org-set-local 'org-font-lock-keywords org-font-lock-extra-keywords)
+    (org-set-local 'font-lock-defaults
+		   '(org-font-lock-keywords t nil nil backward-paragraph))
     (kill-local-variable 'font-lock-keywords) nil))
 
 (defvar org-m nil)
@@ -3812,9 +3823,7 @@
     (org-insert-heading)
     (save-excursion
       (org-back-to-heading)
-      (if org-noutline-p
-	  (outline-previous-heading)
-	(outline-previous-visible-heading t))
+      (outline-previous-heading)
       (looking-at org-todo-line-regexp))
     (if (or arg
 	    (not (match-beginning 2))
@@ -4703,7 +4712,7 @@
 	(pc '(:org-comment t))
 	(pall '(:org-archived t :org-comment t))
 	(rea (concat ":" org-archive-tag ":"))
-	bmp file re)
+	     bmp file re)
     (save-excursion
       (while (setq file (pop files))
 	(org-check-agenda-file file)
@@ -4775,7 +4784,7 @@
     pos))
 
 (defconst org-dblock-start-re
-  "^#\\+BEGIN:[ \t]+\\(\\S-+\\)[ \t]+\\(.*\\)"
+  "^#\\+BEGIN:[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?"
   "Matches the startline of a dynamic block, with parameters.")
 
 (defconst org-dblock-end-re "^#\\+END\\([: \t\r\n]\\|$\\)"
@@ -4803,7 +4812,7 @@
   (let* ((begdel (1+ (match-end 0)))
 	 (name (match-string 1))
 	 (params (append (list :name name)
-			 (read (concat "(" (match-string 2) ")")))))
+			 (read (concat "(" (match-string 3) ")")))))
     (unless (re-search-forward org-dblock-end-re nil t)
       (error "Dynamic block not terminated"))
     (delete-region begdel (match-beginning 0))
@@ -5200,7 +5209,6 @@
 that the match should indeed be shown."
   (interactive "sRegexp: ")
   (org-remove-occur-highlights nil nil t)
-  (setq regexp (org-check-occur-regexp regexp))
   (let ((cnt 0))
     (save-excursion
       (goto-char (point-min))
@@ -5625,56 +5633,58 @@
 For time difference computation, a year is assumed to be exactly 365
 days in order to avoid rounding problems."
   (interactive "P")
-  (save-excursion
-    (unless (org-at-date-range-p)
-      (goto-char (point-at-bol))
-      (re-search-forward org-tr-regexp (point-at-eol) t))
-    (if (not (org-at-date-range-p))
-	(error "Not at a time-stamp range, and none found in current line")))
-  (let* ((ts1 (match-string 1))
-	 (ts2 (match-string 2))
-	 (havetime (or (> (length ts1) 15) (> (length ts2) 15)))
-	 (match-end (match-end 0))
-	 (time1 (org-time-string-to-time ts1))
-	 (time2 (org-time-string-to-time ts2))
-	 (t1 (time-to-seconds time1))
-	 (t2 (time-to-seconds time2))
-	 (diff (abs (- t2 t1)))
-	 (negative (< (- t2 t1) 0))
-	 ;; (ys (floor (* 365 24 60 60)))
-	 (ds (* 24 60 60))
-	 (hs (* 60 60))
-	 (fy "%dy %dd %02d:%02d")
-	 (fy1 "%dy %dd")
-	 (fd "%dd %02d:%02d")
-	 (fd1 "%dd")
-	 (fh "%02d:%02d")
-	 y d h m align)
-    (if havetime
-	(setq ; y (floor (/ diff ys))  diff (mod diff ys)
-	 y 0
-	 d (floor (/ diff ds))  diff (mod diff ds)
-	 h (floor (/ diff hs))  diff (mod diff hs)
-	 m (floor (/ diff 60)))
-      (setq ; y (floor (/ diff ys))  diff (mod diff ys)
-       y 0
-       d (floor (+ (/ diff ds) 0.5))
-       h 0 m 0))
-    (if (not to-buffer)
-	(message (org-make-tdiff-string y d h m))
-      (when (org-at-table-p)
-	(goto-char match-end)
-	(setq align t)
-	(and (looking-at " *|") (goto-char (match-end 0))))
-      (if (looking-at
-	   "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]")
-	  (replace-match ""))
-      (if negative (insert " -"))
-      (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m))
-	(if (> d 0) (insert " " (format (if havetime fd fd1) d h m))
-	  (insert " " (format fh h m))))
-      (if align (org-table-align))
-      (message "Time difference inserted"))))
+  (or
+   (org-clock-update-time-maybe)
+   (save-excursion
+     (unless (org-at-date-range-p)
+       (goto-char (point-at-bol))
+       (re-search-forward org-tr-regexp (point-at-eol) t))
+     (if (not (org-at-date-range-p))
+	 (error "Not at a time-stamp range, and none found in current line")))
+   (let* ((ts1 (match-string 1))
+	  (ts2 (match-string 2))
+	  (havetime (or (> (length ts1) 15) (> (length ts2) 15)))
+	  (match-end (match-end 0))
+	  (time1 (org-time-string-to-time ts1))
+	  (time2 (org-time-string-to-time ts2))
+	  (t1 (time-to-seconds time1))
+	  (t2 (time-to-seconds time2))
+	  (diff (abs (- t2 t1)))
+	  (negative (< (- t2 t1) 0))
+	  ;; (ys (floor (* 365 24 60 60)))
+	  (ds (* 24 60 60))
+	  (hs (* 60 60))
+	  (fy "%dy %dd %02d:%02d")
+	  (fy1 "%dy %dd")
+	  (fd "%dd %02d:%02d")
+	  (fd1 "%dd")
+	  (fh "%02d:%02d")
+	  y d h m align)
+     (if havetime
+	 (setq ; y (floor (/ diff ys))  diff (mod diff ys)
+	  y 0
+	  d (floor (/ diff ds))  diff (mod diff ds)
+	  h (floor (/ diff hs))  diff (mod diff hs)
+	  m (floor (/ diff 60)))
+       (setq ; y (floor (/ diff ys))  diff (mod diff ys)
+	y 0
+	d (floor (+ (/ diff ds) 0.5))
+	h 0 m 0))
+     (if (not to-buffer)
+	 (message (org-make-tdiff-string y d h m))
+       (when (org-at-table-p)
+	 (goto-char match-end)
+	 (setq align t)
+	 (and (looking-at " *|") (goto-char (match-end 0))))
+       (if (looking-at
+	    "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]")
+	   (replace-match ""))
+       (if negative (insert " -"))
+       (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m))
+	 (if (> d 0) (insert " " (format (if havetime fd fd1) d h m))
+	   (insert " " (format fh h m))))
+       (if align (org-table-align))
+       (message "Time difference inserted")))))
 
 (defun org-make-tdiff-string (y d h m)
   (let ((fmt "")
@@ -5817,6 +5827,7 @@
 	  (setcar (nthcdr 2 time0) (or (nth 1 time0) 0))
 	  (setq time (apply 'encode-time time0))))
     (insert (setq org-last-changed-timestamp (format-time-string fmt time)))
+    (org-clock-update-time-maybe)
     (goto-char pos)
     ;; Try to recenter the calendar window, if any
     (if (and org-calendar-follow-timestamp-change
@@ -5937,18 +5948,19 @@
   "Holds the file total time in minutes, after a call to `org-clock-sum'.")
   (make-variable-buffer-local 'org-clock-file-total-minutes)
 
-(defun org-clock-sum ()
+(defun org-clock-sum (&optional tstart tend)
   "Sum the times for each subtree.
 Puts the resulting times in minutes as a text property on each headline."
   (interactive)
   (let* ((bmp (buffer-modified-p))
 	 (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*"
 		     org-clock-string
-		     ".*=>[ \t]*\\([0-9]+\\):\\([0-9]+\\)[ \t]*$"))
+		     "[ \t]*\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)"))
 	 (lmax 30)
 	 (ltimes (make-vector lmax 0))
 	 (t1 0)
 	 (level 0)
+	 ts te dt
 	 time)
     (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t))
     (save-excursion
@@ -5956,8 +5968,16 @@
       (while (re-search-backward re nil t)
 	(if (match-end 2)
 	    ;; A time
-	    (setq t1 (+ t1 (* 60 (string-to-number (match-string 2)))
-			(string-to-number (match-string 3))))
+	    (setq ts (match-string 2)
+		  te (match-string 3)
+		  ts (time-to-seconds
+		      (apply 'encode-time (org-parse-time-string ts)))
+		  te (time-to-seconds
+		      (apply 'encode-time (org-parse-time-string te)))
+		  ts (if tstart (max ts tstart) ts)
+		  te (if tend (min te tend) te)
+		  dt (- te ts)
+		  t1 (if (> dt 0) (+ t1 (floor (/ dt 60))) t1))
 	  ;; A headline
 	  (setq level (- (match-end 1) (match-beginning 1)))
 	  (when (or (> t1 0) (> (aref ltimes level) 0))
@@ -6069,26 +6089,112 @@
   (interactive)
   (org-remove-clock-overlays)
   (unless (org-find-dblock "clocktable")
-    (org-create-dblock  (list :name "clocktable"
-			      :maxlevel 2 :emphasize nil)))
+    (org-create-dblock (list :name "clocktable"
+			     :maxlevel 2 :emphasize nil)))
   (org-update-dblock))
 
+(defun org-clock-update-time-maybe ()
+  "If this is a CLOCK line, update it and return t.
+Otherwise, return nil."
+  (interactive)
+  (save-excursion
+    (beginning-of-line 1)
+    (skip-chars-forward " \t")
+    (when (looking-at org-clock-string)
+      (let ((re (concat "[ \t]*" org-clock-string
+			" *[[<]\\([^]>]+\\)[]>]-+[[<]\\([^]>]+\\)[]>]"
+			"\\([ \t]*=>.*\\)?"))
+	    ts te h m s)
+	(if (not (looking-at re))
+	    nil
+	  (and (match-end 3) (delete-region (match-beginning 3) (match-end 3)))
+	  (end-of-line 1)
+	  (setq ts (match-string 1)
+		te (match-string 2))
+	  (setq s (- (time-to-seconds
+		      (apply 'encode-time (org-parse-time-string te)))
+		     (time-to-seconds
+		      (apply 'encode-time (org-parse-time-string ts))))
+		h (floor (/ s 3600))
+		s (- s (* 3600 h))
+		m (floor (/ s 60))
+		s (- s (* 60 s)))
+	  (insert " => " (format "%2d:%02d" h m))
+	  t)))))
+
+(defun org-clock-special-range (key &optional time as-strings)
+  "Return two times bordering a special time range.
+Key is a symbol specifying the range and can be one of `today', `yesterday',
+`thisweek', `lastweek', `thismonth', `lastmonth', `thisyear', `lastyear'.
+A week starts Monday 0:00 and ends Sunday 24:00.
+The range is determined relative to TIME.  TIME defaults to the current time.
+The return value is a cons cell with two internal times like the ones
+returned by `current time' or `encode-time'. if AS-STRINGS is non-nil,
+the returned times will be formatted strings."
+  (let* ((tm (decode-time (or time (current-time))))
+	 (s 0) (m (nth 1 tm)) (h (nth 2 tm))
+	 (d (nth 3 tm)) (month (nth 4 tm)) (y (nth 5 tm))
+	 (dow (nth 6 tm))
+	 s1 m1 h1 d1 month1 y1 diff ts te fm)
+    (cond
+     ((eq key 'today)
+      (setq h 0 m 0 h1 24 m1 0))
+     ((eq key 'yesterday)
+      (setq d (1- d) h 0 m 0 h1 24 m1 0))
+     ((eq key 'thisweek)
+      (setq diff (if (= dow 0) 6 (1- dow))
+	    m 0 h 0 d (- d diff) d1 (+ 7 d)))
+     ((eq key 'lastweek)
+      (setq diff (+ 7 (if (= dow 0) 6 (1- dow)))
+	    m 0 h 0 d (- d diff) d1 (+ 7 d)))
+     ((eq key 'thismonth)
+      (setq d 1 h 0 m 0 d1 1 month1 (1+ month) h1 0 m1 0))
+     ((eq key 'lastmonth)
+      (setq d 1 h 0 m 0 d1 1 month (1- month) month1 (1+ month) h1 0 m1 0))
+     ((eq key 'thisyear)
+      (setq m 0 h 0 d 1 month 1 y1 (1+ y)))
+     ((eq key 'lastyear)
+      (setq m 0 h 0 d 1 month 1 y (1- y) y1 (1+ y)))
+     (t (error "No such time block %s" key)))
+    (setq ts (encode-time s m h d month y)
+	  te (encode-time (or s1 s) (or m1 m) (or h1 h)
+			  (or d1 d) (or month1 month) (or y1 y)))
+    (setq fm (cdr org-time-stamp-formats))
+    (if as-strings
+	(cons (format-time-string fm ts) (format-time-string fm te))
+      (cons ts te))))
+
 (defun org-dblock-write:clocktable (params)
   "Write the standard clocktable."
   (let ((hlchars '((1 . "*") (2 . ?/)))
 	(emph nil)
 	(ins (make-marker))
-	ipos time h m p level hlc hdl maxlevel)
+	ipos time h m p level hlc hdl maxlevel
+	ts te cc block)
     (setq maxlevel (or (plist-get params :maxlevel) 3)
-	  emph (plist-get params :emphasize))
+	  emph (plist-get params :emphasize)
+	  ts (plist-get params :tstart)
+	  te (plist-get params :tend)
+	  block (plist-get params :block))
+    (when block
+      (setq cc (org-clock-special-range block nil t)
+	    ts (car cc) te (cdr cc)))
+    (if ts (setq ts (time-to-seconds
+		     (apply 'encode-time (org-parse-time-string ts)))))
+    (if te (setq te (time-to-seconds
+		     (apply 'encode-time (org-parse-time-string te)))))
     (move-marker ins (point))
     (setq ipos (point))
     (insert-before-markers "Clock summary at [" 
 			   (substring
 			    (format-time-string (cdr org-time-stamp-formats))
 			    1 -1)
-			   "]\n|L|Headline|Time|\n")
-    (org-clock-sum)
+			   "]."
+			   (if block 
+			       (format "  Considered range is /%s/." block)
+			     "")
+			   "\n\n|L|Headline|Time|\n")
+    (org-clock-sum ts te)
     (setq h (/ org-clock-file-total-minutes 60)
 	  m (- org-clock-file-total-minutes (* 60 h)))
     (insert-before-markers "|-\n|0|" "*Total file time*| "
@@ -6475,7 +6581,7 @@
   (if (stringp org-agenda-files)
       (let ((cw (current-window-configuration)))
 	(find-file org-agenda-files)
-	(set (make-local-variable 'org-window-configuration) cw)
+	(org-set-local 'org-window-configuration cw)
 	(org-add-hook 'after-save-hook
 		      (lambda ()
 			(set-window-configuration
@@ -6603,7 +6709,7 @@
     (setq buffer-read-only nil)
     (erase-buffer)
     (org-agenda-mode) (setq buffer-read-only nil)
-    (set (make-local-variable 'org-agenda-type) 'timeline)
+    (org-set-local 'org-agenda-type 'timeline)
     (if doclosed (push :closed args))
     (push :timestamp args)
     (if dotodo (push :todo args))
@@ -6701,9 +6807,9 @@
     (setq buffer-read-only nil)
     (erase-buffer)
     (org-agenda-mode) (setq buffer-read-only nil)
-    (set (make-local-variable 'org-agenda-type) 'agenda)
-    (set (make-local-variable 'starting-day) (car day-numbers))
-    (set (make-local-variable 'include-all-loc) include-all)
+    (org-set-local 'org-agenda-type 'agenda)
+    (org-set-local 'starting-day (car day-numbers))
+    (org-set-local 'include-all-loc include-all)
     (when (and (or include-all org-agenda-include-all-todo)
 	       (member today day-numbers))
       (setq files thefiles
@@ -6812,11 +6918,11 @@
     (setq buffer-read-only nil)
     (erase-buffer)
     (org-agenda-mode) (setq buffer-read-only nil)
-    (set (make-local-variable 'org-agenda-type) 'todo)
-    (set (make-local-variable 'last-arg) arg)
-    (set (make-local-variable 'org-todo-keywords) kwds)
-    (set (make-local-variable 'org-agenda-redo-command)
-	 '(org-todo-list (or current-prefix-arg last-arg) t))
+    (org-set-local 'org-agenda-type 'todo)
+    (org-set-local 'last-arg arg)
+    (org-set-local 'org-todo-keywords kwds)
+    (org-set-local 'org-agenda-redo-command
+		   '(org-todo-list (or current-prefix-arg last-arg) t))
     (setq files (org-agenda-files)
 	  rtnall nil)
     (org-prepare-agenda-buffers files)
@@ -7704,11 +7810,12 @@
 			      (abbreviate-file-name buffer-file-name))))
 	 (regexp org-tr-regexp)
 	 (d0 (calendar-absolute-from-gregorian date))
-	 marker hdmarker ee txt d1 d2 s1 s2 timestr category tags)
+	 marker hdmarker ee txt d1 d2 s1 s2 timestr category tags pos)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
 	(org-agenda-skip)
+	(setq pos (point))
 	(setq timestr (match-string 0)
 	      s1 (match-string 1)
 	      s2 (match-string 2)
@@ -7736,7 +7843,8 @@
 		'org-marker marker 'org-hd-marker hdmarker
 		'priority (org-get-priority txt) 'category category)
 	      (push txt ee)))
-	(outline-next-heading)))
+	(goto-char pos)))
+;	(outline-next-heading))) ;FIXME: correct to be removed??????
     ;; Sort the entries by expiration date.
     (nreverse ee)))
 
@@ -7757,7 +7865,7 @@
 
 (defconst org-stamp-time-of-day-regexp
   (concat
-   "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +[a-zA-Z]+ +\\)"
+   "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +\\sw+ +\\)"
    "\\([012][0-9]:[0-5][0-9]\\)>"
    "\\(--?"
    "<\\1\\([012][0-9]:[0-5][0-9]\\)>\\)?")
@@ -8620,10 +8728,10 @@
     (setq buffer-read-only nil)
     (erase-buffer)
     (org-agenda-mode) (setq buffer-read-only nil)
-    (set (make-local-variable 'org-agenda-type) 'tags)
-    (set (make-local-variable 'org-agenda-redo-command)
-	 (list 'org-tags-view (list 'quote todo-only)
-	       (list 'if 'current-prefix-arg nil match) t))
+    (org-set-local 'org-agenda-type 'tags)
+    (org-set-local 'org-agenda-redo-command
+		   (list 'org-tags-view (list 'quote todo-only)
+			 (list 'if 'current-prefix-arg nil match) t))
     (setq files (org-agenda-files)
 	  rtnall nil)
     (org-prepare-agenda-buffers files)
@@ -9359,6 +9467,7 @@
   "Follow a Gnus link to GROUP and ARTICLE."
   (require 'gnus)
   (funcall (cdr (assq 'gnus org-link-frame-setup)))
+  (if gnus-other-frame-object (select-frame gnus-other-frame-object))
   (if group (gnus-fetch-group group))
   (if article
       (or (gnus-summary-goto-article article nil 'force)
@@ -10234,13 +10343,13 @@
 	      (org-startup-with-deadline-check nil))
 	  (org-mode))
 	(if (and file (string-match "\\S-" file) (not (file-directory-p file)))
-	    (set (make-local-variable 'org-default-notes-file) file))
+	    (org-set-local 'org-default-notes-file file))
 	(goto-char (point-min))
 	(if (re-search-forward "%\\?" nil t) (replace-match "")))
     (let ((org-startup-folded nil)
 	  (org-startup-with-deadline-check nil))
       (org-mode)))
-  (set (make-local-variable 'org-finish-function) 'remember-buffer))
+  (org-set-local 'org-finish-function 'remember-buffer))
 
 ;;;###autoload
 (defun org-remember-handler ()
@@ -11492,10 +11601,10 @@
 			      '(invisible t org-cwidth t display t
 					  intangible t))
       (goto-char p)
-      (set (make-local-variable 'org-finish-function)
-	   'org-table-finish-edit-field)
-      (set (make-local-variable 'org-window-configuration) cw)
-      (set (make-local-variable 'org-field-marker) pos)
+      (org-set-local 'org-finish-function
+		     'org-table-finish-edit-field)
+      (org-set-local 'org-window-configuration cw)
+      (org-set-local 'org-field-marker pos)
       (message "Edit and finish with C-c C-c"))))
 
 (defun org-table-finish-edit-field ()
@@ -12098,10 +12207,11 @@
 	  (setq formula (car tmp)
 		fmt (concat (cdr (assoc "%" org-table-local-parameters))
 			    (nth 1 tmp)))
-	  (while (string-match "[pnfse]\\(-?[0-9]+\\)" fmt)
+	  (while (string-match "\\([pnfse]\\)\\(-?[0-9]+\\)" fmt)
 	    (setq c (string-to-char (match-string 1 fmt))
-		  n (string-to-number (or (match-string 1 fmt) "")))
-	    (if (= c ?p) (setq modes (org-set-calc-mode 'calc-internal-prec n))
+		  n (string-to-number (match-string 2 fmt)))
+	    (if (= c ?p)
+		(setq modes (org-set-calc-mode 'calc-internal-prec n))
 	      (setq modes (org-set-calc-mode
 			   'calc-float-format
 			   (list (cdr (assoc c '((?n . float) (?f . fix)
@@ -12314,8 +12424,8 @@
     (switch-to-buffer-other-window "*Edit Formulas*")
     (erase-buffer)
     (fundamental-mode)
-    (set (make-local-variable 'org-pos) pos)
-    (set (make-local-variable 'org-window-configuration) wc)
+    (org-set-local 'org-pos pos)
+    (org-set-local 'org-window-configuration wc)
     (use-local-map org-edit-formulas-map)
     (setq s "# Edit formulas and finish with `C-c C-c'.
 # Use `C-u C-c C-c' to also appy them immediately to the entire table.
@@ -12481,15 +12591,15 @@
 	  (let ((c (assq 'orgtbl-mode minor-mode-map-alist)))
 	    (and c (setq minor-mode-map-alist
 			 (cons c (delq c minor-mode-map-alist)))))
-	  (set (make-local-variable (quote org-table-may-need-update)) t)
+	  (org-set-local (quote org-table-may-need-update) t)
 	  (org-add-hook 'before-change-functions 'org-before-change-function
 			nil 'local)
-	  (set (make-local-variable 'org-old-auto-fill-inhibit-regexp)
-	       auto-fill-inhibit-regexp)
-	  (set (make-local-variable 'auto-fill-inhibit-regexp)
-	       (if auto-fill-inhibit-regexp
-		   (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp)
-		 "[ \t]*|"))
+	  (org-set-local 'org-old-auto-fill-inhibit-regexp
+			 auto-fill-inhibit-regexp)
+	  (org-set-local 'auto-fill-inhibit-regexp
+			 (if auto-fill-inhibit-regexp
+			     (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp)
+			   "[ \t]*|"))
 	  (org-add-to-invisibility-spec '(org-cwidth))
 	  (easy-menu-add orgtbl-mode-menu)
 	  (run-hooks 'orgtbl-mode-hook))
@@ -13388,7 +13498,7 @@
 	      (set (make-local-variable (cdr x))
 		   (plist-get opt-plist (car x))))
 	    org-export-plist-vars)
-    (set (make-local-variable 'org-odd-levels-only) odd)
+    (org-set-local 'org-odd-levels-only odd)
     (setq umax (if arg (prefix-numeric-value arg)
 		 org-export-headline-levels))
 
@@ -13594,22 +13704,15 @@
       (goto-char (point-min)))))
 
 (defun org-find-visible ()
-  (if (featurep 'noutline)
-      (let ((s (point)))
-	(while (and (not (= (point-max) (setq s (next-overlay-change s))))
-		    (get-char-property s 'invisible)))
-	s)
-    (skip-chars-forward "^\n")
-    (point)))
+  (let ((s (point)))
+    (while (and (not (= (point-max) (setq s (next-overlay-change s))))
+		(get-char-property s 'invisible)))
+    s))
 (defun org-find-invisible ()
-  (if (featurep 'noutline)
-      (let ((s (point)))
-	(while (and (not (= (point-max) (setq s (next-overlay-change s))))
-		    (not (get-char-property s 'invisible))))
-	s)
-    (skip-chars-forward "^\r")
-    (point)))
-
+  (let ((s (point)))
+    (while (and (not (= (point-max) (setq s (next-overlay-change s))))
+		(not (get-char-property s 'invisible))))
+    s))
 
 ;; HTML
 
@@ -13859,14 +13962,16 @@
       (insert (or (plist-get opt-plist :preamble) ""))
 
       (when (plist-get opt-plist :auto-preamble)
-	(if title     (insert (concat "<h1 class=\"title\">"
-				      (org-html-expand title) "</h1>\n")))
-
+	(if title     (insert (format org-export-html-title-format
+				      (org-html-expand title))))
 	(if text      (insert "<p>\n" (org-html-expand text) "</p>")))
 
       (if org-export-with-toc
 	  (progn
-	    (insert (format "<h2>%s</h2>\n" (nth 3 lang-words)))
+	    (insert (format "<h%d>%s</h%d>\n"
+			    org-export-html-toplevel-hlevel
+			    (nth 3 lang-words)
+			    org-export-html-toplevel-hlevel))
 	    (insert "<ul>\n<li>")
 	    (setq lines
 	    (mapcar '(lambda (line)
@@ -14553,7 +14658,7 @@
 	      (insert "<ul>\n<li>" title "<br/>\n")))
 	(if org-export-with-section-numbers
 	    (setq title (concat (org-section-number level) " " title)))
-	(setq level (+ level 1))
+	(setq level (+ level org-export-html-toplevel-hlevel -1))
 	(if with-toc
 	    (insert (format "\n<h%d><a name=\"sec-%d\">%s</a></h%d>\n"
 			    level head-count title level))
@@ -15763,6 +15868,10 @@
     "--"
     ("TODO Lists"
      ["TODO/DONE/-" org-todo t]
+     ("Select keyword"
+      ["Next keyword" org-shiftright (org-on-heading-p)]
+      ["Previous keyword" org-shiftleft (org-on-heading-p)]
+      ["Complete Keyword" org-complete (assq :todo-keyword (org-context))])
      ["Show TODO Tree" org-show-todo-tree t]
      ["Global TODO list" org-todo-list t]
      "--"
@@ -16042,31 +16151,32 @@
   ;; In the paragraph separator we include headlines, because filling
   ;; text in a line directly attached to a headline would otherwise
   ;; fill the headline as well.
-  (set (make-local-variable 'comment-start-skip) "^#+[ \t]*")
-  (set (make-local-variable 'paragraph-separate) "\f\\|\\*\\|[ 	]*$\\|[ \t]*[:|]")
+  (org-set-local 'comment-start-skip "^#+[ \t]*")
+  (org-set-local 'paragraph-separate "\f\\|\\*\\|[ 	]*$\\|[ \t]*[:|]")
   ;; The paragraph starter includes hand-formatted lists.
-  (set (make-local-variable 'paragraph-start)
-       "\f\\|[ 	]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]")
+  (org-set-local 'paragraph-start
+		 "\f\\|[ 	]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]")
   ;; Inhibit auto-fill for headers, tables and fixed-width lines.
   ;; But only if the user has not turned off tables or fixed-width regions
-  (set (make-local-variable 'auto-fill-inhibit-regexp)
-       (concat "\\*\\|#"
-	       "\\|[ \t]*" org-keyword-time-regexp
-	       (if (or org-enable-table-editor org-enable-fixed-width-editor)
-		   (concat
-		    "\\|[ \t]*["
-		    (if org-enable-table-editor "|" "")
-		    (if org-enable-fixed-width-editor ":"  "")
-		    "]"))))
+  (org-set-local
+   'auto-fill-inhibit-regexp
+   (concat "\\*\\|#"
+	   "\\|[ \t]*" org-keyword-time-regexp
+	   (if (or org-enable-table-editor org-enable-fixed-width-editor)
+	       (concat
+		"\\|[ \t]*["
+		(if org-enable-table-editor "|" "")
+		(if org-enable-fixed-width-editor ":"  "")
+		"]"))))
   ;; We use our own fill-paragraph function, to make sure that tables
   ;; and fixed-width regions are not wrapped.  That function will pass
   ;; through to `fill-paragraph' when appropriate.
-  (set (make-local-variable 'fill-paragraph-function) 'org-fill-paragraph)
-  ;; Adaptive filling: To get full control, first make sure that
+  (org-set-local 'fill-paragraph-function 'org-fill-paragraph)
+  ; Adaptive filling: To get full control, first make sure that
   ;; `adaptive-fill-regexp' never matches.  Then install our own matcher.
-  (set (make-local-variable 'adaptive-fill-regexp) "\000")
-  (set (make-local-variable 'adaptive-fill-function)
-       'org-adaptive-fill-function))
+  (org-set-local 'adaptive-fill-regexp "\000")
+  (org-set-local 'adaptive-fill-function
+		 'org-adaptive-fill-function))
 
 (defun org-fill-paragraph (&optional justify)
   "Re-align a table, pass through to fill-paragraph if no table."
@@ -16145,18 +16255,7 @@
 			  t)
 	      "\\'"))))
 
-;; Functions needed for compatibility with old outline.el.
-
-;; Programming for the old outline.el (that uses selective display
-;; instead of `invisible' text properties) is a nightmare, mostly
-;; because regular expressions can no longer be anchored at
-;; beginning/end of line.  Therefore a number of function need special
-;; treatment when the old outline.el is being used.
-
-;; The following functions capture almost the entire compatibility code
-;; between the different versions of outline-mode.  The only other
-;; places where this is important are the font-lock-keywords, and in
-;; `org-export-visible'.  Search for `org-noutline-p' to find them.
+;; Functions extending outline functionality
 
 ;; C-a should go to the beginning of a *visible* line, also in the
 ;; new outline.el.  I guess this should be patched into Emacs?
@@ -16174,60 +16273,26 @@
 	  (beginning-of-line 1))
       (forward-char 1))))
 
-(when org-noutline-p
-  (define-key org-mode-map "\C-a" 'org-beginning-of-line))
+(define-key org-mode-map "\C-a" 'org-beginning-of-line)
 
 (defun org-invisible-p ()
   "Check if point is at a character currently not visible."
-  (if org-noutline-p
-      ;; Early versions of noutline don't have `outline-invisible-p'.
-      (if (fboundp 'outline-invisible-p)
-	  (outline-invisible-p)
-	(get-char-property (point) 'invisible))
-    (save-excursion
-      (skip-chars-backward "^\r\n")
-      (equal (char-before) ?\r))))
+  ;; Early versions of noutline don't have `outline-invisible-p'.
+  (if (fboundp 'outline-invisible-p)
+      (outline-invisible-p)
+    (get-char-property (point) 'invisible)))
 
 (defun org-invisible-p2 ()
   "Check if point is at a character currently not visible."
   (save-excursion
-    (if org-noutline-p
-	(progn
-	  (if (and (eolp) (not (bobp))) (backward-char 1))
-	  ;; Early versions of noutline don't have `outline-invisible-p'.
-	  (if (fboundp 'outline-invisible-p)
-	      (outline-invisible-p)
-	    (get-char-property (point) 'invisible)))
-      (skip-chars-backward "^\r\n")
-      (equal (char-before) ?\r))))
-
-(defun org-back-to-heading (&optional invisible-ok)
-  "Move to previous heading line, or beg of this line if it's a heading.
-Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
-  (if org-noutline-p
-      (outline-back-to-heading invisible-ok)
-    (if (and (or (bobp) (memq (char-before) '(?\n ?\r)))
-             (looking-at outline-regexp))
-	t
-      (if (re-search-backward (concat (if invisible-ok "\\([\r\n]\\|^\\)" "^")
-				      outline-regexp)
-			      nil t)
-	  (if invisible-ok
-	      (progn (goto-char (or (match-end 1) (match-beginning 0)))
-                     (looking-at outline-regexp)))
-	(error "Before first heading")))))
-
-(defun org-on-heading-p (&optional invisible-ok)
-  "Return t if point is on a (visible) heading line.
-If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
-  (if org-noutline-p
-      (outline-on-heading-p 'invisible-ok)
-    (save-excursion
-      (skip-chars-backward "^\n\r")
-      (and (looking-at outline-regexp)
-	   (or invisible-ok
-	       (bobp)
-	       (equal (char-before) ?\n))))))
+    (if (and (eolp) (not (bobp))) (backward-char 1))
+    ;; Early versions of noutline don't have `outline-invisible-p'.
+    (if (fboundp 'outline-invisible-p)
+	(outline-invisible-p)
+      (get-char-property (point) 'invisible))))
+
+(defalias 'org-back-to-heading 'outline-back-to-heading)
+(defalias 'org-on-heading-p 'outline-on-heading-p)
 
 (defun org-on-target-p ()
   (let ((pos (point)))
@@ -16243,47 +16308,20 @@
   "Move to the heading line of which the present line is a subheading.
 This function considers both visible and invisible heading lines.
 With argument, move up ARG levels."
-  (if org-noutline-p
-      (if (fboundp 'outline-up-heading-all)
-	  (outline-up-heading-all arg)   ; emacs 21 version of outline.el
-	(outline-up-heading arg t))      ; emacs 22 version of outline.el
-    (org-back-to-heading t)
-    (looking-at outline-regexp)
-    (if (<= (- (match-end 0) (match-beginning 0)) arg)
-	(error "Cannot move up %d levels" arg)
-    (re-search-backward
-     (concat "[\n\r]" (regexp-quote
-		       (make-string (- (match-end 0) (match-beginning 0) arg)
-				    ?*))
-	     "[^*]"))
-    (forward-char 1))))
+  (if (fboundp 'outline-up-heading-all)
+      (outline-up-heading-all arg)   ; emacs 21 version of outline.el
+    (outline-up-heading arg t)))     ; emacs 22 version of outline.el
 
 (defun org-show-hidden-entry ()
   "Show an entry where even the heading is hidden."
   (save-excursion
-    (if (not org-noutline-p)
-	(progn
-	  (org-back-to-heading t)
-	  (org-flag-heading nil)))
     (org-show-entry)))
 
-(defun org-check-occur-regexp (regexp)
-  "If REGEXP starts with \"^\", modify it to check for \\r as well.
-Of course, only for the old outline mode."
-  (if org-noutline-p
-      regexp
-    (if (string-match "^\\^" regexp)
-	(concat "[\n\r]" (substring regexp 1))
-      regexp)))
-
 (defun org-flag-heading (flag &optional entry)
   "Flag the current heading.  FLAG non-nil means make invisible.
 When ENTRY is non-nil, show the entire entry."
   (save-excursion
     (org-back-to-heading t)
-    (if (not org-noutline-p)
-	;; Make the current headline visible
-	(outline-flag-region (max 1 (1- (point))) (point) (if flag ?\r ?\n)))
     ;; Check if we should show the entire entry
     (if entry
 	(progn
@@ -16293,9 +16331,7 @@
 		 (org-flag-heading nil))))
       (outline-flag-region (max 1 (1- (point)))
 			   (save-excursion (outline-end-of-heading) (point))
-			   (if org-noutline-p
-			       flag
-			     (if flag ?\r ?\n))))))
+			   flag))))
 
 (defun org-end-of-subtree (&optional invisible-OK)
   ;; This is an exact copy of the original function, but it uses
@@ -16324,7 +16360,7 @@
    (point)
    (save-excursion
      (outline-end-of-subtree) (outline-next-heading) (point))
-   (if org-noutline-p nil ?\n)))
+   nil))
 
 (defun org-show-entry ()
   "Show the body directly following this heading.
@@ -16337,16 +16373,16 @@
      (save-excursion
        (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move)
        (or (match-beginning 1) (point-max)))
-     (if org-noutline-p nil ?\n))))
+     nil)))
 
 (defun org-make-options-regexp (kwds)
   "Make a regular expression for keyword lines."
   (concat
-   (if org-noutline-p "^" "[\n\r]")
+   "^"
    "#?[ \t]*\\+\\("
    (mapconcat 'regexp-quote kwds "\\|")
    "\\):[ \t]*"
-   (if org-noutline-p "\\(.+\\)" "\\([^\n\r]+\\)")))
+   "\\(.+\\)"))
 
 ;; Make `bookmark-jump' show the jump location if it was hidden.
 (eval-after-load "bookmark"
--- a/lisp/tumme.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/tumme.el	Sat Oct 14 16:56:21 2006 +0000
@@ -172,12 +172,12 @@
   :group 'multimedia)
 
 (defcustom tumme-dir "~/.emacs.d/tumme/"
-  "*Directory where thumbnail images are stored."
+  "Directory where thumbnail images are stored."
   :type 'string
   :group 'tumme)
 
 (defcustom tumme-thumbnail-storage 'use-tumme-dir
-  "*How to store tumme's thumbnail files.
+  "How to store tumme's thumbnail files.
 Tumme can store thumbnail files in one of two ways and this is
 controlled by this variable.  \"Use tumme dir\" means that the
 thumbnails are stored in a central directory.  \"Per directory\"
@@ -193,17 +193,17 @@
   :group 'tumme)
 
 (defcustom tumme-db-file "~/.emacs.d/tumme/.tumme_db"
-  "*Database file where file names and their associated tags are stored."
+  "Database file where file names and their associated tags are stored."
   :type 'string
   :group 'tumme)
 
 (defcustom tumme-temp-image-file "~/.emacs.d/tumme/.tumme_temp"
-  "*Name of temporary image file used by various commands."
+  "Name of temporary image file used by various commands."
   :type 'string
   :group 'tumme)
 
 (defcustom tumme-gallery-dir "~/.emacs.d/tumme/.tumme_gallery"
-  "*Directory to store generated gallery html pages.
+  "Directory to store generated gallery html pages.
 This path needs to be \"shared\" to the public so that it can access
 the index.html page that tumme creates."
   :type 'string
@@ -211,7 +211,7 @@
 
 (defcustom tumme-gallery-image-root-url
 "http://your.own.server/tummepics"
-  "*URL where the full size images are to be found.
+  "URL where the full size images are to be found.
 Note that this path has to be configured in your web server.  Tumme
 expects to find pictures in this directory."
   :type 'string
@@ -219,7 +219,7 @@
 
 (defcustom tumme-gallery-thumb-image-root-url
 "http://your.own.server/tummethumbs"
-  "*URL where the thumbnail images are to be found.
+  "URL where the thumbnail images are to be found.
 Note that this path has to be configured in your web server.  Tumme
 expects to find pictures in this directory."
   :type 'string
@@ -227,14 +227,14 @@
 
 (defcustom tumme-cmd-create-thumbnail-program
   "convert"
-  "*Executable used to create thumbnail.
+  "Executable used to create thumbnail.
 Used together with `tumme-cmd-create-thumbnail-options'."
   :type 'string
   :group 'tumme)
 
 (defcustom tumme-cmd-create-thumbnail-options
   "%p -size %wx%h \"%f\" -resize %wx%h +profile \"*\" jpeg:\"%t\""
-  "*Format of command used to create thumbnail image.
+  "Format of command used to create thumbnail image.
 Available options are %p which is replaced by
 `tumme-cmd-create-thumbnail-program', %w which is replaced by
 `tumme-thumb-width', %h which is replaced by `tumme-thumb-height',
@@ -245,14 +245,14 @@
 
 (defcustom tumme-cmd-create-temp-image-program
   "convert"
-  "*Executable used to create temporary image.
+  "Executable used to create temporary image.
 Used together with `tumme-cmd-create-temp-image-options'."
   :type 'string
   :group 'tumme)
 
 (defcustom tumme-cmd-create-temp-image-options
   "%p -size %wx%h \"%f\" -resize %wx%h +profile \"*\" jpeg:\"%t\""
-  "*Format of command used to create temporary image for display window.
+  "Format of command used to create temporary image for display window.
 Available options are %p which is replaced by
 `tumme-cmd-create-temp-image-program', %w and %h which is replaced by
 the calculated max size for width and height in the image display window,
@@ -262,13 +262,13 @@
   :group 'tumme)
 
 (defcustom tumme-cmd-pngnq-program (executable-find "pngnq")
-  "*The file name of the `pngnq' program.
+  "The file name of the `pngnq' program.
 It quantizes colors of PNG images down to 256 colors."
   :type '(choice (const :tag "Not Set" nil) string)
   :group 'tumme)
 
 (defcustom tumme-cmd-pngcrush-program (executable-find "pngcrush")
-  "*The file name of the `pngcrush' program.
+  "The file name of the `pngcrush' program.
 It optimizes the compression of PNG images.  Also it adds PNG textual chunks
 with the information required by the Thumbnail Managing Standard."
   :type '(choice (const :tag "Not Set" nil) string)
@@ -305,20 +305,20 @@
         "-text b \"Thumb::URI\" \"file://%f\" "
         "%q %t"
         " ; rm %q")))
-  "*Command to create thumbnails according to the Thumbnail Managing Standard."
+  "Command to create thumbnails according to the Thumbnail Managing Standard."
   :type 'string
   :group 'tumme)
 
 (defcustom tumme-cmd-rotate-thumbnail-program
   "mogrify"
-  "*Executable used to rotate thumbnail.
+  "Executable used to rotate thumbnail.
 Used together with `tumme-cmd-rotate-thumbnail-options'."
   :type 'string
   :group 'tumme)
 
 (defcustom tumme-cmd-rotate-thumbnail-options
   "%p -rotate %d \"%t\""
-  "*Format of command used to rotate thumbnail image.
+  "Format of command used to rotate thumbnail image.
 Available options are %p which is replaced by
 `tumme-cmd-rotate-thumbnail-program', %d which is replaced by the
 number of (positive) degrees to rotate the image, normally 90 or 270
@@ -329,14 +329,14 @@
 
 (defcustom tumme-cmd-rotate-original-program
   "jpegtran"
-  "*Executable used to rotate original image.
+  "Executable used to rotate original image.
 Used together with `tumme-cmd-rotate-original-options'."
   :type 'string
   :group 'tumme)
 
 (defcustom tumme-cmd-rotate-original-options
   "%p -rotate %d -copy all \"%o\" > %t"
-  "*Format of command used to rotate original image.
+  "Format of command used to rotate original image.
 Available options are %p which is replaced by
 `tumme-cmd-rotate-original-program', %d which is replaced by the
 number of (positive) degrees to rotate the image, normally 90 or
@@ -348,7 +348,7 @@
 
 (defcustom tumme-temp-rotate-image-file
   "~/.emacs.d/tumme/.tumme_rotate_temp"
-  "*Temporary file for rotate operations."
+  "Temporary file for rotate operations."
   :type 'string
   :group 'tumme)
 
@@ -361,14 +361,14 @@
 
 (defcustom tumme-cmd-write-exif-data-program
   "exiftool"
-  "*Program used to write EXIF data to image.
+  "Program used to write EXIF data to image.
 Used together with `tumme-cmd-write-exif-data-options'."
   :type 'string
   :group 'tumme)
 
 (defcustom tumme-cmd-write-exif-data-options
   "%p -%t=\"%v\" \"%f\""
-  "*Format of command used to write EXIF data.
+  "Format of command used to write EXIF data.
 Available options are %p which is replaced by
 `tumme-cmd-write-exif-data-program', %f which is replaced by the
 image file name, %t which is replaced by the tag name and %v
@@ -378,14 +378,14 @@
 
 (defcustom tumme-cmd-read-exif-data-program
   "exiftool"
-  "*Program used to read EXIF data to image.
+  "Program used to read EXIF data to image.
 Used together with `tumme-cmd-read-exif-data-program-options'."
   :type 'string
   :group 'tumme)
 
 (defcustom tumme-cmd-read-exif-data-options
   "%p -s -s -s -%t \"%f\""
-  "*Format of command used to read EXIF data.
+  "Format of command used to read EXIF data.
 Available options are %p which is replaced by
 `tumme-cmd-write-exif-data-options', %f which is replaced
 by the image file name and %t which is replaced by the tag name."
@@ -394,7 +394,7 @@
 
 (defcustom tumme-gallery-hidden-tags
   (list "private" "hidden" "pending")
-  "*List of \"hidden\" tags.
+  "List of \"hidden\" tags.
 Used by `tumme-gallery-generate' to leave out \"hidden\" images."
   :type '(repeat string)
   :group 'tumme)
@@ -416,18 +416,18 @@
   :group 'tumme)
 
 (defcustom tumme-thumb-relief 2
-  "*Size of button-like border around thumbnails."
+  "Size of button-like border around thumbnails."
   :type 'integer
   :group 'tumme)
 
 (defcustom tumme-thumb-margin 2
-  "*Size of the margin around thumbnails.
+  "Size of the margin around thumbnails.
 This is where you see the cursor."
   :type 'integer
   :group 'tumme)
 
 (defcustom tumme-line-up-method 'dynamic
-  "*Default method for line-up of thumbnails in thumbnail buffer.
+  "Default method for line-up of thumbnails in thumbnail buffer.
 Used by `tumme-display-thumbs' and other functions that needs to
 line-up thumbnails.  Dynamic means to use the available width of the
 window containing the thumbnail buffer, Fixed means to use
@@ -441,19 +441,19 @@
   :group 'tumme)
 
 (defcustom tumme-thumbs-per-row 3
-  "*Number of thumbnails to display per row in thumb buffer."
+  "Number of thumbnails to display per row in thumb buffer."
   :type 'integer
   :group 'tumme)
 
 (defcustom tumme-display-window-width-correction 1
-  "*Number to be used to correct image display window width.
+  "Number to be used to correct image display window width.
 Change if the default (1) does not work (i.e. if the image does not
 completely fit)."
   :type 'integer
   :group 'tumme)
 
 (defcustom tumme-display-window-height-correction 0
-  "*Number to be used to correct image display window height.
+  "Number to be used to correct image display window height.
 Change if the default (0) does not work (i.e. if the image does not
 completely fit)."
   :type 'integer
@@ -487,7 +487,7 @@
   :group 'tumme)
 
 (defcustom tumme-display-properties-format "%b: %f (%t): %c"
-  "*Display format for thumbnail properties.
+  "Display format for thumbnail properties.
 %b is replaced with associated dired buffer name, %f with file name
 \(without path) of original image file, %t with the list of tags and %c
 with the comment."
@@ -500,20 +500,20 @@
   (cond ((executable-find "display"))
         ((executable-find "xli"))
         ((executable-find "qiv") "qiv -t"))
-  "*Name of external viewer.
+  "Name of external viewer.
 Including parameters.  Used when displaying original image from
 `tumme-thumbnail-mode'."
   :type 'string
   :group 'tumme)
 
 (defcustom tumme-main-image-directory "~/pics/"
-  "*Name of main image directory, if any.
+  "Name of main image directory, if any.
 Used by `tumme-copy-with-exif-file-name'."
   :type 'string
   :group 'tumme)
 
 (defcustom tumme-show-all-from-dir-max-files 50
-  "*Maximum number of files to show using `tumme-show-all-from-dir'.
+  "Maximum number of files to show using `tumme-show-all-from-dir'.
 before warning the user."
   :type 'integer
   :group 'tumme)
--- a/lisp/url/ChangeLog	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/url/ChangeLog	Sat Oct 14 16:56:21 2006 +0000
@@ -1,3 +1,20 @@
+2006-08-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* url-handlers.el (url-file-local-copy): Tell url-copy-file that the
+	dest file will already exist.
+
+2006-07-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* url-util.el (url-hexify-string): Only utf-8 encode if it's
+	a multibyte string.
+	(url-normalize-url): Remove unused var `grok'.
+	(url-truncate-url-for-viewing): Remove unused var `tail'.
+
+2006-07-30  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* url-util.el (url-hexify-string): Rewrite.
+	Suggested by David Smith <davidsmith@acm.org>.
+
 2006-07-12  Michael Olson  <mwolson@gnu.org>
 
 	* url-irc.el (url-irc-erc): Call erc-handle-irc-url.
--- a/lisp/url/url-handlers.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/url/url-handlers.el	Sat Oct 14 16:56:21 2006 +0000
@@ -213,7 +213,7 @@
 Returns the name of the local copy, or nil, if FILE is directly
 accessible."
   (let ((filename (make-temp-file "url")))
-    (url-copy-file url filename)
+    (url-copy-file url filename 'ok-if-already-exists)
     filename))
 
 (defun url-insert (buffer &optional beg end)
--- a/lisp/url/url-util.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/url/url-util.el	Sat Oct 14 16:56:21 2006 +0000
@@ -163,7 +163,7 @@
 (defun url-normalize-url (url)
   "Return a 'normalized' version of URL.
 Strips out default port numbers, etc."
-  (let (type data grok retval)
+  (let (type data retval)
     (setq data (url-generic-parse-url url)
 	  type (url-type data))
     (if (member type '("www" "about" "mailto" "info"))
@@ -352,17 +352,31 @@
 This is taken from RFC 2396.")
 
 ;;;###autoload
-(defun url-hexify-string (str)
-  "Escape characters in a string."
-  (mapconcat
-   (lambda (char)
-     ;; Fixme: use a char table instead.
-     (if (not (memq char url-unreserved-chars))
-	 (if (> char 255)
-	       (error "Hexifying multibyte character %s" str)
-	   (format "%%%02X" char))
-       (char-to-string char)))
-   str ""))
+(defun url-hexify-string (string)
+  "Return a new string that is STRING URI-encoded.
+First, STRING is converted to utf-8, if necessary.  Then, for each
+character in the utf-8 string, those found in `url-unreserved-chars'
+are left as-is, all others are represented as a three-character
+string: \"%\" followed by two lowercase hex digits."
+  ;; To go faster and avoid a lot of consing, we could do:
+  ;; 
+  ;; (defconst url-hexify-table
+  ;;   (let ((map (make-vector 256 nil)))
+  ;;     (dotimes (byte 256) (aset map byte
+  ;;                               (if (memq byte url-unreserved-chars)
+  ;;                                   (char-to-string byte)
+  ;;                                 (format "%%%02x" byte))))
+  ;;     map))
+  ;;
+  ;; (mapconcat (curry 'aref url-hexify-table) ...)
+  (mapconcat (lambda (byte)
+               (if (memq byte url-unreserved-chars)
+                   (char-to-string byte)
+                 (format "%%%02x" byte)))
+             (if (multibyte-string-p string)
+                 (encode-coding-string string 'utf-8)
+               string)
+             ""))
 
 ;;;###autoload
 (defun url-file-extension (fname &optional x)
@@ -389,7 +403,6 @@
 WIDTH defaults to the current frame width."
   (let* ((fr-width (or width (frame-width)))
 	 (str-width (length url))
-	 (tail (file-name-nondirectory url))
 	 (fname nil)
 	 (modified 0)
 	 (urlobj nil))
@@ -397,8 +410,7 @@
     (if (and (>= str-width fr-width)
 	     (string-match "?" url))
 	(setq url (concat (substring url 0 (match-beginning 0)) "?...")
-	      str-width (length url)
-	      tail (file-name-nondirectory url)))
+	      str-width (length url)))
     (if (< str-width fr-width)
 	nil				; Hey, we are done!
       (setq urlobj (url-generic-parse-url url)
--- a/lisp/wdired.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/wdired.el	Sat Oct 14 16:56:21 2006 +0000
@@ -238,6 +238,8 @@
 
 See `wdired-mode'."
   (interactive)
+  (or (eq major-mode 'dired-mode)
+      (error "Not a Dired buffer"))
   (set (make-local-variable 'wdired-old-content)
        (buffer-substring (point-min) (point-max)))
   (set (make-local-variable 'wdired-old-point) (point))
@@ -328,6 +330,8 @@
 
 (defun wdired-change-to-dired-mode ()
   "Change the mode back to dired."
+  (or (eq major-mode 'wdired-mode)
+      (error "Not a Wdired buffer"))
   (let ((inhibit-read-only t))
     (remove-text-properties (point-min) (point-max)
 			    '(read-only nil local-map nil)))
--- a/lisp/whitespace.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/whitespace.el	Sat Oct 14 16:56:21 2006 +0000
@@ -518,13 +518,15 @@
 ;;;###autoload
 (defun whitespace-cleanup ()
   "Cleanup the five different kinds of whitespace problems.
+It normally applies to the whole buffer, but in Transient Mark mode
+when the mark is active it applies to the region.
 See `whitespace-buffer' docstring for a summary of the problems."
   (interactive)
   (if (and transient-mark-mode mark-active)
       (whitespace-cleanup-region (region-beginning) (region-end))
     (whitespace-cleanup-internal)))
 
-(defun whitespace-cleanup-internal ()
+(defun whitespace-cleanup-internal (&optional region-only)
   ;; If this buffer really contains a file, then run, else quit.
   (whitespace-check-whitespace-mode current-prefix-arg)
   (if (and buffer-file-name whitespace-mode)
@@ -569,9 +571,12 @@
 	;; Call this recursively till everything is taken care of
 	(if whitespace-any
 	    (whitespace-cleanup-internal)
+	  ;; if we are done, talk to the user
 	  (progn
-	    (if (not whitespace-silent)
-		(message "%s clean" buffer-file-name))
+	    (unless whitespace-silent
+	      (if region-only
+		  (message "The region is now clean")
+		(message "%s is now clean" buffer-file-name)))
 	    (whitespace-update-modeline)))
 	(setq tab-width whitespace-tabwith-saved))))
 
@@ -582,7 +587,7 @@
   (save-excursion
     (save-restriction
       (narrow-to-region s e)
-      (whitespace-cleanup-internal))
+      (whitespace-cleanup-internal t))
     (whitespace-buffer t)))
 
 (defun whitespace-buffer-leading ()
--- a/lisp/window.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/window.el	Sat Oct 14 16:56:21 2006 +0000
@@ -246,9 +246,10 @@
                 (windowp window-or-frame))
       (error "Not a frame or window: %s" window-or-frame)))
   (let ((subtree (bw-find-tree-sub window-or-frame)))
-    (if (integerp subtree)
-        nil
-      (bw-get-tree-1 subtree))))
+    (when subtree
+      (if (integerp subtree)
+	  nil
+	(bw-get-tree-1 subtree)))))
 
 (defun bw-get-tree-1 (split)
   (if (windowp split)
--- a/lisp/x-dnd.el	Sun Jul 30 10:19:46 2006 +0000
+++ b/lisp/x-dnd.el	Sat Oct 14 16:56:21 2006 +0000
@@ -122,6 +122,12 @@
 (defun x-dnd-init-frame (&optional frame)
   "Setup drag and drop for FRAME (i.e. create appropriate properties)."
   (when (eq 'x (window-system frame))
+    (x-register-dnd-atom "DndProtocol" frame)
+    (x-register-dnd-atom "_MOTIF_DRAG_AND_DROP_MESSAGE" frame)
+    (x-register-dnd-atom "XdndEnter" frame)
+    (x-register-dnd-atom "XdndPosition" frame)
+    (x-register-dnd-atom "XdndLeave" frame)
+    (x-register-dnd-atom "XdndDrop" frame)
     (x-dnd-init-xdnd-for-frame frame)
     (x-dnd-init-motif-for-frame frame)))
 
@@ -320,7 +326,8 @@
 	  ;; If dropping in an ordinary window which we could use,
 	  ;; let dnd-open-file-other-window specify what to do.
 	  (progn
-	    (goto-char (posn-point (event-start event)))
+	    (when (not mouse-yank-at-point)
+	      (goto-char (posn-point (event-start event))))
 	    (funcall handler window action data))
 	;; If we can't display the file here,
 	;; make a new window for it.
--- a/lispintro/ChangeLog	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispintro/ChangeLog	Sat Oct 14 16:56:21 2006 +0000
@@ -1,3 +1,12 @@
+2006-08-21  Robert J. Chassell  <bob@rattlesnake.com>
+
+	* emacs-lisp-intro.texi: deleted in directory copy of texinfo.tex
+          and pointed towards ../man/texinfo.tex so only one file
+          needs updating.  Added comment of what to do when building on own.
+
+	* texinfo.tex: changed to version 2006-02-13.16
+          to enable a DVI build using the more recent versions of TeX.
+
 2006-05-25  David Kastrup  <dak@gnu.org>
 
 	* emacs-lisp-intro.texi (setcar): replace an antelope rather than
--- a/lispintro/emacs-lisp-intro.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispintro/emacs-lisp-intro.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -1,4 +1,5 @@
-\input texinfo                                  @c -*-texinfo-*-
+\input ../man/texinfo                                  @c -*-texinfo-*-
+@c change above to   \input texinfo   if building on own.
 @comment %**start of header
 @setfilename ../info/eintr
 @c setfilename emacs-lisp-intro.info
--- a/lispintro/texinfo.tex	Sun Jul 30 10:19:46 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6777 +0,0 @@
-% texinfo.tex -- TeX macros to handle Texinfo files.
-%
-% Load plain if necessary, i.e., if running under initex.
-\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
-%
-\def\texinfoversion{2003-12-30.09}
-%
-% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
-% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-%
-% This texinfo.tex file is free software; you can redistribute it and/or
-% modify it under the terms of the GNU General Public License as
-% published by the Free Software Foundation; either version 2, or (at
-% your option) any later version.
-%
-% This texinfo.tex file is distributed in the hope that it will be
-% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-% General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License
-% along with this texinfo.tex file; see the file COPYING.  If not, write
-% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-% Boston, MA 02110-1301, USA.
-%
-% In other words, you are welcome to use, share and improve this program.
-% You are forbidden to forbid anyone else to use, share and improve
-% what you give them.   Help stamp out software-hoarding!
-%
-% Please try the latest version of texinfo.tex before submitting bug
-% reports; you can get the latest version from:
-%   ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex
-%     (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
-%   ftp://tug.org/tex/texinfo.tex
-%     (and all CTAN mirrors, see http://www.ctan.org),
-%   and /home/gd/gnu/doc/texinfo.tex on the GNU machines.
-%
-% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
-%
-% The texinfo.tex in any given Texinfo distribution could well be out
-% of date, so if that's what you're using, please check.
-%
-% Send bug reports to bug-texinfo@gnu.org.  Please include including a
-% complete document in each bug report with which we can reproduce the
-% problem.  Patches are, of course, greatly appreciated.
-%
-% To process a Texinfo manual with TeX, it's most reliable to use the
-% texi2dvi shell script that comes with the distribution.  For a simple
-% manual foo.texi, however, you can get away with this:
-%   tex foo.texi
-%   texindex foo.??
-%   tex foo.texi
-%   tex foo.texi
-%   dvips foo.dvi -o  # or whatever; this makes foo.ps.
-% The extra TeX runs get the cross-reference information correct.
-% Sometimes one run after texindex suffices, and sometimes you need more
-% than two; texi2dvi does it as many times as necessary.
-%
-% It is possible to adapt texinfo.tex for other languages, to some
-% extent.  You can get the existing language-specific files from the
-% full Texinfo distribution.
-
-\message{Loading texinfo [version \texinfoversion]:}
-
-% If in a .fmt file, print the version number
-% and turn on active characters that we couldn't do earlier because
-% they might have appeared in the input file name.
-\everyjob{\message{[Texinfo version \texinfoversion]}%
-  \catcode`+=\active \catcode`\_=\active}
-
-\message{Basics,}
-\chardef\other=12
-
-% We never want plain's \outer definition of \+ in Texinfo.
-% For @tex, we can use \tabalign.
-\let\+ = \relax
-
-% Save some plain tex macros whose names we will redefine.
-\let\ptexb=\b
-\let\ptexbullet=\bullet
-\let\ptexc=\c
-\let\ptexcomma=\,
-\let\ptexdot=\.
-\let\ptexdots=\dots
-\let\ptexend=\end
-\let\ptexequiv=\equiv
-\let\ptexexclam=\!
-\let\ptexgtr=>
-\let\ptexhat=^
-\let\ptexi=\i
-\let\ptexindent=\indent
-\let\ptexlbrace=\{
-\let\ptexless=<
-\let\ptexplus=+
-\let\ptexrbrace=\}
-\let\ptexslash=\/
-\let\ptexstar=\*
-\let\ptext=\t
-
-% If this character appears in an error message or help string, it
-% starts a new line in the output.
-\newlinechar = `^^J
-
-% Set up fixed words for English if not already set.
-\ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
-\ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
-\ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
-\ifx\putwordin\undefined        \gdef\putwordin{in}\fi
-\ifx\putwordIndexIsEmpty\undefined     \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
-\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
-\ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
-\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
-\ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
-\ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
-\ifx\putwordof\undefined        \gdef\putwordof{of}\fi
-\ifx\putwordon\undefined        \gdef\putwordon{on}\fi
-\ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
-\ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
-\ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
-\ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
-\ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
-\ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
-\ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
-%
-\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
-\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
-\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
-\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
-\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
-\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
-\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
-\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
-\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
-\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
-\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
-\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
-%
-\ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
-\ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
-\ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
-\ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
-\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
-\ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
-\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
-
-% In some macros, we cannot use the `\? notation---the left quote is
-% in some cases the escape char.
-\chardef\colonChar = `\:
-\chardef\commaChar = `\,
-\chardef\dotChar   = `\.
-\chardef\equalChar = `\=
-\chardef\exclamChar= `\!
-\chardef\questChar = `\?
-\chardef\semiChar  = `\;
-\chardef\spaceChar = `\ %
-\chardef\underChar = `\_
-
-% Ignore a token.
-%
-\def\gobble#1{}
-
-% True if #1 is the empty string, i.e., called like `\ifempty{}'.
-%
-\def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}%
-\def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}%
-
-% Hyphenation fixes.
-\hyphenation{ap-pen-dix}
-\hyphenation{eshell}
-\hyphenation{mini-buf-fer mini-buf-fers}
-\hyphenation{time-stamp}
-\hyphenation{white-space}
-
-% Margin to add to right of even pages, to left of odd pages.
-\newdimen\bindingoffset
-\newdimen\normaloffset
-\newdimen\pagewidth \newdimen\pageheight
-
-% Sometimes it is convenient to have everything in the transcript file
-% and nothing on the terminal.  We don't just call \tracingall here,
-% since that produces some useless output on the terminal.  We also make
-% some effort to order the tracing commands to reduce output in the log
-% file; cf. trace.sty in LaTeX.
-%
-\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
-\def\loggingall{%
-  \tracingstats2
-  \tracingpages1
-  \tracinglostchars2  % 2 gives us more in etex
-  \tracingparagraphs1
-  \tracingoutput1
-  \tracingmacros2
-  \tracingrestores1
-  \showboxbreadth\maxdimen \showboxdepth\maxdimen
-  \ifx\eTeXversion\undefined\else % etex gives us more logging
-    \tracingscantokens1
-    \tracingifs1
-    \tracinggroups1
-    \tracingnesting2
-    \tracingassigns1
-  \fi
-  \tracingcommands3  % 3 gives us more in etex
-  \errorcontextlines\maxdimen
-}%
-
-% add check for \lastpenalty to plain's definitions.  If the last thing
-% we did was a \nobreak, we don't want to insert more space.
-%
-\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
-  \removelastskip\penalty-50\smallskip\fi\fi}
-\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
-  \removelastskip\penalty-100\medskip\fi\fi}
-\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
-  \removelastskip\penalty-200\bigskip\fi\fi}
-
-% For @cropmarks command.
-% Do @cropmarks to get crop marks.
-%
-\newif\ifcropmarks
-\let\cropmarks = \cropmarkstrue
-%
-% Dimensions to add cropmarks at corners.
-% Added by P. A. MacKay, 12 Nov. 1986
-%
-\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
-\newdimen\cornerlong  \cornerlong=1pc
-\newdimen\cornerthick \cornerthick=.3pt
-\newdimen\topandbottommargin \topandbottommargin=.75in
-
-% Main output routine.
-\chardef\PAGE = 255
-\output = {\onepageout{\pagecontents\PAGE}}
-
-\newbox\headlinebox
-\newbox\footlinebox
-
-% \onepageout takes a vbox as an argument.  Note that \pagecontents
-% does insertions, but you have to call it yourself.
-\def\onepageout#1{%
-  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
-  %
-  \ifodd\pageno  \advance\hoffset by \bindingoffset
-  \else \advance\hoffset by -\bindingoffset\fi
-  %
-  % Do this outside of the \shipout so @code etc. will be expanded in
-  % the headline as they should be, not taken literally (outputting ''code).
-  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
-  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
-  %
-  {%
-    % Have to do this stuff outside the \shipout because we want it to
-    % take effect in \write's, yet the group defined by the \vbox ends
-    % before the \shipout runs.
-    %
-    \escapechar = `\\     % use backslash in output files.
-    \indexdummies         % don't expand commands in the output.
-    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
-                   % the page break happens to be in the middle of an example.
-    \shipout\vbox{%
-      % Do this early so pdf references go to the beginning of the page.
-      \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
-      %
-      \ifcropmarks \vbox to \outervsize\bgroup
-        \hsize = \outerhsize
-        \vskip-\topandbottommargin
-        \vtop to0pt{%
-          \line{\ewtop\hfil\ewtop}%
-          \nointerlineskip
-          \line{%
-            \vbox{\moveleft\cornerthick\nstop}%
-            \hfill
-            \vbox{\moveright\cornerthick\nstop}%
-          }%
-          \vss}%
-        \vskip\topandbottommargin
-        \line\bgroup
-          \hfil % center the page within the outer (page) hsize.
-          \ifodd\pageno\hskip\bindingoffset\fi
-          \vbox\bgroup
-      \fi
-      %
-      \unvbox\headlinebox
-      \pagebody{#1}%
-      \ifdim\ht\footlinebox > 0pt
-        % Only leave this space if the footline is nonempty.
-        % (We lessened \vsize for it in \oddfootingxxx.)
-        % The \baselineskip=24pt in plain's \makefootline has no effect.
-        \vskip 2\baselineskip
-        \unvbox\footlinebox
-      \fi
-      %
-      \ifcropmarks
-          \egroup % end of \vbox\bgroup
-        \hfil\egroup % end of (centering) \line\bgroup
-        \vskip\topandbottommargin plus1fill minus1fill
-        \boxmaxdepth = \cornerthick
-        \vbox to0pt{\vss
-          \line{%
-            \vbox{\moveleft\cornerthick\nsbot}%
-            \hfill
-            \vbox{\moveright\cornerthick\nsbot}%
-          }%
-          \nointerlineskip
-          \line{\ewbot\hfil\ewbot}%
-        }%
-      \egroup % \vbox from first cropmarks clause
-      \fi
-    }% end of \shipout\vbox
-  }% end of group with \normalturnoffactive
-  \advancepageno
-  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
-}
-
-\newinsert\margin \dimen\margin=\maxdimen
-
-\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
-{\catcode`\@ =11
-\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
-% marginal hacks, juha@viisa.uucp (Juha Takala)
-\ifvoid\margin\else % marginal info is present
-  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
-\dimen@=\dp#1 \unvbox#1
-\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
-\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
-}
-
-% Here are the rules for the cropmarks.  Note that they are
-% offset so that the space between them is truly \outerhsize or \outervsize
-% (P. A. MacKay, 12 November, 1986)
-%
-\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
-\def\nstop{\vbox
-  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
-\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
-\def\nsbot{\vbox
-  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
-
-% Parse an argument, then pass it to #1.  The argument is the rest of
-% the input line (except we remove a trailing comment).  #1 should be a
-% macro which expects an ordinary undelimited TeX argument.
-%
-\def\parsearg#1{%
-  \let\next = #1%
-  \begingroup
-    \obeylines
-    \futurelet\temp\parseargx
-}
-
-% If the next token is an obeyed space (from an @example environment or
-% the like), remove it and recurse.  Otherwise, we're done.
-\def\parseargx{%
-  % \obeyedspace is defined far below, after the definition of \sepspaces.
-  \ifx\obeyedspace\temp
-    \expandafter\parseargdiscardspace
-  \else
-    \expandafter\parseargline
-  \fi
-}
-
-% Remove a single space (as the delimiter token to the macro call).
-{\obeyspaces %
- \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
-
-{\obeylines %
-  \gdef\parseargline#1^^M{%
-    \endgroup % End of the group started in \parsearg.
-    %
-    % First remove any @c comment, then any @comment.
-    % Result of each macro is put in \toks0.
-    \argremovec #1\c\relax %
-    \expandafter\argremovecomment \the\toks0 \comment\relax %
-    %
-    % Call the caller's macro, saved as \next in \parsearg.
-    \expandafter\next\expandafter{\the\toks0}%
-  }%
-}
-
-% Since all \c{,omment} does is throw away the argument, we can let TeX
-% do that for us.  The \relax here is matched by the \relax in the call
-% in \parseargline; it could be more or less anything, its purpose is
-% just to delimit the argument to the \c.
-\def\argremovec#1\c#2\relax{\toks0 = {#1}}
-\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
-
-% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
-%    @end itemize  @c foo
-% will have two active spaces as part of the argument with the
-% `itemize'.  Here we remove all active spaces from #1, and assign the
-% result to \toks0.
-%
-% This loses if there are any *other* active characters besides spaces
-% in the argument -- _ ^ +, for example -- since they get expanded.
-% Fortunately, Texinfo does not define any such commands.  (If it ever
-% does, the catcode of the characters in questionwill have to be changed
-% here.)  But this means we cannot call \removeactivespaces as part of
-% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
-% that \parsearg gets might well have any character at all in it.
-%
-\def\removeactivespaces#1{%
-  \begingroup
-    \ignoreactivespaces
-    \edef\temp{#1}%
-    \global\toks0 = \expandafter{\temp}%
-  \endgroup
-}
-
-% Change the active space to expand to nothing.
-%
-\begingroup
-  \obeyspaces
-  \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
-\endgroup
-
-
-\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
-
-%% These are used to keep @begin/@end levels from running away
-%% Call \inENV within environments (after a \begingroup)
-\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
-\def\ENVcheck{%
-\ifENV\errmessage{Still within an environment; press RETURN to continue}
-\endgroup\fi} % This is not perfect, but it should reduce lossage
-
-% @begin foo  is the same as @foo, for now.
-\newhelp\EMsimple{Press RETURN to continue.}
-
-\outer\def\begin{\parsearg\beginxxx}
-
-\def\beginxxx #1{%
-\expandafter\ifx\csname #1\endcsname\relax
-{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
-\csname #1\endcsname\fi}
-
-% @end foo executes the definition of \Efoo.
-%
-\def\end{\parsearg\endxxx}
-\def\endxxx #1{%
-  \removeactivespaces{#1}%
-  \edef\endthing{\the\toks0}%
-  %
-  \expandafter\ifx\csname E\endthing\endcsname\relax
-    \expandafter\ifx\csname \endthing\endcsname\relax
-      % There's no \foo, i.e., no ``environment'' foo.
-      \errhelp = \EMsimple
-      \errmessage{Undefined command `@end \endthing'}%
-    \else
-      \unmatchedenderror\endthing
-    \fi
-  \else
-    % Everything's ok; the right environment has been started.
-    \csname E\endthing\endcsname
-  \fi
-}
-
-% There is an environment #1, but it hasn't been started.  Give an error.
-%
-\def\unmatchedenderror#1{%
-  \errhelp = \EMsimple
-  \errmessage{This `@end #1' doesn't have a matching `@#1'}%
-}
-
-% Define the control sequence \E#1 to give an unmatched @end error.
-%
-\def\defineunmatchedend#1{%
-  \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
-}
-
-
-%% Simple single-character @ commands
-
-% @@ prints an @
-% Kludge this until the fonts are right (grr).
-\def\@{{\tt\char64}}
-
-% This is turned off because it was never documented
-% and you can use @w{...} around a quote to suppress ligatures.
-%% Define @` and @' to be the same as ` and '
-%% but suppressing ligatures.
-%\def\`{{`}}
-%\def\'{{'}}
-
-% Used to generate quoted braces.
-\def\mylbrace {{\tt\char123}}
-\def\myrbrace {{\tt\char125}}
-\let\{=\mylbrace
-\let\}=\myrbrace
-\begingroup
-  % Definitions to produce \{ and \} commands for indices,
-  % and @{ and @} for the aux file.
-  \catcode`\{ = \other \catcode`\} = \other
-  \catcode`\[ = 1 \catcode`\] = 2
-  \catcode`\! = 0 \catcode`\\ = \other
-  !gdef!lbracecmd[\{]%
-  !gdef!rbracecmd[\}]%
-  !gdef!lbraceatcmd[@{]%
-  !gdef!rbraceatcmd[@}]%
-!endgroup
-
-% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
-% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
-\let\, = \c
-\let\dotaccent = \.
-\def\ringaccent#1{{\accent23 #1}}
-\let\tieaccent = \t
-\let\ubaraccent = \b
-\let\udotaccent = \d
-
-% Other special characters: @questiondown @exclamdown
-% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
-\def\questiondown{?`}
-\def\exclamdown{!`}
-
-% Dotless i and dotless j, used for accents.
-\def\imacro{i}
-\def\jmacro{j}
-\def\dotless#1{%
-  \def\temp{#1}%
-  \ifx\temp\imacro \ptexi
-  \else\ifx\temp\jmacro \j
-  \else \errmessage{@dotless can be used only with i or j}%
-  \fi\fi
-}
-
-% Be sure we're in horizontal mode when doing a tie, since we make space
-% equivalent to this in @example-like environments. Otherwise, a space
-% at the beginning of a line will start with \penalty -- and
-% since \penalty is valid in vertical mode, we'd end up putting the
-% penalty on the vertical list instead of in the new paragraph.
-{\catcode`@ = 11
- % Avoid using \@M directly, because that causes trouble
- % if the definition is written into an index file.
- \global\let\tiepenalty = \@M
- \gdef\tie{\leavevmode\penalty\tiepenalty\ }
-}
-
-% @: forces normal size whitespace following.
-\def\:{\spacefactor=1000 }
-
-% @* forces a line break.
-\def\*{\hfil\break\hbox{}\ignorespaces}
-
-% @/ allows a line break.
-\let\/=\allowbreak
-
-% @. is an end-of-sentence period.
-\def\.{.\spacefactor=3000 }
-
-% @! is an end-of-sentence bang.
-\def\!{!\spacefactor=3000 }
-
-% @? is an end-of-sentence query.
-\def\?{?\spacefactor=3000 }
-
-% @w prevents a word break.  Without the \leavevmode, @w at the
-% beginning of a paragraph, when TeX is still in vertical mode, would
-% produce a whole line of output instead of starting the paragraph.
-\def\w#1{\leavevmode\hbox{#1}}
-
-% @group ... @end group forces ... to be all on one page, by enclosing
-% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
-% to keep its height that of a normal line.  According to the rules for
-% \topskip (p.114 of the TeXbook), the glue inserted is
-% max (\topskip - \ht (first item), 0).  If that height is large,
-% therefore, no glue is inserted, and the space between the headline and
-% the text is small, which looks bad.
-%
-% Another complication is that the group might be very large.  This can
-% cause the glue on the previous page to be unduly stretched, because it
-% does not have much material.  In this case, it's better to add an
-% explicit \vfill so that the extra space is at the bottom.  The
-% threshold for doing this is if the group is more than \vfilllimit
-% percent of a page (\vfilllimit can be changed inside of @tex).
-%
-\newbox\groupbox
-\def\vfilllimit{0.7}
-%
-\def\group{\begingroup
-  \ifnum\catcode13=\active \else
-    \errhelp = \groupinvalidhelp
-    \errmessage{@group invalid in context where filling is enabled}%
-  \fi
-  %
-  % The \vtop we start below produces a box with normal height and large
-  % depth; thus, TeX puts \baselineskip glue before it, and (when the
-  % next line of text is done) \lineskip glue after it.  (See p.82 of
-  % the TeXbook.)  Thus, space below is not quite equal to space
-  % above.  But it's pretty close.
-  \def\Egroup{%
-    \egroup           % End the \vtop.
-    % \dimen0 is the vertical size of the group's box.
-    \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
-    % \dimen2 is how much space is left on the page (more or less).
-    \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
-    % if the group doesn't fit on the current page, and it's a big big
-    % group, force a page break.
-    \ifdim \dimen0 > \dimen2
-      \ifdim \pagetotal < \vfilllimit\pageheight
-        \page
-      \fi
-    \fi
-    \copy\groupbox
-    \endgroup         % End the \group.
-  }%
-  %
-  \setbox\groupbox = \vtop\bgroup
-    % We have to put a strut on the last line in case the @group is in
-    % the midst of an example, rather than completely enclosing it.
-    % Otherwise, the interline space between the last line of the group
-    % and the first line afterwards is too small.  But we can't put the
-    % strut in \Egroup, since there it would be on a line by itself.
-    % Hence this just inserts a strut at the beginning of each line.
-    \everypar = {\strut}%
-    %
-    % Since we have a strut on every line, we don't need any of TeX's
-    % normal interline spacing.
-    \offinterlineskip
-    %
-    % OK, but now we have to do something about blank
-    % lines in the input in @example-like environments, which normally
-    % just turn into \lisppar, which will insert no space now that we've
-    % turned off the interline space.  Simplest is to make them be an
-    % empty paragraph.
-    \ifx\par\lisppar
-      \edef\par{\leavevmode \par}%
-      %
-      % Reset ^^M's definition to new definition of \par.
-      \obeylines
-    \fi
-    %
-    % Do @comment since we are called inside an environment such as
-    % @example, where each end-of-line in the input causes an
-    % end-of-line in the output.  We don't want the end-of-line after
-    % the `@group' to put extra space in the output.  Since @group
-    % should appear on a line by itself (according to the Texinfo
-    % manual), we don't worry about eating any user text.
-    \comment
-}
-%
-% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
-% message, so this ends up printing `@group can only ...'.
-%
-\newhelp\groupinvalidhelp{%
-group can only be used in environments such as @example,^^J%
-where each line of input produces a line of output.}
-
-% @need space-in-mils
-% forces a page break if there is not space-in-mils remaining.
-
-\newdimen\mil  \mil=0.001in
-
-\def\need{\parsearg\needx}
-
-% Old definition--didn't work.
-%\def\needx #1{\par %
-%% This method tries to make TeX break the page naturally
-%% if the depth of the box does not fit.
-%{\baselineskip=0pt%
-%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
-%\prevdepth=-1000pt
-%}}
-
-\def\needx#1{%
-  % Ensure vertical mode, so we don't make a big box in the middle of a
-  % paragraph.
-  \par
-  %
-  % If the @need value is less than one line space, it's useless.
-  \dimen0 = #1\mil
-  \dimen2 = \ht\strutbox
-  \advance\dimen2 by \dp\strutbox
-  \ifdim\dimen0 > \dimen2
-    %
-    % Do a \strut just to make the height of this box be normal, so the
-    % normal leading is inserted relative to the preceding line.
-    % And a page break here is fine.
-    \vtop to #1\mil{\strut\vfil}%
-    %
-    % TeX does not even consider page breaks if a penalty added to the
-    % main vertical list is 10000 or more.  But in order to see if the
-    % empty box we just added fits on the page, we must make it consider
-    % page breaks.  On the other hand, we don't want to actually break the
-    % page after the empty box.  So we use a penalty of 9999.
-    %
-    % There is an extremely small chance that TeX will actually break the
-    % page at this \penalty, if there are no other feasible breakpoints in
-    % sight.  (If the user is using lots of big @group commands, which
-    % almost-but-not-quite fill up a page, TeX will have a hard time doing
-    % good page breaking, for example.)  However, I could not construct an
-    % example where a page broke at this \penalty; if it happens in a real
-    % document, then we can reconsider our strategy.
-    \penalty9999
-    %
-    % Back up by the size of the box, whether we did a page break or not.
-    \kern -#1\mil
-    %
-    % Do not allow a page break right after this kern.
-    \nobreak
-  \fi
-}
-
-% @br   forces paragraph break
-
-\let\br = \par
-
-% @dots{} output an ellipsis using the current font.
-% We do .5em per period so that it has the same spacing in a typewriter
-% font as three actual period characters.
-%
-\def\dots{%
-  \leavevmode
-  \hbox to 1.5em{%
-    \hskip 0pt plus 0.25fil minus 0.25fil
-    .\hss.\hss.%
-    \hskip 0pt plus 0.5fil minus 0.5fil
-  }%
-}
-
-% @enddots{} is an end-of-sentence ellipsis.
-%
-\def\enddots{%
-  \leavevmode
-  \hbox to 2em{%
-    \hskip 0pt plus 0.25fil minus 0.25fil
-    .\hss.\hss.\hss.%
-    \hskip 0pt plus 0.5fil minus 0.5fil
-  }%
-  \spacefactor=3000
-}
-
-% @page forces the start of a new page.
-%
-\def\page{\par\vfill\supereject}
-
-% @exdent text....
-% outputs text on separate line in roman font, starting at standard page margin
-
-% This records the amount of indent in the innermost environment.
-% That's how much \exdent should take out.
-\newskip\exdentamount
-
-% This defn is used inside fill environments such as @defun.
-\def\exdent{\parsearg\exdentyyy}
-\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
-
-% This defn is used inside nofill environments such as @example.
-\def\nofillexdent{\parsearg\nofillexdentyyy}
-\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
-\leftline{\hskip\leftskip{\rm#1}}}}
-
-% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
-% paragraph.  For more general purposes, use the \margin insertion
-% class.  WHICH is `l' or `r'.
-%
-\newskip\inmarginspacing \inmarginspacing=1cm
-\def\strutdepth{\dp\strutbox}
-%
-\def\doinmargin#1#2{\strut\vadjust{%
-  \nobreak
-  \kern-\strutdepth
-  \vtop to \strutdepth{%
-    \baselineskip=\strutdepth
-    \vss
-    % if you have multiple lines of stuff to put here, you'll need to
-    % make the vbox yourself of the appropriate size.
-    \ifx#1l%
-      \llap{\ignorespaces #2\hskip\inmarginspacing}%
-    \else
-      \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
-    \fi
-    \null
-  }%
-}}
-\def\inleftmargin{\doinmargin l}
-\def\inrightmargin{\doinmargin r}
-%
-% @inmargin{TEXT [, RIGHT-TEXT]}
-% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
-% else use TEXT for both).
-%
-\def\inmargin#1{\parseinmargin #1,,\finish}
-\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
-  \setbox0 = \hbox{\ignorespaces #2}%
-  \ifdim\wd0 > 0pt
-    \def\lefttext{#1}%  have both texts
-    \def\righttext{#2}%
-  \else
-    \def\lefttext{#1}%  have only one text
-    \def\righttext{#1}%
-  \fi
-  %
-  \ifodd\pageno
-    \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
-  \else
-    \def\temp{\inleftmargin\lefttext}%
-  \fi
-  \temp
-}
-
-% @include file    insert text of that file as input.
-% Allow normal characters that  we make active in the argument (a file name).
-\def\include{\begingroup
-  \catcode`\\=\other
-  \catcode`~=\other
-  \catcode`^=\other
-  \catcode`_=\other
-  \catcode`|=\other
-  \catcode`<=\other
-  \catcode`>=\other
-  \catcode`+=\other
-  \parsearg\includezzz}
-% Restore active chars for included file.
-\def\includezzz#1{\endgroup\begingroup
-  % Read the included file in a group so nested @include's work.
-  \def\thisfile{#1}%
-  \let\value=\expandablevalue
-  \input\thisfile
-\endgroup}
-
-\def\thisfile{}
-
-% @center line
-% outputs that line, centered.
-%
-\def\center{\parsearg\docenter}
-\def\docenter#1{{%
-  \ifhmode \hfil\break \fi
-  \advance\hsize by -\leftskip
-  \advance\hsize by -\rightskip
-  \line{\hfil \ignorespaces#1\unskip \hfil}%
-  \ifhmode \break \fi
-}}
-
-% @sp n   outputs n lines of vertical space
-
-\def\sp{\parsearg\spxxx}
-\def\spxxx #1{\vskip #1\baselineskip}
-
-% @comment ...line which is ignored...
-% @c is the same as @comment
-% @ignore ... @end ignore  is another way to write a comment
-
-\def\comment{\begingroup \catcode`\^^M=\other%
-\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
-\commentxxx}
-{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
-
-\let\c=\comment
-
-% @paragraphindent NCHARS
-% We'll use ems for NCHARS, close enough.
-% NCHARS can also be the word `asis' or `none'.
-% We cannot feasibly implement @paragraphindent asis, though.
-%
-\def\asisword{asis} % no translation, these are keywords
-\def\noneword{none}
-%
-\def\paragraphindent{\parsearg\doparagraphindent}
-\def\doparagraphindent#1{%
-  \def\temp{#1}%
-  \ifx\temp\asisword
-  \else
-    \ifx\temp\noneword
-      \defaultparindent = 0pt
-    \else
-      \defaultparindent = #1em
-    \fi
-  \fi
-  \parindent = \defaultparindent
-}
-
-% @exampleindent NCHARS
-% We'll use ems for NCHARS like @paragraphindent.
-% It seems @exampleindent asis isn't necessary, but
-% I preserve it to make it similar to @paragraphindent.
-\def\exampleindent{\parsearg\doexampleindent}
-\def\doexampleindent#1{%
-  \def\temp{#1}%
-  \ifx\temp\asisword
-  \else
-    \ifx\temp\noneword
-      \lispnarrowing = 0pt
-    \else
-      \lispnarrowing = #1em
-    \fi
-  \fi
-}
-
-% @firstparagraphindent WORD
-% If WORD is `none', then suppress indentation of the first paragraph
-% after a section heading.  If WORD is `insert', then do indentat such
-% paragraphs.
-%
-% The paragraph indentation is suppressed or not by calling
-% \suppressfirstparagraphindent, which the sectioning commands do.  We
-% switch the definition of this back and forth according to WORD.  By
-% default, we suppress indentation.
-%
-\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
-\newdimen\currentparindent
-%
-\def\insertword{insert}
-%
-\def\firstparagraphindent{\parsearg\dofirstparagraphindent}
-\def\dofirstparagraphindent#1{%
-  \def\temp{#1}%
-  \ifx\temp\noneword
-    \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
-  \else\ifx\temp\insertword
-    \let\suppressfirstparagraphindent = \relax
-  \else
-    \errhelp = \EMsimple
-    \errmessage{Unknown @firstparagraphindent option `\temp'}%
-  \fi\fi
-}
-
-% Here is how we actually suppress indentation.  Redefine \everypar to
-% \kern backwards by \parindent, and then reset itself to empty.
-%
-% We also make \indent itself not actually do anything until the next
-% paragraph.
-%
-\gdef\dosuppressfirstparagraphindent{%
-  \gdef\indent{%
-    \global\let\indent=\ptexindent
-    \global\everypar = {}%
-  }%
-  \global\everypar = {%
-    \kern-\parindent
-    \global\let\indent=\ptexindent
-    \global\everypar = {}%
-  }%
-}%
-
-
-% @asis just yields its argument.  Used with @table, for example.
-%
-\def\asis#1{#1}
-
-% @math outputs its argument in math mode.
-% We don't use $'s directly in the definition of \math because we need
-% to set catcodes according to plain TeX first, to allow for subscripts,
-% superscripts, special math chars, etc.
-%
-\let\implicitmath = $%$ font-lock fix
-%
-% One complication: _ usually means subscripts, but it could also mean
-% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
-% _ within @math be active (mathcode "8000), and distinguish by seeing
-% if the current family is \slfam, which is what @var uses.
-%
-{\catcode\underChar = \active
-\gdef\mathunderscore{%
-  \catcode\underChar=\active
-  \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
-}}
-%
-% Another complication: we want \\ (and @\) to output a \ character.
-% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
-% this is not advertised and we don't care.  Texinfo does not
-% otherwise define @\.
-%
-% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
-\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
-%
-\def\math{%
-  \tex
-  \mathcode`\_="8000 \mathunderscore
-  \let\\ = \mathbackslash
-  \mathactive
-  \implicitmath\finishmath}
-\def\finishmath#1{#1\implicitmath\Etex}
-
-% Some active characters (such as <) are spaced differently in math.
-% We have to reset their definitions in case the @math was an
-% argument to a command which set the catcodes (such as @item or @section).
-%
-{
-  \catcode`^ = \active
-  \catcode`< = \active
-  \catcode`> = \active
-  \catcode`+ = \active
-  \gdef\mathactive{%
-    \let^ = \ptexhat
-    \let< = \ptexless
-    \let> = \ptexgtr
-    \let+ = \ptexplus
-  }
-}
-
-% @bullet and @minus need the same treatment as @math, just above.
-\def\bullet{\implicitmath\ptexbullet\implicitmath}
-\def\minus{\implicitmath-\implicitmath}
-
-% @refill is a no-op.
-\let\refill=\relax
-
-% If working on a large document in chapters, it is convenient to
-% be able to disable indexing, cross-referencing, and contents, for test runs.
-% This is done with @novalidate (before @setfilename).
-%
-\newif\iflinks \linkstrue % by default we want the aux files.
-\let\novalidate = \linksfalse
-
-% @setfilename is done at the beginning of every texinfo file.
-% So open here the files we need to have open while reading the input.
-% This makes it possible to make a .fmt file for texinfo.
-\def\setfilename{%
-   \iflinks
-     \readauxfile
-   \fi % \openindices needs to do some work in any case.
-   \openindices
-   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
-   \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
-   %
-   % If texinfo.cnf is present on the system, read it.
-   % Useful for site-wide @afourpaper, etc.
-   % Just to be on the safe side, close the input stream before the \input.
-   \openin 1 texinfo.cnf
-   \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
-   \closein1
-   \temp
-   %
-   \comment % Ignore the actual filename.
-}
-
-% Called from \setfilename.
-%
-\def\openindices{%
-  \newindex{cp}%
-  \newcodeindex{fn}%
-  \newcodeindex{vr}%
-  \newcodeindex{tp}%
-  \newcodeindex{ky}%
-  \newcodeindex{pg}%
-}
-
-% @bye.
-\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
-
-
-\message{pdf,}
-% adobe `portable' document format
-\newcount\tempnum
-\newcount\lnkcount
-\newtoks\filename
-\newcount\filenamelength
-\newcount\pgn
-\newtoks\toksA
-\newtoks\toksB
-\newtoks\toksC
-\newtoks\toksD
-\newbox\boxA
-\newcount\countA
-\newif\ifpdf
-\newif\ifpdfmakepagedest
-
-\ifx\pdfoutput\undefined
-  \pdffalse
-  \let\pdfmkdest = \gobble
-  \let\pdfurl = \gobble
-  \let\endlink = \relax
-  \let\linkcolor = \relax
-  \let\pdfmakeoutlines = \relax
-\else
-  \pdftrue
-  \pdfoutput = 1
-  \input pdfcolor
-  \def\dopdfimage#1#2#3{%
-    \def\imagewidth{#2}%
-    \def\imageheight{#3}%
-    % without \immediate, pdftex seg faults when the same image is
-    % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
-    \ifnum\pdftexversion < 14
-      \immediate\pdfimage
-    \else
-      \immediate\pdfximage
-    \fi
-      \ifx\empty\imagewidth\else width \imagewidth \fi
-      \ifx\empty\imageheight\else height \imageheight \fi
-      \ifnum\pdftexversion<13
-         #1.pdf%
-       \else
-         {#1.pdf}%
-       \fi
-    \ifnum\pdftexversion < 14 \else
-      \pdfrefximage \pdflastximage
-    \fi}
-  \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}}
-  \def\pdfmkpgn#1{#1}
-  \let\linkcolor = \Blue  % was Cyan, but that seems light?
-  \def\endlink{\Black\pdfendlink}
-  % Adding outlines to PDF; macros for calculating structure of outlines
-  % come from Petr Olsak
-  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
-    \else \csname#1\endcsname \fi}
-  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
-    \advance\tempnum by1
-    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
-  \def\pdfmakeoutlines{{%
-    \openin 1 \jobname.toc
-    \ifeof 1\else\begingroup
-      \closein 1
-      % Thanh's hack / proper braces in bookmarks
-      \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
-      \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
-      %
-      \def\chapentry ##1##2##3{}
-      \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
-      \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
-      \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
-      \let\appendixentry = \chapentry
-      \let\unnumbchapentry = \chapentry
-      \let\unnumbsecentry = \secentry
-      \let\unnumbsubsecentry = \subsecentry
-      \let\unnumbsubsubsecentry = \subsubsecentry
-      \input \jobname.toc
-      \def\chapentry ##1##2##3{%
-        \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
-      \def\secentry ##1##2##3##4{%
-        \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
-      \def\subsecentry ##1##2##3##4##5{%
-        \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
-      \def\subsubsecentry ##1##2##3##4##5##6{%
-        \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
-      \let\appendixentry = \chapentry
-      \let\unnumbchapentry = \chapentry
-      \let\unnumbsecentry = \secentry
-      \let\unnumbsubsecentry = \subsecentry
-      \let\unnumbsubsubsecentry = \subsubsecentry
-      %
-      % Make special characters normal for writing to the pdf file.
-      %
-      \indexnofonts
-      \let\tt=\relax
-      \turnoffactive
-      \input \jobname.toc
-    \endgroup\fi
-  }}
-  \def\makelinks #1,{%
-    \def\params{#1}\def\E{END}%
-    \ifx\params\E
-      \let\nextmakelinks=\relax
-    \else
-      \let\nextmakelinks=\makelinks
-      \ifnum\lnkcount>0,\fi
-      \picknum{#1}%
-      \startlink attr{/Border [0 0 0]}
-        goto name{\pdfmkpgn{\the\pgn}}%
-      \linkcolor #1%
-      \advance\lnkcount by 1%
-      \endlink
-    \fi
-    \nextmakelinks
-  }
-  \def\picknum#1{\expandafter\pn#1}
-  \def\pn#1{%
-    \def\p{#1}%
-    \ifx\p\lbrace
-      \let\nextpn=\ppn
-    \else
-      \let\nextpn=\ppnn
-      \def\first{#1}
-    \fi
-    \nextpn
-  }
-  \def\ppn#1{\pgn=#1\gobble}
-  \def\ppnn{\pgn=\first}
-  \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
-  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
-  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
-    \ifx\PP\D\let\nextsp\relax
-    \else\let\nextsp\skipspaces
-      \ifx\p\space\else\addtokens{\filename}{\PP}%
-        \advance\filenamelength by 1
-      \fi
-    \fi
-    \nextsp}
-  \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
-  \ifnum\pdftexversion < 14
-    \let \startlink \pdfannotlink
-  \else
-    \let \startlink \pdfstartlink
-  \fi
-  \def\pdfurl#1{%
-    \begingroup
-      \normalturnoffactive\def\@{@}%
-      \let\value=\expandablevalue
-      \leavevmode\Red
-      \startlink attr{/Border [0 0 0]}%
-        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
-        % #1
-    \endgroup}
-  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
-  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
-  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
-  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
-  \def\maketoks{%
-    \expandafter\poptoks\the\toksA|ENDTOKS|
-    \ifx\first0\adn0
-    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
-    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
-    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
-    \else
-      \ifnum0=\countA\else\makelink\fi
-      \ifx\first.\let\next=\done\else
-        \let\next=\maketoks
-        \addtokens{\toksB}{\the\toksD}
-        \ifx\first,\addtokens{\toksB}{\space}\fi
-      \fi
-    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
-    \next}
-  \def\makelink{\addtokens{\toksB}%
-    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
-  \def\pdflink#1{%
-    \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
-    \linkcolor #1\endlink}
-  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
-\fi % \ifx\pdfoutput
-
-
-\message{fonts,}
-% Font-change commands.
-
-% Texinfo sort of supports the sans serif font style, which plain TeX does not.
-% So we set up a \sf analogous to plain's \rm, etc.
-\newfam\sffam
-\def\sf{\fam=\sffam \tensf}
-\let\li = \sf % Sometimes we call it \li, not \sf.
-
-% We don't need math for this one.
-\def\ttsl{\tenttsl}
-
-% Default leading.
-\newdimen\textleading  \textleading = 13.2pt
-
-% Set the baselineskip to #1, and the lineskip and strut size
-% correspondingly.  There is no deep meaning behind these magic numbers
-% used as factors; they just match (closely enough) what Knuth defined.
-%
-\def\lineskipfactor{.08333}
-\def\strutheightpercent{.70833}
-\def\strutdepthpercent {.29167}
-%
-\def\setleading#1{%
-  \normalbaselineskip = #1\relax
-  \normallineskip = \lineskipfactor\normalbaselineskip
-  \normalbaselines
-  \setbox\strutbox =\hbox{%
-    \vrule width0pt height\strutheightpercent\baselineskip
-                    depth \strutdepthpercent \baselineskip
-  }%
-}
-
-% Set the font macro #1 to the font named #2, adding on the
-% specified font prefix (normally `cm').
-% #3 is the font's design size, #4 is a scale factor
-\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
-
-% Use cm as the default font prefix.
-% To specify the font prefix, you must define \fontprefix
-% before you read in texinfo.tex.
-\ifx\fontprefix\undefined
-\def\fontprefix{cm}
-\fi
-% Support font families that don't use the same naming scheme as CM.
-\def\rmshape{r}
-\def\rmbshape{bx}               %where the normal face is bold
-\def\bfshape{b}
-\def\bxshape{bx}
-\def\ttshape{tt}
-\def\ttbshape{tt}
-\def\ttslshape{sltt}
-\def\itshape{ti}
-\def\itbshape{bxti}
-\def\slshape{sl}
-\def\slbshape{bxsl}
-\def\sfshape{ss}
-\def\sfbshape{ss}
-\def\scshape{csc}
-\def\scbshape{csc}
-
-\newcount\mainmagstep
-\ifx\bigger\relax
-  % not really supported.
-  \mainmagstep=\magstep1
-  \setfont\textrm\rmshape{12}{1000}
-  \setfont\texttt\ttshape{12}{1000}
-\else
-  \mainmagstep=\magstephalf
-  \setfont\textrm\rmshape{10}{\mainmagstep}
-  \setfont\texttt\ttshape{10}{\mainmagstep}
-\fi
-% Instead of cmb10, you may want to use cmbx10.
-% cmbx10 is a prettier font on its own, but cmb10
-% looks better when embedded in a line with cmr10
-% (in Bob's opinion).
-\setfont\textbf\bfshape{10}{\mainmagstep}
-\setfont\textit\itshape{10}{\mainmagstep}
-\setfont\textsl\slshape{10}{\mainmagstep}
-\setfont\textsf\sfshape{10}{\mainmagstep}
-\setfont\textsc\scshape{10}{\mainmagstep}
-\setfont\textttsl\ttslshape{10}{\mainmagstep}
-\font\texti=cmmi10 scaled \mainmagstep
-\font\textsy=cmsy10 scaled \mainmagstep
-
-% A few fonts for @defun, etc.
-\setfont\defbf\bxshape{10}{\magstep1} %was 1314
-\setfont\deftt\ttshape{10}{\magstep1}
-\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
-
-% Fonts for indices, footnotes, small examples (9pt).
-\setfont\smallrm\rmshape{9}{1000}
-\setfont\smalltt\ttshape{9}{1000}
-\setfont\smallbf\bfshape{10}{900}
-\setfont\smallit\itshape{9}{1000}
-\setfont\smallsl\slshape{9}{1000}
-\setfont\smallsf\sfshape{9}{1000}
-\setfont\smallsc\scshape{10}{900}
-\setfont\smallttsl\ttslshape{10}{900}
-\font\smalli=cmmi9
-\font\smallsy=cmsy9
-
-% Fonts for small examples (8pt).
-\setfont\smallerrm\rmshape{8}{1000}
-\setfont\smallertt\ttshape{8}{1000}
-\setfont\smallerbf\bfshape{10}{800}
-\setfont\smallerit\itshape{8}{1000}
-\setfont\smallersl\slshape{8}{1000}
-\setfont\smallersf\sfshape{8}{1000}
-\setfont\smallersc\scshape{10}{800}
-\setfont\smallerttsl\ttslshape{10}{800}
-\font\smalleri=cmmi8
-\font\smallersy=cmsy8
-
-% Fonts for title page:
-\setfont\titlerm\rmbshape{12}{\magstep3}
-\setfont\titleit\itbshape{10}{\magstep4}
-\setfont\titlesl\slbshape{10}{\magstep4}
-\setfont\titlett\ttbshape{12}{\magstep3}
-\setfont\titlettsl\ttslshape{10}{\magstep4}
-\setfont\titlesf\sfbshape{17}{\magstep1}
-\let\titlebf=\titlerm
-\setfont\titlesc\scbshape{10}{\magstep4}
-\font\titlei=cmmi12 scaled \magstep3
-\font\titlesy=cmsy10 scaled \magstep4
-\def\authorrm{\secrm}
-\def\authortt{\sectt}
-
-% Chapter (and unnumbered) fonts (17.28pt).
-\setfont\chaprm\rmbshape{12}{\magstep2}
-\setfont\chapit\itbshape{10}{\magstep3}
-\setfont\chapsl\slbshape{10}{\magstep3}
-\setfont\chaptt\ttbshape{12}{\magstep2}
-\setfont\chapttsl\ttslshape{10}{\magstep3}
-\setfont\chapsf\sfbshape{17}{1000}
-\let\chapbf=\chaprm
-\setfont\chapsc\scbshape{10}{\magstep3}
-\font\chapi=cmmi12 scaled \magstep2
-\font\chapsy=cmsy10 scaled \magstep3
-
-% Section fonts (14.4pt).
-\setfont\secrm\rmbshape{12}{\magstep1}
-\setfont\secit\itbshape{10}{\magstep2}
-\setfont\secsl\slbshape{10}{\magstep2}
-\setfont\sectt\ttbshape{12}{\magstep1}
-\setfont\secttsl\ttslshape{10}{\magstep2}
-\setfont\secsf\sfbshape{12}{\magstep1}
-\let\secbf\secrm
-\setfont\secsc\scbshape{10}{\magstep2}
-\font\seci=cmmi12 scaled \magstep1
-\font\secsy=cmsy10 scaled \magstep2
-
-% Subsection fonts (13.15pt).
-\setfont\ssecrm\rmbshape{12}{\magstephalf}
-\setfont\ssecit\itbshape{10}{1315}
-\setfont\ssecsl\slbshape{10}{1315}
-\setfont\ssectt\ttbshape{12}{\magstephalf}
-\setfont\ssecttsl\ttslshape{10}{1315}
-\setfont\ssecsf\sfbshape{12}{\magstephalf}
-\let\ssecbf\ssecrm
-\setfont\ssecsc\scbshape{10}{\magstep1}
-\font\sseci=cmmi12 scaled \magstephalf
-\font\ssecsy=cmsy10 scaled 1315
-% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
-% but that is not a standard magnification.
-
-% In order for the font changes to affect most math symbols and letters,
-% we have to define the \textfont of the standard families.  Since
-% texinfo doesn't allow for producing subscripts and superscripts except
-% in the main text, we don't bother to reset \scriptfont and
-% \scriptscriptfont (which would also require loading a lot more fonts).
-%
-\def\resetmathfonts{%
-  \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
-  \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
-  \textfont\ttfam=\tentt \textfont\sffam=\tensf
-}
-
-% The font-changing commands redefine the meanings of \tenSTYLE, instead
-% of just \STYLE.  We do this so that font changes will continue to work
-% in math mode, where it is the current \fam that is relevant in most
-% cases, not the current font.  Plain TeX does \def\bf{\fam=\bffam
-% \tenbf}, for example.  By redefining \tenbf, we obviate the need to
-% redefine \bf itself.
-\def\textfonts{%
-  \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
-  \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
-  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
-  \resetmathfonts \setleading{\textleading}}
-\def\titlefonts{%
-  \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
-  \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
-  \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
-  \let\tenttsl=\titlettsl
-  \resetmathfonts \setleading{25pt}}
-\def\titlefont#1{{\titlefonts\rm #1}}
-\def\chapfonts{%
-  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
-  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
-  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
-  \resetmathfonts \setleading{19pt}}
-\def\secfonts{%
-  \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
-  \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
-  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
-  \resetmathfonts \setleading{16pt}}
-\def\subsecfonts{%
-  \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
-  \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
-  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
-  \resetmathfonts \setleading{15pt}}
-\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
-\def\smallfonts{%
-  \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
-  \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
-  \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
-  \let\tenttsl=\smallttsl
-  \resetmathfonts \setleading{10.5pt}}
-\def\smallerfonts{%
-  \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
-  \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
-  \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
-  \let\tenttsl=\smallerttsl
-  \resetmathfonts \setleading{9.5pt}}
-
-% Set the fonts to use with the @small... environments.
-\let\smallexamplefonts = \smallfonts
-
-% About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
-% can fit this many characters:
-%   8.5x11=86   smallbook=72  a4=90  a5=69
-% If we use \smallerfonts (8pt), then we can fit this many characters:
-%   8.5x11=90+  smallbook=80  a4=90+  a5=77
-% For me, subjectively, the few extra characters that fit aren't worth
-% the additional smallness of 8pt.  So I'm making the default 9pt.
-%
-% By the way, for comparison, here's what fits with @example (10pt):
-%   8.5x11=71  smallbook=60  a4=75  a5=58
-%
-% I wish we used A4 paper on this side of the Atlantic.
-%
-% --karl, 24jan03.
-
-
-% Set up the default fonts, so we can use them for creating boxes.
-%
-\textfonts
-
-% Define these so they can be easily changed for other fonts.
-\def\angleleft{$\langle$}
-\def\angleright{$\rangle$}
-
-% Count depth in font-changes, for error checks
-\newcount\fontdepth \fontdepth=0
-
-% Fonts for short table of contents.
-\setfont\shortcontrm\rmshape{12}{1000}
-\setfont\shortcontbf\bxshape{12}{1000}
-\setfont\shortcontsl\slshape{12}{1000}
-\setfont\shortconttt\ttshape{12}{1000}
-
-%% Add scribe-like font environments, plus @l for inline lisp (usually sans
-%% serif) and @ii for TeX italic
-
-% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
-% unless the following character is such as not to need one.
-\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else
-                    \ptexslash\fi\fi\fi}
-\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
-\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
-
-\let\i=\smartitalic
-\let\var=\smartslanted
-\let\dfn=\smartslanted
-\let\emph=\smartitalic
-\let\cite=\smartslanted
-
-\def\b#1{{\bf #1}}
-\let\strong=\b
-
-% We can't just use \exhyphenpenalty, because that only has effect at
-% the end of a paragraph.  Restore normal hyphenation at the end of the
-% group within which \nohyphenation is presumably called.
-%
-\def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
-\def\restorehyphenation{\hyphenchar\font = `- }
-
-% Set sfcode to normal for the chars that usually have another value.
-% Can't use plain's \frenchspacing because it uses the `\x notation, and
-% sometimes \x has an active definition that messes things up.
-%
-\catcode`@=11
-  \def\frenchspacing{%
-    \sfcode\dotChar  =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
-    \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
-  }
-\catcode`@=\other
-
-\def\t#1{%
-  {\tt \rawbackslash \frenchspacing #1}%
-  \null
-}
-\let\ttfont=\t
-\def\samp#1{`\tclose{#1}'\null}
-\setfont\keyrm\rmshape{8}{1000}
-\font\keysy=cmsy9
-\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
-  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
-    \vbox{\hrule\kern-0.4pt
-     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
-    \kern-0.4pt\hrule}%
-  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
-% The old definition, with no lozenge:
-%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
-\def\ctrl #1{{\tt \rawbackslash \hat}#1}
-
-% @file, @option are the same as @samp.
-\let\file=\samp
-\let\option=\samp
-
-% @code is a modification of @t,
-% which makes spaces the same size as normal in the surrounding text.
-\def\tclose#1{%
-  {%
-    % Change normal interword space to be same as for the current font.
-    \spaceskip = \fontdimen2\font
-    %
-    % Switch to typewriter.
-    \tt
-    %
-    % But `\ ' produces the large typewriter interword space.
-    \def\ {{\spaceskip = 0pt{} }}%
-    %
-    % Turn off hyphenation.
-    \nohyphenation
-    %
-    \rawbackslash
-    \frenchspacing
-    #1%
-  }%
-  \null
-}
-
-% We *must* turn on hyphenation at `-' and `_' in \code.
-% Otherwise, it is too hard to avoid overfull hboxes
-% in the Emacs manual, the Library manual, etc.
-
-% Unfortunately, TeX uses one parameter (\hyphenchar) to control
-% both hyphenation at - and hyphenation within words.
-% We must therefore turn them both off (\tclose does that)
-% and arrange explicitly to hyphenate at a dash.
-%  -- rms.
-{
-  \catcode`\-=\active
-  \catcode`\_=\active
-  %
-  \global\def\code{\begingroup
-    \catcode`\-=\active \let-\codedash
-    \catcode`\_=\active \let_\codeunder
-    \codex
-  }
-  %
-  % If we end up with any active - characters when handling the index,
-  % just treat them as a normal -.
-  \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
-}
-
-\def\realdash{-}
-\def\codedash{-\discretionary{}{}{}}
-\def\codeunder{%
-  % this is all so @math{@code{var_name}+1} can work.  In math mode, _
-  % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
-  % will therefore expand the active definition of _, which is us
-  % (inside @code that is), therefore an endless loop.
-  \ifusingtt{\ifmmode
-               \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
-             \else\normalunderscore \fi
-             \discretionary{}{}{}}%
-            {\_}%
-}
-\def\codex #1{\tclose{#1}\endgroup}
-
-% @kbd is like @code, except that if the argument is just one @key command,
-% then @kbd has no effect.
-
-% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
-%   `example' (@kbd uses ttsl only inside of @example and friends),
-%   or `code' (@kbd uses normal tty font always).
-\def\kbdinputstyle{\parsearg\kbdinputstylexxx}
-\def\kbdinputstylexxx#1{%
-  \def\arg{#1}%
-  \ifx\arg\worddistinct
-    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
-  \else\ifx\arg\wordexample
-    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
-  \else\ifx\arg\wordcode
-    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
-  \else
-    \errhelp = \EMsimple
-    \errmessage{Unknown @kbdinputstyle option `\arg'}%
-  \fi\fi\fi
-}
-\def\worddistinct{distinct}
-\def\wordexample{example}
-\def\wordcode{code}
-
-% Default is `distinct.'
-\kbdinputstyle distinct
-
-\def\xkey{\key}
-\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
-\ifx\one\xkey\ifx\threex\three \key{#2}%
-\else{\tclose{\kbdfont\look}}\fi
-\else{\tclose{\kbdfont\look}}\fi}
-
-% For @url, @env, @command quotes seem unnecessary, so use \code.
-\let\url=\code
-\let\env=\code
-\let\command=\code
-
-% @uref (abbreviation for `urlref') takes an optional (comma-separated)
-% second argument specifying the text to display and an optional third
-% arg as text to display instead of (rather than in addition to) the url
-% itself.  First (mandatory) arg is the url.  Perhaps eventually put in
-% a hypertex \special here.
-%
-\def\uref#1{\douref #1,,,\finish}
-\def\douref#1,#2,#3,#4\finish{\begingroup
-  \unsepspaces
-  \pdfurl{#1}%
-  \setbox0 = \hbox{\ignorespaces #3}%
-  \ifdim\wd0 > 0pt
-    \unhbox0 % third arg given, show only that
-  \else
-    \setbox0 = \hbox{\ignorespaces #2}%
-    \ifdim\wd0 > 0pt
-      \ifpdf
-        \unhbox0             % PDF: 2nd arg given, show only it
-      \else
-        \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
-      \fi
-    \else
-      \code{#1}% only url given, so show it
-    \fi
-  \fi
-  \endlink
-\endgroup}
-
-% rms does not like angle brackets --karl, 17may97.
-% So now @email is just like @uref, unless we are pdf.
-%
-%\def\email#1{\angleleft{\tt #1}\angleright}
-\ifpdf
-  \def\email#1{\doemail#1,,\finish}
-  \def\doemail#1,#2,#3\finish{\begingroup
-    \unsepspaces
-    \pdfurl{mailto:#1}%
-    \setbox0 = \hbox{\ignorespaces #2}%
-    \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
-    \endlink
-  \endgroup}
-\else
-  \let\email=\uref
-\fi
-
-% Check if we are currently using a typewriter font.  Since all the
-% Computer Modern typewriter fonts have zero interword stretch (and
-% shrink), and it is reasonable to expect all typewriter fonts to have
-% this property, we can check that font parameter.
-%
-\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
-
-% Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
-% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
-%
-\def\dmn#1{\thinspace #1}
-
-\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
-
-% @l was never documented to mean ``switch to the Lisp font'',
-% and it is not used as such in any manual I can find.  We need it for
-% Polish suppressed-l.  --karl, 22sep96.
-%\def\l#1{{\li #1}\null}
-
-% Explicit font changes: @r, @sc, undocumented @ii.
-\def\r#1{{\rm #1}}              % roman font
-\def\sc#1{{\smallcaps#1}}       % smallcaps font
-\def\ii#1{{\it #1}}             % italic font
-
-% @acronym downcases the argument and prints in smallcaps.
-\def\acronym#1{{\smallcaps \lowercase{#1}}}
-
-% @pounds{} is a sterling sign.
-\def\pounds{{\it\$}}
-
-% @registeredsymbol - R in a circle.  For now, only works in text size;
-% we'd have to redo the font mechanism to change the \scriptstyle and
-% \scriptscriptstyle font sizes to make it look right in headings.
-% Adapted from the plain.tex definition of \copyright.
-%
-\def\registeredsymbol{%
-  $^{{\ooalign{\hfil\raise.07ex\hbox{$\scriptstyle\rm R$}\hfil\crcr\Orb}}%
-    }$%
-}
-
-
-\message{page headings,}
-
-\newskip\titlepagetopglue \titlepagetopglue = 1.5in
-\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
-
-% First the title page.  Must do @settitle before @titlepage.
-\newif\ifseenauthor
-\newif\iffinishedtitlepage
-
-% Do an implicit @contents or @shortcontents after @end titlepage if the
-% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
-%
-\newif\ifsetcontentsaftertitlepage
- \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
-\newif\ifsetshortcontentsaftertitlepage
- \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
-
-\def\shorttitlepage{\parsearg\shorttitlepagezzz}
-\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
-        \endgroup\page\hbox{}\page}
-
-\def\titlepage{\begingroup \parindent=0pt \textfonts
-   \let\subtitlerm=\tenrm
-   \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
-   %
-   \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
-                   \let\tt=\authortt}%
-   %
-   % Leave some space at the very top of the page.
-   \vglue\titlepagetopglue
-   %
-   % Now you can print the title using @title.
-   \def\title{\parsearg\titlezzz}%
-   \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
-                    % print a rule at the page bottom also.
-                    \finishedtitlepagefalse
-                    \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
-   % No rule at page bottom unless we print one at the top with @title.
-   \finishedtitlepagetrue
-   %
-   % Now you can put text using @subtitle.
-   \def\subtitle{\parsearg\subtitlezzz}%
-   \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
-   %
-   % @author should come last, but may come many times.
-   \def\author{\parsearg\authorzzz}%
-   \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
-      {\authorfont \leftline{##1}}}%
-   %
-   % Most title ``pages'' are actually two pages long, with space
-   % at the top of the second.  We don't want the ragged left on the second.
-   \let\oldpage = \page
-   \def\page{%
-      \iffinishedtitlepage\else
-         \finishtitlepage
-      \fi
-      \oldpage
-      \let\page = \oldpage
-      \hbox{}}%
-%   \def\page{\oldpage \hbox{}}
-}
-
-\def\Etitlepage{%
-   \iffinishedtitlepage\else
-      \finishtitlepage
-   \fi
-   % It is important to do the page break before ending the group,
-   % because the headline and footline are only empty inside the group.
-   % If we use the new definition of \page, we always get a blank page
-   % after the title page, which we certainly don't want.
-   \oldpage
-   \endgroup
-   %
-   % Need this before the \...aftertitlepage checks so that if they are
-   % in effect the toc pages will come out with page numbers.
-   \HEADINGSon
-   %
-   % If they want short, they certainly want long too.
-   \ifsetshortcontentsaftertitlepage
-     \shortcontents
-     \contents
-     \global\let\shortcontents = \relax
-     \global\let\contents = \relax
-   \fi
-   %
-   \ifsetcontentsaftertitlepage
-     \contents
-     \global\let\contents = \relax
-     \global\let\shortcontents = \relax
-   \fi
-}
-
-\def\finishtitlepage{%
-   \vskip4pt \hrule height 2pt width \hsize
-   \vskip\titlepagebottomglue
-   \finishedtitlepagetrue
-}
-
-%%% Set up page headings and footings.
-
-\let\thispage=\folio
-
-\newtoks\evenheadline    % headline on even pages
-\newtoks\oddheadline     % headline on odd pages
-\newtoks\evenfootline    % footline on even pages
-\newtoks\oddfootline     % footline on odd pages
-
-% Now make Tex use those variables
-\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
-                            \else \the\evenheadline \fi}}
-\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
-                            \else \the\evenfootline \fi}\HEADINGShook}
-\let\HEADINGShook=\relax
-
-% Commands to set those variables.
-% For example, this is what  @headings on  does
-% @evenheading @thistitle|@thispage|@thischapter
-% @oddheading @thischapter|@thispage|@thistitle
-% @evenfooting @thisfile||
-% @oddfooting ||@thisfile
-
-\def\evenheading{\parsearg\evenheadingxxx}
-\def\oddheading{\parsearg\oddheadingxxx}
-\def\everyheading{\parsearg\everyheadingxxx}
-
-\def\evenfooting{\parsearg\evenfootingxxx}
-\def\oddfooting{\parsearg\oddfootingxxx}
-\def\everyfooting{\parsearg\everyfootingxxx}
-
-{\catcode`\@=0 %
-
-\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
-\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
-\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
-\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
-\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
-
-\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
-\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
-\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
-\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
-  \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
-  %
-  % Leave some space for the footline.  Hopefully ok to assume
-  % @evenfooting will not be used by itself.
-  \global\advance\pageheight by -\baselineskip
-  \global\advance\vsize by -\baselineskip
-}
-
-\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
-%
-}% unbind the catcode of @.
-
-% @headings double      turns headings on for double-sided printing.
-% @headings single      turns headings on for single-sided printing.
-% @headings off         turns them off.
-% @headings on          same as @headings double, retained for compatibility.
-% @headings after       turns on double-sided headings after this page.
-% @headings doubleafter turns on double-sided headings after this page.
-% @headings singleafter turns on single-sided headings after this page.
-% By default, they are off at the start of a document,
-% and turned `on' after @end titlepage.
-
-\def\headings #1 {\csname HEADINGS#1\endcsname}
-
-\def\HEADINGSoff{
-\global\evenheadline={\hfil} \global\evenfootline={\hfil}
-\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
-\HEADINGSoff
-% When we turn headings on, set the page number to 1.
-% For double-sided printing, put current file name in lower left corner,
-% chapter name on inside top of right hand pages, document
-% title on inside top of left hand pages, and page numbers on outside top
-% edge of all pages.
-\def\HEADINGSdouble{
-\global\pageno=1
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\folio\hfil\thistitle}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chapoddpage
-}
-\let\contentsalignmacro = \chappager
-
-% For single-sided printing, chapter title goes across top left of page,
-% page number on top right.
-\def\HEADINGSsingle{
-\global\pageno=1
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\thischapter\hfil\folio}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chappager
-}
-\def\HEADINGSon{\HEADINGSdouble}
-
-\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
-\let\HEADINGSdoubleafter=\HEADINGSafter
-\def\HEADINGSdoublex{%
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\folio\hfil\thistitle}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chapoddpage
-}
-
-\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
-\def\HEADINGSsinglex{%
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\thischapter\hfil\folio}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chappager
-}
-
-% Subroutines used in generating headings
-% This produces Day Month Year style of output.
-% Only define if not already defined, in case a txi-??.tex file has set
-% up a different format (e.g., txi-cs.tex does this).
-\ifx\today\undefined
-\def\today{%
-  \number\day\space
-  \ifcase\month
-  \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
-  \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
-  \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
-  \fi
-  \space\number\year}
-\fi
-
-% @settitle line...  specifies the title of the document, for headings.
-% It generates no output of its own.
-\def\thistitle{\putwordNoTitle}
-\def\settitle{\parsearg\settitlezzz}
-\def\settitlezzz #1{\gdef\thistitle{#1}}
-
-
-\message{tables,}
-% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
-
-% default indentation of table text
-\newdimen\tableindent \tableindent=.8in
-% default indentation of @itemize and @enumerate text
-\newdimen\itemindent  \itemindent=.3in
-% margin between end of table item and start of table text.
-\newdimen\itemmargin  \itemmargin=.1in
-
-% used internally for \itemindent minus \itemmargin
-\newdimen\itemmax
-
-% Note @table, @vtable, and @vtable define @item, @itemx, etc., with
-% these defs.
-% They also define \itemindex
-% to index the item name in whatever manner is desired (perhaps none).
-
-\newif\ifitemxneedsnegativevskip
-
-\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
-
-\def\internalBitem{\smallbreak \parsearg\itemzzz}
-\def\internalBitemx{\itemxpar \parsearg\itemzzz}
-
-\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
-\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
-
-\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
-\def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
-
-\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
-                 \itemzzz {#1}}
-
-\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
-                 \itemzzz {#1}}
-
-\def\itemzzz #1{\begingroup %
-  \advance\hsize by -\rightskip
-  \advance\hsize by -\tableindent
-  \setbox0=\hbox{\itemfont{#1}}%
-  \itemindex{#1}%
-  \nobreak % This prevents a break before @itemx.
-  %
-  % If the item text does not fit in the space we have, put it on a line
-  % by itself, and do not allow a page break either before or after that
-  % line.  We do not start a paragraph here because then if the next
-  % command is, e.g., @kindex, the whatsit would get put into the
-  % horizontal list on a line by itself, resulting in extra blank space.
-  \ifdim \wd0>\itemmax
-    %
-    % Make this a paragraph so we get the \parskip glue and wrapping,
-    % but leave it ragged-right.
-    \begingroup
-      \advance\leftskip by-\tableindent
-      \advance\hsize by\tableindent
-      \advance\rightskip by0pt plus1fil
-      \leavevmode\unhbox0\par
-    \endgroup
-    %
-    % We're going to be starting a paragraph, but we don't want the
-    % \parskip glue -- logically it's part of the @item we just started.
-    \nobreak \vskip-\parskip
-    %
-    % Stop a page break at the \parskip glue coming up.  (Unfortunately
-    % we can't prevent a possible page break at the following
-    % \baselineskip glue.)  However, if what follows is an environment
-    % such as @example, there will be no \parskip glue; then
-    % the negative vskip we just would cause the example and the item to
-    % crash together.  So we use this bizarre value of 10001 as a signal
-    % to \aboveenvbreak to insert \parskip glue after all.
-    % (Possibly there are other commands that could be followed by
-    % @example which need the same treatment, but not section titles; or
-    % maybe section titles are the only special case and they should be
-    % penalty 10001...)
-    \penalty 10001
-    \endgroup
-    \itemxneedsnegativevskipfalse
-  \else
-    % The item text fits into the space.  Start a paragraph, so that the
-    % following text (if any) will end up on the same line.
-    \noindent
-    % Do this with kerns and \unhbox so that if there is a footnote in
-    % the item text, it can migrate to the main vertical list and
-    % eventually be printed.
-    \nobreak\kern-\tableindent
-    \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
-    \unhbox0
-    \nobreak\kern\dimen0
-    \endgroup
-    \itemxneedsnegativevskiptrue
-  \fi
-}
-
-\def\item{\errmessage{@item while not in a table}}
-\def\itemx{\errmessage{@itemx while not in a table}}
-\def\kitem{\errmessage{@kitem while not in a table}}
-\def\kitemx{\errmessage{@kitemx while not in a table}}
-\def\xitem{\errmessage{@xitem while not in a table}}
-\def\xitemx{\errmessage{@xitemx while not in a table}}
-
-% Contains a kludge to get @end[description] to work.
-\def\description{\tablez{\dontindex}{1}{}{}{}{}}
-
-% @table, @ftable, @vtable.
-\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
-{\obeylines\obeyspaces%
-\gdef\tablex #1^^M{%
-\tabley\dontindex#1        \endtabley}}
-
-\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
-{\obeylines\obeyspaces%
-\gdef\ftablex #1^^M{%
-\tabley\fnitemindex#1        \endtabley
-\def\Eftable{\endgraf\afterenvbreak\endgroup}%
-\let\Etable=\relax}}
-
-\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
-{\obeylines\obeyspaces%
-\gdef\vtablex #1^^M{%
-\tabley\vritemindex#1        \endtabley
-\def\Evtable{\endgraf\afterenvbreak\endgroup}%
-\let\Etable=\relax}}
-
-\def\dontindex #1{}
-\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
-\def\vritemindex #1{\doind {vr}{\code{#1}}}%
-
-{\obeyspaces %
-\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
-\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
-
-\def\tablez #1#2#3#4#5#6{%
-\aboveenvbreak %
-\begingroup %
-\def\Edescription{\Etable}% Necessary kludge.
-\let\itemindex=#1%
-\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
-\ifnum 0#4>0 \tableindent=#4\mil \fi %
-\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
-\def\itemfont{#2}%
-\itemmax=\tableindent %
-\advance \itemmax by -\itemmargin %
-\advance \leftskip by \tableindent %
-\exdentamount=\tableindent
-\parindent = 0pt
-\parskip = \smallskipamount
-\ifdim \parskip=0pt \parskip=2pt \fi%
-\def\Etable{\endgraf\afterenvbreak\endgroup}%
-\let\item = \internalBitem %
-\let\itemx = \internalBitemx %
-\let\kitem = \internalBkitem %
-\let\kitemx = \internalBkitemx %
-\let\xitem = \internalBxitem %
-\let\xitemx = \internalBxitemx %
-}
-
-% This is the counter used by @enumerate, which is really @itemize
-
-\newcount \itemno
-
-\def\itemize{\parsearg\itemizezzz}
-
-\def\itemizezzz #1{%
-  \begingroup % ended by the @end itemize
-  \itemizey {#1}{\Eitemize}
-}
-
-\def\itemizey#1#2{%
-  \aboveenvbreak
-  \itemmax=\itemindent
-  \advance\itemmax by -\itemmargin
-  \advance\leftskip by \itemindent
-  \exdentamount=\itemindent
-  \parindent=0pt
-  \parskip=\smallskipamount
-  \ifdim\parskip=0pt \parskip=2pt \fi
-  \def#2{\endgraf\afterenvbreak\endgroup}%
-  \def\itemcontents{#1}%
-  % @itemize with no arg is equivalent to @itemize @bullet.
-  \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
-  \let\item=\itemizeitem
-}
-
-% \splitoff TOKENS\endmark defines \first to be the first token in
-% TOKENS, and \rest to be the remainder.
-%
-\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
-
-% Allow an optional argument of an uppercase letter, lowercase letter,
-% or number, to specify the first label in the enumerated list.  No
-% argument is the same as `1'.
-%
-\def\enumerate{\parsearg\enumeratezzz}
-\def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
-\def\enumeratey #1 #2\endenumeratey{%
-  \begingroup % ended by the @end enumerate
-  %
-  % If we were given no argument, pretend we were given `1'.
-  \def\thearg{#1}%
-  \ifx\thearg\empty \def\thearg{1}\fi
-  %
-  % Detect if the argument is a single token.  If so, it might be a
-  % letter.  Otherwise, the only valid thing it can be is a number.
-  % (We will always have one token, because of the test we just made.
-  % This is a good thing, since \splitoff doesn't work given nothing at
-  % all -- the first parameter is undelimited.)
-  \expandafter\splitoff\thearg\endmark
-  \ifx\rest\empty
-    % Only one token in the argument.  It could still be anything.
-    % A ``lowercase letter'' is one whose \lccode is nonzero.
-    % An ``uppercase letter'' is one whose \lccode is both nonzero, and
-    %   not equal to itself.
-    % Otherwise, we assume it's a number.
-    %
-    % We need the \relax at the end of the \ifnum lines to stop TeX from
-    % continuing to look for a <number>.
-    %
-    \ifnum\lccode\expandafter`\thearg=0\relax
-      \numericenumerate % a number (we hope)
-    \else
-      % It's a letter.
-      \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
-        \lowercaseenumerate % lowercase letter
-      \else
-        \uppercaseenumerate % uppercase letter
-      \fi
-    \fi
-  \else
-    % Multiple tokens in the argument.  We hope it's a number.
-    \numericenumerate
-  \fi
-}
-
-% An @enumerate whose labels are integers.  The starting integer is
-% given in \thearg.
-%
-\def\numericenumerate{%
-  \itemno = \thearg
-  \startenumeration{\the\itemno}%
-}
-
-% The starting (lowercase) letter is in \thearg.
-\def\lowercaseenumerate{%
-  \itemno = \expandafter`\thearg
-  \startenumeration{%
-    % Be sure we're not beyond the end of the alphabet.
-    \ifnum\itemno=0
-      \errmessage{No more lowercase letters in @enumerate; get a bigger
-                  alphabet}%
-    \fi
-    \char\lccode\itemno
-  }%
-}
-
-% The starting (uppercase) letter is in \thearg.
-\def\uppercaseenumerate{%
-  \itemno = \expandafter`\thearg
-  \startenumeration{%
-    % Be sure we're not beyond the end of the alphabet.
-    \ifnum\itemno=0
-      \errmessage{No more uppercase letters in @enumerate; get a bigger
-                  alphabet}
-    \fi
-    \char\uccode\itemno
-  }%
-}
-
-% Call itemizey, adding a period to the first argument and supplying the
-% common last two arguments.  Also subtract one from the initial value in
-% \itemno, since @item increments \itemno.
-%
-\def\startenumeration#1{%
-  \advance\itemno by -1
-  \itemizey{#1.}\Eenumerate\flushcr
-}
-
-% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
-% to @enumerate.
-%
-\def\alphaenumerate{\enumerate{a}}
-\def\capsenumerate{\enumerate{A}}
-\def\Ealphaenumerate{\Eenumerate}
-\def\Ecapsenumerate{\Eenumerate}
-
-% Definition of @item while inside @itemize.
-
-\def\itemizeitem{%
-\advance\itemno by 1
-{\let\par=\endgraf \smallbreak}%
-\ifhmode \errmessage{In hmode at itemizeitem}\fi
-{\parskip=0in \hskip 0pt
-\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
-\vadjust{\penalty 1200}}%
-\flushcr}
-
-% @multitable macros
-% Amy Hendrickson, 8/18/94, 3/6/96
-%
-% @multitable ... @end multitable will make as many columns as desired.
-% Contents of each column will wrap at width given in preamble.  Width
-% can be specified either with sample text given in a template line,
-% or in percent of \hsize, the current width of text on page.
-
-% Table can continue over pages but will only break between lines.
-
-% To make preamble:
-%
-% Either define widths of columns in terms of percent of \hsize:
-%   @multitable @columnfractions .25 .3 .45
-%   @item ...
-%
-%   Numbers following @columnfractions are the percent of the total
-%   current hsize to be used for each column. You may use as many
-%   columns as desired.
-
-
-% Or use a template:
-%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
-%   @item ...
-%   using the widest term desired in each column.
-%
-% For those who want to use more than one line's worth of words in
-% the preamble, break the line within one argument and it
-% will parse correctly, i.e.,
-%
-%     @multitable {Column 1 template} {Column 2 template} {Column 3
-%      template}
-% Not:
-%     @multitable {Column 1 template} {Column 2 template}
-%      {Column 3 template}
-
-% Each new table line starts with @item, each subsequent new column
-% starts with @tab. Empty columns may be produced by supplying @tab's
-% with nothing between them for as many times as empty columns are needed,
-% ie, @tab@tab@tab will produce two empty columns.
-
-% @item, @tab, @multitable or @end multitable do not need to be on their
-% own lines, but it will not hurt if they are.
-
-% Sample multitable:
-
-%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
-%   @item first col stuff @tab second col stuff @tab third col
-%   @item
-%   first col stuff
-%   @tab
-%   second col stuff
-%   @tab
-%   third col
-%   @item first col stuff @tab second col stuff
-%   @tab Many paragraphs of text may be used in any column.
-%
-%         They will wrap at the width determined by the template.
-%   @item@tab@tab This will be in third column.
-%   @end multitable
-
-% Default dimensions may be reset by user.
-% @multitableparskip is vertical space between paragraphs in table.
-% @multitableparindent is paragraph indent in table.
-% @multitablecolmargin is horizontal space to be left between columns.
-% @multitablelinespace is space to leave between table items, baseline
-%                                                            to baseline.
-%   0pt means it depends on current normal line spacing.
-%
-\newskip\multitableparskip
-\newskip\multitableparindent
-\newdimen\multitablecolspace
-\newskip\multitablelinespace
-\multitableparskip=0pt
-\multitableparindent=6pt
-\multitablecolspace=12pt
-\multitablelinespace=0pt
-
-% Macros used to set up halign preamble:
-%
-\let\endsetuptable\relax
-\def\xendsetuptable{\endsetuptable}
-\let\columnfractions\relax
-\def\xcolumnfractions{\columnfractions}
-\newif\ifsetpercent
-
-% #1 is the part of the @columnfraction before the decimal point, which
-% is presumably either 0 or the empty string (but we don't check, we
-% just throw it away).  #2 is the decimal part, which we use as the
-% percent of \hsize for this column.
-\def\pickupwholefraction#1.#2 {%
-  \global\advance\colcount by 1
-  \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
-  \setuptable
-}
-
-\newcount\colcount
-\def\setuptable#1{%
-  \def\firstarg{#1}%
-  \ifx\firstarg\xendsetuptable
-    \let\go = \relax
-  \else
-    \ifx\firstarg\xcolumnfractions
-      \global\setpercenttrue
-    \else
-      \ifsetpercent
-         \let\go\pickupwholefraction
-      \else
-         \global\advance\colcount by 1
-         \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
-                   % separator; typically that is always in the input, anyway.
-         \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
-      \fi
-    \fi
-    \ifx\go\pickupwholefraction
-      % Put the argument back for the \pickupwholefraction call, so
-      % we'll always have a period there to be parsed.
-      \def\go{\pickupwholefraction#1}%
-    \else
-      \let\go = \setuptable
-    \fi%
-  \fi
-  \go
-}
-
-% @multitable ... @end multitable definitions:
-%
-\def\multitable{\parsearg\dotable}
-\def\dotable#1{\bgroup
-  \vskip\parskip
-  \let\item=\crcrwithfootnotes
-  % A \tab used to include \hskip1sp.  But then the space in a template
-  % line is not enough.  That is bad.  So let's go back to just & until
-  % we encounter the problem it was intended to solve again.  --karl,
-  % nathan@acm.org, 20apr99.
-  \let\tab=&%
-  \let\startfootins=\startsavedfootnote
-  \tolerance=9500
-  \hbadness=9500
-  \setmultitablespacing
-  \parskip=\multitableparskip
-  \parindent=\multitableparindent
-  \overfullrule=0pt
-  \global\colcount=0
-  \def\Emultitable{%
-    \global\setpercentfalse
-    \crcrwithfootnotes\crcr
-    \egroup\egroup
-  }%
-  %
-  % To parse everything between @multitable and @item:
-  \setuptable#1 \endsetuptable
-  %
-  % \everycr will reset column counter, \colcount, at the end of
-  % each line. Every column entry will cause \colcount to advance by one.
-  % The table preamble
-  % looks at the current \colcount to find the correct column width.
-  \everycr{\noalign{%
-  %
-  % \filbreak%% keeps underfull box messages off when table breaks over pages.
-  % Maybe so, but it also creates really weird page breaks when the table
-  % breaks over pages. Wouldn't \vfil be better?  Wait until the problem
-  % manifests itself, so it can be fixed for real --karl.
-    \global\colcount=0\relax}}%
-  %
-  % This preamble sets up a generic column definition, which will
-  % be used as many times as user calls for columns.
-  % \vtop will set a single line and will also let text wrap and
-  % continue for many paragraphs if desired.
-  \halign\bgroup&\global\advance\colcount by 1\relax
-    \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
-  %
-  % In order to keep entries from bumping into each other
-  % we will add a \leftskip of \multitablecolspace to all columns after
-  % the first one.
-  %
-  % If a template has been used, we will add \multitablecolspace
-  % to the width of each template entry.
-  %
-  % If the user has set preamble in terms of percent of \hsize we will
-  % use that dimension as the width of the column, and the \leftskip
-  % will keep entries from bumping into each other.  Table will start at
-  % left margin and final column will justify at right margin.
-  %
-  % Make sure we don't inherit \rightskip from the outer environment.
-  \rightskip=0pt
-  \ifnum\colcount=1
-    % The first column will be indented with the surrounding text.
-    \advance\hsize by\leftskip
-  \else
-    \ifsetpercent \else
-      % If user has not set preamble in terms of percent of \hsize
-      % we will advance \hsize by \multitablecolspace.
-      \advance\hsize by \multitablecolspace
-    \fi
-   % In either case we will make \leftskip=\multitablecolspace:
-  \leftskip=\multitablecolspace
-  \fi
-  % Ignoring space at the beginning and end avoids an occasional spurious
-  % blank line, when TeX decides to break the line at the space before the
-  % box from the multistrut, so the strut ends up on a line by itself.
-  % For example:
-  % @multitable @columnfractions .11 .89
-  % @item @code{#}
-  % @tab Legal holiday which is valid in major parts of the whole country.
-  % Is automatically provided with highlighting sequences respectively marking
-  % characters.
-  \noindent\ignorespaces##\unskip\multistrut}\cr
-}
-
-\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
-% If so, do nothing. If not, give it an appropriate dimension based on
-% current baselineskip.
-\ifdim\multitablelinespace=0pt
-\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
-\global\advance\multitablelinespace by-\ht0
-%% strut to put in table in case some entry doesn't have descenders,
-%% to keep lines equally spaced
-\let\multistrut = \strut
-\else
-%% FIXME: what is \box0 supposed to be?
-\gdef\multistrut{\vrule height\multitablelinespace depth\dp0
-width0pt\relax} \fi
-%% Test to see if parskip is larger than space between lines of
-%% table. If not, do nothing.
-%%        If so, set to same dimension as multitablelinespace.
-\ifdim\multitableparskip>\multitablelinespace
-\global\multitableparskip=\multitablelinespace
-\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
-                                      %% than skip between lines in the table.
-\fi%
-\ifdim\multitableparskip=0pt
-\global\multitableparskip=\multitablelinespace
-\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
-                                      %% than skip between lines in the table.
-\fi}
-
-% In case a @footnote appears inside an alignment, save the footnote
-% text to a box and make the \insert when a row of the table is
-% finished.  Otherwise, the insertion is lost, it never migrates to the
-% main vertical list.  --kasal, 22jan03.
-%
-\newbox\savedfootnotes
-%
-% \dotable \let's \startfootins to this, so that \dofootnote will call
-% it instead of starting the insertion right away.
-\def\startsavedfootnote{%
-  \global\setbox\savedfootnotes = \vbox\bgroup
-    \unvbox\savedfootnotes
-}
-\def\crcrwithfootnotes{%
-  \crcr
-  \ifvoid\savedfootnotes \else
-    \noalign{\insert\footins{\box\savedfootnotes}}%
-  \fi
-}
-
-\message{conditionals,}
-% Prevent errors for section commands.
-% Used in @ignore and in failing conditionals.
-\def\ignoresections{%
-  \let\chapter=\relax
-  \let\unnumbered=\relax
-  \let\top=\relax
-  \let\unnumberedsec=\relax
-  \let\unnumberedsection=\relax
-  \let\unnumberedsubsec=\relax
-  \let\unnumberedsubsection=\relax
-  \let\unnumberedsubsubsec=\relax
-  \let\unnumberedsubsubsection=\relax
-  \let\section=\relax
-  \let\subsec=\relax
-  \let\subsubsec=\relax
-  \let\subsection=\relax
-  \let\subsubsection=\relax
-  \let\appendix=\relax
-  \let\appendixsec=\relax
-  \let\appendixsection=\relax
-  \let\appendixsubsec=\relax
-  \let\appendixsubsection=\relax
-  \let\appendixsubsubsec=\relax
-  \let\appendixsubsubsection=\relax
-  \let\contents=\relax
-  \let\smallbook=\relax
-  \let\titlepage=\relax
-}
-
-% Used in nested conditionals, where we have to parse the Texinfo source
-% and so want to turn off most commands, in case they are used
-% incorrectly.
-%
-% We use \empty instead of \relax for the @def... commands, so that \end
-% doesn't throw an error.  For instance:
-% @ignore
-% @deffn ...
-% @end deffn
-% @end ignore
-%
-% The @end deffn is going to get expanded, because we're trying to allow
-% nested conditionals.  But we don't want to expand the actual @deffn,
-% since it might be syntactically correct and intended to be ignored.
-% Since \end checks for \relax, using \empty does not cause an error.
-%
-\def\ignoremorecommands{%
-  \let\defcodeindex = \relax
-  \let\defcv = \empty
-  \let\defcvx = \empty
-  \let\Edefcv = \empty
-  \let\deffn = \empty
-  \let\deffnx = \empty
-  \let\Edeffn = \empty
-  \let\defindex = \relax
-  \let\defivar = \empty
-  \let\defivarx = \empty
-  \let\Edefivar = \empty
-  \let\defmac = \empty
-  \let\defmacx = \empty
-  \let\Edefmac = \empty
-  \let\defmethod = \empty
-  \let\defmethodx = \empty
-  \let\Edefmethod = \empty
-  \let\defop = \empty
-  \let\defopx = \empty
-  \let\Edefop = \empty
-  \let\defopt = \empty
-  \let\defoptx = \empty
-  \let\Edefopt = \empty
-  \let\defspec = \empty
-  \let\defspecx = \empty
-  \let\Edefspec = \empty
-  \let\deftp = \empty
-  \let\deftpx = \empty
-  \let\Edeftp = \empty
-  \let\deftypefn = \empty
-  \let\deftypefnx = \empty
-  \let\Edeftypefn = \empty
-  \let\deftypefun = \empty
-  \let\deftypefunx = \empty
-  \let\Edeftypefun = \empty
-  \let\deftypeivar = \empty
-  \let\deftypeivarx = \empty
-  \let\Edeftypeivar = \empty
-  \let\deftypemethod = \empty
-  \let\deftypemethodx = \empty
-  \let\Edeftypemethod = \empty
-  \let\deftypeop = \empty
-  \let\deftypeopx = \empty
-  \let\Edeftypeop = \empty
-  \let\deftypevar = \empty
-  \let\deftypevarx = \empty
-  \let\Edeftypevar = \empty
-  \let\deftypevr = \empty
-  \let\deftypevrx = \empty
-  \let\Edeftypevr = \empty
-  \let\defun = \empty
-  \let\defunx = \empty
-  \let\Edefun = \empty
-  \let\defvar = \empty
-  \let\defvarx = \empty
-  \let\Edefvar = \empty
-  \let\defvr = \empty
-  \let\defvrx = \empty
-  \let\Edefvr = \empty
-  \let\clear = \relax
-  \let\down = \relax
-  \let\evenfooting = \relax
-  \let\evenheading = \relax
-  \let\everyfooting = \relax
-  \let\everyheading = \relax
-  \let\headings = \relax
-  \let\include = \relax
-  \let\item = \relax
-  \let\lowersections = \relax
-  \let\oddfooting = \relax
-  \let\oddheading = \relax
-  \let\printindex = \relax
-  \let\pxref = \relax
-  \let\raisesections = \relax
-  \let\ref = \relax
-  \let\set = \relax
-  \let\setchapternewpage = \relax
-  \let\setchapterstyle = \relax
-  \let\settitle = \relax
-  \let\up = \relax
-  \let\verbatiminclude = \relax
-  \let\xref = \relax
-}
-
-% Ignore @ignore, @ifhtml, @ifinfo, and the like.
-%
-\def\direntry{\doignore{direntry}}
-\def\documentdescriptionword{documentdescription}
-\def\documentdescription{\doignore{documentdescription}}
-\def\html{\doignore{html}}
-\def\ifhtml{\doignore{ifhtml}}
-\def\ifinfo{\doignore{ifinfo}}
-\def\ifnottex{\nestedignore{ifnottex}}
-\def\ifplaintext{\doignore{ifplaintext}}
-\def\ifxml{\doignore{ifxml}}
-\def\ignore{\doignore{ignore}}
-\def\menu{\doignore{menu}}
-\def\xml{\doignore{xml}}
-
-% @dircategory CATEGORY  -- specify a category of the dir file
-% which this file should belong to.  Ignore this in TeX.
-\let\dircategory = \comment
-
-% Ignore text until a line `@end #1'.
-%
-\def\doignore#1{\begingroup
-  % Don't complain about control sequences we have declared \outer.
-  \ignoresections
-  %
-  % Define a command to swallow text until we reach `@end #1'.
-  % This @ is a catcode 12 token (that is the normal catcode of @ in
-  % this texinfo.tex file).  We change the catcode of @ below to match.
-  \long\def\doignoretext##1@end #1{\enddoignore}%
-  %
-  % Make sure that spaces turn into tokens that match what \doignoretext wants.
-  \catcode\spaceChar = 10
-  %
-  % Ignore braces, too, so mismatched braces don't cause trouble.
-  \catcode`\{ = 9
-  \catcode`\} = 9
-  %
-  % We must not have @c interpreted as a control sequence.
-  \catcode`\@ = 12
-  %
-  \def\ignoreword{#1}%
-  \ifx\ignoreword\documentdescriptionword
-    % The c kludge breaks documentdescription, since
-    % `documentdescription' contains a `c'.  Means not everything will
-    % be ignored inside @documentdescription, but oh well...
-  \else
-    % Make the letter c a comment character so that the rest of the line
-    % will be ignored. This way, the document can have (for example)
-    %   @c @end ifinfo
-    % and the @end ifinfo will be properly ignored.
-    % (We've just changed @ to catcode 12.)
-    \catcode`\c = 14
-  \fi
-  %
-  % And now expand the command defined above.
-  \doignoretext
-}
-
-% What we do to finish off ignored text.
-%
-\def\enddoignore{\endgroup\ignorespaces}%
-
-\newif\ifwarnedobs\warnedobsfalse
-\def\obstexwarn{%
-  \ifwarnedobs\relax\else
-  % We need to warn folks that they may have trouble with TeX 3.0.
-  % This uses \immediate\write16 rather than \message to get newlines.
-    \immediate\write16{}
-    \immediate\write16{WARNING: for users of Unix TeX 3.0!}
-    \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
-    \immediate\write16{If you are running another version of TeX, relax.}
-    \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
-    \immediate\write16{  Then upgrade your TeX installation if you can.}
-    \immediate\write16{  (See ftp://ftp.gnu.org/non-gnu/TeX.README.)}
-    \immediate\write16{If you are stuck with version 3.0, run the}
-    \immediate\write16{  script ``tex3patch'' from the Texinfo distribution}
-    \immediate\write16{  to use a workaround.}
-    \immediate\write16{}
-    \global\warnedobstrue
-    \fi
-}
-
-% **In TeX 3.0, setting text in \nullfont hangs tex.  For a
-% workaround (which requires the file ``dummy.tfm'' to be installed),
-% uncomment the following line:
-%%%%%\font\nullfont=dummy\let\obstexwarn=\relax
-
-% Ignore text, except that we keep track of conditional commands for
-% purposes of nesting, up to an `@end #1' command.
-%
-\def\nestedignore#1{%
-  \obstexwarn
-  % We must actually expand the ignored text to look for the @end
-  % command, so that nested ignore constructs work.  Thus, we put the
-  % text into a \vbox and then do nothing with the result.  To minimize
-  % the chance of memory overflow, we follow the approach outlined on
-  % page 401 of the TeXbook.
-  %
-  \setbox0 = \vbox\bgroup
-    % Don't complain about control sequences we have declared \outer.
-    \ignoresections
-    %
-    % Define `@end #1' to end the box, which will in turn undefine the
-    % @end command again.
-    \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
-    %
-    % We are going to be parsing Texinfo commands.  Most cause no
-    % trouble when they are used incorrectly, but some commands do
-    % complicated argument parsing or otherwise get confused, so we
-    % undefine them.
-    %
-    % We can't do anything about stray @-signs, unfortunately;
-    % they'll produce `undefined control sequence' errors.
-    \ignoremorecommands
-    %
-    % Set the current font to be \nullfont, a TeX primitive, and define
-    % all the font commands to also use \nullfont.  We don't use
-    % dummy.tfm, as suggested in the TeXbook, because some sites
-    % might not have that installed.  Therefore, math mode will still
-    % produce output, but that should be an extremely small amount of
-    % stuff compared to the main input.
-    %
-    \nullfont
-    \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont
-    \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont
-    \let\tensf=\nullfont
-    % Similarly for index fonts.
-    \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont
-    \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont
-    \let\smallsf=\nullfont
-    % Similarly for smallexample fonts.
-    \let\smallerrm=\nullfont \let\smallerit=\nullfont \let\smallersl=\nullfont
-    \let\smallerbf=\nullfont \let\smallertt=\nullfont \let\smallersc=\nullfont
-    \let\smallersf=\nullfont
-    %
-    % Don't complain when characters are missing from the fonts.
-    \tracinglostchars = 0
-    %
-    % Don't bother to do space factor calculations.
-    \frenchspacing
-    %
-    % Don't report underfull hboxes.
-    \hbadness = 10000
-    %
-    % Do minimal line-breaking.
-    \pretolerance = 10000
-    %
-    % Do not execute instructions in @tex.
-    \def\tex{\doignore{tex}}%
-    % Do not execute macro definitions.
-    % `c' is a comment character, so the word `macro' will get cut off.
-    \def\macro{\doignore{ma}}%
-}
-
-% @set VAR sets the variable VAR to an empty value.
-% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
-%
-% Since we want to separate VAR from REST-OF-LINE (which might be
-% empty), we can't just use \parsearg; we have to insert a space of our
-% own to delimit the rest of the line, and then take it out again if we
-% didn't need it.  Make sure the catcode of space is correct to avoid
-% losing inside @example, for instance.
-%
-\def\set{\begingroup\catcode` =10
-  \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
-  \parsearg\setxxx}
-\def\setxxx#1{\setyyy#1 \endsetyyy}
-\def\setyyy#1 #2\endsetyyy{%
-  \def\temp{#2}%
-  \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
-  \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
-  \fi
-  \endgroup
-}
-% Can't use \xdef to pre-expand #2 and save some time, since \temp or
-% \next or other control sequences that we've defined might get us into
-% an infinite loop. Consider `@set foo @cite{bar}'.
-\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
-
-% @clear VAR clears (i.e., unsets) the variable VAR.
-%
-\def\clear{\parsearg\clearxxx}
-\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
-
-% @value{foo} gets the text saved in variable foo.
-{
-  \catcode`\_ = \active
-  %
-  % We might end up with active _ or - characters in the argument if
-  % we're called from @code, as @code{@value{foo-bar_}}.  So \let any
-  % such active characters to their normal equivalents.
-  \gdef\value{\begingroup
-    \catcode`\-=\other \catcode`\_=\other
-    \indexbreaks \let_\normalunderscore
-    \valuexxx}
-}
-\def\valuexxx#1{\expandablevalue{#1}\endgroup}
-
-% We have this subroutine so that we can handle at least some @value's
-% properly in indexes (we \let\value to this in \indexdummies).  Ones
-% whose names contain - or _ still won't work, but we can't do anything
-% about that.  The command has to be fully expandable (if the variable
-% is set), since the result winds up in the index file.  This means that
-% if the variable's value contains other Texinfo commands, it's almost
-% certain it will fail (although perhaps we could fix that with
-% sufficient work to do a one-level expansion on the result, instead of
-% complete).
-%
-\def\expandablevalue#1{%
-  \expandafter\ifx\csname SET#1\endcsname\relax
-    {[No value for ``#1'']}%
-    \message{Variable `#1', used in @value, is not set.}%
-  \else
-    \csname SET#1\endcsname
-  \fi
-}
-
-% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
-% with @set.
-%
-\def\ifset{\parsearg\doifset}
-\def\doifset#1{%
-  \expandafter\ifx\csname SET#1\endcsname\relax
-    \let\next=\ifsetfail
-  \else
-    \let\next=\ifsetsucceed
-  \fi
-  \next
-}
-\def\ifsetsucceed{\conditionalsucceed{ifset}}
-\def\ifsetfail{\nestedignore{ifset}}
-\defineunmatchedend{ifset}
-
-% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
-% defined with @set, or has been undefined with @clear.
-%
-\def\ifclear{\parsearg\doifclear}
-\def\doifclear#1{%
-  \expandafter\ifx\csname SET#1\endcsname\relax
-    \let\next=\ifclearsucceed
-  \else
-    \let\next=\ifclearfail
-  \fi
-  \next
-}
-\def\ifclearsucceed{\conditionalsucceed{ifclear}}
-\def\ifclearfail{\nestedignore{ifclear}}
-\defineunmatchedend{ifclear}
-
-% @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we
-% read the text following, through the first @end iftex (etc.).  Make
-% `@end iftex' (etc.) valid only after an @iftex.
-%
-\def\iftex{\conditionalsucceed{iftex}}
-\def\ifnothtml{\conditionalsucceed{ifnothtml}}
-\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
-\def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}}
-\defineunmatchedend{iftex}
-\defineunmatchedend{ifnothtml}
-\defineunmatchedend{ifnotinfo}
-\defineunmatchedend{ifnotplaintext}
-
-% True conditional.  Since \set globally defines its variables, we can
-% just start and end a group (to keep the @end definition undefined at
-% the outer level).
-%
-\def\conditionalsucceed#1{\begingroup
-  \expandafter\def\csname E#1\endcsname{\endgroup}%
-}
-
-% @defininfoenclose.
-\let\definfoenclose=\comment
-
-
-\message{indexing,}
-% Index generation facilities
-
-% Define \newwrite to be identical to plain tex's \newwrite
-% except not \outer, so it can be used within \newindex.
-{\catcode`\@=11
-\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
-
-% \newindex {foo} defines an index named foo.
-% It automatically defines \fooindex such that
-% \fooindex ...rest of line... puts an entry in the index foo.
-% It also defines \fooindfile to be the number of the output channel for
-% the file that accumulates this index.  The file's extension is foo.
-% The name of an index should be no more than 2 characters long
-% for the sake of vms.
-%
-\def\newindex#1{%
-  \iflinks
-    \expandafter\newwrite \csname#1indfile\endcsname
-    \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
-  \fi
-  \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
-    \noexpand\doindex{#1}}
-}
-
-% @defindex foo  ==  \newindex{foo}
-%
-\def\defindex{\parsearg\newindex}
-
-% Define @defcodeindex, like @defindex except put all entries in @code.
-%
-\def\defcodeindex{\parsearg\newcodeindex}
-%
-\def\newcodeindex#1{%
-  \iflinks
-    \expandafter\newwrite \csname#1indfile\endcsname
-    \openout \csname#1indfile\endcsname \jobname.#1
-  \fi
-  \expandafter\xdef\csname#1index\endcsname{%
-    \noexpand\docodeindex{#1}}%
-}
-
-
-% @synindex foo bar    makes index foo feed into index bar.
-% Do this instead of @defindex foo if you don't want it as a separate index.
-%
-% @syncodeindex foo bar   similar, but put all entries made for index foo
-% inside @code.
-%
-\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
-\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
-
-% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
-% #3 the target index (bar).
-\def\dosynindex#1#2#3{%
-  % Only do \closeout if we haven't already done it, else we'll end up
-  % closing the target index.
-  \expandafter \ifx\csname donesynindex#2\endcsname \undefined
-    % The \closeout helps reduce unnecessary open files; the limit on the
-    % Acorn RISC OS is a mere 16 files.
-    \expandafter\closeout\csname#2indfile\endcsname
-    \expandafter\let\csname\donesynindex#2\endcsname = 1
-  \fi
-  % redefine \fooindfile:
-  \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
-  \expandafter\let\csname#2indfile\endcsname=\temp
-  % redefine \fooindex:
-  \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
-}
-
-% Define \doindex, the driver for all \fooindex macros.
-% Argument #1 is generated by the calling \fooindex macro,
-%  and it is "foo", the name of the index.
-
-% \doindex just uses \parsearg; it calls \doind for the actual work.
-% This is because \doind is more useful to call from other macros.
-
-% There is also \dosubind {index}{topic}{subtopic}
-% which makes an entry in a two-level index such as the operation index.
-
-\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
-\def\singleindexer #1{\doind{\indexname}{#1}}
-
-% like the previous two, but they put @code around the argument.
-\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
-\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
-
-% Take care of Texinfo commands that can appear in an index entry.
-% Since there are some commands we want to expand, and others we don't,
-% we have to laboriously prevent expansion for those that we don't.
-%
-\def\indexdummies{%
-  \def\@{@}% change to @@ when we switch to @ as escape char in index files.
-  \def\ {\realbackslash\space }%
-  % Need these in case \tex is in effect and \{ is a \delimiter again.
-  % But can't use \lbracecmd and \rbracecmd because texindex assumes
-  % braces and backslashes are used only as delimiters.
-  \let\{ = \mylbrace
-  \let\} = \myrbrace
-  %
-  % \definedummyword defines \#1 as \realbackslash #1\space, thus
-  % effectively preventing its expansion.  This is used only for control
-  % words, not control letters, because the \space would be incorrect
-  % for control characters, but is needed to separate the control word
-  % from whatever follows.
-  %
-  % For control letters, we have \definedummyletter, which omits the
-  % space.
-  %
-  % These can be used both for control words that take an argument and
-  % those that do not.  If it is followed by {arg} in the input, then
-  % that will dutifully get written to the index (or wherever).
-  %
-  \def\definedummyword##1{%
-    \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}%
-  }%
-  \def\definedummyletter##1{%
-    \expandafter\def\csname ##1\endcsname{\realbackslash ##1}%
-  }%
-  %
-  % Do the redefinitions.
-  \commondummies
-}
-
-% For the aux file, @ is the escape character.  So we want to redefine
-% everything using @ instead of \realbackslash.  When everything uses
-% @, this will be simpler.
-%
-\def\atdummies{%
-  \def\@{@@}%
-  \def\ {@ }%
-  \let\{ = \lbraceatcmd
-  \let\} = \rbraceatcmd
-  %
-  % (See comments in \indexdummies.)
-  \def\definedummyword##1{%
-    \expandafter\def\csname ##1\endcsname{@##1\space}%
-  }%
-  \def\definedummyletter##1{%
-    \expandafter\def\csname ##1\endcsname{@##1}%
-  }%
-  %
-  % Do the redefinitions.
-  \commondummies
-}
-
-% Called from \indexdummies and \atdummies.  \definedummyword and
-% \definedummyletter must be defined first.
-%
-\def\commondummies{%
-  %
-  \normalturnoffactive
-  %
-  % Control letters and accents.
-  \definedummyletter{_}%
-  \definedummyletter{,}%
-  \definedummyletter{"}%
-  \definedummyletter{`}%
-  \definedummyletter{'}%
-  \definedummyletter{^}%
-  \definedummyletter{~}%
-  \definedummyletter{=}%
-  \definedummyword{u}%
-  \definedummyword{v}%
-  \definedummyword{H}%
-  \definedummyword{dotaccent}%
-  \definedummyword{ringaccent}%
-  \definedummyword{tieaccent}%
-  \definedummyword{ubaraccent}%
-  \definedummyword{udotaccent}%
-  \definedummyword{dotless}%
-  %
-  % Other non-English letters.
-  \definedummyword{AA}%
-  \definedummyword{AE}%
-  \definedummyword{L}%
-  \definedummyword{OE}%
-  \definedummyword{O}%
-  \definedummyword{aa}%
-  \definedummyword{ae}%
-  \definedummyword{l}%
-  \definedummyword{oe}%
-  \definedummyword{o}%
-  \definedummyword{ss}%
-  %
-  % Although these internal commands shouldn't show up, sometimes they do.
-  \definedummyword{bf}%
-  \definedummyword{gtr}%
-  \definedummyword{hat}%
-  \definedummyword{less}%
-  \definedummyword{sf}%
-  \definedummyword{sl}%
-  \definedummyword{tclose}%
-  \definedummyword{tt}%
-  %
-  % Texinfo font commands.
-  \definedummyword{b}%
-  \definedummyword{i}%
-  \definedummyword{r}%
-  \definedummyword{sc}%
-  \definedummyword{t}%
-  %
-  \definedummyword{TeX}%
-  \definedummyword{acronym}%
-  \definedummyword{cite}%
-  \definedummyword{code}%
-  \definedummyword{command}%
-  \definedummyword{dfn}%
-  \definedummyword{dots}%
-  \definedummyword{emph}%
-  \definedummyword{env}%
-  \definedummyword{file}%
-  \definedummyword{kbd}%
-  \definedummyword{key}%
-  \definedummyword{math}%
-  \definedummyword{option}%
-  \definedummyword{samp}%
-  \definedummyword{strong}%
-  \definedummyword{uref}%
-  \definedummyword{url}%
-  \definedummyword{var}%
-  \definedummyword{w}%
-  %
-  % Assorted special characters.
-  \definedummyword{bullet}%
-  \definedummyword{copyright}%
-  \definedummyword{dots}%
-  \definedummyword{enddots}%
-  \definedummyword{equiv}%
-  \definedummyword{error}%
-  \definedummyword{expansion}%
-  \definedummyword{minus}%
-  \definedummyword{pounds}%
-  \definedummyword{point}%
-  \definedummyword{print}%
-  \definedummyword{result}%
-  %
-  % Handle some cases of @value -- where the variable name does not
-  % contain - or _, and the value does not contain any
-  % (non-fully-expandable) commands.
-  \let\value = \expandablevalue
-  %
-  % Normal spaces, not active ones.
-  \unsepspaces
-  %
-  % No macro expansion.
-  \turnoffmacros
-}
-
-% If an index command is used in an @example environment, any spaces
-% therein should become regular spaces in the raw index file, not the
-% expansion of \tie (\leavevmode \penalty \@M \ ).
-{\obeyspaces
- \gdef\unsepspaces{\obeyspaces\let =\space}}
-
-
-% \indexnofonts is used when outputting the strings to sort the index
-% by, and when constructing control sequence names.  It eliminates all
-% control sequences and just writes whatever the best ASCII sort string
-% would be for a given command (usually its argument).
-%
-\def\indexdummytex{TeX}
-\def\indexdummydots{...}
-%
-\def\indexnofonts{%
-  \def\ { }%
-  \def\@{@}%
-  % how to handle braces?
-  \def\_{\normalunderscore}%
-  %
-  \let\,=\asis
-  \let\"=\asis
-  \let\`=\asis
-  \let\'=\asis
-  \let\^=\asis
-  \let\~=\asis
-  \let\==\asis
-  \let\u=\asis
-  \let\v=\asis
-  \let\H=\asis
-  \let\dotaccent=\asis
-  \let\ringaccent=\asis
-  \let\tieaccent=\asis
-  \let\ubaraccent=\asis
-  \let\udotaccent=\asis
-  \let\dotless=\asis
-  %
-  % Other non-English letters.
-  \def\AA{AA}%
-  \def\AE{AE}%
-  \def\L{L}%
-  \def\OE{OE}%
-  \def\O{O}%
-  \def\aa{aa}%
-  \def\ae{ae}%
-  \def\l{l}%
-  \def\oe{oe}%
-  \def\o{o}%
-  \def\ss{ss}%
-  \def\exclamdown{!}%
-  \def\questiondown{?}%
-  %
-  % Don't no-op \tt, since it isn't a user-level command
-  % and is used in the definitions of the active chars like <, >, |, etc.
-  % Likewise with the other plain tex font commands.
-  %\let\tt=\asis
-  %
-  % Texinfo font commands.
-  \let\b=\asis
-  \let\i=\asis
-  \let\r=\asis
-  \let\sc=\asis
-  \let\t=\asis
-  %
-  \let\TeX=\indexdummytex
-  \let\acronym=\asis
-  \let\cite=\asis
-  \let\code=\asis
-  \let\command=\asis
-  \let\dfn=\asis
-  \let\dots=\indexdummydots
-  \let\emph=\asis
-  \let\env=\asis
-  \let\file=\asis
-  \let\kbd=\asis
-  \let\key=\asis
-  \let\math=\asis
-  \let\option=\asis
-  \let\samp=\asis
-  \let\strong=\asis
-  \let\uref=\asis
-  \let\url=\asis
-  \let\var=\asis
-  \let\w=\asis
-}
-
-\let\indexbackslash=0  %overridden during \printindex.
-\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
-
-% For \ifx comparisons.
-\def\emptymacro{\empty}
-
-% Most index entries go through here, but \dosubind is the general case.
-%
-\def\doind#1#2{\dosubind{#1}{#2}\empty}
-
-% Workhorse for all \fooindexes.
-% #1 is name of index, #2 is stuff to put there, #3 is subentry --
-% \empty if called from \doind, as we usually are.  The main exception
-% is with defuns, which call us directly.
-%
-\def\dosubind#1#2#3{%
-  % Put the index entry in the margin if desired.
-  \ifx\SETmarginindex\relax\else
-    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
-  \fi
-  {%
-    \count255=\lastpenalty
-    {%
-      \indexdummies % Must do this here, since \bf, etc expand at this stage
-      \escapechar=`\\
-      {%
-        \let\folio = 0% We will expand all macros now EXCEPT \folio.
-        \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
-        % so it will be output as is; and it will print as backslash.
-        %
-        % The main index entry text.
-        \toks0 = {#2}%
-        %
-        % If third arg is present, precede it with space in sort key.
-        \def\thirdarg{#3}%
-        \ifx\thirdarg\emptymacro \else
-           % If the third (subentry) arg is present, add it to the index
-           % line to write.
-          \toks0 = \expandafter{\the\toks0 \space #3}%
-        \fi
-        %
-        % Process the index entry with all font commands turned off, to
-        % get the string to sort by.
-        {\indexnofonts
-         \edef\temp{\the\toks0}% need full expansion
-         \xdef\indexsorttmp{\temp}%
-        }%
-        %
-        % Set up the complete index entry, with both the sort key and
-        % the original text, including any font commands.  We write
-        % three arguments to \entry to the .?? file (four in the
-        % subentry case), texindex reduces to two when writing the .??s
-        % sorted result.
-        \edef\temp{%
-          \write\csname#1indfile\endcsname{%
-            \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
-        }%
-        %
-        % If a skip is the last thing on the list now, preserve it
-        % by backing up by \lastskip, doing the \write, then inserting
-        % the skip again.  Otherwise, the whatsit generated by the
-        % \write will make \lastskip zero.  The result is that sequences
-        % like this:
-        % @end defun
-        % @tindex whatever
-        % @defun ...
-        % will have extra space inserted, because the \medbreak in the
-        % start of the @defun won't see the skip inserted by the @end of
-        % the previous defun.
-        %
-        % But don't do any of this if we're not in vertical mode.  We
-        % don't want to do a \vskip and prematurely end a paragraph.
-        %
-        % Avoid page breaks due to these extra skips, too.
-        %
-        \iflinks
-          \ifvmode
-            \skip0 = \lastskip
-            \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi
-          \fi
-          %
-          \temp % do the write
-          %
-          \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
-        \fi
-      }%
-    }%
-    \penalty\count255
-  }%
-}
-
-% The index entry written in the file actually looks like
-%  \entry {sortstring}{page}{topic}
-% or
-%  \entry {sortstring}{page}{topic}{subtopic}
-% The texindex program reads in these files and writes files
-% containing these kinds of lines:
-%  \initial {c}
-%     before the first topic whose initial is c
-%  \entry {topic}{pagelist}
-%     for a topic that is used without subtopics
-%  \primary {topic}
-%     for the beginning of a topic that is used with subtopics
-%  \secondary {subtopic}{pagelist}
-%     for each subtopic.
-
-% Define the user-accessible indexing commands
-% @findex, @vindex, @kindex, @cindex.
-
-\def\findex {\fnindex}
-\def\kindex {\kyindex}
-\def\cindex {\cpindex}
-\def\vindex {\vrindex}
-\def\tindex {\tpindex}
-\def\pindex {\pgindex}
-
-\def\cindexsub {\begingroup\obeylines\cindexsub}
-{\obeylines %
-\gdef\cindexsub "#1" #2^^M{\endgroup %
-\dosubind{cp}{#2}{#1}}}
-
-% Define the macros used in formatting output of the sorted index material.
-
-% @printindex causes a particular index (the ??s file) to get printed.
-% It does not print any chapter heading (usually an @unnumbered).
-%
-\def\printindex{\parsearg\doprintindex}
-\def\doprintindex#1{\begingroup
-  \dobreak \chapheadingskip{10000}%
-  %
-  \smallfonts \rm
-  \tolerance = 9500
-  \everypar = {}% don't want the \kern\-parindent from indentation suppression.
-  \indexbreaks
-  %
-  % See if the index file exists and is nonempty.
-  % Change catcode of @ here so that if the index file contains
-  % \initial {@}
-  % as its first line, TeX doesn't complain about mismatched braces
-  % (because it thinks @} is a control sequence).
-  \catcode`\@ = 11
-  \openin 1 \jobname.#1s
-  \ifeof 1
-    % \enddoublecolumns gets confused if there is no text in the index,
-    % and it loses the chapter title and the aux file entries for the
-    % index.  The easiest way to prevent this problem is to make sure
-    % there is some text.
-    \putwordIndexNonexistent
-  \else
-    %
-    % If the index file exists but is empty, then \openin leaves \ifeof
-    % false.  We have to make TeX try to read something from the file, so
-    % it can discover if there is anything in it.
-    \read 1 to \temp
-    \ifeof 1
-      \putwordIndexIsEmpty
-    \else
-      % Index files are almost Texinfo source, but we use \ as the escape
-      % character.  It would be better to use @, but that's too big a change
-      % to make right now.
-      \def\indexbackslash{\rawbackslashxx}%
-      \catcode`\\ = 0
-      \escapechar = `\\
-      \begindoublecolumns
-      \input \jobname.#1s
-      \enddoublecolumns
-    \fi
-  \fi
-  \closein 1
-\endgroup}
-
-% These macros are used by the sorted index file itself.
-% Change them to control the appearance of the index.
-
-\def\initial#1{{%
-  % Some minor font changes for the special characters.
-  \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
-  %
-  % Remove any glue we may have, we'll be inserting our own.
-  \removelastskip
-  %
-  % We like breaks before the index initials, so insert a bonus.
-  \penalty -300
-  %
-  % Typeset the initial.  Making this add up to a whole number of
-  % baselineskips increases the chance of the dots lining up from column
-  % to column.  It still won't often be perfect, because of the stretch
-  % we need before each entry, but it's better.
-  %
-  % No shrink because it confuses \balancecolumns.
-  \vskip 1.67\baselineskip plus .5\baselineskip
-  \leftline{\secbf #1}%
-  \vskip .33\baselineskip plus .1\baselineskip
-  %
-  % Do our best not to break after the initial.
-  \nobreak
-}}
-
-% This typesets a paragraph consisting of #1, dot leaders, and then #2
-% flush to the right margin.  It is used for index and table of contents
-% entries.  The paragraph is indented by \leftskip.
-%
-\def\entry#1#2{\begingroup
-  %
-  % Start a new paragraph if necessary, so our assignments below can't
-  % affect previous text.
-  \par
-  %
-  % Do not fill out the last line with white space.
-  \parfillskip = 0in
-  %
-  % No extra space above this paragraph.
-  \parskip = 0in
-  %
-  % Do not prefer a separate line ending with a hyphen to fewer lines.
-  \finalhyphendemerits = 0
-  %
-  % \hangindent is only relevant when the entry text and page number
-  % don't both fit on one line.  In that case, bob suggests starting the
-  % dots pretty far over on the line.  Unfortunately, a large
-  % indentation looks wrong when the entry text itself is broken across
-  % lines.  So we use a small indentation and put up with long leaders.
-  %
-  % \hangafter is reset to 1 (which is the value we want) at the start
-  % of each paragraph, so we need not do anything with that.
-  \hangindent = 2em
-  %
-  % When the entry text needs to be broken, just fill out the first line
-  % with blank space.
-  \rightskip = 0pt plus1fil
-  %
-  % A bit of stretch before each entry for the benefit of balancing columns.
-  \vskip 0pt plus1pt
-  %
-  % Start a ``paragraph'' for the index entry so the line breaking
-  % parameters we've set above will have an effect.
-  \noindent
-  %
-  % Insert the text of the index entry.  TeX will do line-breaking on it.
-  #1%
-  % The following is kludged to not output a line of dots in the index if
-  % there are no page numbers.  The next person who breaks this will be
-  % cursed by a Unix daemon.
-  \def\tempa{{\rm }}%
-  \def\tempb{#2}%
-  \edef\tempc{\tempa}%
-  \edef\tempd{\tempb}%
-  \ifx\tempc\tempd\ \else%
-    %
-    % If we must, put the page number on a line of its own, and fill out
-    % this line with blank space.  (The \hfil is overwhelmed with the
-    % fill leaders glue in \indexdotfill if the page number does fit.)
-    \hfil\penalty50
-    \null\nobreak\indexdotfill % Have leaders before the page number.
-    %
-    % The `\ ' here is removed by the implicit \unskip that TeX does as
-    % part of (the primitive) \par.  Without it, a spurious underfull
-    % \hbox ensues.
-    \ifpdf
-      \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
-    \else
-      \ #2% The page number ends the paragraph.
-    \fi
-  \fi%
-  \par
-\endgroup}
-
-% Like \dotfill except takes at least 1 em.
-\def\indexdotfill{\cleaders
-  \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
-
-\def\primary #1{\line{#1\hfil}}
-
-\newskip\secondaryindent \secondaryindent=0.5cm
-\def\secondary#1#2{{%
-  \parfillskip=0in
-  \parskip=0in
-  \hangindent=1in
-  \hangafter=1
-  \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
-  \ifpdf
-    \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
-  \else
-    #2
-  \fi
-  \par
-}}
-
-% Define two-column mode, which we use to typeset indexes.
-% Adapted from the TeXbook, page 416, which is to say,
-% the manmac.tex format used to print the TeXbook itself.
-\catcode`\@=11
-
-\newbox\partialpage
-\newdimen\doublecolumnhsize
-
-\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
-  % Grab any single-column material above us.
-  \output = {%
-    %
-    % Here is a possibility not foreseen in manmac: if we accumulate a
-    % whole lot of material, we might end up calling this \output
-    % routine twice in a row (see the doublecol-lose test, which is
-    % essentially a couple of indexes with @setchapternewpage off).  In
-    % that case we just ship out what is in \partialpage with the normal
-    % output routine.  Generally, \partialpage will be empty when this
-    % runs and this will be a no-op.  See the indexspread.tex test case.
-    \ifvoid\partialpage \else
-      \onepageout{\pagecontents\partialpage}%
-    \fi
-    %
-    \global\setbox\partialpage = \vbox{%
-      % Unvbox the main output page.
-      \unvbox\PAGE
-      \kern-\topskip \kern\baselineskip
-    }%
-  }%
-  \eject % run that output routine to set \partialpage
-  %
-  % Use the double-column output routine for subsequent pages.
-  \output = {\doublecolumnout}%
-  %
-  % Change the page size parameters.  We could do this once outside this
-  % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
-  % format, but then we repeat the same computation.  Repeating a couple
-  % of assignments once per index is clearly meaningless for the
-  % execution time, so we may as well do it in one place.
-  %
-  % First we halve the line length, less a little for the gutter between
-  % the columns.  We compute the gutter based on the line length, so it
-  % changes automatically with the paper format.  The magic constant
-  % below is chosen so that the gutter has the same value (well, +-<1pt)
-  % as it did when we hard-coded it.
-  %
-  % We put the result in a separate register, \doublecolumhsize, so we
-  % can restore it in \pagesofar, after \hsize itself has (potentially)
-  % been clobbered.
-  %
-  \doublecolumnhsize = \hsize
-    \advance\doublecolumnhsize by -.04154\hsize
-    \divide\doublecolumnhsize by 2
-  \hsize = \doublecolumnhsize
-  %
-  % Double the \vsize as well.  (We don't need a separate register here,
-  % since nobody clobbers \vsize.)
-  \vsize = 2\vsize
-}
-
-% The double-column output routine for all double-column pages except
-% the last.
-%
-\def\doublecolumnout{%
-  \splittopskip=\topskip \splitmaxdepth=\maxdepth
-  % Get the available space for the double columns -- the normal
-  % (undoubled) page height minus any material left over from the
-  % previous page.
-  \dimen@ = \vsize
-  \divide\dimen@ by 2
-  \advance\dimen@ by -\ht\partialpage
-  %
-  % box0 will be the left-hand column, box2 the right.
-  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
-  \onepageout\pagesofar
-  \unvbox255
-  \penalty\outputpenalty
-}
-%
-% Re-output the contents of the output page -- any previous material,
-% followed by the two boxes we just split, in box0 and box2.
-\def\pagesofar{%
-  \unvbox\partialpage
-  %
-  \hsize = \doublecolumnhsize
-  \wd0=\hsize \wd2=\hsize
-  \hbox to\pagewidth{\box0\hfil\box2}%
-}
-%
-% All done with double columns.
-\def\enddoublecolumns{%
-  \output = {%
-    % Split the last of the double-column material.  Leave it on the
-    % current page, no automatic page break.
-    \balancecolumns
-    %
-    % If we end up splitting too much material for the current page,
-    % though, there will be another page break right after this \output
-    % invocation ends.  Having called \balancecolumns once, we do not
-    % want to call it again.  Therefore, reset \output to its normal
-    % definition right away.  (We hope \balancecolumns will never be
-    % called on to balance too much material, but if it is, this makes
-    % the output somewhat more palatable.)
-    \global\output = {\onepageout{\pagecontents\PAGE}}%
-  }%
-  \eject
-  \endgroup % started in \begindoublecolumns
-  %
-  % \pagegoal was set to the doubled \vsize above, since we restarted
-  % the current page.  We're now back to normal single-column
-  % typesetting, so reset \pagegoal to the normal \vsize (after the
-  % \endgroup where \vsize got restored).
-  \pagegoal = \vsize
-}
-%
-% Called at the end of the double column material.
-\def\balancecolumns{%
-  \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
-  \dimen@ = \ht0
-  \advance\dimen@ by \topskip
-  \advance\dimen@ by-\baselineskip
-  \divide\dimen@ by 2 % target to split to
-  %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
-  \splittopskip = \topskip
-  % Loop until we get a decent breakpoint.
-  {%
-    \vbadness = 10000
-    \loop
-      \global\setbox3 = \copy0
-      \global\setbox1 = \vsplit3 to \dimen@
-    \ifdim\ht3>\dimen@
-      \global\advance\dimen@ by 1pt
-    \repeat
-  }%
-  %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
-  \setbox0=\vbox to\dimen@{\unvbox1}%
-  \setbox2=\vbox to\dimen@{\unvbox3}%
-  %
-  \pagesofar
-}
-\catcode`\@ = \other
-
-
-\message{sectioning,}
-% Chapters, sections, etc.
-
-\newcount\chapno
-\newcount\secno        \secno=0
-\newcount\subsecno     \subsecno=0
-\newcount\subsubsecno  \subsubsecno=0
-
-% This counter is funny since it counts through charcodes of letters A, B, ...
-\newcount\appendixno  \appendixno = `\@
-% \def\appendixletter{\char\the\appendixno}
-% We do the following for the sake of pdftex, which needs the actual
-% letter in the expansion, not just typeset.
-\def\appendixletter{%
-  \ifnum\appendixno=`A A%
-  \else\ifnum\appendixno=`B B%
-  \else\ifnum\appendixno=`C C%
-  \else\ifnum\appendixno=`D D%
-  \else\ifnum\appendixno=`E E%
-  \else\ifnum\appendixno=`F F%
-  \else\ifnum\appendixno=`G G%
-  \else\ifnum\appendixno=`H H%
-  \else\ifnum\appendixno=`I I%
-  \else\ifnum\appendixno=`J J%
-  \else\ifnum\appendixno=`K K%
-  \else\ifnum\appendixno=`L L%
-  \else\ifnum\appendixno=`M M%
-  \else\ifnum\appendixno=`N N%
-  \else\ifnum\appendixno=`O O%
-  \else\ifnum\appendixno=`P P%
-  \else\ifnum\appendixno=`Q Q%
-  \else\ifnum\appendixno=`R R%
-  \else\ifnum\appendixno=`S S%
-  \else\ifnum\appendixno=`T T%
-  \else\ifnum\appendixno=`U U%
-  \else\ifnum\appendixno=`V V%
-  \else\ifnum\appendixno=`W W%
-  \else\ifnum\appendixno=`X X%
-  \else\ifnum\appendixno=`Y Y%
-  \else\ifnum\appendixno=`Z Z%
-  % The \the is necessary, despite appearances, because \appendixletter is
-  % expanded while writing the .toc file.  \char\appendixno is not
-  % expandable, thus it is written literally, thus all appendixes come out
-  % with the same letter (or @) in the toc without it.
-  \else\char\the\appendixno
-  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
-  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
-
-% Each @chapter defines this as the name of the chapter.
-% page headings and footings can use it.  @section does likewise.
-\def\thischapter{}
-\def\thissection{}
-
-\newcount\absseclevel % used to calculate proper heading level
-\newcount\secbase\secbase=0 % @raise/lowersections modify this count
-
-% @raisesections: treat @section as chapter, @subsection as section, etc.
-\def\raisesections{\global\advance\secbase by -1}
-\let\up=\raisesections % original BFox name
-
-% @lowersections: treat @chapter as section, @section as subsection, etc.
-\def\lowersections{\global\advance\secbase by 1}
-\let\down=\lowersections % original BFox name
-
-% Choose a numbered-heading macro
-% #1 is heading level if unmodified by @raisesections or @lowersections
-% #2 is text for heading
-\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
-\ifcase\absseclevel
-  \chapterzzz{#2}
-\or
-  \seczzz{#2}
-\or
-  \numberedsubseczzz{#2}
-\or
-  \numberedsubsubseczzz{#2}
-\else
-  \ifnum \absseclevel<0
-    \chapterzzz{#2}
-  \else
-    \numberedsubsubseczzz{#2}
-  \fi
-\fi
-\suppressfirstparagraphindent
-}
-
-% like \numhead, but chooses appendix heading levels
-\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
-\ifcase\absseclevel
-  \appendixzzz{#2}
-\or
-  \appendixsectionzzz{#2}
-\or
-  \appendixsubseczzz{#2}
-\or
-  \appendixsubsubseczzz{#2}
-\else
-  \ifnum \absseclevel<0
-    \appendixzzz{#2}
-  \else
-    \appendixsubsubseczzz{#2}
-  \fi
-\fi
-\suppressfirstparagraphindent
-}
-
-% like \numhead, but chooses numberless heading levels
-\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
-\ifcase\absseclevel
-  \unnumberedzzz{#2}
-\or
-  \unnumberedseczzz{#2}
-\or
-  \unnumberedsubseczzz{#2}
-\or
-  \unnumberedsubsubseczzz{#2}
-\else
-  \ifnum \absseclevel<0
-    \unnumberedzzz{#2}
-  \else
-    \unnumberedsubsubseczzz{#2}
-  \fi
-\fi
-\suppressfirstparagraphindent
-}
-
-% @chapter, @appendix, @unnumbered.
-\def\thischaptername{No Chapter Title}
-\outer\def\chapter{\parsearg\chapteryyy}
-\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
-\def\chapterzzz #1{%
-  \secno=0 \subsecno=0 \subsubsecno=0
-  \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
-  \chapmacro {#1}{\the\chapno}%
-  \gdef\thissection{#1}%
-  \gdef\thischaptername{#1}%
-  % We don't substitute the actual chapter name into \thischapter
-  % because we don't want its macros evaluated now.
-  \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
-  \writetocentry{chap}{#1}{{\the\chapno}}
-  \donoderef
-  \global\let\section = \numberedsec
-  \global\let\subsection = \numberedsubsec
-  \global\let\subsubsection = \numberedsubsubsec
-}
-
-% we use \chapno to avoid indenting back
-\def\appendixbox#1{%
-  \setbox0 = \hbox{\putwordAppendix{} \the\chapno}%
-  \hbox to \wd0{#1\hss}}
-
-\outer\def\appendix{\parsearg\appendixyyy}
-\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
-\def\appendixzzz #1{%
-  \secno=0 \subsecno=0 \subsubsecno=0
-  \global\advance \appendixno by 1
-  \message{\putwordAppendix\space \appendixletter}%
-  \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}%
-  \gdef\thissection{#1}%
-  \gdef\thischaptername{#1}%
-  \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
-  \writetocentry{appendix}{#1}{{\appendixletter}}
-  \appendixnoderef
-  \global\let\section = \appendixsec
-  \global\let\subsection = \appendixsubsec
-  \global\let\subsubsection = \appendixsubsubsec
-}
-
-% @centerchap is like @unnumbered, but the heading is centered.
-\outer\def\centerchap{\parsearg\centerchapyyy}
-\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
-
-% @top is like @unnumbered.
-\outer\def\top{\parsearg\unnumberedyyy}
-
-\outer\def\unnumbered{\parsearg\unnumberedyyy}
-\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
-\def\unnumberedzzz #1{%
-  \secno=0 \subsecno=0 \subsubsecno=0
-  %
-  % This used to be simply \message{#1}, but TeX fully expands the
-  % argument to \message.  Therefore, if #1 contained @-commands, TeX
-  % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
-  % expanded @cite (which turns out to cause errors because \cite is meant
-  % to be executed, not expanded).
-  %
-  % Anyway, we don't want the fully-expanded definition of @cite to appear
-  % as a result of the \message, we just want `@cite' itself.  We use
-  % \the<toks register> to achieve this: TeX expands \the<toks> only once,
-  % simply yielding the contents of <toks register>.  (We also do this for
-  % the toc entries.)
-  \toks0 = {#1}\message{(\the\toks0)}%
-  %
-  \unnumbchapmacro {#1}%
-  \gdef\thischapter{#1}\gdef\thissection{#1}%
-  \writetocentry{unnumbchap}{#1}{{\the\chapno}}
-  \unnumbnoderef
-  \global\let\section = \unnumberedsec
-  \global\let\subsection = \unnumberedsubsec
-  \global\let\subsubsection = \unnumberedsubsubsec
-}
-
-% Sections.
-\outer\def\numberedsec{\parsearg\secyyy}
-\def\secyyy #1{\numhead1{#1}} % normally calls seczzz
-\def\seczzz #1{%
-  \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
-  \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
-  \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}}
-  \donoderef
-  \nobreak
-}
-
-\outer\def\appendixsection{\parsearg\appendixsecyyy}
-\outer\def\appendixsec{\parsearg\appendixsecyyy}
-\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
-\def\appendixsectionzzz #1{%
-  \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
-  \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
-  \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}}
-  \appendixnoderef
-  \nobreak
-}
-
-\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
-\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
-\def\unnumberedseczzz #1{%
-  \plainsecheading {#1}\gdef\thissection{#1}%
-  \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}}
-  \unnumbnoderef
-  \nobreak
-}
-
-% Subsections.
-\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
-\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
-\def\numberedsubseczzz #1{%
-  \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
-  \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
-  \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
-  \donoderef
-  \nobreak
-}
-
-\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
-\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
-\def\appendixsubseczzz #1{%
-  \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
-  \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
-  \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}}
-  \appendixnoderef
-  \nobreak
-}
-
-\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
-\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
-\def\unnumberedsubseczzz #1{%
-  \plainsubsecheading {#1}\gdef\thissection{#1}%
-  \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
-  \unnumbnoderef
-  \nobreak
-}
-
-% Subsubsections.
-\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
-\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
-\def\numberedsubsubseczzz #1{%
-  \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
-  \subsubsecheading {#1}
-    {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
-  \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
-  \donoderef
-  \nobreak
-}
-
-\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
-\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
-\def\appendixsubsubseczzz #1{%
-  \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
-  \subsubsecheading {#1}
-    {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
-  \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
-  \appendixnoderef
-  \nobreak
-}
-
-\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
-\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
-\def\unnumberedsubsubseczzz #1{%
-  \plainsubsubsecheading {#1}\gdef\thissection{#1}%
-  \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
-  \unnumbnoderef
-  \nobreak
-}
-
-% These are variants which are not "outer", so they can appear in @ifinfo.
-% Actually, they should now be obsolete; ordinary section commands should work.
-\def\infotop{\parsearg\unnumberedzzz}
-\def\infounnumbered{\parsearg\unnumberedzzz}
-\def\infounnumberedsec{\parsearg\unnumberedseczzz}
-\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
-\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
-
-\def\infoappendix{\parsearg\appendixzzz}
-\def\infoappendixsec{\parsearg\appendixseczzz}
-\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
-\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
-
-\def\infochapter{\parsearg\chapterzzz}
-\def\infosection{\parsearg\sectionzzz}
-\def\infosubsection{\parsearg\subsectionzzz}
-\def\infosubsubsection{\parsearg\subsubsectionzzz}
-
-% These macros control what the section commands do, according
-% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
-% Define them by default for a numbered chapter.
-\global\let\section = \numberedsec
-\global\let\subsection = \numberedsubsec
-\global\let\subsubsection = \numberedsubsubsec
-
-% Define @majorheading, @heading and @subheading
-
-% NOTE on use of \vbox for chapter headings, section headings, and such:
-%       1) We use \vbox rather than the earlier \line to permit
-%          overlong headings to fold.
-%       2) \hyphenpenalty is set to 10000 because hyphenation in a
-%          heading is obnoxious; this forbids it.
-%       3) Likewise, headings look best if no \parindent is used, and
-%          if justification is not attempted.  Hence \raggedright.
-
-
-\def\majorheading{\parsearg\majorheadingzzz}
-\def\majorheadingzzz #1{%
-  {\advance\chapheadingskip by 10pt \chapbreak }%
-  {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
-                    \parindent=0pt\raggedright
-                    \rm #1\hfill}}\bigskip \par\penalty 200}
-
-\def\chapheading{\parsearg\chapheadingzzz}
-\def\chapheadingzzz #1{\chapbreak %
-  {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
-                    \parindent=0pt\raggedright
-                    \rm #1\hfill}}\bigskip \par\penalty 200}
-
-% @heading, @subheading, @subsubheading.
-\def\heading{\parsearg\plainsecheading}
-\def\subheading{\parsearg\plainsubsecheading}
-\def\subsubheading{\parsearg\plainsubsubsecheading}
-
-% These macros generate a chapter, section, etc. heading only
-% (including whitespace, linebreaking, etc. around it),
-% given all the information in convenient, parsed form.
-
-%%% Args are the skip and penalty (usually negative)
-\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
-
-\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
-
-%%% Define plain chapter starts, and page on/off switching for it
-% Parameter controlling skip before chapter headings (if needed)
-
-\newskip\chapheadingskip
-
-\def\chapbreak{\dobreak \chapheadingskip {-4000}}
-\def\chappager{\par\vfill\supereject}
-\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
-
-\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
-
-\def\CHAPPAGoff{%
-\global\let\contentsalignmacro = \chappager
-\global\let\pchapsepmacro=\chapbreak
-\global\let\pagealignmacro=\chappager}
-
-\def\CHAPPAGon{%
-\global\let\contentsalignmacro = \chappager
-\global\let\pchapsepmacro=\chappager
-\global\let\pagealignmacro=\chappager
-\global\def\HEADINGSon{\HEADINGSsingle}}
-
-\def\CHAPPAGodd{
-\global\let\contentsalignmacro = \chapoddpage
-\global\let\pchapsepmacro=\chapoddpage
-\global\let\pagealignmacro=\chapoddpage
-\global\def\HEADINGSon{\HEADINGSdouble}}
-
-\CHAPPAGon
-
-\def\CHAPFplain{
-\global\let\chapmacro=\chfplain
-\global\let\unnumbchapmacro=\unnchfplain
-\global\let\centerchapmacro=\centerchfplain}
-
-% Plain chapter opening.
-% #1 is the text, #2 the chapter number or empty if unnumbered.
-\def\chfplain#1#2{%
-  \pchapsepmacro
-  {%
-    \chapfonts \rm
-    \def\chapnum{#2}%
-    \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
-    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
-          \hangindent = \wd0 \centerparametersmaybe
-          \unhbox0 #1\par}%
-  }%
-  \nobreak\bigskip % no page break after a chapter title
-  \nobreak
-}
-
-% Plain opening for unnumbered.
-\def\unnchfplain#1{\chfplain{#1}{}}
-
-% @centerchap -- centered and unnumbered.
-\let\centerparametersmaybe = \relax
-\def\centerchfplain#1{{%
-  \def\centerparametersmaybe{%
-    \advance\rightskip by 3\rightskip
-    \leftskip = \rightskip
-    \parfillskip = 0pt
-  }%
-  \chfplain{#1}{}%
-}}
-
-\CHAPFplain % The default
-
-\def\unnchfopen #1{%
-\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
-                       \parindent=0pt\raggedright
-                       \rm #1\hfill}}\bigskip \par\nobreak
-}
-
-\def\chfopen #1#2{\chapoddpage {\chapfonts
-\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
-\par\penalty 5000 %
-}
-
-\def\centerchfopen #1{%
-\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
-                       \parindent=0pt
-                       \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
-}
-
-\def\CHAPFopen{
-\global\let\chapmacro=\chfopen
-\global\let\unnumbchapmacro=\unnchfopen
-\global\let\centerchapmacro=\centerchfopen}
-
-
-% Section titles.
-\newskip\secheadingskip
-\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
-\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
-\def\plainsecheading#1{\sectionheading{sec}{}{#1}}
-
-% Subsection titles.
-\newskip \subsecheadingskip
-\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
-\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
-\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
-
-% Subsubsection titles.
-\let\subsubsecheadingskip = \subsecheadingskip
-\let\subsubsecheadingbreak = \subsecheadingbreak
-\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
-\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
-
-
-% Print any size section title.
-%
-% #1 is the section type (sec/subsec/subsubsec), #2 is the section
-% number (maybe empty), #3 the text.
-\def\sectionheading#1#2#3{%
-  {%
-    \expandafter\advance\csname #1headingskip\endcsname by \parskip
-    \csname #1headingbreak\endcsname
-  }%
-  {%
-    % Switch to the right set of fonts.
-    \csname #1fonts\endcsname \rm
-    %
-    % Only insert the separating space if we have a section number.
-    \def\secnum{#2}%
-    \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
-    %
-    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
-          \hangindent = \wd0 % zero if no section number
-          \unhbox0 #3}%
-  }%
-  % Add extra space after the heading -- either a line space or a
-  % paragraph space, whichever is more.  (Some people like to set
-  % \parskip to large values for some reason.)  Don't allow stretch, though.
-  \nobreak
-  \ifdim\parskip>\normalbaselineskip
-    \kern\parskip
-  \else
-    \kern\normalbaselineskip
-  \fi
-  \nobreak
-}
-
-
-\message{toc,}
-% Table of contents.
-\newwrite\tocfile
-
-% Write an entry to the toc file, opening it if necessary.
-% Called from @chapter, etc.  We supply {\folio} at the end of the
-% argument, which will end up as the last argument to the \...entry macro.
-%
-% Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}}
-% We open the .toc file for writing here instead of at @setfilename (or
-% any other fixed time) so that @contents can be anywhere in the document.
-%
-\newif\iftocfileopened
-\def\writetocentry#1#2#3{%
-  \iftocfileopened\else
-    \immediate\openout\tocfile = \jobname.toc
-    \global\tocfileopenedtrue
-  \fi
-  %
-  \iflinks
-    \toks0 = {#2}%
-    \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}%
-    \temp
-  \fi
-  %
-  % Tell \shipout to create a page destination if we're doing pdf, which
-  % will be the target of the links in the table of contents.  We can't
-  % just do it on every page because the title pages are numbered 1 and
-  % 2 (the page numbers aren't printed), and so are the first two pages
-  % of the document.  Thus, we'd have two destinations named `1', and
-  % two named `2'.
-  \ifpdf \pdfmakepagedesttrue \fi
-}
-
-\newskip\contentsrightmargin \contentsrightmargin=1in
-\newcount\savepageno
-\newcount\lastnegativepageno \lastnegativepageno = -1
-
-% Finish up the main text and prepare to read what we've written
-% to \tocfile.
-%
-\def\startcontents#1{%
-   % If @setchapternewpage on, and @headings double, the contents should
-   % start on an odd page, unlike chapters.  Thus, we maintain
-   % \contentsalignmacro in parallel with \pagealignmacro.
-   % From: Torbjorn Granlund <tege@matematik.su.se>
-   \contentsalignmacro
-   \immediate\closeout\tocfile
-   %
-   % Don't need to put `Contents' or `Short Contents' in the headline.
-   % It is abundantly clear what they are.
-   \unnumbchapmacro{#1}\def\thischapter{}%
-   \savepageno = \pageno
-   \begingroup                  % Set up to handle contents files properly.
-      \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
-      % We can't do this, because then an actual ^ in a section
-      % title fails, e.g., @chapter ^ -- exponentiation.  --karl, 9jul97.
-      %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
-      \raggedbottom             % Worry more about breakpoints than the bottom.
-      \advance\hsize by -\contentsrightmargin % Don't use the full line length.
-      %
-      % Roman numerals for page numbers.
-      \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
-}
-
-
-% Normal (long) toc.
-\def\contents{%
-   \startcontents{\putwordTOC}%
-     \openin 1 \jobname.toc
-     \ifeof 1 \else
-       \closein 1
-       \input \jobname.toc
-     \fi
-     \vfill \eject
-     \contentsalignmacro % in case @setchapternewpage odd is in effect
-     \pdfmakeoutlines
-   \endgroup
-   \lastnegativepageno = \pageno
-   \global\pageno = \savepageno
-}
-
-% And just the chapters.
-\def\summarycontents{%
-   \startcontents{\putwordShortTOC}%
-      %
-      \let\chapentry = \shortchapentry
-      \let\appendixentry = \shortappendixentry
-      \let\unnumbchapentry = \shortunnumberedentry
-      % We want a true roman here for the page numbers.
-      \secfonts
-      \let\rm=\shortcontrm \let\bf=\shortcontbf
-      \let\sl=\shortcontsl \let\tt=\shortconttt
-      \rm
-      \hyphenpenalty = 10000
-      \advance\baselineskip by 1pt % Open it up a little.
-      \def\secentry ##1##2##3##4{}
-      \def\subsecentry ##1##2##3##4##5{}
-      \def\subsubsecentry ##1##2##3##4##5##6{}
-      \let\unnumbsecentry = \secentry
-      \let\unnumbsubsecentry = \subsecentry
-      \let\unnumbsubsubsecentry = \subsubsecentry
-      \openin 1 \jobname.toc
-      \ifeof 1 \else
-        \closein 1
-        \input \jobname.toc
-      \fi
-     \vfill \eject
-     \contentsalignmacro % in case @setchapternewpage odd is in effect
-   \endgroup
-   \lastnegativepageno = \pageno
-   \global\pageno = \savepageno
-}
-\let\shortcontents = \summarycontents
-
-\ifpdf
-  \pdfcatalog{/PageMode /UseOutlines}%
-\fi
-
-% These macros generate individual entries in the table of contents.
-% The first argument is the chapter or section name.
-% The last argument is the page number.
-% The arguments in between are the chapter number, section number, ...
-
-% Chapters, in the main contents.
-\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
-%
-% Chapters, in the short toc.
-% See comments in \dochapentry re vbox and related settings.
-\def\shortchapentry#1#2#3{%
-  \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}%
-}
-
-% Appendices, in the main contents.
-\def\appendixentry#1#2#3{%
-  \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}}
-%
-% Appendices, in the short toc.
-\let\shortappendixentry = \shortchapentry
-
-% Typeset the label for a chapter or appendix for the short contents.
-% The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter.
-% We could simplify the code here by writing out an \appendixentry
-% command in the toc file for appendices, instead of using \chapentry
-% for both, but it doesn't seem worth it.
-%
-\newdimen\shortappendixwidth
-%
-\def\shortchaplabel#1{%
-  % This space should be enough, since a single number is .5em, and the
-  % widest letter (M) is 1em, at least in the Computer Modern fonts.
-  % But use \hss just in case.
-  % (This space doesn't include the extra space that gets added after
-  % the label; that gets put in by \shortchapentry above.)
-  \dimen0 = 1em
-  \hbox to \dimen0{#1\hss}%
-}
-
-% Unnumbered chapters.
-\def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}}
-\def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}}
-
-% Sections.
-\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
-\def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}}
-
-% Subsections.
-\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
-\def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}}
-
-% And subsubsections.
-\def\subsubsecentry#1#2#3#4#5#6{%
-  \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
-\def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}}
-
-% This parameter controls the indentation of the various levels.
-\newdimen\tocindent \tocindent = 3pc
-
-% Now for the actual typesetting. In all these, #1 is the text and #2 is the
-% page number.
-%
-% If the toc has to be broken over pages, we want it to be at chapters
-% if at all possible; hence the \penalty.
-\def\dochapentry#1#2{%
-   \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
-   \begingroup
-     \chapentryfonts
-     \tocentry{#1}{\dopageno\bgroup#2\egroup}%
-   \endgroup
-   \nobreak\vskip .25\baselineskip plus.1\baselineskip
-}
-
-\def\dosecentry#1#2{\begingroup
-  \secentryfonts \leftskip=\tocindent
-  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
-\endgroup}
-
-\def\dosubsecentry#1#2{\begingroup
-  \subsecentryfonts \leftskip=2\tocindent
-  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
-\endgroup}
-
-\def\dosubsubsecentry#1#2{\begingroup
-  \subsubsecentryfonts \leftskip=3\tocindent
-  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
-\endgroup}
-
-% Final typesetting of a toc entry; we use the same \entry macro as for
-% the index entries, but we want to suppress hyphenation here.  (We
-% can't do that in the \entry macro, since index entries might consist
-% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
-\def\tocentry#1#2{\begingroup
-  \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
-  % Do not use \turnoffactive in these arguments.  Since the toc is
-  % typeset in cmr, characters such as _ would come out wrong; we
-  % have to do the usual translation tricks.
-  \entry{#1}{#2}%
-\endgroup}
-
-% Space between chapter (or whatever) number and the title.
-\def\labelspace{\hskip1em \relax}
-
-\def\dopageno#1{{\rm #1}}
-\def\doshortpageno#1{{\rm #1}}
-
-\def\chapentryfonts{\secfonts \rm}
-\def\secentryfonts{\textfonts}
-\let\subsecentryfonts = \textfonts
-\let\subsubsecentryfonts = \textfonts
-
-
-\message{environments,}
-% @foo ... @end foo.
-
-% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
-%
-% Since these characters are used in examples, it should be an even number of
-% \tt widths. Each \tt character is 1en, so two makes it 1em.
-%
-\def\point{$\star$}
-\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
-\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
-\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
-\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
-
-% The @error{} command.
-% Adapted from the TeXbook's \boxit.
-%
-\newbox\errorbox
-%
-{\tentt \global\dimen0 = 3em}% Width of the box.
-\dimen2 = .55pt % Thickness of rules
-% The text. (`r' is open on the right, `e' somewhat less so on the left.)
-\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
-%
-\global\setbox\errorbox=\hbox to \dimen0{\hfil
-   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
-   \advance\hsize by -2\dimen2 % Rules.
-   \vbox{
-      \hrule height\dimen2
-      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
-         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
-         \kern3pt\vrule width\dimen2}% Space to right.
-      \hrule height\dimen2}
-    \hfil}
-%
-\def\error{\leavevmode\lower.7ex\copy\errorbox}
-
-% @tex ... @end tex    escapes into raw Tex temporarily.
-% One exception: @ is still an escape character, so that @end tex works.
-% But \@ or @@ will get a plain tex @ character.
-
-\def\tex{\begingroup
-  \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
-  \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
-  \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
-  \catcode `\%=14
-  \catcode `\+=\other
-  \catcode `\"=\other
-  \catcode `\==\other
-  \catcode `\|=\other
-  \catcode `\<=\other
-  \catcode `\>=\other
-  \escapechar=`\\
-  %
-  \let\b=\ptexb
-  \let\bullet=\ptexbullet
-  \let\c=\ptexc
-  \let\,=\ptexcomma
-  \let\.=\ptexdot
-  \let\dots=\ptexdots
-  \let\equiv=\ptexequiv
-  \let\!=\ptexexclam
-  \let\i=\ptexi
-  \let\indent=\ptexindent
-  \let\{=\ptexlbrace
-  \let\+=\tabalign
-  \let\}=\ptexrbrace
-  \let\/=\ptexslash
-  \let\*=\ptexstar
-  \let\t=\ptext
-  %
-  \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
-  \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
-  \def\@{@}%
-\let\Etex=\endgroup}
-
-% Define @lisp ... @end lisp.
-% @lisp does a \begingroup so it can rebind things,
-% including the definition of @end lisp (which normally is erroneous).
-
-% Amount to narrow the margins by for @lisp.
-\newskip\lispnarrowing \lispnarrowing=0.4in
-
-% This is the definition that ^^M gets inside @lisp, @example, and other
-% such environments.  \null is better than a space, since it doesn't
-% have any width.
-\def\lisppar{\null\endgraf}
-
-% Make each space character in the input produce a normal interword
-% space in the output.  Don't allow a line break at this space, as this
-% is used only in environments like @example, where each line of input
-% should produce a line of output anyway.
-%
-{\obeyspaces %
-\gdef\sepspaces{\obeyspaces\let =\tie}}
-
-% Define \obeyedspace to be our active space, whatever it is.  This is
-% for use in \parsearg.
-{\sepspaces%
-\global\let\obeyedspace= }
-
-% This space is always present above and below environments.
-\newskip\envskipamount \envskipamount = 0pt
-
-% Make spacing and below environment symmetrical.  We use \parskip here
-% to help in doing that, since in @example-like environments \parskip
-% is reset to zero; thus the \afterenvbreak inserts no space -- but the
-% start of the next paragraph will insert \parskip.
-%
-\def\aboveenvbreak{{%
-  % =10000 instead of <10000 because of a special case in \itemzzz, q.v.
-  \ifnum \lastpenalty=10000 \else
-    \advance\envskipamount by \parskip
-    \endgraf
-    \ifdim\lastskip<\envskipamount
-      \removelastskip
-      % it's not a good place to break if the last penalty was \nobreak
-      % or better ...
-      \ifnum\lastpenalty>10000 \else \penalty-50 \fi
-      \vskip\envskipamount
-    \fi
-  \fi
-}}
-
-\let\afterenvbreak = \aboveenvbreak
-
-% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
-\let\nonarrowing=\relax
-
-% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
-% environment contents.
-\font\circle=lcircle10
-\newdimen\circthick
-\newdimen\cartouter\newdimen\cartinner
-\newskip\normbskip\newskip\normpskip\newskip\normlskip
-\circthick=\fontdimen8\circle
-%
-\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
-\def\ctr{{\hskip 6pt\circle\char'010}}
-\def\cbl{{\circle\char'012\hskip -6pt}}
-\def\cbr{{\hskip 6pt\circle\char'011}}
-\def\carttop{\hbox to \cartouter{\hskip\lskip
-        \ctl\leaders\hrule height\circthick\hfil\ctr
-        \hskip\rskip}}
-\def\cartbot{\hbox to \cartouter{\hskip\lskip
-        \cbl\leaders\hrule height\circthick\hfil\cbr
-        \hskip\rskip}}
-%
-\newskip\lskip\newskip\rskip
-
-\def\cartouche{%
-\par  % can't be in the midst of a paragraph.
-\begingroup
-        \lskip=\leftskip \rskip=\rightskip
-        \leftskip=0pt\rightskip=0pt %we want these *outside*.
-        \cartinner=\hsize \advance\cartinner by-\lskip
-                          \advance\cartinner by-\rskip
-        \cartouter=\hsize
-        \advance\cartouter by 18.4pt % allow for 3pt kerns on either
-%                                    side, and for 6pt waste from
-%                                    each corner char, and rule thickness
-        \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
-        % Flag to tell @lisp, etc., not to narrow margin.
-        \let\nonarrowing=\comment
-        \vbox\bgroup
-                \baselineskip=0pt\parskip=0pt\lineskip=0pt
-                \carttop
-                \hbox\bgroup
-                        \hskip\lskip
-                        \vrule\kern3pt
-                        \vbox\bgroup
-                                \hsize=\cartinner
-                                \kern3pt
-                                \begingroup
-                                        \baselineskip=\normbskip
-                                        \lineskip=\normlskip
-                                        \parskip=\normpskip
-                                        \vskip -\parskip
-\def\Ecartouche{%
-                                \endgroup
-                                \kern3pt
-                        \egroup
-                        \kern3pt\vrule
-                        \hskip\rskip
-                \egroup
-                \cartbot
-        \egroup
-\endgroup
-}}
-
-
-% This macro is called at the beginning of all the @example variants,
-% inside a group.
-\def\nonfillstart{%
-  \aboveenvbreak
-  \inENV % This group ends at the end of the body
-  \hfuzz = 12pt % Don't be fussy
-  \sepspaces % Make spaces be word-separators rather than space tokens.
-  \let\par = \lisppar % don't ignore blank lines
-  \obeylines % each line of input is a line of output
-  \parskip = 0pt
-  \parindent = 0pt
-  \emergencystretch = 0pt % don't try to avoid overfull boxes
-  % @cartouche defines \nonarrowing to inhibit narrowing
-  % at next level down.
-  \ifx\nonarrowing\relax
-    \advance \leftskip by \lispnarrowing
-    \exdentamount=\lispnarrowing
-    \let\exdent=\nofillexdent
-    \let\nonarrowing=\relax
-  \fi
-}
-
-% Define the \E... control sequence only if we are inside the particular
-% environment, so the error checking in \end will work.
-%
-% To end an @example-like environment, we first end the paragraph (via
-% \afterenvbreak's vertical glue), and then the group.  That way we keep
-% the zero \parskip that the environments set -- \parskip glue will be
-% inserted at the beginning of the next paragraph in the document, after
-% the environment.
-%
-\def\nonfillfinish{\afterenvbreak\endgroup}
-
-% @lisp: indented, narrowed, typewriter font.
-\def\lisp{\begingroup
-  \nonfillstart
-  \let\Elisp = \nonfillfinish
-  \tt
-  \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
-  \gobble       % eat return
-}
-
-% @example: Same as @lisp.
-\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
-
-% @smallexample and @smalllisp: use smaller fonts.
-% Originally contributed by Pavel@xerox.
-\def\smalllisp{\begingroup
-  \def\Esmalllisp{\nonfillfinish\endgroup}%
-  \def\Esmallexample{\nonfillfinish\endgroup}%
-  \smallexamplefonts
-  \lisp
-}
-\let\smallexample = \smalllisp
-
-
-% @display: same as @lisp except keep current font.
-%
-\def\display{\begingroup
-  \nonfillstart
-  \let\Edisplay = \nonfillfinish
-  \gobble
-}
-%
-% @smalldisplay: @display plus smaller fonts.
-%
-\def\smalldisplay{\begingroup
-  \def\Esmalldisplay{\nonfillfinish\endgroup}%
-  \smallexamplefonts \rm
-  \display
-}
-
-% @format: same as @display except don't narrow margins.
-%
-\def\format{\begingroup
-  \let\nonarrowing = t
-  \nonfillstart
-  \let\Eformat = \nonfillfinish
-  \gobble
-}
-%
-% @smallformat: @format plus smaller fonts.
-%
-\def\smallformat{\begingroup
-  \def\Esmallformat{\nonfillfinish\endgroup}%
-  \smallexamplefonts \rm
-  \format
-}
-
-% @flushleft (same as @format).
-%
-\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
-
-% @flushright.
-%
-\def\flushright{\begingroup
-  \let\nonarrowing = t
-  \nonfillstart
-  \let\Eflushright = \nonfillfinish
-  \advance\leftskip by 0pt plus 1fill
-  \gobble
-}
-
-
-% @quotation does normal linebreaking (hence we can't use \nonfillstart)
-% and narrows the margins.
-%
-\def\quotation{%
-  \begingroup\inENV %This group ends at the end of the @quotation body
-  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
-  \parindent=0pt
-  % We have retained a nonzero parskip for the environment, since we're
-  % doing normal filling. So to avoid extra space below the environment...
-  \def\Equotation{\parskip = 0pt \nonfillfinish}%
-  %
-  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
-  \ifx\nonarrowing\relax
-    \advance\leftskip by \lispnarrowing
-    \advance\rightskip by \lispnarrowing
-    \exdentamount = \lispnarrowing
-    \let\nonarrowing = \relax
-  \fi
-}
-
-
-% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
-% If we want to allow any <char> as delimiter,
-% we need the curly braces so that makeinfo sees the @verb command, eg:
-% `@verbx...x' would look like the '@verbx' command.  --janneke@gnu.org
-%
-% [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
-%
-% [Knuth] p.344; only we need to do the other characters Texinfo sets
-% active too.  Otherwise, they get lost as the first character on a
-% verbatim line.
-\def\dospecials{%
-  \do\ \do\\\do\{\do\}\do\$\do\&%
-  \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
-  \do\<\do\>\do\|\do\@\do+\do\"%
-}
-%
-% [Knuth] p. 380
-\def\uncatcodespecials{%
-  \def\do##1{\catcode`##1=12}\dospecials}
-%
-% [Knuth] pp. 380,381,391
-% Disable Spanish ligatures ?` and !` of \tt font
-\begingroup
-  \catcode`\`=\active\gdef`{\relax\lq}
-\endgroup
-%
-% Setup for the @verb command.
-%
-% Eight spaces for a tab
-\begingroup
-  \catcode`\^^I=\active
-  \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
-\endgroup
-%
-\def\setupverb{%
-  \tt  % easiest (and conventionally used) font for verbatim
-  \def\par{\leavevmode\endgraf}%
-  \catcode`\`=\active
-  \tabeightspaces
-  % Respect line breaks,
-  % print special symbols as themselves, and
-  % make each space count
-  % must do in this order:
-  \obeylines \uncatcodespecials \sepspaces
-}
-
-% Setup for the @verbatim environment
-%
-% Real tab expansion
-\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
-%
-\def\starttabbox{\setbox0=\hbox\bgroup}
-\begingroup
-  \catcode`\^^I=\active
-  \gdef\tabexpand{%
-    \catcode`\^^I=\active
-    \def^^I{\leavevmode\egroup
-      \dimen0=\wd0 % the width so far, or since the previous tab
-      \divide\dimen0 by\tabw
-      \multiply\dimen0 by\tabw % compute previous multiple of \tabw
-      \advance\dimen0 by\tabw  % advance to next multiple of \tabw
-      \wd0=\dimen0 \box0 \starttabbox
-    }%
-  }
-\endgroup
-\def\setupverbatim{%
-  % Easiest (and conventionally used) font for verbatim
-  \tt
-  \def\par{\leavevmode\egroup\box0\endgraf}%
-  \catcode`\`=\active
-  \tabexpand
-  % Respect line breaks,
-  % print special symbols as themselves, and
-  % make each space count
-  % must do in this order:
-  \obeylines \uncatcodespecials \sepspaces
-  \everypar{\starttabbox}%
-}
-
-% Do the @verb magic: verbatim text is quoted by unique
-% delimiter characters.  Before first delimiter expect a
-% right brace, after last delimiter expect closing brace:
-%
-%    \def\doverb'{'<char>#1<char>'}'{#1}
-%
-% [Knuth] p. 382; only eat outer {}
-\begingroup
-  \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
-  \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
-\endgroup
-%
-\def\verb{\begingroup\setupverb\doverb}
-%
-%
-% Do the @verbatim magic: define the macro \doverbatim so that
-% the (first) argument ends when '@end verbatim' is reached, ie:
-%
-%     \def\doverbatim#1@end verbatim{#1}
-%
-% For Texinfo it's a lot easier than for LaTeX,
-% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
-% we need not redefine '\', '{' and '}'.
-%
-% Inspired by LaTeX's verbatim command set [latex.ltx]
-%% Include LaTeX hack for completeness -- never know
-%% \begingroup
-%% \catcode`|=0 \catcode`[=1
-%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active
-%% \catcode`\\=12|gdef|doverbatim#1@end verbatim[
-%% #1|endgroup|def|Everbatim[]|end[verbatim]]
-%% |endgroup
-%
-\begingroup
-  \catcode`\ =\active
-  \obeylines %
-  % ignore everything up to the first ^^M, that's the newline at the end
-  % of the @verbatim input line itself.  Otherwise we get an extra blank
-  % line in the output.
-  \gdef\doverbatim#1^^M#2@end verbatim{#2\end{verbatim}}%
-\endgroup
-%
-\def\verbatim{%
-  \def\Everbatim{\nonfillfinish\endgroup}%
-  \begingroup
-    \nonfillstart
-    \advance\leftskip by -\defbodyindent
-    \begingroup\setupverbatim\doverbatim
-}
-
-% @verbatiminclude FILE - insert text of file in verbatim environment.
-%
-% Allow normal characters that we make active in the argument (a file name).
-\def\verbatiminclude{%
-  \begingroup
-    \catcode`\\=\other
-    \catcode`~=\other
-    \catcode`^=\other
-    \catcode`_=\other
-    \catcode`|=\other
-    \catcode`<=\other
-    \catcode`>=\other
-    \catcode`+=\other
-    \parsearg\doverbatiminclude
-}
-\def\setupverbatiminclude{%
-  \begingroup
-    \nonfillstart
-    \advance\leftskip by -\defbodyindent
-    \begingroup\setupverbatim
-}
-%
-\def\doverbatiminclude#1{%
-     % Restore active chars for included file.
-  \endgroup
-  \begingroup
-    \let\value=\expandablevalue
-    \def\thisfile{#1}%
-    \expandafter\expandafter\setupverbatiminclude\input\thisfile
-  \endgroup
-  \nonfillfinish
-  \endgroup
-}
-
-% @copying ... @end copying.
-% Save the text away for @insertcopying later.  Many commands won't be
-% allowed in this context, but that's ok.
-%
-% We save the uninterpreted tokens, rather than creating a box.
-% Saving the text in a box would be much easier, but then all the
-% typesetting commands (@smallbook, font changes, etc.) have to be done
-% beforehand -- and a) we want @copying to be done first in the source
-% file; b) letting users define the frontmatter in as flexible order as
-% possible is very desirable.
-%
-\def\copying{\begingroup
-  % Define a command to swallow text until we reach `@end copying'.
-  % \ is the escape char in this texinfo.tex file, so it is the
-  % delimiter for the command; @ will be the escape char when we read
-  % it, but that doesn't matter.
-  \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}%
-  %
-  % We must preserve ^^M's in the input file; see \insertcopying below.
-  \catcode`\^^M = \active
-  \docopying
-}
-
-% What we do to finish off the copying text.
-%
-\def\enddocopying{\endgroup\ignorespaces}
-
-% @insertcopying.  Here we must play games with ^^M's.  On the one hand,
-% we need them to delimit commands such as `@end quotation', so they
-% must be active.  On the other hand, we certainly don't want every
-% end-of-line to be a \par, as would happen with the normal active
-% definition of ^^M.  On the third hand, two ^^M's in a row should still
-% generate a \par.
-%
-% Our approach is to make ^^M insert a space and a penalty1 normally;
-% then it can also check if \lastpenalty=1.  If it does, then manually
-% do \par.
-%
-% This messes up the normal definitions of @c[omment], so we redefine
-% it.  Similarly for @ignore.  (These commands are used in the gcc
-% manual for man page generation.)
-%
-% Seems pretty fragile, most line-oriented commands will presumably
-% fail, but for the limited use of getting the copying text (which
-% should be quite simple) inserted, we can hope it's ok.
-%
-{\catcode`\^^M=\active %
-\gdef\insertcopying{\begingroup %
-  \parindent = 0pt  % looks wrong on title page
-  \def^^M{%
-    \ifnum \lastpenalty=1 %
-      \par %
-    \else %
-      \space \penalty 1 %
-    \fi %
-  }%
-  %
-  % Fix @c[omment] for catcode 13 ^^M's.
-  \def\c##1^^M{\ignorespaces}%
-  \let\comment = \c %
-  %
-  % Don't bother jumping through all the hoops that \doignore does, it
-  % would be very hard since the catcodes are already set.
-  \long\def\ignore##1\end ignore{\ignorespaces}%
-  %
-  \copyingtext %
-\endgroup}%
-}
-
-\message{defuns,}
-% @defun etc.
-
-% Allow user to change definition object font (\df) internally
-\def\setdeffont#1 {\csname DEF#1\endcsname}
-
-\newskip\defbodyindent \defbodyindent=.4in
-\newskip\defargsindent \defargsindent=50pt
-\newskip\deflastargmargin \deflastargmargin=18pt
-
-\newcount\parencount
-
-% We want ()&[] to print specially on the defun line.
-%
-\def\activeparens{%
-  \catcode`\(=\active \catcode`\)=\active
-  \catcode`\&=\active
-  \catcode`\[=\active \catcode`\]=\active
-}
-
-% Make control sequences which act like normal parenthesis chars.
-\let\lparen = ( \let\rparen = )
-
-{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
-
-% Be sure that we always have a definition for `(', etc.  For example,
-% if the fn name has parens in it, \boldbrax will not be in effect yet,
-% so TeX would otherwise complain about undefined control sequence.
-\global\let(=\lparen \global\let)=\rparen
-\global\let[=\lbrack \global\let]=\rbrack
-
-\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
-\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
-% This is used to turn on special parens
-% but make & act ordinary (given that it's active).
-\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
-
-% Definitions of (, ) and & used in args for functions.
-% This is the definition of ( outside of all parentheses.
-\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
-  \global\advance\parencount by 1
-}
-%
-% This is the definition of ( when already inside a level of parens.
-\gdef\opnested{\char`\(\global\advance\parencount by 1 }
-%
-\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
-  % also in that case restore the outer-level definition of (.
-  \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
-  \global\advance \parencount by -1 }
-% If we encounter &foo, then turn on ()-hacking afterwards
-\gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
-%
-\gdef\normalparens{\boldbrax\let&=\ampnr}
-} % End of definition inside \activeparens
-%% These parens (in \boldbrax) actually are a little bolder than the
-%% contained text.  This is especially needed for [ and ]
-\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
-\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
-\let\ampnr = \&
-\def\lbrb{{\bf\char`\[}}
-\def\rbrb{{\bf\char`\]}}
-
-% Active &'s sneak into the index arguments, so make sure it's defined.
-{
-  \catcode`& = \active
-  \global\let& = \ampnr
-}
-
-% \defname, which formats the name of the @def (not the args).
-% #1 is the function name.
-% #2 is the type of definition, such as "Function".
-%
-\def\defname#1#2{%
-  % How we'll output the type name.  Putting it in brackets helps
-  % distinguish it from the body text that may end up on the next line
-  % just below it.
-  \ifempty{#2}%
-    \def\defnametype{}%
-  \else
-    \def\defnametype{[\rm #2]}%
-  \fi
-  %
-  % Get the values of \leftskip and \rightskip as they were outside the @def...
-  \dimen2=\leftskip
-  \advance\dimen2 by -\defbodyindent
-  %
-  % Figure out values for the paragraph shape.
-  \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}%
-  \dimen0=\hsize \advance \dimen0 by -\wd0  % compute size for first line
-  \dimen1=\hsize \advance \dimen1 by -\defargsindent  % size for continuations
-  \parshape 2 0in \dimen0 \defargsindent \dimen1
-  %
-  % Output arg 2 ("Function" or some such) but stuck inside a box of
-  % width 0 so it does not interfere with linebreaking.
-  \noindent
-  %
-  {% Adjust \hsize to exclude the ambient margins,
-   % so that \rightline will obey them.
-   \advance \hsize by -\dimen2
-   \dimen3 = 0pt  % was -1.25pc
-   \rlap{\rightline{\defnametype\kern\dimen3}}%
-  }%
-  %
-  % Allow all lines to be underfull without complaint:
-  \tolerance=10000 \hbadness=10000
-  \advance\leftskip by -\defbodyindent
-  \exdentamount=\defbodyindent
-  {\df #1}\enskip        % output function name
-  % \defunargs will be called next to output the arguments, if any.
-}
-
-% Common pieces to start any @def...
-% #1 is the \E... control sequence to end the definition (which we define).
-% #2 is the \...x control sequence (which our caller defines).
-% #3 is the control sequence to process the header, such as \defunheader.
-%
-\def\parsebodycommon#1#2#3{%
-  \begingroup\inENV
-  % If there are two @def commands in a row, we'll have a \nobreak,
-  % which is there to keep the function description together with its
-  % header.  But if there's nothing but headers, we want to allow a
-  % break after all.  Check for penalty 10002 (inserted by
-  % \defargscommonending) instead of 10000, since the sectioning
-  % commands insert a \penalty10000, and we don't want to allow a break
-  % between a section heading and a defun.
-  \ifnum\lastpenalty=10002 \penalty0 \fi
-  \medbreak
-  %
-  % Define the \E... end token that this defining construct specifies
-  % so that it will exit this group.
-  \def#1{\endgraf\endgroup\medbreak}%
-  %
-  \parindent=0in
-  \advance\leftskip by \defbodyindent
-  \exdentamount=\defbodyindent
-}
-
-% Common part of the \...x definitions.
-%
-\def\defxbodycommon{%
-  % As with \parsebodycommon above, allow line break if we have multiple
-  % x headers in a row.  It's not a great place, though.
-  \ifnum\lastpenalty=10000 \penalty1000 \fi
-  %
-  \begingroup\obeylines
-}
-
-% Process body of @defun, @deffn, @defmac, etc.
-%
-\def\defparsebody#1#2#3{%
-  \parsebodycommon{#1}{#2}{#3}%
-  \def#2{\defxbodycommon \activeparens \spacesplit#3}%
-  \catcode\equalChar=\active
-  \begingroup\obeylines\activeparens
-  \spacesplit#3%
-}
-
-% #1, #2, #3 are the common arguments (see \parsebodycommon above).
-% #4, delimited by the space, is the class name.
-%
-\def\defmethparsebody#1#2#3#4 {%
-  \parsebodycommon{#1}{#2}{#3}%
-  \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}%
-  \begingroup\obeylines\activeparens
-  % The \empty here prevents misinterpretation of a construct such as
-  %   @deffn {whatever} {Enharmonic comma}
-  % See comments at \deftpparsebody, although in our case we don't have
-  % to remove the \empty afterwards, since it is empty.
-  \spacesplit{#3{#4}}\empty
-}
-
-% Used for @deftypemethod and @deftypeivar.
-% #1, #2, #3 are the common arguments (see \defparsebody).
-% #4, delimited by a space, is the class name.
-% #5 is the method's return type.
-%
-\def\deftypemethparsebody#1#2#3#4 #5 {%
-  \parsebodycommon{#1}{#2}{#3}%
-  \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}%
-  \begingroup\obeylines\activeparens
-  \spacesplit{#3{#4}{#5}}%
-}
-
-% Used for @deftypeop.  The change from \deftypemethparsebody is an
-% extra argument at the beginning which is the `category', instead of it
-% being the hardwired string `Method' or `Instance Variable'.  We have
-% to account for this both in the \...x definition and in parsing the
-% input at hand.  Thus also need a control sequence (passed as #5) for
-% the \E... definition to assign the category name to.
-%
-\def\deftypeopparsebody#1#2#3#4#5 #6 {%
-  \parsebodycommon{#1}{#2}{#3}%
-  \def#2##1 ##2 ##3 {\def#4{##1}%
-    \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}%
-  \begingroup\obeylines\activeparens
-  \spacesplit{#3{#5}{#6}}%
-}
-
-% For @defop.
-\def\defopparsebody #1#2#3#4#5 {%
-  \parsebodycommon{#1}{#2}{#3}%
-  \def#2##1 ##2 {\def#4{##1}%
-    \defxbodycommon \activeparens \spacesplit{#3{##2}}}%
-  \begingroup\obeylines\activeparens
-  \spacesplit{#3{#5}}%
-}
-
-% These parsing functions are similar to the preceding ones
-% except that they do not make parens into active characters.
-% These are used for "variables" since they have no arguments.
-%
-\def\defvarparsebody #1#2#3{%
-  \parsebodycommon{#1}{#2}{#3}%
-  \def#2{\defxbodycommon \spacesplit#3}%
-  \catcode\equalChar=\active
-  \begingroup\obeylines
-  \spacesplit#3%
-}
-
-% @defopvar.
-\def\defopvarparsebody #1#2#3#4#5 {%
-  \parsebodycommon{#1}{#2}{#3}%
-  \def#2##1 ##2 {\def#4{##1}%
-    \defxbodycommon \spacesplit{#3{##2}}}%
-  \begingroup\obeylines
-  \spacesplit{#3{#5}}%
-}
-
-\def\defvrparsebody#1#2#3#4 {%
-  \parsebodycommon{#1}{#2}{#3}%
-  \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
-  \begingroup\obeylines
-  \spacesplit{#3{#4}}%
-}
-
-% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
-% type is just `struct', because we lose the braces in `{struct
-% termios}' when \spacesplit reads its undelimited argument.  Sigh.
-% \let\deftpparsebody=\defvrparsebody
-%
-% So, to get around this, we put \empty in with the type name.  That
-% way, TeX won't find exactly `{...}' as an undelimited argument, and
-% won't strip off the braces.
-%
-\def\deftpparsebody #1#2#3#4 {%
-  \parsebodycommon{#1}{#2}{#3}%
-  \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
-  \begingroup\obeylines
-  \spacesplit{\parsetpheaderline{#3{#4}}}\empty
-}
-
-% Fine, but then we have to eventually remove the \empty *and* the
-% braces (if any).  That's what this does.
-%
-\def\removeemptybraces\empty#1\relax{#1}
-
-% After \spacesplit has done its work, this is called -- #1 is the final
-% thing to call, #2 the type name (which starts with \empty), and #3
-% (which might be empty) the arguments.
-%
-\def\parsetpheaderline#1#2#3{%
-  #1{\removeemptybraces#2\relax}{#3}%
-}%
-
-% Split up #2 (the rest of the input line) at the first space token.
-% call #1 with two arguments:
-%  the first is all of #2 before the space token,
-%  the second is all of #2 after that space token.
-% If #2 contains no space token, all of it is passed as the first arg
-% and the second is passed as empty.
-%
-{\obeylines %
- \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}%
- \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{%
-   \ifx\relax #3%
-     #1{#2}{}%
-   \else %
-     #1{#2}{#3#4}%
-   \fi}%
-}
-
-% Define @defun.
-
-% This is called to end the arguments processing for all the @def... commands.
-%
-\def\defargscommonending{%
-  \interlinepenalty = 10000
-  \advance\rightskip by 0pt plus 1fil
-  \endgraf
-  \nobreak\vskip -\parskip
-  \penalty 10002  % signal to \parsebodycommon.
-}
-
-% This expands the args and terminates the paragraph they comprise.
-%
-\def\defunargs#1{\functionparens \sl
-% Expand, preventing hyphenation at `-' chars.
-% Note that groups don't affect changes in \hyphenchar.
-% Set the font temporarily and use \font in case \setfont made \tensl a macro.
-{\tensl\hyphenchar\font=0}%
-#1%
-{\tensl\hyphenchar\font=45}%
-\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
-  \defargscommonending
-}
-
-\def\deftypefunargs #1{%
-% Expand, preventing hyphenation at `-' chars.
-% Note that groups don't affect changes in \hyphenchar.
-% Use \boldbraxnoamp, not \functionparens, so that & is not special.
-\boldbraxnoamp
-\tclose{#1}% avoid \code because of side effects on active chars
-  \defargscommonending
-}
-
-% Do complete processing of one @defun or @defunx line already parsed.
-
-% @deffn Command forward-char nchars
-
-\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
-
-\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
-\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
-\catcode\equalChar=\other % Turn off change made in \defparsebody
-}
-
-% @defun == @deffn Function
-
-\def\defun{\defparsebody\Edefun\defunx\defunheader}
-
-\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
-\begingroup\defname {#1}{\putwordDeffunc}%
-\defunargs {#2}\endgroup %
-\catcode\equalChar=\other % Turn off change made in \defparsebody
-}
-
-% @deftypefun int foobar (int @var{foo}, float @var{bar})
-
-\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
-
-% #1 is the data type.  #2 is the name and args.
-\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
-% #1 is the data type, #2 the name, #3 the args.
-\def\deftypefunheaderx #1#2 #3\relax{%
-\doind {fn}{\code{#2}}% Make entry in function index
-\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}%
-\deftypefunargs {#3}\endgroup %
-\catcode\equalChar=\other % Turn off change made in \defparsebody
-}
-
-% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
-
-\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
-
-% \defheaderxcond#1\relax$.$
-% puts #1 in @code, followed by a space, but does nothing if #1 is null.
-\def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi}
-
-% #1 is the classification.  #2 is the data type.  #3 is the name and args.
-\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
-% #1 is the classification, #2 the data type, #3 the name, #4 the args.
-\def\deftypefnheaderx #1#2#3 #4\relax{%
-\doind {fn}{\code{#3}}% Make entry in function index
-\begingroup
-\normalparens % notably, turn off `&' magic, which prevents
-%               at least some C++ text from working
-\defname {\defheaderxcond#2\relax$.$#3}{#1}%
-\deftypefunargs {#4}\endgroup %
-\catcode\equalChar=\other % Turn off change made in \defparsebody
-}
-
-% @defmac == @deffn Macro
-
-\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
-
-\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
-\begingroup\defname {#1}{\putwordDefmac}%
-\defunargs {#2}\endgroup %
-\catcode\equalChar=\other % Turn off change made in \defparsebody
-}
-
-% @defspec == @deffn Special Form
-
-\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
-
-\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
-\begingroup\defname {#1}{\putwordDefspec}%
-\defunargs {#2}\endgroup %
-\catcode\equalChar=\other % Turn off change made in \defparsebody
-}
-
-% @defop CATEGORY CLASS OPERATION ARG...
-%
-\def\defop #1 {\def\defoptype{#1}%
-\defopparsebody\Edefop\defopx\defopheader\defoptype}
-%
-\def\defopheader#1#2#3{%
-  \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry
-  \begingroup
-    \defname{#2}{\defoptype\ \putwordon\ #1}%
-    \defunargs{#3}%
-  \endgroup
-}
-
-% @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
-%
-\def\deftypeop #1 {\def\deftypeopcategory{#1}%
-  \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
-                       \deftypeopcategory}
-%
-% #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
-\def\deftypeopheader#1#2#3#4{%
-  \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
-  \begingroup
-    \defname{\defheaderxcond#2\relax$.$#3}
-            {\deftypeopcategory\ \putwordon\ \code{#1}}%
-    \deftypefunargs{#4}%
-  \endgroup
-}
-
-% @deftypemethod CLASS TYPE METHOD ARG...
-%
-\def\deftypemethod{%
-  \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
-%
-% #1 is the class name, #2 the data type, #3 the method name, #4 the args.
-\def\deftypemethodheader#1#2#3#4{%
-  \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
-  \begingroup
-    \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}%
-    \deftypefunargs{#4}%
-  \endgroup
-}
-
-% @deftypeivar CLASS TYPE VARNAME
-%
-\def\deftypeivar{%
-  \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
-%
-% #1 is the class name, #2 the data type, #3 the variable name.
-\def\deftypeivarheader#1#2#3{%
-  \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
-  \begingroup
-    \defname{\defheaderxcond#2\relax$.$#3}
-            {\putwordInstanceVariableof\ \code{#1}}%
-    \defvarargs{#3}%
-  \endgroup
-}
-
-% @defmethod == @defop Method
-%
-\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
-%
-% #1 is the class name, #2 the method name, #3 the args.
-\def\defmethodheader#1#2#3{%
-  \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
-  \begingroup
-    \defname{#2}{\putwordMethodon\ \code{#1}}%
-    \defunargs{#3}%
-  \endgroup
-}
-
-% @defcv {Class Option} foo-class foo-flag
-
-\def\defcv #1 {\def\defcvtype{#1}%
-\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
-
-\def\defcvarheader #1#2#3{%
-  \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry
-  \begingroup
-    \defname{#2}{\defcvtype\ \putwordof\ #1}%
-    \defvarargs{#3}%
-  \endgroup
-}
-
-% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
-%
-\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
-%
-\def\defivarheader#1#2#3{%
-  \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index
-  \begingroup
-    \defname{#2}{\putwordInstanceVariableof\ #1}%
-    \defvarargs{#3}%
-  \endgroup
-}
-
-% @defvar
-% First, define the processing that is wanted for arguments of @defvar.
-% This is actually simple: just print them in roman.
-% This must expand the args and terminate the paragraph they make up
-\def\defvarargs #1{\normalparens #1%
-  \defargscommonending
-}
-
-% @defvr Counter foo-count
-
-\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
-
-\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
-\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
-
-% @defvar == @defvr Variable
-
-\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
-
-\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
-\begingroup\defname {#1}{\putwordDefvar}%
-\defvarargs {#2}\endgroup %
-}
-
-% @defopt == @defvr {User Option}
-
-\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
-
-\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
-\begingroup\defname {#1}{\putwordDefopt}%
-\defvarargs {#2}\endgroup %
-}
-
-% @deftypevar int foobar
-
-\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
-
-% #1 is the data type.  #2 is the name, perhaps followed by text that
-% is actually part of the data type, which should not be put into the index.
-\def\deftypevarheader #1#2{%
-\dovarind#2 \relax% Make entry in variables index
-\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}%
-  \defargscommonending
-\endgroup}
-\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
-
-% @deftypevr {Global Flag} int enable
-
-\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
-
-\def\deftypevrheader #1#2#3{\dovarind#3 \relax%
-\begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1}
-  \defargscommonending
-\endgroup}
-
-% Now define @deftp
-% Args are printed in bold, a slight difference from @defvar.
-
-\def\deftpargs #1{\bf \defvarargs{#1}}
-
-% @deftp Class window height width ...
-
-\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
-
-\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
-\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
-
-% These definitions are used if you use @defunx (etc.)
-% anywhere other than immediately after a @defun or @defunx.
-%
-\def\defcvx#1 {\errmessage{@defcvx in invalid context}}
-\def\deffnx#1 {\errmessage{@deffnx in invalid context}}
-\def\defivarx#1 {\errmessage{@defivarx in invalid context}}
-\def\defmacx#1 {\errmessage{@defmacx in invalid context}}
-\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
-\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
-\def\defopx#1 {\errmessage{@defopx in invalid context}}
-\def\defspecx#1 {\errmessage{@defspecx in invalid context}}
-\def\deftpx#1 {\errmessage{@deftpx in invalid context}}
-\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
-\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
-\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
-\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
-\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
-\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
-\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
-\def\defunx#1 {\errmessage{@defunx in invalid context}}
-\def\defvarx#1 {\errmessage{@defvarx in invalid context}}
-\def\defvrx#1 {\errmessage{@defvrx in invalid context}}
-
-
-\message{macros,}
-% @macro.
-
-% To do this right we need a feature of e-TeX, \scantokens,
-% which we arrange to emulate with a temporary file in ordinary TeX.
-\ifx\eTeXversion\undefined
- \newwrite\macscribble
- \def\scanmacro#1{%
-   \begingroup \newlinechar`\^^M
-   % Undo catcode changes of \startcontents and \doprintindex
-   \catcode`\@=0 \catcode`\\=\other \escapechar=`\@
-   % Append \endinput to make sure that TeX does not see the ending newline.
-   \toks0={#1\endinput}%
-   \immediate\openout\macscribble=\jobname.tmp
-   \immediate\write\macscribble{\the\toks0}%
-   \immediate\closeout\macscribble
-   \let\xeatspaces\eatspaces
-   \input \jobname.tmp
-   \endgroup
-}
-\else
-\def\scanmacro#1{%
-\begingroup \newlinechar`\^^M
-% Undo catcode changes of \startcontents and \doprintindex
-\catcode`\@=0 \catcode`\\=\other \escapechar=`\@
-\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
-\fi
-
-\newcount\paramno   % Count of parameters
-\newtoks\macname    % Macro name
-\newif\ifrecursive  % Is it recursive?
-\def\macrolist{}    % List of all defined macros in the form
-                    % \do\macro1\do\macro2...
-
-% Utility routines.
-% Thisdoes \let #1 = #2, except with \csnames.
-\def\cslet#1#2{%
-\expandafter\expandafter
-\expandafter\let
-\expandafter\expandafter
-\csname#1\endcsname
-\csname#2\endcsname}
-
-% Trim leading and trailing spaces off a string.
-% Concepts from aro-bend problem 15 (see CTAN).
-{\catcode`\@=11
-\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
-\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
-\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
-\def\unbrace#1{#1}
-\unbrace{\gdef\trim@@@ #1 } #2@{#1}
-}
-
-% Trim a single trailing ^^M off a string.
-{\catcode`\^^M=\other \catcode`\Q=3%
-\gdef\eatcr #1{\eatcra #1Q^^MQ}%
-\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
-\gdef\eatcrb#1Q#2Q{#1}%
-}
-
-% Macro bodies are absorbed as an argument in a context where
-% all characters are catcode 10, 11 or 12, except \ which is active
-% (as in normal texinfo). It is necessary to change the definition of \.
-
-% It's necessary to have hard CRs when the macro is executed. This is
-% done by  making ^^M (\endlinechar) catcode 12 when reading the macro
-% body, and then making it the \newlinechar in \scanmacro.
-
-\def\macrobodyctxt{%
-  \catcode`\~=\other
-  \catcode`\^=\other
-  \catcode`\_=\other
-  \catcode`\|=\other
-  \catcode`\<=\other
-  \catcode`\>=\other
-  \catcode`\+=\other
-  \catcode`\{=\other
-  \catcode`\}=\other
-  \catcode`\@=\other
-  \catcode`\^^M=\other
-  \usembodybackslash}
-
-\def\macroargctxt{%
-  \catcode`\~=\other
-  \catcode`\^=\other
-  \catcode`\_=\other
-  \catcode`\|=\other
-  \catcode`\<=\other
-  \catcode`\>=\other
-  \catcode`\+=\other
-  \catcode`\@=\other
-  \catcode`\\=\other}
-
-% \mbodybackslash is the definition of \ in @macro bodies.
-% It maps \foo\ => \csname macarg.foo\endcsname => #N
-% where N is the macro parameter number.
-% We define \csname macarg.\endcsname to be \realbackslash, so
-% \\ in macro replacement text gets you a backslash.
-
-{\catcode`@=0 @catcode`@\=@active
- @gdef@usembodybackslash{@let\=@mbodybackslash}
- @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
-}
-\expandafter\def\csname macarg.\endcsname{\realbackslash}
-
-\def\macro{\recursivefalse\parsearg\macroxxx}
-\def\rmacro{\recursivetrue\parsearg\macroxxx}
-
-\def\macroxxx#1{%
-  \getargs{#1}%           now \macname is the macname and \argl the arglist
-  \ifx\argl\empty       % no arguments
-     \paramno=0%
-  \else
-     \expandafter\parsemargdef \argl;%
-  \fi
-  \if1\csname ismacro.\the\macname\endcsname
-     \message{Warning: redefining \the\macname}%
-  \else
-     \expandafter\ifx\csname \the\macname\endcsname \relax
-     \else \errmessage{Macro name \the\macname\space already defined}\fi
-     \global\cslet{macsave.\the\macname}{\the\macname}%
-     \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
-     % Add the macroname to \macrolist
-     \toks0 = \expandafter{\macrolist\do}%
-     \xdef\macrolist{\the\toks0
-       \expandafter\noexpand\csname\the\macname\endcsname}%
-  \fi
-  \begingroup \macrobodyctxt
-  \ifrecursive \expandafter\parsermacbody
-  \else \expandafter\parsemacbody
-  \fi}
-
-\def\unmacro{\parsearg\dounmacro}
-\def\dounmacro#1{%
-  \if1\csname ismacro.#1\endcsname
-    \global\cslet{#1}{macsave.#1}%
-    \global\expandafter\let \csname ismacro.#1\endcsname=0%
-    % Remove the macro name from \macrolist:
-    \begingroup
-      \expandafter\let\csname#1\endcsname \relax
-      \let\do\unmacrodo
-      \xdef\macrolist{\macrolist}%
-    \endgroup
-  \else
-    \errmessage{Macro #1 not defined}%
-  \fi
-}
-
-% Called by \do from \dounmacro on each macro.  The idea is to omit any
-% macro definitions that have been changed to \relax.
-%
-\def\unmacrodo#1{%
-  \ifx#1\relax
-    % remove this
-  \else
-    \noexpand\do \noexpand #1%
-  \fi
-}
-
-% This makes use of the obscure feature that if the last token of a
-% <parameter list> is #, then the preceding argument is delimited by
-% an opening brace, and that opening brace is not consumed.
-\def\getargs#1{\getargsxxx#1{}}
-\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
-\def\getmacname #1 #2\relax{\macname={#1}}
-\def\getmacargs#1{\def\argl{#1}}
-
-% Parse the optional {params} list.  Set up \paramno and \paramlist
-% so \defmacro knows what to do.  Define \macarg.blah for each blah
-% in the params list, to be ##N where N is the position in that list.
-% That gets used by \mbodybackslash (above).
-
-% We need to get `macro parameter char #' into several definitions.
-% The technique used is stolen from LaTeX:  let \hash be something
-% unexpandable, insert that wherever you need a #, and then redefine
-% it to # just before using the token list produced.
-%
-% The same technique is used to protect \eatspaces till just before
-% the macro is used.
-
-\def\parsemargdef#1;{\paramno=0\def\paramlist{}%
-        \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
-\def\parsemargdefxxx#1,{%
-  \if#1;\let\next=\relax
-  \else \let\next=\parsemargdefxxx
-    \advance\paramno by 1%
-    \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
-        {\xeatspaces{\hash\the\paramno}}%
-    \edef\paramlist{\paramlist\hash\the\paramno,}%
-  \fi\next}
-
-% These two commands read recursive and nonrecursive macro bodies.
-% (They're different since rec and nonrec macros end differently.)
-
-\long\def\parsemacbody#1@end macro%
-{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
-\long\def\parsermacbody#1@end rmacro%
-{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
-
-% This defines the macro itself. There are six cases: recursive and
-% nonrecursive macros of zero, one, and many arguments.
-% Much magic with \expandafter here.
-% \xdef is used so that macro definitions will survive the file
-% they're defined in; @include reads the file inside a group.
-\def\defmacro{%
-  \let\hash=##% convert placeholders to macro parameter chars
-  \ifrecursive
-    \ifcase\paramno
-    % 0
-      \expandafter\xdef\csname\the\macname\endcsname{%
-        \noexpand\scanmacro{\temp}}%
-    \or % 1
-      \expandafter\xdef\csname\the\macname\endcsname{%
-         \bgroup\noexpand\macroargctxt
-         \noexpand\braceorline
-         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
-      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
-         \egroup\noexpand\scanmacro{\temp}}%
-    \else % many
-      \expandafter\xdef\csname\the\macname\endcsname{%
-         \bgroup\noexpand\macroargctxt
-         \noexpand\csname\the\macname xx\endcsname}%
-      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
-          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
-      \expandafter\expandafter
-      \expandafter\xdef
-      \expandafter\expandafter
-        \csname\the\macname xxx\endcsname
-          \paramlist{\egroup\noexpand\scanmacro{\temp}}%
-    \fi
-  \else
-    \ifcase\paramno
-    % 0
-      \expandafter\xdef\csname\the\macname\endcsname{%
-        \noexpand\norecurse{\the\macname}%
-        \noexpand\scanmacro{\temp}\egroup}%
-    \or % 1
-      \expandafter\xdef\csname\the\macname\endcsname{%
-         \bgroup\noexpand\macroargctxt
-         \noexpand\braceorline
-         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
-      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
-        \egroup
-        \noexpand\norecurse{\the\macname}%
-        \noexpand\scanmacro{\temp}\egroup}%
-    \else % many
-      \expandafter\xdef\csname\the\macname\endcsname{%
-         \bgroup\noexpand\macroargctxt
-         \expandafter\noexpand\csname\the\macname xx\endcsname}%
-      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
-          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
-      \expandafter\expandafter
-      \expandafter\xdef
-      \expandafter\expandafter
-      \csname\the\macname xxx\endcsname
-      \paramlist{%
-          \egroup
-          \noexpand\norecurse{\the\macname}%
-          \noexpand\scanmacro{\temp}\egroup}%
-    \fi
-  \fi}
-
-\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
-
-% \braceorline decides whether the next nonwhitespace character is a
-% {.  If so it reads up to the closing }, if not, it reads the whole
-% line.  Whatever was read is then fed to the next control sequence
-% as an argument (by \parsebrace or \parsearg)
-\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
-\def\braceorlinexxx{%
-  \ifx\nchar\bgroup\else
-    \expandafter\parsearg
-  \fi \next}
-
-% We mant to disable all macros during \shipout so that they are not
-% expanded by \write.
-\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
-  \edef\next{\macrolist}\expandafter\endgroup\next}
-
-
-% @alias.
-% We need some trickery to remove the optional spaces around the equal
-% sign.  Just make them active and then expand them all to nothing.
-\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
-\def\aliasxxx #1{\aliasyyy#1\relax}
-\def\aliasyyy #1=#2\relax{\ignoreactivespaces
-\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
-           \expandafter\noexpand\csname#2\endcsname}%
-\expandafter\endgroup\next}
-
-
-\message{cross references,}
-% @xref etc.
-
-\newwrite\auxfile
-
-\newif\ifhavexrefs    % True if xref values are known.
-\newif\ifwarnedxrefs  % True if we warned once that they aren't known.
-
-% @inforef is relatively simple.
-\def\inforef #1{\inforefzzz #1,,,,**}
-\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
-  node \samp{\ignorespaces#1{}}}
-
-% @node's job is to define \lastnode.
-\def\node{\ENVcheck\parsearg\nodezzz}
-\def\nodezzz#1{\nodexxx #1,\finishnodeparse}
-\def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#1}}
-\let\nwnode=\node
-\let\lastnode=\relax
-
-% The sectioning commands (@chapter, etc.) call these.
-\def\donoderef{%
-  \ifx\lastnode\relax\else
-    \expandafter\expandafter\expandafter\setref{\lastnode}%
-      {Ysectionnumberandtype}%
-    \global\let\lastnode=\relax
-  \fi
-}
-\def\unnumbnoderef{%
-  \ifx\lastnode\relax\else
-    \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
-    \global\let\lastnode=\relax
-  \fi
-}
-\def\appendixnoderef{%
-  \ifx\lastnode\relax\else
-    \expandafter\expandafter\expandafter\setref{\lastnode}%
-      {Yappendixletterandtype}%
-    \global\let\lastnode=\relax
-  \fi
-}
-
-
-% @anchor{NAME} -- define xref target at arbitrary point.
-%
-\newcount\savesfregister
-\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
-\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
-\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
-
-% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
-% anchor), namely NAME-title (the corresponding @chapter/etc. name),
-% NAME-pg (the page number), and NAME-snt (section number and type).
-% Called from \foonoderef.
-%
-% We have to set \indexdummies so commands such as @code in a section
-% title aren't expanded.  It would be nicer not to expand the titles in
-% the first place, but there's so many layers that that is hard to do.
-%
-% Likewise, use \turnoffactive so that punctuation chars such as underscore
-% and backslash work in node names.
-%
-\def\setref#1#2{{%
-  \atdummies
-  \pdfmkdest{#1}%
-  %
-  \turnoffactive
-  \dosetq{#1-title}{Ytitle}%
-  \dosetq{#1-pg}{Ypagenumber}%
-  \dosetq{#1-snt}{#2}%
-}}
-
-% @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
-% the node name, #2 the name of the Info cross-reference, #3 the printed
-% node name, #4 the name of the Info file, #5 the name of the printed
-% manual.  All but the node name can be omitted.
-%
-\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
-\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
-\def\ref#1{\xrefX[#1,,,,,,,]}
-\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
-  \unsepspaces
-  \def\printedmanual{\ignorespaces #5}%
-  \def\printednodename{\ignorespaces #3}%
-  \setbox1=\hbox{\printedmanual}%
-  \setbox0=\hbox{\printednodename}%
-  \ifdim \wd0 = 0pt
-    % No printed node name was explicitly given.
-    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
-      % Use the node name inside the square brackets.
-      \def\printednodename{\ignorespaces #1}%
-    \else
-      % Use the actual chapter/section title appear inside
-      % the square brackets.  Use the real section title if we have it.
-      \ifdim \wd1 > 0pt
-        % It is in another manual, so we don't have it.
-        \def\printednodename{\ignorespaces #1}%
-      \else
-        \ifhavexrefs
-          % We know the real title if we have the xref values.
-          \def\printednodename{\refx{#1-title}{}}%
-        \else
-          % Otherwise just copy the Info node name.
-          \def\printednodename{\ignorespaces #1}%
-        \fi%
-      \fi
-    \fi
-  \fi
-  %
-  % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
-  % insert empty discretionaries after hyphens, which means that it will
-  % not find a line break at a hyphen in a node names.  Since some manuals
-  % are best written with fairly long node names, containing hyphens, this
-  % is a loss.  Therefore, we give the text of the node name again, so it
-  % is as if TeX is seeing it for the first time.
-  \ifpdf
-    \leavevmode
-    \getfilename{#4}%
-    {\turnoffactive \otherbackslash
-     \ifnum\filenamelength>0
-       \startlink attr{/Border [0 0 0]}%
-         goto file{\the\filename.pdf} name{#1}%
-     \else
-       \startlink attr{/Border [0 0 0]}%
-         goto name{#1}%
-     \fi
-    }%
-    \linkcolor
-  \fi
-  %
-  \ifdim \wd1 > 0pt
-    \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
-  \else
-    % _ (for example) has to be the character _ for the purposes of the
-    % control sequence corresponding to the node, but it has to expand
-    % into the usual \leavevmode...\vrule stuff for purposes of
-    % printing. So we \turnoffactive for the \refx-snt, back on for the
-    % printing, back off for the \refx-pg.
-    {\turnoffactive \otherbackslash
-     % Only output a following space if the -snt ref is nonempty; for
-     % @unnumbered and @anchor, it won't be.
-     \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
-     \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
-    }%
-    % output the `[mynode]' via a macro.
-    \xrefprintnodename\printednodename
-    %
-    % But we always want a comma and a space:
-    ,\space
-    %
-    % output the `page 3'.
-    \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
-  \fi
-  \endlink
-\endgroup}
-
-% This macro is called from \xrefX for the `[nodename]' part of xref
-% output.  It's a separate macro only so it can be changed more easily,
-% since not square brackets don't work in some documents.  Particularly
-% one that Bob is working on :).
-%
-\def\xrefprintnodename#1{[#1]}
-
-% \dosetq is called from \setref to do the actual \write (\iflinks).
-%
-\def\dosetq#1#2{%
-  {\let\folio=0%
-   \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
-   \iflinks \next \fi
-  }%
-}
-
-% \internalsetq{foo}{page} expands into
-%   CHARACTERS @xrdef{foo}{...expansion of \page...}
-\def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}}
-
-% Things to be expanded by \internalsetq.
-%
-\def\Ypagenumber{\folio}
-\def\Ytitle{\thissection}
-\def\Ynothing{}
-\def\Ysectionnumberandtype{%
-  \ifnum\secno=0
-    \putwordChapter@tie \the\chapno
-  \else \ifnum\subsecno=0
-    \putwordSection@tie \the\chapno.\the\secno
-  \else \ifnum\subsubsecno=0
-    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
-  \else
-    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
-  \fi\fi\fi
-}
-
-\def\Yappendixletterandtype{%
-  \ifnum\secno=0
-     \putwordAppendix@tie @char\the\appendixno{}%
-  \else \ifnum\subsecno=0
-     \putwordSection@tie @char\the\appendixno.\the\secno
-  \else \ifnum\subsubsecno=0
-    \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
-  \else
-    \putwordSection@tie
-      @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
-  \fi\fi\fi
-}
-
-% Use TeX 3.0's \inputlineno to get the line number, for better error
-% messages, but if we're using an old version of TeX, don't do anything.
-%
-\ifx\inputlineno\thisisundefined
-  \let\linenumber = \empty % Pre-3.0.
-\else
-  \def\linenumber{\the\inputlineno:\space}
-\fi
-
-% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
-% If its value is nonempty, SUFFIX is output afterward.
-%
-\def\refx#1#2{%
-  {%
-    \indexnofonts
-    \otherbackslash
-    \expandafter\global\expandafter\let\expandafter\thisrefX
-      \csname X#1\endcsname
-  }%
-  \ifx\thisrefX\relax
-    % If not defined, say something at least.
-    \angleleft un\-de\-fined\angleright
-    \iflinks
-      \ifhavexrefs
-        \message{\linenumber Undefined cross reference `#1'.}%
-      \else
-        \ifwarnedxrefs\else
-          \global\warnedxrefstrue
-          \message{Cross reference values unknown; you must run TeX again.}%
-        \fi
-      \fi
-    \fi
-  \else
-    % It's defined, so just use it.
-    \thisrefX
-  \fi
-  #2% Output the suffix in any case.
-}
-
-% This is the macro invoked by entries in the aux file.
-%
-\def\xrdef#1{\expandafter\gdef\csname X#1\endcsname}
-
-% Read the last existing aux file, if any.  No error if none exists.
-\def\readauxfile{\begingroup
-  \catcode`\^^@=\other
-  \catcode`\^^A=\other
-  \catcode`\^^B=\other
-  \catcode`\^^C=\other
-  \catcode`\^^D=\other
-  \catcode`\^^E=\other
-  \catcode`\^^F=\other
-  \catcode`\^^G=\other
-  \catcode`\^^H=\other
-  \catcode`\^^K=\other
-  \catcode`\^^L=\other
-  \catcode`\^^N=\other
-  \catcode`\^^P=\other
-  \catcode`\^^Q=\other
-  \catcode`\^^R=\other
-  \catcode`\^^S=\other
-  \catcode`\^^T=\other
-  \catcode`\^^U=\other
-  \catcode`\^^V=\other
-  \catcode`\^^W=\other
-  \catcode`\^^X=\other
-  \catcode`\^^Z=\other
-  \catcode`\^^[=\other
-  \catcode`\^^\=\other
-  \catcode`\^^]=\other
-  \catcode`\^^^=\other
-  \catcode`\^^_=\other
-  % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
-  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
-  % supported in the main text, it doesn't seem desirable.  Furthermore,
-  % that is not enough: for node names that actually contain a ^
-  % character, we would end up writing a line like this: 'xrdef {'hat
-  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
-  % argument, and \hat is not an expandable control sequence.  It could
-  % all be worked out, but why?  Either we support ^^ or we don't.
-  %
-  % The other change necessary for this was to define \auxhat:
-  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
-  % and then to call \auxhat in \setq.
-  %
-  \catcode`\^=\other
-  %
-  % Special characters.  Should be turned off anyway, but...
-  \catcode`\~=\other
-  \catcode`\[=\other
-  \catcode`\]=\other
-  \catcode`\"=\other
-  \catcode`\_=\other
-  \catcode`\|=\other
-  \catcode`\<=\other
-  \catcode`\>=\other
-  \catcode`\$=\other
-  \catcode`\#=\other
-  \catcode`\&=\other
-  \catcode`\%=\other
-  \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
-  %
-  % Make the characters 128-255 be printing characters
-  {%
-    \count 1=128
-    \def\loop{%
-      \catcode\count 1=\other
-      \advance\count 1 by 1
-      \ifnum \count 1<256 \loop \fi
-    }%
-  }%
-  %
-  % Turn off \ as an escape so we do not lose on
-  % entries which were dumped with control sequences in their names.
-  % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^
-  % Reference to such entries still does not work the way one would wish,
-  % but at least they do not bomb out when the aux file is read in.
-  \catcode`\\=\other
-  %
-  % @ is our escape character in .aux files.
-  \catcode`\{=1
-  \catcode`\}=2
-  \catcode`\@=0
-  %
-  \openin 1 \jobname.aux
-  \ifeof 1 \else
-    \closein 1
-    \input \jobname.aux
-    \global\havexrefstrue
-    \global\warnedobstrue
-  \fi
-  % Open the new aux file.  TeX will close it automatically at exit.
-  \openout\auxfile=\jobname.aux
-\endgroup}
-
-
-% Footnotes.
-
-\newcount \footnoteno
-
-% The trailing space in the following definition for supereject is
-% vital for proper filling; pages come out unaligned when you do a
-% pagealignmacro call if that space before the closing brace is
-% removed. (Generally, numeric constants should always be followed by a
-% space to prevent strange expansion errors.)
-\def\supereject{\par\penalty -20000\footnoteno =0 }
-
-% @footnotestyle is meaningful for info output only.
-\let\footnotestyle=\comment
-
-\let\ptexfootnote=\footnote
-
-{\catcode `\@=11
-%
-% Auto-number footnotes.  Otherwise like plain.
-\gdef\footnote{%
-  \let\indent=\ptexindent
-  \global\advance\footnoteno by \@ne
-  \edef\thisfootno{$^{\the\footnoteno}$}%
-  %
-  % In case the footnote comes at the end of a sentence, preserve the
-  % extra spacing after we do the footnote number.
-  \let\@sf\empty
-  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
-  %
-  % Remove inadvertent blank space before typesetting the footnote number.
-  \unskip
-  \thisfootno\@sf
-  \dofootnote
-}%
-
-% Don't bother with the trickery in plain.tex to not require the
-% footnote text as a parameter.  Our footnotes don't need to be so general.
-%
-% Oh yes, they do; otherwise, @ifset and anything else that uses
-% \parseargline fail inside footnotes because the tokens are fixed when
-% the footnote is read.  --karl, 16nov96.
-%
-% The start of the footnote looks usually like this:
-\gdef\startfootins{\insert\footins\bgroup}
-%
-% ... but this macro is redefined inside @multitable.
-%
-\gdef\dofootnote{%
-  \startfootins
-  % We want to typeset this text as a normal paragraph, even if the
-  % footnote reference occurs in (for example) a display environment.
-  % So reset some parameters.
-  \hsize=\pagewidth
-  \interlinepenalty\interfootnotelinepenalty
-  \splittopskip\ht\strutbox % top baseline for broken footnotes
-  \splitmaxdepth\dp\strutbox
-  \floatingpenalty\@MM
-  \leftskip\z@skip
-  \rightskip\z@skip
-  \spaceskip\z@skip
-  \xspaceskip\z@skip
-  \parindent\defaultparindent
-  %
-  \smallfonts \rm
-  %
-  % Because we use hanging indentation in footnotes, a @noindent appears
-  % to exdent this text, so make it be a no-op.  makeinfo does not use
-  % hanging indentation so @noindent can still be needed within footnote
-  % text after an @example or the like (not that this is good style).
-  \let\noindent = \relax
-  %
-  % Hang the footnote text off the number.  Use \everypar in case the
-  % footnote extends for more than one paragraph.
-  \everypar = {\hang}%
-  \textindent{\thisfootno}%
-  %
-  % Don't crash into the line above the footnote text.  Since this
-  % expands into a box, it must come within the paragraph, lest it
-  % provide a place where TeX can split the footnote.
-  \footstrut
-  \futurelet\next\fo@t
-}
-}%end \catcode `\@=11
-
-% @| inserts a changebar to the left of the current line.  It should
-% surround any changed text.  This approach does *not* work if the
-% change spans more than two lines of output.  To handle that, we would
-% have adopt a much more difficult approach (putting marks into the main
-% vertical list for the beginning and end of each change).
-%
-\def\|{%
-  % \vadjust can only be used in horizontal mode.
-  \leavevmode
-  %
-  % Append this vertical mode material after the current line in the output.
-  \vadjust{%
-    % We want to insert a rule with the height and depth of the current
-    % leading; that is exactly what \strutbox is supposed to record.
-    \vskip-\baselineskip
-    %
-    % \vadjust-items are inserted at the left edge of the type.  So
-    % the \llap here moves out into the left-hand margin.
-    \llap{%
-      %
-      % For a thicker or thinner bar, change the `1pt'.
-      \vrule height\baselineskip width1pt
-      %
-      % This is the space between the bar and the text.
-      \hskip 12pt
-    }%
-  }%
-}
-
-% For a final copy, take out the rectangles
-% that mark overfull boxes (in case you have decided
-% that the text looks ok even though it passes the margin).
-%
-\def\finalout{\overfullrule=0pt}
-
-% @image.  We use the macros from epsf.tex to support this.
-% If epsf.tex is not installed and @image is used, we complain.
-%
-% Check for and read epsf.tex up front.  If we read it only at @image
-% time, we might be inside a group, and then its definitions would get
-% undone and the next image would fail.
-\openin 1 = epsf.tex
-\ifeof 1 \else
-  \closein 1
-  % Do not bother showing banner with epsf.tex v2.7k (available in
-  % doc/epsf.tex and on ctan).
-  \def\epsfannounce{\toks0 = }%
-  \input epsf.tex
-\fi
-%
-% We will only complain once about lack of epsf.tex.
-\newif\ifwarnednoepsf
-\newhelp\noepsfhelp{epsf.tex must be installed for images to
-  work.  It is also included in the Texinfo distribution, or you can get
-  it from ftp://tug.org/tex/epsf.tex.}
-%
-\def\image#1{%
-  \ifx\epsfbox\undefined
-    \ifwarnednoepsf \else
-      \errhelp = \noepsfhelp
-      \errmessage{epsf.tex not found, images will be ignored}%
-      \global\warnednoepsftrue
-    \fi
-  \else
-    \imagexxx #1,,,,,\finish
-  \fi
-}
-%
-% Arguments to @image:
-% #1 is (mandatory) image filename; we tack on .eps extension.
-% #2 is (optional) width, #3 is (optional) height.
-% #4 is (ignored optional) html alt text.
-% #5 is (ignored optional) extension.
-% #6 is just the usual extra ignored arg for parsing this stuff.
-\newif\ifimagevmode
-\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
-  \catcode`\^^M = 5     % in case we're inside an example
-  \normalturnoffactive  % allow _ et al. in names
-  % If the image is by itself, center it.
-  \ifvmode
-    \imagevmodetrue
-    \nobreak\bigskip
-    % Usually we'll have text after the image which will insert
-    % \parskip glue, so insert it here too to equalize the space
-    % above and below.
-    \nobreak\vskip\parskip
-    \nobreak
-    \line\bgroup\hss
-  \fi
-  %
-  % Output the image.
-  \ifpdf
-    \dopdfimage{#1}{#2}{#3}%
-  \else
-    % \epsfbox itself resets \epsf?size at each figure.
-    \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
-    \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
-    \epsfbox{#1.eps}%
-  \fi
-  %
-  \ifimagevmode \hss \egroup \bigbreak \fi  % space after the image
-\endgroup}
-
-
-\message{localization,}
-% and i18n.
-
-% @documentlanguage is usually given very early, just after
-% @setfilename.  If done too late, it may not override everything
-% properly.  Single argument is the language abbreviation.
-% It would be nice if we could set up a hyphenation file here.
-%
-\def\documentlanguage{\parsearg\dodocumentlanguage}
-\def\dodocumentlanguage#1{%
-  \tex % read txi-??.tex file in plain TeX.
-  % Read the file if it exists.
-  \openin 1 txi-#1.tex
-  \ifeof1
-    \errhelp = \nolanghelp
-    \errmessage{Cannot read language file txi-#1.tex}%
-    \let\temp = \relax
-  \else
-    \def\temp{\input txi-#1.tex }%
-  \fi
-  \temp
-  \endgroup
-}
-\newhelp\nolanghelp{The given language definition file cannot be found or
-is empty.  Maybe you need to install it?  In the current directory
-should work if nowhere else does.}
-
-
-% @documentencoding should change something in TeX eventually, most
-% likely, but for now just recognize it.
-\let\documentencoding = \comment
-
-
-% Page size parameters.
-%
-\newdimen\defaultparindent \defaultparindent = 15pt
-
-\chapheadingskip = 15pt plus 4pt minus 2pt
-\secheadingskip = 12pt plus 3pt minus 2pt
-\subsecheadingskip = 9pt plus 2pt minus 2pt
-
-% Prevent underfull vbox error messages.
-\vbadness = 10000
-
-% Don't be so finicky about underfull hboxes, either.
-\hbadness = 2000
-
-% Following George Bush, just get rid of widows and orphans.
-\widowpenalty=10000
-\clubpenalty=10000
-
-% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
-% using an old version of TeX, don't do anything.  We want the amount of
-% stretch added to depend on the line length, hence the dependence on
-% \hsize.  We call this whenever the paper size is set.
-%
-\def\setemergencystretch{%
-  \ifx\emergencystretch\thisisundefined
-    % Allow us to assign to \emergencystretch anyway.
-    \def\emergencystretch{\dimen0}%
-  \else
-    \emergencystretch = .15\hsize
-  \fi
-}
-
-% Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
-% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8)
-% physical page width.
-%
-% We also call \setleading{\textleading}, so the caller should define
-% \textleading.  The caller should also set \parskip.
-%
-\def\internalpagesizes#1#2#3#4#5#6#7#8{%
-  \voffset = #3\relax
-  \topskip = #6\relax
-  \splittopskip = \topskip
-  %
-  \vsize = #1\relax
-  \advance\vsize by \topskip
-  \outervsize = \vsize
-  \advance\outervsize by 2\topandbottommargin
-  \pageheight = \vsize
-  %
-  \hsize = #2\relax
-  \outerhsize = \hsize
-  \advance\outerhsize by 0.5in
-  \pagewidth = \hsize
-  %
-  \normaloffset = #4\relax
-  \bindingoffset = #5\relax
-  %
-  \ifpdf
-    \pdfpageheight #7\relax
-    \pdfpagewidth #8\relax
-  \fi
-  %
-  \setleading{\textleading}
-  %
-  \parindent = \defaultparindent
-  \setemergencystretch
-}
-
-% @letterpaper (the default).
-\def\letterpaper{{\globaldefs = 1
-  \parskip = 3pt plus 2pt minus 1pt
-  \textleading = 13.2pt
-  %
-  % If page is nothing but text, make it come out even.
-  \internalpagesizes{46\baselineskip}{6in}%
-                    {\voffset}{.25in}%
-                    {\bindingoffset}{36pt}%
-                    {11in}{8.5in}%
-}}
-
-% Use @smallbook to reset parameters for 7x9.5 (or so) format.
-\def\smallbook{{\globaldefs = 1
-  \parskip = 2pt plus 1pt
-  \textleading = 12pt
-  %
-  \internalpagesizes{7.5in}{5in}%
-                    {\voffset}{.25in}%
-                    {\bindingoffset}{16pt}%
-                    {9.25in}{7in}%
-  %
-  \lispnarrowing = 0.3in
-  \tolerance = 700
-  \hfuzz = 1pt
-  \contentsrightmargin = 0pt
-  \defbodyindent = .5cm
-}}
-
-% Use @afourpaper to print on European A4 paper.
-\def\afourpaper{{\globaldefs = 1
-  \parskip = 3pt plus 2pt minus 1pt
-  \textleading = 13.2pt
-  %
-  % Double-side printing via postscript on Laserjet 4050
-  % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
-  % To change the settings for a different printer or situation, adjust
-  % \normaloffset until the front-side and back-side texts align.  Then
-  % do the same for \bindingoffset.  You can set these for testing in
-  % your texinfo source file like this:
-  % @tex
-  % \global\normaloffset = -6mm
-  % \global\bindingoffset = 10mm
-  % @end tex
-  \internalpagesizes{51\baselineskip}{160mm}
-                    {\voffset}{\hoffset}%
-                    {\bindingoffset}{44pt}%
-                    {297mm}{210mm}%
-  %
-  \tolerance = 700
-  \hfuzz = 1pt
-  \contentsrightmargin = 0pt
-  \defbodyindent = 5mm
-}}
-
-% Use @afivepaper to print on European A5 paper.
-% From romildo@urano.iceb.ufop.br, 2 July 2000.
-% He also recommends making @example and @lisp be small.
-\def\afivepaper{{\globaldefs = 1
-  \parskip = 2pt plus 1pt minus 0.1pt
-  \textleading = 12.5pt
-  %
-  \internalpagesizes{160mm}{120mm}%
-                    {\voffset}{\hoffset}%
-                    {\bindingoffset}{8pt}%
-                    {210mm}{148mm}%
-  %
-  \lispnarrowing = 0.2in
-  \tolerance = 800
-  \hfuzz = 1.2pt
-  \contentsrightmargin = 0pt
-  \defbodyindent = 2mm
-  \tableindent = 12mm
-}}
-
-% A specific text layout, 24x15cm overall, intended for A4 paper.
-\def\afourlatex{{\globaldefs = 1
-  \afourpaper
-  \internalpagesizes{237mm}{150mm}%
-                    {\voffset}{4.6mm}%
-                    {\bindingoffset}{7mm}%
-                    {297mm}{210mm}%
-  %
-  % Must explicitly reset to 0 because we call \afourpaper.
-  \globaldefs = 0
-}}
-
-% Use @afourwide to print on A4 paper in landscape format.
-\def\afourwide{{\globaldefs = 1
-  \afourpaper
-  \internalpagesizes{241mm}{165mm}%
-                    {\voffset}{-2.95mm}%
-                    {\bindingoffset}{7mm}%
-                    {297mm}{210mm}%
-  \globaldefs = 0
-}}
-
-% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
-% Perhaps we should allow setting the margins, \topskip, \parskip,
-% and/or leading, also. Or perhaps we should compute them somehow.
-%
-\def\pagesizes{\parsearg\pagesizesxxx}
-\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
-\def\pagesizesyyy#1,#2,#3\finish{{%
-  \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
-  \globaldefs = 1
-  %
-  \parskip = 3pt plus 2pt minus 1pt
-  \setleading{\textleading}%
-  %
-  \dimen0 = #1
-  \advance\dimen0 by \voffset
-  %
-  \dimen2 = \hsize
-  \advance\dimen2 by \normaloffset
-  %
-  \internalpagesizes{#1}{\hsize}%
-                    {\voffset}{\normaloffset}%
-                    {\bindingoffset}{44pt}%
-                    {\dimen0}{\dimen2}%
-}}
-
-% Set default to letter.
-%
-\letterpaper
-
-
-\message{and turning on texinfo input format.}
-
-% Define macros to output various characters with catcode for normal text.
-\catcode`\"=\other
-\catcode`\~=\other
-\catcode`\^=\other
-\catcode`\_=\other
-\catcode`\|=\other
-\catcode`\<=\other
-\catcode`\>=\other
-\catcode`\+=\other
-\catcode`\$=\other
-\def\normaldoublequote{"}
-\def\normaltilde{~}
-\def\normalcaret{^}
-\def\normalunderscore{_}
-\def\normalverticalbar{|}
-\def\normalless{<}
-\def\normalgreater{>}
-\def\normalplus{+}
-\def\normaldollar{$}%$ font-lock fix
-
-% This macro is used to make a character print one way in ttfont
-% where it can probably just be output, and another way in other fonts,
-% where something hairier probably needs to be done.
-%
-% #1 is what to print if we are indeed using \tt; #2 is what to print
-% otherwise.  Since all the Computer Modern typewriter fonts have zero
-% interword stretch (and shrink), and it is reasonable to expect all
-% typewriter fonts to have this, we can check that font parameter.
-%
-\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
-
-% Same as above, but check for italic font.  Actually this also catches
-% non-italic slanted fonts since it is impossible to distinguish them from
-% italic fonts.  But since this is only used by $ and it uses \sl anyway
-% this is not a problem.
-\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
-
-% Turn off all special characters except @
-% (and those which the user can use as if they were ordinary).
-% Most of these we simply print from the \tt font, but for some, we can
-% use math or other variants that look better in normal text.
-
-\catcode`\"=\active
-\def\activedoublequote{{\tt\char34}}
-\let"=\activedoublequote
-\catcode`\~=\active
-\def~{{\tt\char126}}
-\chardef\hat=`\^
-\catcode`\^=\active
-\def^{{\tt \hat}}
-
-\catcode`\_=\active
-\def_{\ifusingtt\normalunderscore\_}
-% Subroutine for the previous macro.
-\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
-
-\catcode`\|=\active
-\def|{{\tt\char124}}
-\chardef \less=`\<
-\catcode`\<=\active
-\def<{{\tt \less}}
-\chardef \gtr=`\>
-\catcode`\>=\active
-\def>{{\tt \gtr}}
-\catcode`\+=\active
-\def+{{\tt \char 43}}
-\catcode`\$=\active
-\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
-
-% Set up an active definition for =, but don't enable it most of the time.
-{\catcode`\==\active
-\global\def={{\tt \char 61}}}
-
-\catcode`+=\active
-\catcode`\_=\active
-
-% If a .fmt file is being used, characters that might appear in a file
-% name cannot be active until we have parsed the command line.
-% So turn them off again, and have \everyjob (or @setfilename) turn them on.
-% \otherifyactive is called near the end of this file.
-\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
-
-\catcode`\@=0
-
-% \rawbackslashxx outputs one backslash character in current font,
-% as in \char`\\.
-\global\chardef\rawbackslashxx=`\\
-
-% \rawbackslash defines an active \ to do \rawbackslashxx.
-% \otherbackslash defines an active \ to be a literal `\' character with
-% catcode other.
-{\catcode`\\=\active
- @gdef@rawbackslash{@let\=@rawbackslashxx}
- @gdef@otherbackslash{@let\=@realbackslash}
-}
-
-% \realbackslash is an actual character `\' with catcode other.
-{\catcode`\\=\other @gdef@realbackslash{\}}
-
-% \normalbackslash outputs one backslash in fixed width font.
-\def\normalbackslash{{\tt\rawbackslashxx}}
-
-\catcode`\\=\active
-
-% Used sometimes to turn off (effectively) the active characters
-% even after parsing them.
-@def@turnoffactive{%
-  @let"=@normaldoublequote
-  @let\=@realbackslash
-  @let~=@normaltilde
-  @let^=@normalcaret
-  @let_=@normalunderscore
-  @let|=@normalverticalbar
-  @let<=@normalless
-  @let>=@normalgreater
-  @let+=@normalplus
-  @let$=@normaldollar %$ font-lock fix
-}
-
-% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
-% the literal character `\'.  (Thus, \ is not expandable when this is in
-% effect.)
-%
-@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash}
-
-% Make _ and + \other characters, temporarily.
-% This is canceled by @fixbackslash.
-@otherifyactive
-
-% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
-% That is what \eatinput is for; after that, the `\' should revert to printing
-% a backslash.
-%
-@gdef@eatinput input texinfo{@fixbackslash}
-@global@let\ = @eatinput
-
-% On the other hand, perhaps the file did not have a `\input texinfo'. Then
-% the first `\{ in the file would cause an error. This macro tries to fix
-% that, assuming it is called before the first `\' could plausibly occur.
-% Also back turn on active characters that might appear in the input
-% file name, in case not using a pre-dumped format.
-%
-@gdef@fixbackslash{%
-  @ifx\@eatinput @let\ = @normalbackslash @fi
-  @catcode`+=@active
-  @catcode`@_=@active
-}
-
-% Say @foo, not \foo, in error messages.
-@escapechar = `@@
-
-% These look ok in all fonts, so just make them not special.
-@catcode`@& = @other
-@catcode`@# = @other
-@catcode`@% = @other
-
-@c Set initial fonts.
-@textfonts
-@rm
-
-
-@c Local variables:
-@c eval: (add-hook 'write-file-hooks 'time-stamp)
-@c page-delimiter: "^\\\\message"
-@c time-stamp-start: "def\\\\texinfoversion{"
-@c time-stamp-format: "%:y-%02m-%02d.%02H"
-@c time-stamp-end: "}"
-@c End:
-
-@ignore
-   arch-tag: 53261dd3-7df7-4ec3-9d90-af7a955d3c87
-@end ignore
--- a/lispref/ChangeLog	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/ChangeLog	Sat Oct 14 16:56:21 2006 +0000
@@ -1,3 +1,129 @@
+2006-08-27  Michael Olson  <mwolson@gnu.org>
+
+	* processes.texi (Transaction Queues): Remove stray quote
+	character.
+
+2006-08-25  Richard Stallman  <rms@gnu.org>
+
+	* os.texi (Idle Timers): run-with-idle-timer allows Lisp time value.
+	Add xref.
+
+2006-08-24  Chong Yidong  <cyd@stupidchicken.com>
+
+	* os.texi (Timers): Avoid waiting inside timers.
+
+2006-08-21  Lute Kamstra  <lute@gnu.org>
+
+	* Makefile.in: Use ../man/texinfo.tex to build elisp.dvi.
+
+2006-08-20  Richard Stallman  <rms@gnu.org>
+
+	* os.texi (Idle Timers): New node, split out from Timers.
+	Document current-idle-time.
+	* commands.texi (Reading One Event): Update xref.
+	* elisp.texi (Top): Update subnode menu.
+
+2006-08-16  Richard Stallman  <rms@gnu.org>
+
+	* keymaps.texi (Extended Menu Items): Show format of cached
+	bindings in extended menu items.
+
+	* customize.texi (Variable Definitions): Explain when the
+	standard value expression is evaluated.
+
+2006-08-15  Chong Yidong  <cyd@stupidchicken.com>
+
+	* commands.texi (Reading One Event): Explain idleness in
+	`read-event'.
+
+2006-08-12  Chong Yidong  <cyd@stupidchicken.com>
+
+	* text.texi (Near Point): Say "cursor" not "terminal cursor".
+	(Commands for Insertion): Removed split-line since it's not
+	relevant for Lisp programming.
+	(Yank Commands): Rewrite introduction.
+	(Undo): Clarify.
+	(Maintaining Undo): Clarify.  Document undo-ask-before-discard.
+	(Filling): Remove redundant comment.  Clarify return value of
+	current-justification.
+	(Margins): Minor clarifications.
+	(Adaptive Fill): Update default value of adaptive-fill-regexp.
+	(Sorting): Update definition of sort-lines.
+	(Columns): Clarify behavior of sort-columns.
+	(Indent Tabs): Link to Tab Stops in Emacs manual.
+	(Special Properties): Clarify.
+	(Clickable Text): Mention Buttons package.
+
+2006-08-12  Kevin Ryde  <user42@zip.com.au>
+
+	* os.texi (Time Parsing): Add %z to description of
+	format-time-string, as per docstring.  Add cross reference to
+	glibc manual for strftime.
+
+2006-08-08  Richard Stallman  <rms@gnu.org>
+
+	* modes.texi: Clean up wording in previous change.
+
+2006-08-07  Chong Yidong  <cyd@stupidchicken.com>
+
+	* modes.texi (Hooks): Clarify.
+	(Major Mode Basics): Mention define-derived-mode explicitly.
+	(Major Mode Conventions): Rebinding RET is OK for some modes.
+	Mention change-major-mode-hook and after-change-major-mode-hook.
+	(Example Major Modes): Moved to end of Modes section.
+	(Mode Line Basics): Clarify.
+	(Mode Line Data): Mention help-echo and local-map in strings.
+	Explain reason for treatment of non-risky variables.
+	(Properties in Mode): Clarify.
+	(Faces for Font Lock): Add font-lock-negation-char-face.
+
+2006-08-04  Eli Zaretskii  <eliz@gnu.org>
+
+	* strings.texi (Formatting Strings): Warn against arbitrary
+	strings as first arg to `format'.
+
+2006-07-31  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* text.texi (Clickable Text): Mention `help-echo' text property.
+	Update intro, examples and associated explanations.
+
+2006-07-31  Richard Stallman  <rms@gnu.org>
+
+	* commands.texi: Update xrefs.
+	(Event Mod): New node, cut out from old Translating Input.
+
+	* maps.texi: Update xrefs.
+
+	* keymaps.texi (Translation Keymaps): New node.
+	Update xrefs from Translating Input to Translation Keymaps.
+
+	* elisp.texi (Top): Update subnode menu.
+
+	* display.texi (Face Functions): Fix explanations of FRAME=t or nil.
+
+	* os.texi (System Interface): Fix menu descriptions of some nodes.
+	(Translating Input): Node deleted.
+
+2006-07-31  Nick Roberts  <nickrob@snap.net.nz>
+
+	* modes.texi (Minor Mode Conventions): Update link for add-to-list.
+
+	* lists.texi (Sets And Lists): Likewise.
+
+2006-07-30  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* text.texi (Fields): Mention POS
+	requirement when narrowing is in effect.
+
+2006-07-28  Richard Stallman  <rms@gnu.org>
+
+	* display.texi (Face Attributes): Simplify wording.
+	(Attribute Functions): Clarify meaning of new-frame default
+	attribute settings.
+
+	* customize.texi (Common Keywords): Document how to use
+	:package-version in a package not in Emacs.
+
 2006-07-28  Kim F. Storm  <storm@cua.dk>
 
 	* commands.texi (Reading One Event): Fix last change.
@@ -248,7 +374,7 @@
 
 	* anti.texi, customize.texi, display.texi, internals.texi:
 	* minibuf.texi, modes.texi, tips.texi:
-        Fix overfull/underfull boxes.
+	Fix overfull/underfull boxes.
 
 2006-07-05  Thien-Thi Nguyen  <ttn@gnu.org>
 
@@ -325,7 +451,7 @@
 
 2006-06-09  Aidan Kehoe  <kehoea@parhasard.net>
 
-	* objects.texi (Character Type): Describe the\uABCD and \U00ABCDEF
+	* objects.texi (Character Type): Describe the \uABCD and \U00ABCDEF
 	syntax.
 
 2006-06-07  Eli Zaretskii  <eliz@gnu.org>
@@ -637,7 +763,7 @@
 2006-04-13  Bill Wohler  <wohler@newt.com>
 
 	* customize.texi (Common Keywords): Use dotted notation for
-	:package-version value. Specify its values. Improve documentation
+	:package-version value.  Specify its values.  Improve documentation
 	for customize-package-emacs-version-alist.
 
 2006-04-12  Bill Wohler  <wohler@newt.com>
@@ -1682,7 +1808,7 @@
 	(Jumping): Clarify description of `h' command.
 	Eliminate redundant @ref.
 	(Breaks): New node.
-	(Breakpoints): is now a subsubsection.
+	(Breakpoints): Is now a subsubsection.
 	(Global Break Condition): Mention `C-x X X'.
 	(Edebug Views): Clarify `v' and `p'.  Mention `C-x X w'.
 	(Trace Buffer): Clarify STRING arg of `edebug-tracing'.
@@ -2932,7 +3058,7 @@
 
 2004-10-24  Jason Rumney  <jasonr@gnu.org>
 
-	* commands.texi (Misc Events): Remove mouse-wheel. Add wheel-up
+	* commands.texi (Misc Events): Remove mouse-wheel.  Add wheel-up
 	and wheel-down.
 
 2004-10-24  Kai Grossjohann  <kai.grossjohann@gmx.net>
@@ -3161,7 +3287,7 @@
 	except while processing `frame-title-format' or `icon-title-format'.
 	(Deleting Frames): Correct description of `delete-frame'.
 	Non-nil return values of `frame-live-p' are like those of `framep'.
-	(Frames and Windows): mention return value of
+	(Frames and Windows): Mention return value of
 	`set-frame-selected-window'.
 	(Visibility of Frames): Mention `force' argument to
 	`make-frame-invisible'.  `frame-visible-p' returns t for all
@@ -3488,7 +3614,7 @@
 
 2004-03-07  Thien-Thi Nguyen  <ttn@gnu.org>
 
-	* customize.texi: Fix typo. Remove eol whitespace.
+	* customize.texi: Fix typo.  Remove eol whitespace.
 
 2004-03-04  Richard M. Stallman  <rms@gnu.org>
 
@@ -3524,7 +3650,7 @@
 	* text.texi: Various small changes in addition to the following:
 	(User-Level Deletion): Mention optional BACKWARD-ONLY argument
 	to delete-horizontal-space.
-	(Kill Functions, Yanking, Low-Level Kill Ring): clarify and correct
+	(Kill Functions, Yanking, Low-Level Kill Ring): Clarify and correct
 	description of yank-handler text property at various places.
 
 	* frames.texi (Window System Selections): Add anchor.
@@ -4551,7 +4677,7 @@
 	* loading.texi (Unloading): Fix recent change for load-history.
 
 	* customize.texi (Simple Types): Clarify description of custom
-	type 'number. Describe new custom type 'float.
+	type 'number.  Describe new custom type 'float.
 
 2002-12-04  Markus Rost  <rost@math.ohio-state.edu>
 
@@ -5081,7 +5207,7 @@
 Tue Apr 11 12:23:28 1989  Robert J. Chassell  (bob@rice-chex.ai.mit.edu)
 
 	* Applied Karl Berry's patches to *.texinfo files, but not to
-	texinfo.tex; those diffs are in `berry-texinfo-tex-diffs'. (Karl's
+	texinfo.tex; those diffs are in `berry-texinfo-tex-diffs'.  (Karl's
 	new title page format is also not applied, since it requires
 	texinfo.tex changes.)
 
--- a/lispref/Makefile.in	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/Makefile.in	Sat Oct 14 16:56:21 2006 +0000
@@ -27,6 +27,7 @@
 VPATH=@srcdir@
 
 infodir = $(srcdir)/../info
+usermanualdir = $(srcdir)/../man
 
 TEXI2DVI = texi2dvi
 SHELL = /bin/sh
@@ -103,7 +104,7 @@
 	$(MAKEINFO) -I. -I$(srcdir) $(srcdir)/elisp.texi -o $(infodir)/elisp
 
 elisp.dvi: $(srcs)
-	$(TEXI2DVI) -I $(srcdir) $(srcdir)/elisp.texi
+	$(TEXI2DVI) -I $(srcdir) -I $(usermanualdir) $(srcdir)/elisp.texi
 
 # This is for use in a separate distro of the Emacs Lisp manual.
 install: elisp
--- a/lispref/commands.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/commands.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -1087,7 +1087,7 @@
 latter as the symbol @code{tab}.
 
 Most of the time, it's not useful to distinguish the two.  So normally
-@code{function-key-map} (@pxref{Translating Input}) is set up to map
+@code{function-key-map} (@pxref{Translation Keymaps}) is set up to map
 @code{tab} into 9.  Thus, a key binding for character code 9 (the
 character @kbd{C-i}) also applies to @code{tab}.  Likewise for the other
 symbols in this group.  The function @code{read-char} likewise converts
@@ -2051,14 +2051,14 @@
 See also @code{momentary-string-display} in @ref{Temporary Displays},
 and @code{sit-for} in @ref{Waiting}.  @xref{Terminal Input}, for
 functions and variables for controlling terminal input modes and
-debugging terminal input.  @xref{Translating Input}, for features you
-can use for translating or modifying input events while reading them.
+debugging terminal input.
 
   For higher-level input facilities, see @ref{Minibuffers}.
 
 @menu
 * Key Sequence Input::		How to read one key sequence.
 * Reading One Event::		How to read just one event.
+* Event Mod::                   How Emacs modifies events as they are read.
 * Invoking the Input Method::   How reading an event uses the input method.
 * Quoted Character Input::	Asking the user to specify a character.
 * Event Input Misc::    	How to reread or throw away input events.
@@ -2088,7 +2088,7 @@
 vector are the events in the key sequence.
 
 Reading a key sequence includes translating the events in various
-ways.  @xref{Translating Input}.
+ways.  @xref{Translation Keymaps}.
 
 The argument @var{prompt} is either a string to be displayed in the
 echo area as a prompt, or @code{nil}, meaning not to display a prompt.
@@ -2229,6 +2229,15 @@
 If @var{seconds} is @code{nil}, @code{read-event} waits as long as
 necessary for input to arrive.
 
+If @var{seconds} is @code{nil}, Emacs is considered idle while waiting
+for user input to arrive.  Idle timers---those created with
+@code{run-with-idle-timer} (@pxref{Idle Timers})---can run during this
+period.  However, if @var{seconds} is non-@code{nil}, the state of
+idleness remains unchanged.  If Emacs is non-idle when
+@code{read-event} is called, it remains non-idle throughout the
+operation of @code{read-event}; if Emacs is idle (which can happen if
+the call happens inside an idle timer), it remains idle.
+
 If @code{read-event} gets an event that is defined as a help character,
 then in some cases @code{read-event} processes the event directly without
 returning.  @xref{Help Functions}.  Certain other events, called
@@ -2290,6 +2299,87 @@
 from the terminal---not counting those generated by keyboard macros.
 @end defvar
 
+@node Event Mod
+@subsection Modifying and Translating Input Events
+
+  Emacs modifies every event it reads according to
+@code{extra-keyboard-modifiers}, then translates it through
+@code{keyboard-translate-table} (if applicable), before returning it
+from @code{read-event}.
+
+@c Emacs 19 feature
+@defvar extra-keyboard-modifiers
+This variable lets Lisp programs ``press'' the modifier keys on the
+keyboard.  The value is a character.  Only the modifiers of the
+character matter.  Each time the user types a keyboard key, it is
+altered as if those modifier keys were held down.  For instance, if
+you bind @code{extra-keyboard-modifiers} to @code{?\C-\M-a}, then all
+keyboard input characters typed during the scope of the binding will
+have the control and meta modifiers applied to them.  The character
+@code{?\C-@@}, equivalent to the integer 0, does not count as a control
+character for this purpose, but as a character with no modifiers.
+Thus, setting @code{extra-keyboard-modifiers} to zero cancels any
+modification.
+
+When using a window system, the program can ``press'' any of the
+modifier keys in this way.  Otherwise, only the @key{CTL} and @key{META}
+keys can be virtually pressed.
+
+Note that this variable applies only to events that really come from
+the keyboard, and has no effect on mouse events or any other events.
+@end defvar
+
+@defvar keyboard-translate-table
+This variable is the translate table for keyboard characters.  It lets
+you reshuffle the keys on the keyboard without changing any command
+bindings.  Its value is normally a char-table, or else @code{nil}.
+(It can also be a string or vector, but this is considered obsolete.)
+
+If @code{keyboard-translate-table} is a char-table
+(@pxref{Char-Tables}), then each character read from the keyboard is
+looked up in this char-table.  If the value found there is
+non-@code{nil}, then it is used instead of the actual input character.
+
+Note that this translation is the first thing that happens to a
+character after it is read from the terminal.  Record-keeping features
+such as @code{recent-keys} and dribble files record the characters after
+translation.
+
+Note also that this translation is done before the characters are
+supplied to input methods (@pxref{Input Methods}).  Use
+@code{translation-table-for-input} (@pxref{Translation of Characters}),
+if you want to translate characters after input methods operate.
+@end defvar
+
+@defun keyboard-translate from to
+This function modifies @code{keyboard-translate-table} to translate
+character code @var{from} into character code @var{to}.  It creates
+the keyboard translate table if necessary.
+@end defun
+
+  Here's an example of using the @code{keyboard-translate-table} to
+make @kbd{C-x}, @kbd{C-c} and @kbd{C-v} perform the cut, copy and paste
+operations:
+
+@example
+(keyboard-translate ?\C-x 'control-x)
+(keyboard-translate ?\C-c 'control-c)
+(keyboard-translate ?\C-v 'control-v)
+(global-set-key [control-x] 'kill-region)
+(global-set-key [control-c] 'kill-ring-save)
+(global-set-key [control-v] 'yank)
+@end example
+
+@noindent
+On a graphical terminal that supports extended @acronym{ASCII} input,
+you can still get the standard Emacs meanings of one of those
+characters by typing it with the shift key.  That makes it a different
+character as far as keyboard translation is concerned, but it has the
+same usual meaning.
+
+  @xref{Translation Keymaps}, for mechanisms that translate event sequences
+at the level of @code{read-key-sequence}.
+
 @node Invoking the Input Method
 @subsection Invoking the Input Method
 
--- a/lispref/customize.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/customize.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -133,18 +133,21 @@
 
 @item :package-version '(@var{package} . @var{version})
 This option specifies that the item was first introduced in
-@var{package} version @var{version}, or that its default value was
-changed in that version.  This keyword takes priority over :version.
-The value of @var{package} is a symbol and @var{version} is a string.
-The @var{package} and @var{version} must appear in the alist
-@code{customize-package-emacs-version-alist}.  Since @var{package} must
-be unique and the user might see it in an error message, a good choice
-is the official name of the package, such as MH-E or Gnus.
+@var{package} version @var{version}, or that its meaning or default
+value was changed in that version.  The value of @var{package} is a
+symbol and @var{version} is a string.
 
+This keyword takes priority over @code{:version}.
+
+@var{package} should be the official name of the package, such as MH-E
+or Gnus.  If the package @var{package} is released as part of Emacs,
+@var{package} and @var{version} should appear in the value of
+@code{customize-package-emacs-version-alist}.
 @end table
 
-Packages that use the @code{:package-version} keyword must also update
-the @code{customize-package-emacs-version-alist} variable.
+Packages distributed as part of Emacs that use the
+@code{:package-version} keyword must also update the
+@code{customize-package-emacs-version-alist} variable.
 
 @defvar customize-package-emacs-version-alist
 This alist provides a mapping for the versions of Emacs that are
@@ -248,19 +251,30 @@
 
   Use @code{defcustom} to declare user-editable variables.
 
-@defmac defcustom option default doc [keyword value]@dots{}
-Declare @var{option} as a customizable user option variable.  Do not
-quote @var{option}.  The argument @var{doc} specifies the documentation
-string for the variable.  There is no need to start it with a @samp{*}
-because @code{defcustom} automatically marks @var{option} as a
-@dfn{user option} (@pxref{Defining Variables}).
+@defmac defcustom option standard doc [keyword value]@dots{}
+This construct declares @var{option} as a customizable user option
+variable.  You should not quote @var{option}.  The argument @var{doc}
+specifies the documentation string for the variable.  There is no need
+to start it with a @samp{*}, because @code{defcustom} automatically
+marks @var{option} as a @dfn{user option} (@pxref{Defining
+Variables}).
 
-If @var{option} is void, @code{defcustom} initializes it to
-@var{default}.  @var{default} should be an expression to compute the
-value; be careful in writing it, because it can be evaluated on more
-than one occasion.  You should normally avoid using backquotes in
-@var{default} because they are not expanded when editing the value,
-causing list values to appear to have the wrong structure.
+The argument @var{standard} is an expression that specifies the
+standard value for @var{option}.  Evaluating the @code{defcustom} form
+evaluates @var{standard}, but does not necessarily install the
+standard value.  If @var{option} already has a default value,
+@code{defcustom} does not change it.  If the user has saved a
+customization for @var{option}, @code{defcustom} installs the user's
+customized value as @var{option}'s default value.  If neither of those
+cases applies, @code{defcustom} installs the result of evaluating
+@var{standard} as the default value.
+
+The expression @var{standard} can be evaluated at various other times,
+too---whenever the customization facility needs to know @var{option}'s
+standard value.  So be sure to use an expression which is harmless to
+evaluate at any time.  We recommend avoiding backquotes in
+@var{standard}, because they are not expanded when editing the value,
+so list values will appear to have the wrong structure.
 
 If you specify the @code{:set} option, to make the variable take other
 special actions when set through the customization buffer, the
@@ -403,7 +417,7 @@
 @end defun
 
 Internally, @code{defcustom} uses the symbol property
-@code{standard-value} to record the expression for the default value,
+@code{standard-value} to record the expression for the standard value,
 and @code{saved-value} to record the value saved by the user with the
 customization buffer.  Both properties are actually lists whose car is
 an expression which evaluates to the value.
--- a/lispref/display.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/display.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -1857,9 +1857,9 @@
 
   The effect of using a face is determined by a fixed set of @dfn{face
 attributes}.  This table lists all the face attributes, and what they
-mean.  Note that in general, more than one face can be specified for a
-given piece of text; when that happens, the attributes of all the faces
-are merged to specify how to display the text.  @xref{Displaying Faces}.
+mean.  You can specify more than one face for a given piece of text;
+Emacs merges the attributes of all the faces to determine how to
+display the text.  @xref{Displaying Faces}.
 
   Any attribute in a face can have the value @code{unspecified}.  This
 means the face doesn't specify that attribute.  In face merging, when
@@ -2048,15 +2048,13 @@
 @node Attribute Functions
 @subsection Face Attribute Functions
 
-  You can modify the attributes of an existing face with the following
-functions.  If you specify @var{frame}, they affect just that frame;
-otherwise, they affect all frames as well as the defaults that apply to
-new frames.
+  This section describes the functions for accessing and modifying the
+attributes of an existing face.
 
 @defun set-face-attribute face frame &rest arguments
-This function sets one or more attributes of face @var{face}
-for frame @var{frame}.  If @var{frame} is @code{nil}, it sets
-the attribute for all frames, and the defaults for new frames.
+This function sets one or more attributes of face @var{face} for frame
+@var{frame}.  The attributes you specify this way override whatever
+the @code{defface} says.
 
 The extra arguments @var{arguments} specify the attributes to set, and
 the values for them.  They should consist of alternating attribute names
@@ -2073,6 +2071,13 @@
 @noindent
 sets the attributes @code{:width}, @code{:weight} and @code{:underline}
 to the corresponding values.
+
+If @var{frame} is @code{t}, this function sets the default attributes
+for new frames.  Default attribute values specified this way override
+the @code{defface} for newly created frames.
+
+If @var{frame} is @code{nil}, this function sets the attributes for
+all existing frames, and the default for new frames.
 @end defun
 
 @defun face-attribute face attribute &optional frame inherit
@@ -2080,8 +2085,10 @@
 @var{face} on @var{frame}.  If @var{frame} is @code{nil},
 that means the selected frame (@pxref{Input Focus}).
 
-If @var{frame} is @code{t}, the value is the default for
-@var{face} for new frames.
+If @var{frame} is @code{t}, this returns whatever new-frames default
+value you previously specified with @code{set-face-attribute} for the
+@var{attribute} attribute of @var{face}.  If you have not specified
+one, it returns @code{nil}.
 
 If @var{inherit} is @code{nil}, only attributes directly defined by
 @var{face} are considered, so the return value may be
@@ -2135,6 +2142,8 @@
   The functions above did not exist before Emacs 21.  For compatibility
 with older Emacs versions, you can use the following functions to set
 and examine the face attributes which existed in those versions.
+They use values of @code{t} and @code{nil} for @var{frame}
+just like @code{set-face-attribute} and @code{face-attribute}.
 
 @defun set-face-foreground face color &optional frame
 @defunx set-face-background face color &optional frame
@@ -2191,9 +2200,10 @@
 @end defun
 
   These functions examine the attributes of a face.  If you don't
-specify @var{frame}, they refer to the default data for new frames.
-They return the symbol @code{unspecified} if the face doesn't define any
-value for that attribute.
+specify @var{frame}, they refer to the selected frame; @code{t} refers
+to the default data for new frames.  They return the symbol
+@code{unspecified} if the face doesn't define any value for that
+attribute.
 
 @defun face-foreground face &optional frame inherit
 @defunx face-background face &optional frame inherit
--- a/lispref/elisp.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/elisp.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -1039,8 +1039,10 @@
 * Processor Run Time::      Getting the run time used by Emacs.
 * Time Calculations::       Adding, subtracting, comparing times, etc.
 * Timers::		    Setting a timer to call a function at a certain time.
-* Terminal Input::          Recording terminal input for debugging.
-* Terminal Output::         Recording terminal output for debugging.
+* Idle Timers::             Setting a timer to call a function when Emacs has
+                              been idle for a certain length of time.
+* Terminal Input::          Accessing and recordingo terminal input.
+* Terminal Output::         Controlling and recording terminal output.
 * Sound Output::            Playing sounds on the computer's speaker.
 * X11 Keysyms::             Operating on key symbols for X Windows
 * Batch Mode::              Running Emacs without terminal interaction.
--- a/lispref/keymaps.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/keymaps.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -33,6 +33,7 @@
 * Functions for Key Lookup::    How to request key lookup.
 * Changing Key Bindings::       Redefining a key in a keymap.
 * Remapping Commands::          Bindings that translate one command to another.
+* Translation Keymaps::         Keymaps for translating sequences of events.
 * Key Binding Commands::        Interactive interfaces for redefining keys.
 * Scanning Keymaps::            Looking through all keymaps, for printing help.
 * Menu Keymaps::		Defining a menu as a keymap.
@@ -642,7 +643,7 @@
 and exit commands.  @xref{Intro to Minibuffers}.
 
   Emacs has other keymaps that are used in a different way---translating
-events within @code{read-key-sequence}.  @xref{Translating Input}.
+events within @code{read-key-sequence}.  @xref{Translation Keymaps}.
 
   @xref{Standard Keymaps}, for a list of standard keymaps.
 
@@ -682,7 +683,7 @@
 @node Searching Keymaps
 @section Searching the Active Keymaps
 
-  After translation of the input events (@pxref{Translating Input})
+  After translation of event subsequences (@pxref{Translation Keymaps})
 Emacs looks for them in the active keymaps.  Here is a pseudo-Lisp
 description of the order in which the active keymaps are searched:
 
@@ -1472,6 +1473,125 @@
 @code{nil}.
 @end defun
 
+@node Translation Keymaps
+@section Keymaps for Translating Sequences of Events
+
+  This section describes keymaps that are used during reading a key
+sequence, to translate certain event sequences into others.
+@code{read-key-sequence} checks every subsequence of the key sequence
+being read, as it is read, against @code{function-key-map} and then
+against @code{key-translation-map}.
+
+@defvar function-key-map
+This variable holds a keymap that describes the character sequences sent
+by function keys on an ordinary character terminal.  This keymap has the
+same structure as other keymaps, but is used differently: it specifies
+translations to make while reading key sequences, rather than bindings
+for key sequences.
+
+If @code{function-key-map} ``binds'' a key sequence @var{k} to a vector
+@var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a
+key sequence, it is replaced with the events in @var{v}.
+
+For example, VT100 terminals send @kbd{@key{ESC} O P} when the
+keypad @key{PF1} key is pressed.  Therefore, we want Emacs to translate
+that sequence of events into the single event @code{pf1}.  We accomplish
+this by ``binding'' @kbd{@key{ESC} O P} to @code{[pf1]} in
+@code{function-key-map}, when using a VT100.
+
+Thus, typing @kbd{C-c @key{PF1}} sends the character sequence @kbd{C-c
+@key{ESC} O P}; later the function @code{read-key-sequence} translates
+this back into @kbd{C-c @key{PF1}}, which it returns as the vector
+@code{[?\C-c pf1]}.
+
+Entries in @code{function-key-map} are ignored if they conflict with
+bindings made in the minor mode, local, or global keymaps.  The intent
+is that the character sequences that function keys send should not have
+command bindings in their own right---but if they do, the ordinary
+bindings take priority.
+
+The value of @code{function-key-map} is usually set up automatically
+according to the terminal's Terminfo or Termcap entry, but sometimes
+those need help from terminal-specific Lisp files.  Emacs comes with
+terminal-specific files for many common terminals; their main purpose is
+to make entries in @code{function-key-map} beyond those that can be
+deduced from Termcap and Terminfo.  @xref{Terminal-Specific}.
+@end defvar
+
+@defvar key-translation-map
+This variable is another keymap used just like @code{function-key-map}
+to translate input events into other events.  It differs from
+@code{function-key-map} in two ways:
+
+@itemize @bullet
+@item
+@code{key-translation-map} goes to work after @code{function-key-map} is
+finished; it receives the results of translation by
+@code{function-key-map}.
+
+@item
+Non-prefix bindings in @code{key-translation-map} override actual key
+bindings.  For example, if @kbd{C-x f} has a non-prefix binding in
+@code{key-translation-map}, that translation takes effect even though
+@kbd{C-x f} also has a key binding in the global map.
+@end itemize
+
+Note however that actual key bindings can have an effect on
+@code{key-translation-map}, even though they are overridden by it.
+Indeed, actual key bindings override @code{function-key-map} and thus
+may alter the key sequence that @code{key-translation-map} receives.
+Clearly, it is better to avoid this type of situation.
+
+The intent of @code{key-translation-map} is for users to map one
+character set to another, including ordinary characters normally bound
+to @code{self-insert-command}.
+@end defvar
+
+@cindex key translation function
+You can use @code{function-key-map} or @code{key-translation-map} for
+more than simple aliases, by using a function, instead of a key
+sequence, as the ``translation'' of a key.  Then this function is called
+to compute the translation of that key.
+
+The key translation function receives one argument, which is the prompt
+that was specified in @code{read-key-sequence}---or @code{nil} if the
+key sequence is being read by the editor command loop.  In most cases
+you can ignore the prompt value.
+
+If the function reads input itself, it can have the effect of altering
+the event that follows.  For example, here's how to define @kbd{C-c h}
+to turn the character that follows into a Hyper character:
+
+@example
+@group
+(defun hyperify (prompt)
+  (let ((e (read-event)))
+    (vector (if (numberp e)
+                (logior (lsh 1 24) e)
+              (if (memq 'hyper (event-modifiers e))
+                  e
+                (add-event-modifier "H-" e))))))
+
+(defun add-event-modifier (string e)
+  (let ((symbol (if (symbolp e) e (car e))))
+    (setq symbol (intern (concat string
+                                 (symbol-name symbol))))
+@end group
+@group
+    (if (symbolp e)
+        symbol
+      (cons symbol (cdr e)))))
+
+(define-key function-key-map "\C-ch" 'hyperify)
+@end group
+@end example
+
+  If you have enabled keyboard character set decoding using
+@code{set-keyboard-coding-system}, decoding is done after the
+translations listed above.  @xref{Terminal I/O Encoding}.  However, in
+future Emacs versions, character set decoding may be done at an
+earlier stage.
+
 @node Key Binding Commands
 @section Commands for Binding Keys
 
@@ -1896,7 +2016,7 @@
 
 @c This line is not too long--rms.
 @example
-(@var{item-string} @r{[}@var{help-string}@r{]} (@var{key-binding-data}) . @var{real-binding})
+(@var{item-string} @r{[}@var{help}@r{]} (@var{key-binding-data}) . @var{real-binding})
 @end example
 
 @noindent
@@ -2020,6 +2140,13 @@
 safely be called at any time.
 @end table
 
+  When an equivalent key binding is cached, the binding looks like this.
+
+@example
+(menu-item @var{item-name} @var{real-binding} (@var{key-binding-data})
+    . @var{item-property-list})
+@end example
+
 @node Menu Separators
 @subsubsection Menu Separators
 @cindex menu separators
--- a/lispref/lists.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/lists.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -1489,7 +1489,7 @@
 @code{delete-dups} keeps the first one.
 @end defun
 
-  See also the function @code{add-to-list}, in @ref{Setting Variables},
+  See also the function @code{add-to-list}, in @ref{List Variables},
 for another way to add an element to a list stored in a variable.
 
 @node Association Lists
--- a/lispref/maps.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/maps.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -115,7 +115,7 @@
 @item function-key-map
 The keymap for translating keypad and function keys.@*
 If there are none, then it contains an empty sparse keymap.
-@xref{Translating Input}.
+@xref{Translation Keymaps}.
 
 @item fundamental-mode-map
 @vindex fundamental-mode-map
@@ -158,7 +158,7 @@
 
 @item key-translation-map
 A keymap for translating keys.  This one overrides ordinary key
-bindings, unlike @code{function-key-map}.  @xref{Translating Input}.
+bindings, unlike @code{function-key-map}.  @xref{Translation Keymaps}.
 
 @item kmacro-map
 @vindex kmacro-map
--- a/lispref/modes.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/modes.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -43,18 +43,19 @@
 
 @cindex normal hook
   Most of the hooks in Emacs are @dfn{normal hooks}.  These variables
-contain lists of functions to be called with no arguments.  When the
-hook name ends in @samp{-hook}, that tells you it is normal.  We try to
-make all hooks normal, as much as possible, so that you can use them in
-a uniform way.
-
-  Every major mode function is supposed to run a normal hook called the
-@dfn{mode hook} as the last step of initialization.  This makes it easy
-for a user to customize the behavior of the mode, by overriding the
-buffer-local variable assignments already made by the mode.  Most
-minor modes also run a mode hook at their end.  But hooks are used in
-other contexts too.  For example, the hook @code{suspend-hook} runs
-just before Emacs suspends itself (@pxref{Suspending Emacs}).
+contain lists of functions to be called with no arguments.  By
+convention, whenever the hook name ends in @samp{-hook}, that tells
+you it is normal.  We try to make all hooks normal, as much as
+possible, so that you can use them in a uniform way.
+
+  Every major mode function is supposed to run a normal hook called
+the @dfn{mode hook} as the one of the last steps of initialization.
+This makes it easy for a user to customize the behavior of the mode,
+by overriding the buffer-local variable assignments already made by
+the mode.  Most minor mode functions also run a mode hook at the end.
+But hooks are used in other contexts too.  For example, the hook
+@code{suspend-hook} runs just before Emacs suspends itself
+(@pxref{Suspending Emacs}).
 
   The recommended way to add a hook function to a normal hook is by
 calling @code{add-hook} (see below).  The hook functions may be any of
@@ -65,20 +66,16 @@
 
 @cindex abnormal hook
   If the hook variable's name does not end with @samp{-hook}, that
-indicates it is probably an @dfn{abnormal hook}.  Then you should look at its
-documentation to see how to use the hook properly.
-
-  If the variable's name ends in @samp{-functions} or @samp{-hooks},
-then the value is a list of functions, but it is abnormal in that either
-these functions are called with arguments or their values are used in
-some way.  You can use @code{add-hook} to add a function to the list,
-but you must take care in writing the function.  (A few of these
-variables, notably those ending in @samp{-hooks}, are actually
-normal hooks which were named before we established the convention of
-using @samp{-hook} for them.)
-
-  If the variable's name ends in @samp{-function}, then its value
-is just a single function, not a list of functions.
+indicates it is probably an @dfn{abnormal hook}.  That means the hook
+functions are called with arguments, or their return values are used
+in some way.  The hook's documentation says how the functions are
+called.  You can use @code{add-hook} to add a function to an abnormal
+hook, but you must write the function to follow the hook's calling
+convention.
+
+  By convention, abnormal hook names end in @samp{-functions} or
+@samp{-hooks}.  If the variable's name ends in @samp{-function}, then
+its value is just a single function, not a list of functions.
 
   Here's an example that uses a mode hook to turn on Auto Fill mode when
 in Lisp Interaction mode:
@@ -96,12 +93,13 @@
 symbol that is a normal hook variable.  These arguments are processed
 in the order specified.
 
-If a hook variable has a non-@code{nil} value, that value may be a
-function or a list of functions.  (The former option is considered
-obsolete.)  If the value is a function (either a lambda expression or
-a symbol with a function definition), it is called.  If it is a list
-that isn't a function, its elements are called, consecutively.  All
-the hook functions are called with no arguments.
+If a hook variable has a non-@code{nil} value, that value should be a
+list of functions.  @code{run-hooks} calls all the functions, one by
+one, with no arguments.
+
+The hook variable's value can also be a single function---either a
+lambda expression or a symbol with a function definition---which
+@code{run-hooks} calls.  But this usage is obsolete.
 @end defun
 
 @defun run-hook-with-args hook &rest args
@@ -187,7 +185,6 @@
 @menu
 * Major Mode Basics::
 * Major Mode Conventions::  Coding conventions for keymaps, etc.
-* Example Major Modes::     Text mode and Lisp modes.
 * Auto Major Mode::         How Emacs chooses the major mode automatically.
 * Mode Help::               Finding out how to use a mode.
 * Derived Modes::           Defining a new major mode based on another major
@@ -195,6 +192,7 @@
 * Generic Modes::           Defining a simple major mode that supports
                               comment syntax and Font Lock mode.
 * Mode Hooks::              Hooks run at the end of major mode functions.
+* Example Major Modes::     Text mode and Lisp modes.
 @end menu
 
 @node Major Mode Basics
@@ -214,14 +212,14 @@
 idea.  In practice, writing a major mode is easy (in contrast to
 writing a minor mode, which is often difficult).
 
-  If the new mode is similar to an old one, it is often unwise to modify
-the old one to serve two purposes, since it may become harder to use and
-maintain.  Instead, copy and rename an existing major mode definition
-and alter the copy---or define a @dfn{derived mode} (@pxref{Derived
-Modes}).  For example, Rmail Edit mode, which is in
-@file{emacs/lisp/mail/rmailedit.el}, is a major mode that is very similar to
-Text mode except that it provides two additional commands.  Its
-definition is distinct from that of Text mode, but uses that of Text mode.
+  If the new mode is similar to an old one, it is often unwise to
+modify the old one to serve two purposes, since it may become harder
+to use and maintain.  Instead, copy and rename an existing major mode
+definition and alter the copy---or use @code{define-derived-mode} to
+define a @dfn{derived mode} (@pxref{Derived Modes}).  For example,
+Rmail Edit mode is a major mode that is very similar to Text mode
+except that it provides two additional commands.  Its definition is
+distinct from that of Text mode, but uses that of Text mode.
 
   Even if the new mode is not an obvious derivative of any other mode,
 it is convenient to use @code{define-derived-mode} with a @code{nil}
@@ -287,8 +285,10 @@
 
 @item
 The major mode command should start by calling
-@code{kill-all-local-variables}.  This is what gets rid of the
-buffer-local variables of the major mode previously in effect.
+@code{kill-all-local-variables}.  This runs the normal hook
+@code{change-major-mode-hook}, then gets rid of the buffer-local
+variables of the major mode previously in effect.  @xref{Creating
+Buffer-Local}.
 
 @item
 The major mode command should set the variable @code{major-mode} to the
@@ -355,9 +355,11 @@
 letters and other printing characters as special commands.
 
 @item
-Major modes must not define @key{RET} to do anything other than insert
-a newline.  The command to insert a newline and then indent is
-@kbd{C-j}.  Please keep this distinction uniform for all major modes.
+Major modes modes for editing text should not define @key{RET} to do
+anything other than insert a newline.  However, it is ok for
+specialized modes for text that users don't directly edit, such as
+Dired and Info modes, to redefine @key{RET} to do something entirely
+different.
 
 @item
 Major modes should not alter options that are primarily a matter of user
@@ -427,10 +429,11 @@
 @item
 @cindex mode hook
 @cindex major mode hook
-Each major mode should have a @dfn{mode hook} named
-@code{@var{modename}-mode-hook}.  The major mode command should run that
-hook, with @code{run-mode-hooks}, as the very last thing it
-does.  @xref{Mode Hooks}.
+Each major mode should have a normal @dfn{mode hook} named
+@code{@var{modename}-mode-hook}.  The very last thing the major mode command
+should do is to call @code{run-mode-hooks}.  This runs the mode hook,
+and then runs the normal hook @code{after-change-major-mode-hook}.
+@xref{Mode Hooks}.
 
 @item
 The major mode command may start by calling some other major mode
@@ -488,281 +491,6 @@
 Even if you never load the file more than once, someone else will.
 @end itemize
 
-@node Example Major Modes
-@subsection Major Mode Examples
-
-  Text mode is perhaps the simplest mode besides Fundamental mode.
-Here are excerpts from  @file{text-mode.el} that illustrate many of
-the conventions listed above:
-
-@smallexample
-@group
-;; @r{Create the syntax table for this mode.}
-(defvar text-mode-syntax-table
-  (let ((st (make-syntax-table)))
-    (modify-syntax-entry ?\" ".   " st)
-    (modify-syntax-entry ?\\ ".   " st)
-    ;; Add `p' so M-c on `hello' leads to `Hello', not `hello'.
-    (modify-syntax-entry ?' "w p" st)
-    st)
-  "Syntax table used while in `text-mode'.")
-@end group
-
-;; @r{Create the keymap for this mode.}
-@group
-(defvar text-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "\e\t" 'ispell-complete-word)
-    (define-key map "\es" 'center-line)
-    (define-key map "\eS" 'center-paragraph)
-    map)
-  "Keymap for `text-mode'.
-Many other modes, such as Mail mode, Outline mode
-and Indented Text mode, inherit all the commands
-defined in this map.")
-@end group
-@end smallexample
-
-  Here is how the actual mode command is defined now:
-
-@smallexample
-@group
-(define-derived-mode text-mode nil "Text"
-  "Major mode for editing text written for humans to read.
-In this mode, paragraphs are delimited only by blank or white lines.
-You can thus get the full benefit of adaptive filling
- (see the variable `adaptive-fill-mode').
-\\@{text-mode-map@}
-Turning on Text mode runs the normal hook `text-mode-hook'."
-@end group
-@group
-  (make-local-variable 'text-mode-variant)
-  (setq text-mode-variant t)
-  ;; @r{These two lines are a feature added recently.}
-  (set (make-local-variable 'require-final-newline)
-       mode-require-final-newline)
-  (set (make-local-variable 'indent-line-function) 'indent-relative))
-@end group
-@end smallexample
-
-  But here is how it was defined formerly, before
-@code{define-derived-mode} existed:
-
-@smallexample
-@group
-;; @r{This isn't needed nowadays, since @code{define-derived-mode} does it.}
-(defvar text-mode-abbrev-table nil
-  "Abbrev table used while in text mode.")
-(define-abbrev-table 'text-mode-abbrev-table ())
-@end group
-
-@group
-(defun text-mode ()
-  "Major mode for editing text intended for humans to read...
- Special commands: \\@{text-mode-map@}
-@end group
-@group
-Turning on text-mode runs the hook `text-mode-hook'."
-  (interactive)
-  (kill-all-local-variables)
-  (use-local-map text-mode-map)
-@end group
-@group
-  (setq local-abbrev-table text-mode-abbrev-table)
-  (set-syntax-table text-mode-syntax-table)
-@end group
-@group
-  ;; @r{These four lines are absent from the current version}
-  ;; @r{not because this is done some other way, but rather}
-  ;; @r{because nowadays Text mode uses the normal definition of paragraphs.}
-  (make-local-variable 'paragraph-start)
-  (setq paragraph-start (concat "[ \t]*$\\|" page-delimiter))
-  (make-local-variable 'paragraph-separate)
-  (setq paragraph-separate paragraph-start)
-  (make-local-variable 'indent-line-function)
-  (setq indent-line-function 'indent-relative-maybe)
-@end group
-@group
-  (setq mode-name "Text")
-  (setq major-mode 'text-mode)
-  (run-mode-hooks 'text-mode-hook)) ; @r{Finally, this permits the user to}
-                                    ;   @r{customize the mode with a hook.}
-@end group
-@end smallexample
-
-@cindex @file{lisp-mode.el}
-  The three Lisp modes (Lisp mode, Emacs Lisp mode, and Lisp
-Interaction mode) have more features than Text mode and the code is
-correspondingly more complicated.  Here are excerpts from
-@file{lisp-mode.el} that illustrate how these modes are written.
-
-@cindex syntax table example
-@smallexample
-@group
-;; @r{Create mode-specific table variables.}
-(defvar lisp-mode-syntax-table nil "")
-(defvar lisp-mode-abbrev-table nil "")
-@end group
-
-@group
-(defvar emacs-lisp-mode-syntax-table
-  (let ((table (make-syntax-table)))
-    (let ((i 0))
-@end group
-
-@group
-      ;; @r{Set syntax of chars up to @samp{0} to say they are}
-      ;;   @r{part of symbol names but not words.}
-      ;;   @r{(The digit @samp{0} is @code{48} in the @acronym{ASCII} character set.)}
-      (while (< i ?0)
-	(modify-syntax-entry i "_   " table)
-	(setq i (1+ i)))
-      ;; @r{@dots{} similar code follows for other character ranges.}
-@end group
-@group
-      ;; @r{Then set the syntax codes for characters that are special in Lisp.}
-      (modify-syntax-entry ?  "    " table)
-      (modify-syntax-entry ?\t "    " table)
-      (modify-syntax-entry ?\f "    " table)
-      (modify-syntax-entry ?\n ">   " table)
-@end group
-@group
-      ;; @r{Give CR the same syntax as newline, for selective-display.}
-      (modify-syntax-entry ?\^m ">   " table)
-      (modify-syntax-entry ?\; "<   " table)
-      (modify-syntax-entry ?` "'   " table)
-      (modify-syntax-entry ?' "'   " table)
-      (modify-syntax-entry ?, "'   " table)
-@end group
-@group
-      ;; @r{@dots{}likewise for many other characters@dots{}}
-      (modify-syntax-entry ?\( "()  " table)
-      (modify-syntax-entry ?\) ")(  " table)
-      (modify-syntax-entry ?\[ "(]  " table)
-      (modify-syntax-entry ?\] ")[  " table))
-    table))
-@end group
-@group
-;; @r{Create an abbrev table for lisp-mode.}
-(define-abbrev-table 'lisp-mode-abbrev-table ())
-@end group
-@end smallexample
-
-  Much code is shared among the three Lisp modes.  The following
-function sets various variables; it is called by each of the major Lisp
-mode functions:
-
-@smallexample
-@group
-(defun lisp-mode-variables (lisp-syntax)
-  (when lisp-syntax
-    (set-syntax-table lisp-mode-syntax-table))
-  (setq local-abbrev-table lisp-mode-abbrev-table)
-  @dots{}
-@end group
-@end smallexample
-
-  Functions such as @code{forward-paragraph} use the value of the
-@code{paragraph-start} variable.  Since Lisp code is different from
-ordinary text, the @code{paragraph-start} variable needs to be set
-specially to handle Lisp.  Also, comments are indented in a special
-fashion in Lisp and the Lisp modes need their own mode-specific
-@code{comment-indent-function}.  The code to set these variables is the
-rest of @code{lisp-mode-variables}.
-
-@smallexample
-@group
-  (make-local-variable 'paragraph-start)
-  (setq paragraph-start (concat page-delimiter "\\|$" ))
-  (make-local-variable 'paragraph-separate)
-  (setq paragraph-separate paragraph-start)
-  @dots{}
-@end group
-@group
-  (make-local-variable 'comment-indent-function)
-  (setq comment-indent-function 'lisp-comment-indent))
-  @dots{}
-@end group
-@end smallexample
-
-  Each of the different Lisp modes has a slightly different keymap.  For
-example, Lisp mode binds @kbd{C-c C-z} to @code{run-lisp}, but the other
-Lisp modes do not.  However, all Lisp modes have some commands in
-common.  The following code sets up the common commands:
-
-@smallexample
-@group
-(defvar shared-lisp-mode-map ()
-  "Keymap for commands shared by all sorts of Lisp modes.")
-
-;; @r{Putting this @code{if} after the @code{defvar} is an older style.}
-(if shared-lisp-mode-map
-    ()
-   (setq shared-lisp-mode-map (make-sparse-keymap))
-   (define-key shared-lisp-mode-map "\e\C-q" 'indent-sexp)
-   (define-key shared-lisp-mode-map "\177"
-               'backward-delete-char-untabify))
-@end group
-@end smallexample
-
-@noindent
-And here is the code to set up the keymap for Lisp mode:
-
-@smallexample
-@group
-(defvar lisp-mode-map ()
-  "Keymap for ordinary Lisp mode...")
-
-(if lisp-mode-map
-    ()
-  (setq lisp-mode-map (make-sparse-keymap))
-  (set-keymap-parent lisp-mode-map shared-lisp-mode-map)
-  (define-key lisp-mode-map "\e\C-x" 'lisp-eval-defun)
-  (define-key lisp-mode-map "\C-c\C-z" 'run-lisp))
-@end group
-@end smallexample
-
-  Finally, here is the complete major mode function definition for
-Lisp mode.
-
-@smallexample
-@group
-(defun lisp-mode ()
-  "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp.
-Commands:
-Delete converts tabs to spaces as it moves back.
-Blank lines separate paragraphs.  Semicolons start comments.
-\\@{lisp-mode-map@}
-Note that `run-lisp' may be used either to start an inferior Lisp job
-or to switch back to an existing one.
-@end group
-
-@group
-Entry to this mode calls the value of `lisp-mode-hook'
-if that value is non-nil."
-  (interactive)
-  (kill-all-local-variables)
-@end group
-@group
-  (use-local-map lisp-mode-map)          ; @r{Select the mode's keymap.}
-  (setq major-mode 'lisp-mode)           ; @r{This is how @code{describe-mode}}
-                                         ;   @r{finds out what to describe.}
-  (setq mode-name "Lisp")                ; @r{This goes into the mode line.}
-  (lisp-mode-variables t)                ; @r{This defines various variables.}
-  (make-local-variable 'comment-start-skip)
-  (setq comment-start-skip
-        "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
-  (make-local-variable 'font-lock-keywords-case-fold-search)
-  (setq font-lock-keywords-case-fold-search t)
-@end group
-@group
-  (setq imenu-case-fold-search t)
-  (set-syntax-table lisp-mode-syntax-table)
-  (run-mode-hooks 'lisp-mode-hook))           ; @r{This permits the user to use a}
-                                         ;   @r{hook to customize the mode.}
-@end group
-@end smallexample
-
 @node Auto Major Mode
 @subsection How Emacs Chooses a Major Mode
 
@@ -1073,104 +801,365 @@
 @subsection Generic Modes
 @cindex generic mode
 
-@dfn{Generic modes} are simple major modes with basic support for
-comment syntax and Font Lock mode.  They are primarily useful for
-configuration files.  To define a generic mode, use the macro
-@code{define-generic-mode}.  See the file @file{generic-x.el} for some
-examples of the use of @code{define-generic-mode}.
+  @dfn{Generic modes} are simple major modes with basic support for
+comment syntax and Font Lock mode.  To define a generic mode, use the
+macro @code{define-generic-mode}.  See the file @file{generic-x.el}
+for some examples of the use of @code{define-generic-mode}.
 
 @defmac define-generic-mode mode comment-list keyword-list font-lock-list auto-mode-list function-list &optional docstring
-This macro creates a new generic mode.  The argument @var{mode} (an
-unquoted symbol) is the major mode command.  The optional argument
-@var{docstring} is the documentation for the mode command.  If you do
-not supply it, @code{define-generic-mode} uses a default documentation
-string instead.
-
-@var{comment-list} is a list in which each element is either a
-character, a string of one or two characters, or a cons cell.  A
-character or a string is set up in the mode's syntax table as a
+This macro defines a generic mode command named @var{mode} (a symbol,
+not quoted).  The optional argument @var{docstring} is the
+documentation for the mode command.  If you do not supply it,
+@code{define-generic-mode} generates one by default.
+
+The argument @var{comment-list} is a list in which each element is
+either a character, a string of one or two characters, or a cons cell.
+A character or a string is set up in the mode's syntax table as a
 ``comment starter.''  If the entry is a cons cell, the @sc{car} is set
 up as a ``comment starter'' and the @sc{cdr} as a ``comment ender.''
 (Use @code{nil} for the latter if you want comments to end at the end
-of the line.)  Note that the syntax table has limitations about what
-comment starters and enders are actually possible.  @xref{Syntax
-Tables}.
-
-@var{keyword-list} is a list of keywords to highlight with
-@code{font-lock-keyword-face}.  Each keyword should be a string.
-@var{font-lock-list} is a list of additional expressions to highlight.
-Each element of this list should have the same form as an element of
-@code{font-lock-keywords}.  @xref{Search-based Fontification}.
-
-@var{auto-mode-list} is a list of regular expressions to add to the
-variable @code{auto-mode-alist}.  These regular expressions are added
-when Emacs runs the macro expansion.
-
-@var{function-list} is a list of functions to call to do some
-additional setup.  The mode command calls these functions just before
-it runs the mode hook variable @code{@var{mode}-hook}.
+of the line.)  Note that the syntax table mechanism has limitations
+about what comment starters and enders are actually possible.
+@xref{Syntax Tables}.
+
+The argument @var{keyword-list} is a list of keywords to highlight
+with @code{font-lock-keyword-face}.  Each keyword should be a string.
+Meanwhile, @var{font-lock-list} is a list of additional expressions to
+highlight.  Each element of this list should have the same form as an
+element of @code{font-lock-keywords}.  @xref{Search-based
+Fontification}.
+
+The argument @var{auto-mode-list} is a list of regular expressions to
+add to the variable @code{auto-mode-alist}.  They are added by the execution
+of the @code{define-generic-mode} form, not by expanding the macro call.
+
+Finally, @var{function-list} is a list of functions for the mode
+command to call for additional setup.  It calls these functions just
+before it runs the mode hook variable @code{@var{mode}-hook}.
 @end defmac
 
 @node Mode Hooks
 @subsection Mode Hooks
 
-  The two last things a major mode function should do is run its mode
-hook and finally the mode independent normal hook
-@code{after-change-major-mode-hook}.  If the major mode is a derived
-mode, that is if it calls another major mode (the parent mode) in its
-body, then the parent's mode hook is run just before the derived
-mode's hook.  Neither the parent's mode hook nor
-@code{after-change-major-mode-hook} are run at the end of the actual
-call to the parent mode.  This applies recursively if the parent mode
-has itself a parent.  That is, the mode hooks of all major modes
-called directly or indirectly by the major mode function are all run
-in sequence at the end, just before
-@code{after-change-major-mode-hook}.
-
-  These conventions are new in Emacs 22, and some major modes
-implemented by users do not follow them yet.  So if you put a function
-onto @code{after-change-major-mode-hook}, keep in mind that some modes
-will fail to run it.  If a user complains about that, you can respond,
-``That major mode fails to follow Emacs conventions, and that's why it
-fails to work.  Please fix the major mode.''  In most cases, that is
-good enough, so go ahead and use @code{after-change-major-mode-hook}.
-However, if a certain feature needs to be completely reliable,
-it should not use @code{after-change-major-mode-hook} as of yet.
+  Every major mode function should finish by running its mode hook and
+the mode-independent normal hook @code{after-change-major-mode-hook}.
+It does this by calling @code{run-mode-hooks}.  If the major mode is a
+derived mode, that is if it calls another major mode (the parent mode)
+in its body, it should do this inside @code{delay-mode-hooks} so that
+the parent won't run these hooks itself.  Instead, the derived mode's
+call to @code{run-mode-hooks} runs the parent's mode hook too.
+@xref{Major Mode Conventions}.
+
+  Emacs versions before Emacs 22 did not have @code{delay-mode-hooks}.
+When user-implemented major modes have not been updated to use it,
+they won't entirely follow these conventions: they may run the
+parent's mode hook too early, or fail to run
+@code{after-change-major-mode-hook}.  If you encounter such a major
+mode, please correct it to follow these conventions.
 
   When you defined a major mode using @code{define-derived-mode}, it
 automatically makes sure these conventions are followed.  If you
-define a major mode ``from scratch,'' not using
-@code{define-derived-mode}, make sure the major mode command follows
-these and other conventions.  @xref{Major Mode Conventions}.  You use
-these functions to do it properly.
+define a major mode ``by hand,'' not using @code{define-derived-mode},
+use the following functions to handle these conventions automatically.
 
 @defun run-mode-hooks &rest hookvars
 Major modes should run their mode hook using this function.  It is
 similar to @code{run-hooks} (@pxref{Hooks}), but it also runs
 @code{after-change-major-mode-hook}.
 
-When the call to this function is dynamically inside a
-@code{delay-mode-hooks} form, this function does not run any hooks.
+When this function is called during the execution of a
+@code{delay-mode-hooks} form, it does not run the hooks immediately.
 Instead, it arranges for the next call to @code{run-mode-hooks} to run
-@var{hookvars}.
+them.
 @end defun
 
 @defmac delay-mode-hooks body@dots{}
-This macro executes @var{body} like @code{progn}, but all calls to
-@code{run-mode-hooks} inside @var{body} delay running their hooks.
-They will be run by the first call to @code{run-mode-hooks} after exit
-from @code{delay-mode-hooks}.  This is the proper way for a major mode
-command to invoke its parent mode.
+When one major mode command calls another, it should do so inside of
+@code{delay-mode-hooks}.
+
+This macro executes @var{body}, but tells all @code{run-mode-hooks}
+calls during the execution of @var{body} to delay running their hooks.
+The hooks will actually run during the next call to
+@code{run-mode-hooks} after the end of the @code{delay-mode-hooks}
+construct.
 @end defmac
 
 @defvar after-change-major-mode-hook
-Every major mode function should run this normal hook at its very end.
-It normally does not need to do so explicitly.  Indeed, a major mode
-function should normally run its mode hook with @code{run-mode-hooks}
-as the very last thing it does, and the last thing
-@code{run-mode-hooks} does is run @code{after-change-major-mode-hook}.
+This is a normal hook run by @code{run-mode-hooks}.  It is run at the
+very end of every properly-written major mode function.
 @end defvar
 
+@node Example Major Modes
+@subsection Major Mode Examples
+
+  Text mode is perhaps the simplest mode besides Fundamental mode.
+Here are excerpts from  @file{text-mode.el} that illustrate many of
+the conventions listed above:
+
+@smallexample
+@group
+;; @r{Create the syntax table for this mode.}
+(defvar text-mode-syntax-table
+  (let ((st (make-syntax-table)))
+    (modify-syntax-entry ?\" ".   " st)
+    (modify-syntax-entry ?\\ ".   " st)
+    ;; Add `p' so M-c on `hello' leads to `Hello', not `hello'.
+    (modify-syntax-entry ?' "w p" st)
+    st)
+  "Syntax table used while in `text-mode'.")
+@end group
+
+;; @r{Create the keymap for this mode.}
+@group
+(defvar text-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\e\t" 'ispell-complete-word)
+    (define-key map "\es" 'center-line)
+    (define-key map "\eS" 'center-paragraph)
+    map)
+  "Keymap for `text-mode'.
+Many other modes, such as Mail mode, Outline mode
+and Indented Text mode, inherit all the commands
+defined in this map.")
+@end group
+@end smallexample
+
+  Here is how the actual mode command is defined now:
+
+@smallexample
+@group
+(define-derived-mode text-mode nil "Text"
+  "Major mode for editing text written for humans to read.
+In this mode, paragraphs are delimited only by blank or white lines.
+You can thus get the full benefit of adaptive filling
+ (see the variable `adaptive-fill-mode').
+\\@{text-mode-map@}
+Turning on Text mode runs the normal hook `text-mode-hook'."
+@end group
+@group
+  (make-local-variable 'text-mode-variant)
+  (setq text-mode-variant t)
+  ;; @r{These two lines are a feature added recently.}
+  (set (make-local-variable 'require-final-newline)
+       mode-require-final-newline)
+  (set (make-local-variable 'indent-line-function) 'indent-relative))
+@end group
+@end smallexample
+
+  But here is how it was defined formerly, before
+@code{define-derived-mode} existed:
+
+@smallexample
+@group
+;; @r{This isn't needed nowadays, since @code{define-derived-mode} does it.}
+(defvar text-mode-abbrev-table nil
+  "Abbrev table used while in text mode.")
+(define-abbrev-table 'text-mode-abbrev-table ())
+@end group
+
+@group
+(defun text-mode ()
+  "Major mode for editing text intended for humans to read...
+ Special commands: \\@{text-mode-map@}
+@end group
+@group
+Turning on text-mode runs the hook `text-mode-hook'."
+  (interactive)
+  (kill-all-local-variables)
+  (use-local-map text-mode-map)
+@end group
+@group
+  (setq local-abbrev-table text-mode-abbrev-table)
+  (set-syntax-table text-mode-syntax-table)
+@end group
+@group
+  ;; @r{These four lines are absent from the current version}
+  ;; @r{not because this is done some other way, but rather}
+  ;; @r{because nowadays Text mode uses the normal definition of paragraphs.}
+  (make-local-variable 'paragraph-start)
+  (setq paragraph-start (concat "[ \t]*$\\|" page-delimiter))
+  (make-local-variable 'paragraph-separate)
+  (setq paragraph-separate paragraph-start)
+  (make-local-variable 'indent-line-function)
+  (setq indent-line-function 'indent-relative-maybe)
+@end group
+@group
+  (setq mode-name "Text")
+  (setq major-mode 'text-mode)
+  (run-mode-hooks 'text-mode-hook)) ; @r{Finally, this permits the user to}
+                                    ;   @r{customize the mode with a hook.}
+@end group
+@end smallexample
+
+@cindex @file{lisp-mode.el}
+  The three Lisp modes (Lisp mode, Emacs Lisp mode, and Lisp
+Interaction mode) have more features than Text mode and the code is
+correspondingly more complicated.  Here are excerpts from
+@file{lisp-mode.el} that illustrate how these modes are written.
+
+@cindex syntax table example
+@smallexample
+@group
+;; @r{Create mode-specific table variables.}
+(defvar lisp-mode-syntax-table nil "")
+(defvar lisp-mode-abbrev-table nil "")
+@end group
+
+@group
+(defvar emacs-lisp-mode-syntax-table
+  (let ((table (make-syntax-table)))
+    (let ((i 0))
+@end group
+
+@group
+      ;; @r{Set syntax of chars up to @samp{0} to say they are}
+      ;;   @r{part of symbol names but not words.}
+      ;;   @r{(The digit @samp{0} is @code{48} in the @acronym{ASCII} character set.)}
+      (while (< i ?0)
+	(modify-syntax-entry i "_   " table)
+	(setq i (1+ i)))
+      ;; @r{@dots{} similar code follows for other character ranges.}
+@end group
+@group
+      ;; @r{Then set the syntax codes for characters that are special in Lisp.}
+      (modify-syntax-entry ?  "    " table)
+      (modify-syntax-entry ?\t "    " table)
+      (modify-syntax-entry ?\f "    " table)
+      (modify-syntax-entry ?\n ">   " table)
+@end group
+@group
+      ;; @r{Give CR the same syntax as newline, for selective-display.}
+      (modify-syntax-entry ?\^m ">   " table)
+      (modify-syntax-entry ?\; "<   " table)
+      (modify-syntax-entry ?` "'   " table)
+      (modify-syntax-entry ?' "'   " table)
+      (modify-syntax-entry ?, "'   " table)
+@end group
+@group
+      ;; @r{@dots{}likewise for many other characters@dots{}}
+      (modify-syntax-entry ?\( "()  " table)
+      (modify-syntax-entry ?\) ")(  " table)
+      (modify-syntax-entry ?\[ "(]  " table)
+      (modify-syntax-entry ?\] ")[  " table))
+    table))
+@end group
+@group
+;; @r{Create an abbrev table for lisp-mode.}
+(define-abbrev-table 'lisp-mode-abbrev-table ())
+@end group
+@end smallexample
+
+  The three modes for Lisp share much of their code.  For instance,
+each calls the following function to set various variables:
+
+@smallexample
+@group
+(defun lisp-mode-variables (lisp-syntax)
+  (when lisp-syntax
+    (set-syntax-table lisp-mode-syntax-table))
+  (setq local-abbrev-table lisp-mode-abbrev-table)
+  @dots{}
+@end group
+@end smallexample
+
+  In Lisp and most programming languages, we want the paragraph
+commands to treat only blank lines as paragraph separators.  And the
+modes should undestand the Lisp conventions for comments.  The rest of
+@code{lisp-mode-variables} sets this up:
+
+@smallexample
+@group
+  (make-local-variable 'paragraph-start)
+  (setq paragraph-start (concat page-delimiter "\\|$" ))
+  (make-local-variable 'paragraph-separate)
+  (setq paragraph-separate paragraph-start)
+  @dots{}
+@end group
+@group
+  (make-local-variable 'comment-indent-function)
+  (setq comment-indent-function 'lisp-comment-indent))
+  @dots{}
+@end group
+@end smallexample
+
+  Each of the different Lisp modes has a slightly different keymap.  For
+example, Lisp mode binds @kbd{C-c C-z} to @code{run-lisp}, but the other
+Lisp modes do not.  However, all Lisp modes have some commands in
+common.  The following code sets up the common commands:
+
+@smallexample
+@group
+(defvar shared-lisp-mode-map ()
+  "Keymap for commands shared by all sorts of Lisp modes.")
+
+;; @r{Putting this @code{if} after the @code{defvar} is an older style.}
+(if shared-lisp-mode-map
+    ()
+   (setq shared-lisp-mode-map (make-sparse-keymap))
+   (define-key shared-lisp-mode-map "\e\C-q" 'indent-sexp)
+   (define-key shared-lisp-mode-map "\177"
+               'backward-delete-char-untabify))
+@end group
+@end smallexample
+
+@noindent
+And here is the code to set up the keymap for Lisp mode:
+
+@smallexample
+@group
+(defvar lisp-mode-map ()
+  "Keymap for ordinary Lisp mode...")
+
+(if lisp-mode-map
+    ()
+  (setq lisp-mode-map (make-sparse-keymap))
+  (set-keymap-parent lisp-mode-map shared-lisp-mode-map)
+  (define-key lisp-mode-map "\e\C-x" 'lisp-eval-defun)
+  (define-key lisp-mode-map "\C-c\C-z" 'run-lisp))
+@end group
+@end smallexample
+
+  Finally, here is the complete major mode function definition for
+Lisp mode.
+
+@smallexample
+@group
+(defun lisp-mode ()
+  "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp.
+Commands:
+Delete converts tabs to spaces as it moves back.
+Blank lines separate paragraphs.  Semicolons start comments.
+\\@{lisp-mode-map@}
+Note that `run-lisp' may be used either to start an inferior Lisp job
+or to switch back to an existing one.
+@end group
+
+@group
+Entry to this mode calls the value of `lisp-mode-hook'
+if that value is non-nil."
+  (interactive)
+  (kill-all-local-variables)
+@end group
+@group
+  (use-local-map lisp-mode-map)          ; @r{Select the mode's keymap.}
+  (setq major-mode 'lisp-mode)           ; @r{This is how @code{describe-mode}}
+                                         ;   @r{finds out what to describe.}
+  (setq mode-name "Lisp")                ; @r{This goes into the mode line.}
+  (lisp-mode-variables t)                ; @r{This defines various variables.}
+  (make-local-variable 'comment-start-skip)
+  (setq comment-start-skip
+        "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
+  (make-local-variable 'font-lock-keywords-case-fold-search)
+  (setq font-lock-keywords-case-fold-search t)
+@end group
+@group
+  (setq imenu-case-fold-search t)
+  (set-syntax-table lisp-mode-syntax-table)
+  (run-mode-hooks 'lisp-mode-hook))           ; @r{This permits the user to use a}
+                                         ;   @r{hook to customize the mode.}
+@end group
+@end smallexample
+
 @node Minor Modes
 @section Minor Modes
 @cindex minor mode
@@ -1295,7 +1284,7 @@
 @end smallexample
 
 @noindent
-or like this, using @code{add-to-list} (@pxref{Setting Variables}):
+or like this, using @code{add-to-list} (@pxref{List Variables}):
 
 @smallexample
 @group
@@ -1533,16 +1522,14 @@
 @subsection Mode Line Basics
 
   @code{mode-line-format} is a buffer-local variable that holds a
-@dfn{mode line construct}, a kind of template, which controls the
-display the mode line of the current buffer.  All windows for the same
-buffer use the same @code{mode-line-format}, so their mode lines
-appear the same---except for scrolling percentages, and line and
-column numbers, since those depend on point and on how the window is
-scrolled.  The value of @code{header-line-format} specifies the
-buffer's header line in the same way, with a mode line construct.
-
-  For efficiency, Emacs does not recompute the mode line and header
-line of a window in every redisplay.  It does so when circumstances
+@dfn{mode line construct}, a kind of template, which controls what is
+displayed on the mode line of the current buffer.  The value of
+@code{header-line-format} specifies the buffer's header line in the
+same way.  All windows for the same buffer use the same
+@code{mode-line-format} and @code{header-line-format}.
+
+  For efficiency, Emacs does not continuously recompute the mode
+line and header line of a window.  It does so when circumstances
 appear to call for it---for instance, if you change the window
 configuration, switch buffers, narrow or widen the buffer, scroll, or
 change the buffer's modification status.  If you modify any of the
@@ -1552,7 +1539,6 @@
 update of the mode line so as to display the new information or
 display it in the new way.
 
-@c Emacs 19 feature
 @defun force-mode-line-update &optional all
 Force redisplay of the current buffer's mode line and header line.
 The next redisplay will update the mode line and header line based on
@@ -1589,15 +1575,17 @@
 @table @code
 @cindex percent symbol in mode line
 @item @var{string}
-A string as a mode-line construct appears verbatim in the mode line
-except for @dfn{@code{%}-constructs} in it.  These stand for
-substitution of other data; see @ref{%-Constructs}.
-
-If the string has @code{face} properties, they are copied into the
-mode line contents too (@pxref{Properties in Mode}).  Any characters
-in the mode line which have no @code{face} properties are displayed,
-by default, in the face @code{mode-line} or @code{mode-line-inactive}
-(@pxref{Standard Faces,,, emacs, The GNU Emacs Manual}).
+A string as a mode-line construct appears verbatim except for
+@dfn{@code{%}-constructs} in it.  These stand for substitution of
+other data; see @ref{%-Constructs}.
+
+If parts of the string have @code{face} properties, they control
+display of the text just as they would text in the buffer.  Any
+characters which have no @code{face} properties are displayed, by
+default, in the face @code{mode-line} or @code{mode-line-inactive}
+(@pxref{Standard Faces,,, emacs, The GNU Emacs Manual}).  The
+@code{help-echo} and @code{local-map} properties in @var{string} have
+special meanings.  @xref{Properties in Mode}.
 
 @item @var{symbol}
 A symbol as a mode-line construct stands for its value.  The value of
@@ -1612,7 +1600,9 @@
 non-@code{nil} @code{risky-local-variable} property), all text
 properties specified in @var{symbol}'s value are ignored.  This
 includes the text properties of strings in @var{symbol}'s value, as
-well as all @code{:eval} and @code{:propertize} forms in it.
+well as all @code{:eval} and @code{:propertize} forms in it.  (The
+reason for this is security: non-risky variables could be set
+automatically from file variables without prompting the user.)
 
 @item (@var{string} @var{rest}@dots{})
 @itemx (@var{list} @var{rest}@dots{})
@@ -2055,10 +2045,10 @@
 property.
 @end enumerate
 
-  You use the @code{local-map} property to specify a keymap.  Like any
-keymap, it can bind character keys and function keys; but that has no
-effect, since it is impossible to move point into the mode line.  This
-keymap can only take real effect for mouse clicks.
+  You can use the @code{local-map} property to specify a keymap.  This
+keymap only takes real effect for mouse clicks; binding character keys
+and function keys to it has no effect, since it is impossible to move
+point into the mode line.
 
   When the mode line refers to a variable which does not have a
 non-@code{nil} @code{risky-local-variable} property, any text
@@ -2889,6 +2879,10 @@
 @vindex font-lock-preprocessor-face
 Used (typically) for preprocessor commands.
 
+@item font-lock-negation-char-face
+@vindex font-lock-negation-char-face
+Used (typically) for easily-overlooked negation characters.
+
 @item font-lock-warning-face
 @vindex font-lock-warning-face
 Used (typically) for constructs that are peculiar, or that greatly
@@ -3044,7 +3038,7 @@
 make the other also work.  However, for reliable results you must
 attend explicitly to both aspects.
 
-  There are two ways to ensure correct identification of multiline
+  There are three ways to ensure correct identification of multiline
 constructs:
 
 @itemize
@@ -3055,6 +3049,10 @@
 Use @code{font-lock-fontify-region-function} hook to extend the scan
 so that the scanned text never starts or ends in the middle of a
 multiline construct.
+@item
+Add a function to @code{font-lock-extend-region-functions} that does
+the @emph{identification} and extends the scan so that the scanned
+text never starts or ends in the middle of a multiline construct.
 @end itemize
 
   There are three ways to do rehighlighting of multiline constructs:
@@ -3144,7 +3142,7 @@
   You can enlarge (or even reduce) the region to fontify by setting
 one the following variables:
 
-@defvar font-lock-extend-region-function
+@defvar font-lock-extend-after-change-region-function
 This buffer-local variable is either @code{nil} or a function for
 Font-Lock to call to determine the region to scan and fontify.
 
--- a/lispref/os.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/os.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -28,8 +28,10 @@
 * Processor Run Time::  Getting the run time used by Emacs.
 * Time Calculations::   Adding, subtracting, comparing times, etc.
 * Timers::		Setting a timer to call a function at a certain time.
-* Terminal Input::      Recording terminal input for debugging.
-* Terminal Output::     Recording terminal output for debugging.
+* Idle Timers::         Setting a timer to call a function when Emacs has
+                          been idle for a certain length of time.
+* Terminal Input::      Accessing and recording terminal input.
+* Terminal Output::     Controlling and recording terminal output.
 * Sound Output::        Playing sounds on the computer's speaker.
 * X11 Keysyms::         Operating on key symbols for X Windows
 * Batch Mode::          Running Emacs without terminal interaction.
@@ -1256,7 +1258,9 @@
 @item %Y
 This stands for the year with century.
 @item %Z
-This stands for the time zone abbreviation.
+This stands for the time zone abbreviation (e.g., @samp{EST}).
+@item %z
+This stands for the time zone numerical offset (e.g., @samp{-0500}).
 @end table
 
 You can also specify the field width and type of padding for any of
@@ -1286,12 +1290,14 @@
 Universal Time; @code{nil} means describe it using what Emacs believes
 is the local time zone (see @code{current-time-zone}).
 
-This function uses the C library function @code{strftime} to do most of
-the work.  In order to communicate with that function, it first encodes
-its argument using the coding system specified by
-@code{locale-coding-system} (@pxref{Locales}); after @code{strftime}
-returns the resulting string, @code{format-time-string} decodes the
-string using that same coding system.
+This function uses the C library function @code{strftime}
+(@pxref{Formatting Calendar Time,,, libc, The GNU C Library Reference
+Manual}) to do most of the work.  In order to communicate with that
+function, it first encodes its argument using the coding system
+specified by @code{locale-coding-system} (@pxref{Locales}); after
+@code{strftime} returns the resulting string,
+@code{format-time-string} decodes the string using that same coding
+system.
 @end defun
 
 @defun seconds-to-time seconds
@@ -1388,6 +1394,13 @@
 changes from user commands' changes and prevent a single undo entry
 from growing to be quite large.
 
+  Timer functions should also avoid calling functions that cause Emacs
+to wait, such as @code{sit-for} (@pxref{Waiting}).  This can lead to
+unpredictable effects, since other timers (or even the same timer) can
+run while waiting.  If a timer function needs to perform an action
+after a certain time has elapsed, it can do this by scheduling a new
+timer.
+
   If a timer function calls functions that can change the match data,
 it should save and restore the match data.  @xref{Saving Match Data}.
 
@@ -1469,10 +1482,26 @@
 a timer to avoid waiting too long for an answer.  @xref{Yes-or-No
 Queries}.
 
+@defun cancel-timer timer
+This cancels the requested action for @var{timer}, which should be a
+timer---usually, one previously returned by @code{run-at-time} or
+@code{run-with-idle-timer}.  This cancels the effect of that call to
+one of these functions; the arrival of the specified time will not
+cause anything special to happen.
+@end defun
+
+@node Idle Timers
+@section Idle Timers
+
+  Here is how to set up a timer that runs when Emacs is idle for a
+certain length of time.  Aside from how to set them up, idle timers
+work just like ordinary timers.
+
 @deffn Command run-with-idle-timer secs repeat function &rest args
 Set up a timer which runs when Emacs has been idle for @var{secs}
 seconds.  The value of @var{secs} may be an integer or a floating point
-number.
+number; a value of the type returned by @code{current-idle-time}
+is also allowed.
 
 If @var{repeat} is @code{nil}, the timer runs just once, the first time
 Emacs remains idle for a long enough time.  More often @var{repeat} is
@@ -1480,7 +1509,7 @@
 remains idle for @var{secs} seconds.
 
 The function @code{run-with-idle-timer} returns a timer value which you
-can use in calling @code{cancel-timer} (see below).
+can use in calling @code{cancel-timer} (@pxref{Timers}).
 @end deffn
 
 @cindex idleness
@@ -1504,11 +1533,49 @@
 input.  Then it becomes idle again, and all the idle timers that are
 set up to repeat will subsequently run another time, one by one.
 
-@defun cancel-timer timer
-Cancel the requested action for @var{timer}, which should be a value
-previously returned by @code{run-at-time} or @code{run-with-idle-timer}.
-This cancels the effect of that call to one of these functions; the
-arrival of the specified time will not cause anything special to happen.
+@c Emacs 19 feature
+@defun current-idle-time
+This function returns the length of time Emacs has been idle, as a
+list of three integers: @code{(@var{high} @var{low} @var{microsec})}.
+The integers @var{high} and @var{low} combine to give the number of
+seconds of idleness, which is
+@ifnottex
+@var{high} * 2**16 + @var{low}.
+@end ifnottex
+@tex
+$high*2^{16}+low$.
+@end tex
+
+The third element, @var{microsec}, gives the microseconds since the
+start of the current second (or 0 for systems that return time with
+the resolution of only one second).
+
+The main use of this function is when an idle timer function wants to
+``take a break'' for a while.  It can set up another idle timer to
+call the same function again, after a few seconds more idleness.
+Here's an example:
+
+@smallexample
+(defvar resume-timer nil
+  "Timer that `timer-function' used to reschedule itself, or nil.")
+
+(defun timer-function ()
+  ;; @r{If the user types a command while @code{resume-timer}}
+  ;; @r{is active, the next time this function is called from}
+  ;; @r{its main idle timer, deactivate @code{resume-timer}.}
+  (when resume-timer
+    (cancel-timer resume-timer))
+  ...@var{do the work for a while}...
+  (when @var{taking-a-break}
+    (setq resume-timer
+          (run-with-idle-timer
+            ;; Compute an idle time @var{break-length}
+            ;; more than the current value.
+            (time-add (current-idle-time)
+                      (seconds-to-time @var{break-length}))
+            nil
+            'timer-function))))
+@end smallexample
 @end defun
 
 @node Terminal Input
@@ -1521,8 +1588,6 @@
 
 @menu
 * Input Modes::		Options for how input is processed.
-* Translating Input::   Low level conversion of some characters or events
-			  into others.
 * Recording Input::	Saving histories of recent or all input events.
 @end menu
 
@@ -1587,204 +1652,6 @@
 @end table
 @end defun
 
-@node Translating Input
-@subsection Translating Input Events
-@cindex translating input events
-
-  This section describes features for translating input events into
-other input events before they become part of key sequences.  These
-features apply to each event in the order they are described here: each
-event is first modified according to @code{extra-keyboard-modifiers},
-then translated through @code{keyboard-translate-table} (if applicable),
-and finally decoded with the specified keyboard coding system.  If it is
-being read as part of a key sequence, it is then added to the sequence
-being read; then subsequences containing it are checked first with
-@code{function-key-map} and then with @code{key-translation-map}.
-
-@c Emacs 19 feature
-@defvar extra-keyboard-modifiers
-This variable lets Lisp programs ``press'' the modifier keys on the
-keyboard.  The value is a character.  Only the modifiers of the
-character matter.  Each time the user types a keyboard key, it is
-altered as if those modifier keys were held down.  For instance, if
-you bind @code{extra-keyboard-modifiers} to @code{?\C-\M-a}, then all
-keyboard input characters typed during the scope of the binding will
-have the control and meta modifiers applied to them.  The character
-@code{?\C-@@}, equivalent to the integer 0, does not count as a control
-character for this purpose, but as a character with no modifiers.
-Thus, setting @code{extra-keyboard-modifiers} to zero cancels any
-modification.
-
-When using a window system, the program can ``press'' any of the
-modifier keys in this way.  Otherwise, only the @key{CTL} and @key{META}
-keys can be virtually pressed.
-
-Note that this variable applies only to events that really come from
-the keyboard, and has no effect on mouse events or any other events.
-@end defvar
-
-@defvar keyboard-translate-table
-This variable is the translate table for keyboard characters.  It lets
-you reshuffle the keys on the keyboard without changing any command
-bindings.  Its value is normally a char-table, or else @code{nil}.
-(It can also be a string or vector, but this is considered obsolete.)
-
-If @code{keyboard-translate-table} is a char-table
-(@pxref{Char-Tables}), then each character read from the keyboard is
-looked up in this char-table.  If the value found there is
-non-@code{nil}, then it is used instead of the actual input character.
-
-Note that this translation is the first thing that happens to a
-character after it is read from the terminal.  Record-keeping features
-such as @code{recent-keys} and dribble files record the characters after
-translation.
-
-Note also that this translation is done before the characters are
-supplied to input methods (@pxref{Input Methods}).  Use
-@code{translation-table-for-input} (@pxref{Translation of Characters}),
-if you want to translate characters after input methods operate.
-@end defvar
-
-@defun keyboard-translate from to
-This function modifies @code{keyboard-translate-table} to translate
-character code @var{from} into character code @var{to}.  It creates
-the keyboard translate table if necessary.
-@end defun
-
-  Here's an example of using the @code{keyboard-translate-table} to
-make @kbd{C-x}, @kbd{C-c} and @kbd{C-v} perform the cut, copy and paste
-operations:
-
-@example
-(keyboard-translate ?\C-x 'control-x)
-(keyboard-translate ?\C-c 'control-c)
-(keyboard-translate ?\C-v 'control-v)
-(global-set-key [control-x] 'kill-region)
-(global-set-key [control-c] 'kill-ring-save)
-(global-set-key [control-v] 'yank)
-@end example
-
-@noindent
-On a graphical terminal that supports extended @acronym{ASCII} input,
-you can still get the standard Emacs meanings of one of those
-characters by typing it with the shift key.  That makes it a different
-character as far as keyboard translation is concerned, but it has the
-same usual meaning.
-
-  The remaining translation features translate subsequences of key
-sequences being read.  They are implemented in @code{read-key-sequence}
-and have no effect on input read with @code{read-event}.
-
-@defvar function-key-map
-This variable holds a keymap that describes the character sequences sent
-by function keys on an ordinary character terminal.  This keymap has the
-same structure as other keymaps, but is used differently: it specifies
-translations to make while reading key sequences, rather than bindings
-for key sequences.
-
-If @code{function-key-map} ``binds'' a key sequence @var{k} to a vector
-@var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a
-key sequence, it is replaced with the events in @var{v}.
-
-For example, VT100 terminals send @kbd{@key{ESC} O P} when the
-keypad @key{PF1} key is pressed.  Therefore, we want Emacs to translate
-that sequence of events into the single event @code{pf1}.  We accomplish
-this by ``binding'' @kbd{@key{ESC} O P} to @code{[pf1]} in
-@code{function-key-map}, when using a VT100.
-
-Thus, typing @kbd{C-c @key{PF1}} sends the character sequence @kbd{C-c
-@key{ESC} O P}; later the function @code{read-key-sequence} translates
-this back into @kbd{C-c @key{PF1}}, which it returns as the vector
-@code{[?\C-c pf1]}.
-
-Entries in @code{function-key-map} are ignored if they conflict with
-bindings made in the minor mode, local, or global keymaps.  The intent
-is that the character sequences that function keys send should not have
-command bindings in their own right---but if they do, the ordinary
-bindings take priority.
-
-The value of @code{function-key-map} is usually set up automatically
-according to the terminal's Terminfo or Termcap entry, but sometimes
-those need help from terminal-specific Lisp files.  Emacs comes with
-terminal-specific files for many common terminals; their main purpose is
-to make entries in @code{function-key-map} beyond those that can be
-deduced from Termcap and Terminfo.  @xref{Terminal-Specific}.
-@end defvar
-
-@defvar key-translation-map
-This variable is another keymap used just like @code{function-key-map}
-to translate input events into other events.  It differs from
-@code{function-key-map} in two ways:
-
-@itemize @bullet
-@item
-@code{key-translation-map} goes to work after @code{function-key-map} is
-finished; it receives the results of translation by
-@code{function-key-map}.
-
-@item
-Non-prefix bindings in @code{key-translation-map} override actual key
-bindings.  For example, if @kbd{C-x f} has a non-prefix binding in
-@code{key-translation-map}, that translation takes effect even though
-@kbd{C-x f} also has a key binding in the global map.
-@end itemize
-
-Note however that actual key bindings can have an effect on
-@code{key-translation-map}, even though they are overridden by it.
-Indeed, actual key bindings override @code{function-key-map} and thus
-may alter the key sequence that @code{key-translation-map} receives.
-Clearly, it is better to avoid this type of situation.
-
-The intent of @code{key-translation-map} is for users to map one
-character set to another, including ordinary characters normally bound
-to @code{self-insert-command}.
-@end defvar
-
-@cindex key translation function
-You can use @code{function-key-map} or @code{key-translation-map} for
-more than simple aliases, by using a function, instead of a key
-sequence, as the ``translation'' of a key.  Then this function is called
-to compute the translation of that key.
-
-The key translation function receives one argument, which is the prompt
-that was specified in @code{read-key-sequence}---or @code{nil} if the
-key sequence is being read by the editor command loop.  In most cases
-you can ignore the prompt value.
-
-If the function reads input itself, it can have the effect of altering
-the event that follows.  For example, here's how to define @kbd{C-c h}
-to turn the character that follows into a Hyper character:
-
-@example
-@group
-(defun hyperify (prompt)
-  (let ((e (read-event)))
-    (vector (if (numberp e)
-                (logior (lsh 1 24) e)
-              (if (memq 'hyper (event-modifiers e))
-                  e
-                (add-event-modifier "H-" e))))))
-
-(defun add-event-modifier (string e)
-  (let ((symbol (if (symbolp e) e (car e))))
-    (setq symbol (intern (concat string
-                                 (symbol-name symbol))))
-@end group
-@group
-    (if (symbolp e)
-        symbol
-      (cons symbol (cdr e)))))
-
-(define-key function-key-map "\C-ch" 'hyperify)
-@end group
-@end example
-
-Finally, if you have enabled keyboard character set decoding using
-@code{set-keyboard-coding-system}, decoding is done after the
-translations listed above.  @xref{Terminal I/O Encoding}.  In future
-Emacs versions, character set decoding may be done before the other
-translations.
-
 @node Recording Input
 @subsection Recording Input
 
--- a/lispref/processes.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/processes.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -1520,7 +1520,7 @@
 
 If the argument @var{delay-question} is non-nil, delay sending this
 question until the process has finished replying to any previous
-questions.  This produces more reliable results with some processes."
+questions.  This produces more reliable results with some processes.
 
 The return value of @code{tq-enqueue} itself is not meaningful.
 @end defun
--- a/lispref/strings.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/strings.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -700,8 +700,8 @@
 arguments @var{objects} are the computed values to be formatted.
 
 The characters in @var{string}, other than the format specifications,
-are copied directly into the output; if they have text properties,
-these are copied into the output also.
+are copied directly into the output, including their text properties,
+if any.
 @end defun
 
 @cindex @samp{%} in format
@@ -719,6 +719,17 @@
 @end group
 @end example
 
+  Since @code{format} interprets @samp{%} characters as format
+specifications, you should @emph{never} pass an arbitrary string as
+the first argument.  This is particularly true when the string is
+generated by some Lisp code.  Unless the string is @emph{known} to
+never include any @samp{%} characters, pass @code{"%s"}, described
+below, as the first argument, and the string as the second, like this:
+
+@example
+  (format "%s" @var{arbitrary-string})
+@end example
+
   If @var{string} contains more than one format specification, the
 format specifications correspond to successive values from
 @var{objects}.  Thus, the first format specification in @var{string}
--- a/lispref/text.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/lispref/text.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -103,9 +103,9 @@
 buffer.  This is similar to @code{(char-after (point))}.  However, if
 point is at the end of the buffer, then @code{following-char} returns 0.
 
-Remember that point is always between characters, and the terminal
-cursor normally appears over the character following point.  Therefore,
-the character returned by @code{following-char} is the character the
+Remember that point is always between characters, and the cursor
+normally appears over the character following point.  Therefore, the
+character returned by @code{following-char} is the character the
 cursor is over.
 
 In this example, point is between the @samp{a} and the @samp{c}.
@@ -526,16 +526,6 @@
 is the numeric prefix argument.
 @end deffn
 
-@deffn Command split-line
-This command splits the current line, moving the portion of the line
-after point down vertically so that it is on the next line directly
-below where it was before.  Whitespace is inserted as needed at the
-beginning of the lower line, using the @code{indent-to} function.
-@code{split-line} returns the position of point.
-
-Programs hardly ever use this function.
-@end deffn
-
 @defvar overwrite-mode
 This variable controls whether overwrite mode is in effect.  The value
 should be @code{overwrite-mode-textual}, @code{overwrite-mode-binary},
@@ -978,8 +968,11 @@
 @comment  node-name,  next,  previous,  up
 @subsection Functions for Yanking
 
-  @dfn{Yanking} means reinserting an entry of previously killed text
-from the kill ring.  The text properties are copied too.
+  This section describes higher-level commands for yanking, which are
+intended primarily for the user but useful also in Lisp programs.
+Both @code{yank} and @code{yank-pop} honor the
+@code{yank-excluded-properties} variable and @code{yank-handler} text
+property (@pxref{Yanking}).
 
 @deffn Command yank &optional arg
 @cindex inserting killed text
@@ -1213,7 +1206,7 @@
 to the buffer's text so that they can be undone.  (The buffers that
 don't have one are usually special-purpose buffers for which Emacs
 assumes that undoing is not useful.  In particular, any buffer whose
-name begins with a space has its undo recording off by default,
+name begins with a space has its undo recording off by default;
 see @ref{Buffer Names}.)  All the primitives that modify the
 text in the buffer automatically add elements to the front of the undo
 list, which is in the variable @code{buffer-undo-list}.
@@ -1318,8 +1311,7 @@
 @defun primitive-undo count list
 This is the basic function for undoing elements of an undo list.
 It undoes the first @var{count} elements of @var{list}, returning
-the rest of @var{list}.  You could write this function in Lisp,
-but it is convenient to have it in C.
+the rest of @var{list}.
 
 @code{primitive-undo} adds elements to the buffer's undo list when it
 changes the buffer.  Undo commands avoid confusion by saving the undo
@@ -1372,7 +1364,9 @@
 of an undo list measures the cons cells that make up the list, plus the
 strings of deleted text.)  Three variables control the range of acceptable
 sizes: @code{undo-limit}, @code{undo-strong-limit} and
-@code{undo-outer-limit}.
+@code{undo-outer-limit}.  In these variables, size is counted as the
+number of bytes occupied, which includes both saved text and other
+data.
 
 @defopt undo-limit
 This is the soft limit for the acceptable size of an undo list.  The
@@ -1392,6 +1386,17 @@
 This is a last ditch limit to prevent memory overflow.
 @end defopt
 
+@defopt undo-ask-before-discard
+If this variable is non-@code{nil}, when the undo info exceeds
+@code{undo-outer-limit}, Emacs asks in the echo area whether to
+discard the info.  The default value is @code{nil}, which means to
+discard it automatically.
+
+This option is mainly intended for debugging.  Garbage collection is
+inhibited while the question is asked, which means that Emacs might
+leak memory if the user waits too long before answering the question.
+@end defopt
+
 @node Filling
 @comment  node-name,  next,  previous,  up
 @section Filling
@@ -1481,8 +1486,6 @@
 between paragraphs are removed.  This function justifies as well as
 filling when @var{justify} is non-@code{nil}.
 
-In an interactive call, any prefix argument requests justification.
-
 If @var{nosqueeze} is non-@code{nil}, that means to leave whitespace
 other than line breaks untouched.  If @var{squeeze-after} is
 non-@code{nil}, it specifies a position in the region, and means don't
@@ -1522,6 +1525,11 @@
 @defun current-justification
 This function returns the proper justification style to use for filling
 the text around point.
+
+This returns the value of the @code{justification} text property at
+point, or the variable @var{default-justification} if there is no such
+text property.  However, it returns @code{nil} rather than @code{none}
+to mean ``don't justify''.
 @end defun
 
 @defopt sentence-end-double-space
@@ -1569,14 +1577,14 @@
 @section Margins for Filling
 
 @defopt fill-prefix
-This buffer-local variable specifies a string of text that appears at
-the beginning
-of normal text lines and should be disregarded when filling them.  Any
-line that fails to start with the fill prefix is considered the start of
-a paragraph; so is any line that starts with the fill prefix followed by
-additional whitespace.  Lines that start with the fill prefix but no
-additional whitespace are ordinary text lines that can be filled
-together.  The resulting filled lines also start with the fill prefix.
+This buffer-local variable, if non-@code{nil}, specifies a string of
+text that appears at the beginning of normal text lines and should be
+disregarded when filling them.  Any line that fails to start with the
+fill prefix is considered the start of a paragraph; so is any line
+that starts with the fill prefix followed by additional whitespace.
+Lines that start with the fill prefix but no additional whitespace are
+ordinary text lines that can be filled together.  The resulting filled
+lines also start with the fill prefix.
 
 The fill prefix follows the left margin whitespace, if any.
 @end defopt
@@ -1661,12 +1669,11 @@
 
 @defvar fill-nobreak-predicate
 This variable gives major modes a way to specify not to break a line
-at certain places.  Its value should be a list of functions, but a
-single function is also supported for compatibility.  Whenever filling
-considers breaking the line at a certain place in the buffer, it calls
-each of these functions with no arguments and with point located at
-that place.  If any of the functions returns non-@code{nil}, then the
-line won't be broken there.
+at certain places.  Its value should be a list of functions.  Whenever
+filling considers breaking the line at a certain place in the buffer,
+it calls each of these functions with no arguments and with point
+located at that place.  If any of the functions returns
+non-@code{nil}, then the line won't be broken there.
 @end defvar
 
 @node Adaptive Fill
@@ -1733,7 +1740,7 @@
 starting after the left margin whitespace (if any) on a line; the
 characters it matches are that line's candidate for the fill prefix.
 
-@w{@code{"[ \t]*\\([-|#;>*]+[ \t]*\\|(?[0-9]+[.)][ \t]*\\)*"}} is the
+@w{@code{"[ \t]*\\([-!|#%;>*·•‣âƒâ—¦]+[ \t]*\\|(?[0-9]+[.)][ \t]*\\)*"}} is the
 default value.  This matches a number enclosed in parentheses or
 followed by a period, or certain punctuation characters, or any
 sequence of these intermingled with whitespace.  In particular, it
@@ -1898,7 +1905,8 @@
     (save-restriction
       (narrow-to-region beg end)
       (goto-char (point-min))
-      (sort-subr reverse 'forward-line 'end-of-line))))
+      (let ((inhibit-field-text-motion t))
+        (sort-subr reverse 'forward-line 'end-of-line)))))
 @end group
 @end example
 
@@ -2054,9 +2062,12 @@
 containing position @var{beg}, and the entire line containing position
 @var{end}, are included in the region sorted.
 
-Note that @code{sort-columns} uses the @code{sort} utility program,
-and so cannot work properly on text containing tab characters.  Use
-@kbd{M-x untabify} to convert tabs to spaces before sorting.
+Note that @code{sort-columns} rejects text that contains tabs, because
+tabs could be split across the specified columns.  Use @kbd{M-x
+untabify} to convert tabs to spaces before sorting.
+
+When possible, this command actually works by calling the @code{sort}
+utility program.
 @end deffn
 
 @node Columns
@@ -2391,6 +2402,7 @@
 affect the display of tab characters in the buffer (@pxref{Usual
 Display}).  Note that the @key{TAB} character as input uses this tab
 stop feature only in a few major modes, such as Text mode.
+@xref{Tab Stops,,, emacs, The GNU Emacs Manual}.
 
 @deffn Command tab-to-tab-stop
 This command inserts spaces or tabs before point, up to the next tab
@@ -3079,22 +3091,23 @@
 @cindex keymap of character
 @kindex keymap @r{(text property)}
 The @code{keymap} property specifies an additional keymap for
-commands.  The property's value for the character before point applies
-if it is non-@code{nil} and rear-sticky, and the property's value for
-the character after point applies if it is non-@code{nil} and
+commands.  When this keymap applies, it is used for key lookup before
+the minor mode keymaps and before the buffer's local map.
+@xref{Active Keymaps}.  If the property value is a symbol, the
+symbol's function definition is used as the keymap.
+
+The property's value for the character before point applies if it is
+non-@code{nil} and rear-sticky, and the property's value for the
+character after point applies if it is non-@code{nil} and
 front-sticky.  (For mouse clicks, the position of the click is used
-instead of the position of point.)  If the property value is a symbol,
-the symbol's function definition is used as the keymap.
-
-When this keymap applies, it is used for key lookup before the minor
-mode keymaps and before the buffer's local map.  @xref{Active
-Keymaps}.
+instead of the position of point.)
 
 @item local-map
 @kindex local-map @r{(text property)}
 This property works like @code{keymap} except that it specifies a
 keymap to use @emph{instead of} the buffer's local map.  For most
-purposes (perhaps all purposes), the @code{keymap} is superior.
+purposes (perhaps all purposes), it is better to use the @code{keymap}
+property.
 
 @item syntax-table
 The @code{syntax-table} property overrides what the syntax table says
@@ -3479,26 +3492,39 @@
 @subsection Defining Clickable Text
 @cindex clickable text
 
-  There are two parts of setting up @dfn{clickable text} in a buffer:
-(1) to make that text highlight when the mouse moves over it, and (2)
-to make a mouse button do something when you click on that text.
-
-  For highlighting, use the @code{mouse-face} text property.  Here is
-an example of how Dired does it:
+  @dfn{Clickable text} is text that can be clicked, with either the
+the mouse or via keyboard commands, to produce some result.  Many
+major modes use clickable text to implement features such as
+hyper-links.  The @code{button} package provides an easy way to insert
+and manipulate clickable text.  @xref{Buttons}.
+
+  In this section, we will explain how to manually set up clickable
+text in a buffer using text properties.  This involves two things: (1)
+indicating clickability when the mouse moves over the text, and (2)
+making @kbd{RET} or a mouse click on that text do something.
+
+  Indicating clickability usually involves highlighting the text, and
+often involves displaying helpful information about the action, such
+as which mouse button to press, or a short summary of the action.
+This can be done with the @code{mouse-face} and @code{help-echo}
+text properties.  @xref{Special Properties}.
+Here is an example of how Dired does it:
 
 @smallexample
 (condition-case nil
     (if (dired-move-to-filename)
-        (put-text-property (point)
-                           (save-excursion
-                             (dired-move-to-end-of-filename)
-                             (point))
-                           'mouse-face 'highlight))
+        (add-text-properties
+         (point)
+         (save-excursion
+           (dired-move-to-end-of-filename)
+           (point))
+         '(mouse-face highlight
+           help-echo "mouse-2: visit this file in other window")))
   (error nil))
 @end smallexample
 
 @noindent
-The first two arguments to @code{put-text-property} specify the
+The first two arguments to @code{add-text-properties} specify the
 beginning and end of the text.
 
   The usual way to make the mouse do something when you click it
@@ -3508,24 +3534,34 @@
 
 @smallexample
 (defun dired-mouse-find-file-other-window (event)
-  "In dired, visit the file or directory name you click on."
+  "In Dired, visit the file or directory name you click on."
   (interactive "e")
-  (let (file)
+  (let (window pos file)
     (save-excursion
-      (set-buffer (window-buffer (posn-window (event-end event))))
-      (save-excursion
-        (goto-char (posn-point (event-end event)))
-        (setq file (dired-get-filename))))
-    (select-window (posn-window (event-end event)))
-    (find-file-other-window (file-name-sans-versions file t))))
+      (setq window (posn-window (event-end event))
+            pos (posn-point (event-end event)))
+      (if (not (windowp window))
+          (error "No file chosen"))
+      (set-buffer (window-buffer window))
+      (goto-char pos)
+      (setq file (dired-get-file-for-visit)))
+    (if (file-directory-p file)
+        (or (and (cdr dired-subdir-alist)
+                 (dired-goto-subdir file))
+            (progn
+              (select-window window)
+              (dired-other-window file)))
+      (select-window window)
+      (find-file-other-window (file-name-sans-versions file t)))))
 @end smallexample
 
 @noindent
-The reason for the outer @code{save-excursion} construct is to avoid
-changing the current buffer; the reason for the inner one is to avoid
-permanently altering point in the buffer you click on.  In this case,
-Dired uses the function @code{dired-get-filename} to determine which
-file to visit, based on the position found in the event.
+The reason for the @code{save-excursion} construct is to avoid
+changing the current buffer.  In this case,
+Dired uses the functions @code{posn-window} and @code{posn-point}
+to determine which buffer the click happened in and where, and
+in that buffer, @code{dired-get-file-for-visit} to determine which
+file to visit.
 
   Instead of defining a mouse command for the major mode, you can define
 a key binding for the clickable text itself, using the @code{keymap}
@@ -3697,7 +3733,8 @@
 to an empty field whose beginning and end are both at @var{pos}.
 
   In all of these functions, if @var{pos} is omitted or @code{nil}, the
-value of point is used by default.
+value of point is used by default.  If narrowing is in effect, then
+@var{pos} should fall within the accessible portion.  @xref{Narrowing}.
 
 @defun field-beginning &optional pos escape-from-edge limit
 This function returns the beginning of the field specified by @var{pos}.
--- a/man/ChangeLog	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/ChangeLog	Sat Oct 14 16:56:21 2006 +0000
@@ -1,3 +1,138 @@
+2006-08-25  Kim F. Storm  <storm@cua.dk>
+
+	* display.texi (Display Custom): Add variables overline-margin
+	and x-underline-at-descent-line.
+
+2006-08-25  Richard Stallman  <rms@gnu.org>
+
+	* entering.texi (Exiting): Rewrite to give graphical displays
+	priority over text terminals.
+
+	* search.texi (Incremental Search): Move index entries.
+
+2006-08-23  Chong Yidong  <cyd@stupidchicken.com>
+
+	* custom.texi (Init File): Reference Find Init to avoid "home
+	directory" confusion.
+
+2006-08-22  Nick Roberts  <nickrob@snap.net.nz>
+
+	* building.texi (Other GDB-UI Buffers): Describe how to edit
+	a value in the locals buffer.
+
+2006-08-21  Richard Stallman  <rms@gnu.org>
+
+	* search.texi (Basic Isearch): Add `isearch' index entry.
+
+2006-08-16  Richard Stallman  <rms@gnu.org>
+
+	* misc.texi (Saving Emacs Sessions): Clean up wording.
+
+	* mark.texi (Marking Objects): Mention term "select all".
+
+	* emacs.texi (Top): Update subnode menu.
+
+	* help.texi (Help Mode): Move node up in file.
+
+2006-08-15  Carsten Dominik  <dominik@science.uva.nl>
+
+	* org.texi (Installation, Activation): Split from Installation and
+	Activation.
+	(Clocking work time): Documented new features.
+
+2006-08-15  Nick Roberts  <nickrob@snap.net.nz>
+
+	* building.texi (Stack Buffer): Explain fringe arrow.
+
+2006-08-13  Alex Schroeder  <alex@gnu.org>
+
+	* rcirc.texi (Configuration): Use correct variable in rcirc-authinfo
+	example.
+
+2006-08-12  Eli Zaretskii  <eliz@gnu.org>
+
+	* faq.texi (How to add fonts): New node.
+
+	* misc.texi (Saving Emacs Sessions): Clarify when desktop is restored
+	on startup.
+
+2006-08-11  Romain Francoise  <romain@orebokech.com>
+
+	* ack.texi (Acknowledgments): Delete mention to zone-mode.el.
+
+2006-08-10  Sven Joachim  <svenjoac@gmx.de>  (tiny change)
+
+	* mule.texi (Recognize Coding, Text Coding): Fix typos.
+
+2006-08-10  Richard Stallman  <rms@gnu.org>
+
+	* text.texi (Format Faces): Substantial rewrites to deal
+	with face merging.  Empty regions don't count.  Clarify
+	face property inheritance.
+
+2006-08-08  Romain Francoise  <romain@orebokech.com>
+
+	* dired.texi (Marks vs Flags): Fix typo reported by Ari Roponen
+	<arjuropo@cc.jyu.fi>.
+
+2006-08-05  Romain Francoise  <romain@orebokech.com>
+
+	* faq.texi (New in Emacs 22): Expand.
+
+2006-08-04  Eli Zaretskii  <eliz@gnu.org>
+
+	* cmdargs.texi (Window Size X) <--geometry>: Only width and height
+	apply to all frames.
+
+2006-08-03  Michael Olson  <mwolson@gnu.org>
+
+	* erc.texi: Update for ERC 5.1.4.
+
+2006-08-01  Richard Stallman  <rms@gnu.org>
+
+	* help.texi (Name Help): Add index entries for describe-variable.
+
+2006-08-01  Nick Roberts  <nickrob@snap.net.nz>
+
+	* building.texi (GDB Graphical Interface): Shorten node names.
+	(GDB-UI Layout): Use GDB-related.
+	(Other GDB-UI Buffers): Simplify English.
+
+2006-07-31  Richard Stallman  <rms@gnu.org>
+
+	* search.texi (Query Replace): Add xref for Dired's Q command.
+
+2006-07-28  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus.texi (Oort Gnus): Mention that the Lisp files are now installed
+	in .../site-lisp/gnus/ by default.
+	[ From gnus-news.texi in the trunk. ]
+
+2006-07-27  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus.texi (MIME Commands): Additions for yEnc.
+
+2006-07-31  Nick Roberts  <nickrob@snap.net.nz>
+
+	* building.texi (GDB commands in Fringe): Rename to...
+	(Source Buffers): ..this and move forward.  Describe hollow arrow and
+	new option gdb-find-source-frame.
+
+2006-07-29  Richard Stallman  <rms@gnu.org>
+
+	* dired.texi (Operating on Files): Simplify previous change
+	and fix Texinfo usage.
+
+2006-07-29  Eli Zaretskii  <eliz@gnu.org>
+
+	* dired.texi (Operating on Files): Add cross-references.  State the
+	Unix commands that do similar things.
+
+2006-07-28  Richard Stallman  <rms@gnu.org>
+
+	* mark.texi (Transient Mark): Clarify that region never disappears
+	when Transient Mark mode is off, and not when it is on.
+
 2006-07-27  Richard Stallman  <rms@gnu.org>
 
 	* search.texi (Non-ASCII Isearch): Clarify.  Mention C-q.
@@ -6,15 +141,15 @@
 
 	* xresources.texi (GTK styles): Fix texinfo usage.
 
-	* pgg.texi, org.texi, info.texi, forms.texi, flymake.texi: 
+	* pgg.texi, org.texi, info.texi, forms.texi, flymake.texi:
 	* faq.texi: Move periods and commas inside quotes.
 
 	* commands.texi (User Input): Explain why we teach keyboard cmds.
-	
-	* xresources.texi, xresmini.texi, search.texi, programs.texi: 
-	* misc.texi, kmacro.texi, killing.texi, glossary.texi: 
-	* fortran-xtra.texi, files.texi, emacs.texi, emacs-xtra.texi: 
-	* doclicense.texi, display.texi, dired.texi, basic.texi: 
+
+	* xresources.texi, xresmini.texi, search.texi, programs.texi:
+	* misc.texi, kmacro.texi, killing.texi, glossary.texi:
+	* fortran-xtra.texi, files.texi, emacs.texi, emacs-xtra.texi:
+	* doclicense.texi, display.texi, dired.texi, basic.texi:
 	* anti.texi, ack.texi: Move periods and commas inside quotes.
 
 2006-07-22  Eli Zaretskii  <eliz@gnu.org>
--- a/man/ack.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/ack.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -419,8 +419,6 @@
 @item
 John Heidemann wrote @file{mouse-copy.el} and @file{mouse-drag.el},
 which provide alternative mouse-based editing and scrolling features.
-He also contributed @file{zone-mode.el}, a major mode for editing DNS
-zone files.
 
 @item
 Jon K Hellan wrote @file{utf7.el}, support for mail-safe transformation
--- a/man/building.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/building.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -833,17 +833,17 @@
 that way, you can use @kbd{M-x gdba} to invoke GDB in graphical mode.
 
 @menu
-* GDB User Interface Layout::   Control the number of displayed buffers.
+* GDB-UI Layout::               Control the number of displayed buffers.
+* Source Buffers::              Use the mouse in the fringe/margin to
+                                control your program.
 * Breakpoints Buffer::          A breakpoint control panel.
 * Stack Buffer::                Select a frame from the call stack.
-* Other GDB User Interface Buffers:: Input/output, locals, registers,
+* Other GDB-UI Buffers::        Input/output, locals, registers,
                                 assembler, threads and memory buffers.
-* GDB commands in the Fringe::  Use the mouse in the fringe/margin to
-                                control your program.
 * Watch Expressions::           Monitor variable values in the speedbar.
 @end menu
 
-@node GDB User Interface Layout
+@node GDB-UI Layout
 @subsubsection GDB User Interface Layout
 @cindex GDB User Interface layout
 
@@ -863,7 +863,7 @@
 +--------------------------------+--------------------------------+
 |   GUD buffer (I/O of GDB)      |   Locals buffer                |
 |--------------------------------+--------------------------------+
-|   Source buffer                |   I/O buffer for debugged pgm  |
+|   Primary Source buffer        |   I/O buffer for debugged pgm  |
 |--------------------------------+--------------------------------+
 |   Stack buffer                 |   Breakpoints buffer           |
 +--------------------------------+--------------------------------+
@@ -871,8 +871,8 @@
 @end smallexample
 
   However, if @code{gdb-use-separate-io-buffer} is @code{nil}, the I/O
-buffer does not appear and the source buffer occupies the full width
-of the frame.
+buffer does not appear and the primary source buffer occupies the full
+width of the frame.
 
 @findex gdb-restore-windows
   If you change the window layout, for example, while editing and
@@ -884,7 +884,7 @@
 containing just the GUD buffer and a source file, type @kbd{M-x
 gdb-many-windows}.
 
-  You may also specify additional GUD-related buffers to display,
+  You may also specify additional GDB-related buffers to display,
 either in the same frame or a different one.  Select the buffers you
 want with the @samp{GUD->GDB-windows} and @samp{GUD->GDB-Frames}
 sub-menus.  If the menu-bar is unavailable, type @code{M-x
@@ -904,6 +904,61 @@
 breakpoints in recently edited source files are still in the right
 places.
 
+@node Source Buffers
+@subsubsection Source Buffers
+@cindex GDB commands in Fringe
+
+@c @findex gdb-mouse-set-clear-breakpoint
+@c @findex gdb-mouse-toggle-breakpoint
+Many GDB commands can be entered using keybindings or the tool bar but
+sometimes it is quicker to use the fringe.  These commands either
+manipulate breakpoints or control program execution.  When there is no
+fringe, you can use the margin but this is only present when the
+source file already has a breakpoint.
+
+You can click @kbd{Mouse-1} in the fringe or display margin of a
+source buffer to set a breakpoint there and, on a graphical display, a
+red bullet will appear on that line.  If a breakpoint already exists
+on that line, the same click will remove it.  You can also enable or
+disable a breakpoint by clicking @kbd{C-Mouse-1} on the bullet.
+
+A solid arrow in the left fringe of a source buffer indicates the line
+of the innermost frame where the debugged program has stopped. A
+hollow arrow indicates the current execution line of higher level
+frames.
+
+If you drag the arrow in the fringe with @kbd{Mouse-1}
+(@code{gdb-mouse-until}), execution will continue to the line where
+you release the button, provided it is still in the same frame.
+Alternatively, you can click @kbd{Mouse-3} at some point in the fringe
+of this buffer and execution will advance to there.  A similar command
+(@code{gdb-mouse-jump}) allows you to jump to a source line without
+executing the intermediate lines by clicking @kbd{C-Mouse-3}.  This
+command allows you to go backwards which can be useful for running
+through code that has already executed, in order to examine its
+execution in more detail.
+
+@table @kbd
+@item Mouse-1
+Set or clear a breakpoint.
+
+@item C-Mouse-1
+Enable or disable a breakpoint.
+
+@item Mouse-3
+Continue execution to here.
+
+@item C-Mouse-3
+Jump to here.
+@end table
+
+If the variable @code{gdb-find-source-frame} is non-@code{nil} and
+execution stops in a frame for which there is no source code e.g after
+an interrupt, then Emacs finds and displays the first frame further up
+stack for which there is source.  If it is @code{nil} then the source
+buffer continues to display the last frame which maybe more useful,
+for example, when re-setting a breakpoint.
+
 @node Breakpoints Buffer
 @subsubsection Breakpoints Buffer
 
@@ -918,7 +973,7 @@
 @findex gdb-toggle-breakpoint
 Enable/disable the current breakpoint (@code{gdb-toggle-breakpoint}).
 On a graphical display, this changes the color of a bullet in the
-margin of the source buffer at the relevant line.  This is red when
+margin of a source buffer at the relevant line.  This is red when
 the breakpoint is enabled and grey when it is disabled.  Text-only
 terminals correspondingly display a @samp{B} or @samp{b}.
 
@@ -946,34 +1001,35 @@
 program.  @xref{Backtrace,, Backtraces, gdb, The GNU debugger}.
 
 @findex gdb-frames-select
-  The selected frame number is displayed in reverse contrast.  To
-select a frame in GDB, move point in the stack buffer to that stack
-frame and type @key{RET} (@code{gdb-frames-select}), or click
+An arrow in the fringe points to the selected frame or, if the fringe is
+not present, the number of the selected frame is displayed in reverse
+contrast.  To select a frame in GDB, move point in the stack buffer to
+that stack frame and type @key{RET} (@code{gdb-frames-select}), or click
 @kbd{Mouse-2} on a stack frame.  If the locals buffer is visible,
-selecting a stack frame updates it to display the local variables of
-the new frame.
+selecting a stack frame updates it to display the local variables of the
+new frame.
 
-@node Other GDB User Interface Buffers
+@node Other GDB-UI Buffers
 @subsubsection Other Buffers
 
 @table @asis
 @item Input/Output Buffer
 @vindex gdb-use-separate-io-buffer
 If the variable @code{gdb-use-separate-io-buffer} is non-@code{nil},
-the executable program that is being debugged takes its input and
-displays its output here.  Otherwise it uses the GUD buffer for that.
-To toggle whether GUD mode uses this buffer, do @kbd{M-x
-gdb-use-separate-io-buffer}.  That takes effect when you next
-restart the program you are debugging.
+the program being debugged takes its input and displays its output
+here.  Otherwise it uses the GUD buffer for that.  To toggle whether
+GUD mode uses this buffer, do @kbd{M-x gdb-use-separate-io-buffer}.
+This takes effect when you next restart the program you are debugging.
 
 The history and replay commands from Shell mode are available here,
-as are the commands to send signals to the program you are debugging.
+as are the commands to send signals to the debugged program.
 @xref{Shell Mode}.
 
 @item Locals Buffer
 The locals buffer displays the values of local variables of the
 current frame for simple data types (@pxref{Frame Info, Frame Info,
-Information on a frame, gdb, The GNU debugger}).
+Information on a frame, gdb, The GNU debugger}). Press @key{RET} or
+click @kbd{Mouse-2} on the value if you want to edit it.
 
 Arrays and structures display their type only.  With GDB 6.4 or later,
 move point to their name and press @key{RET}, or alternatively click
@@ -985,7 +1041,7 @@
 @findex toggle-gdb-all-registers
 The registers buffer displays the values held by the registers
 (@pxref{Registers,,, gdb, The GNU debugger}).  Press @key{RET} or
-click @kbd{Mouse-2} on a register if you want to change its value.
+click @kbd{Mouse-2} on a register if you want to edit its value.
 With GDB 6.4 or later, recently changed register values display with
 @code{font-lock-warning-face}.  With earlier versions of GDB, you can
 press @key{SPC} to toggle the display of floating point registers
@@ -1003,10 +1059,10 @@
 program (@pxref{Threads, Threads, Debugging programs with multiple
 threads, gdb, The GNU debugger}).  Move point to any thread in the
 list and press @key{RET} to select it (@code{gdb-threads-select}) and
-display the associated source in the source buffer.  Alternatively,
-click @kbd{Mouse-2} on a thread to select it.  If the locals buffer is
-visible, its contents update to display the variables that are local
-in the new thread.
+display the associated source in the primary source buffer.
+Alternatively, click @kbd{Mouse-2} on a thread to select it.  If the
+locals buffer is visible, its contents update to display the variables
+that are local in the new thread.
 
 @item Memory Buffer
 The memory buffer lets you examine sections of program memory
@@ -1017,49 +1073,6 @@
 display format or unit size for these data items.
 @end table
 
-@node GDB commands in the Fringe
-@subsubsection GDB commands in the Fringe
-@cindex GDB commands in the Fringe
-
-@c @findex gdb-mouse-set-clear-breakpoint
-@c @findex gdb-mouse-toggle-breakpoint
-Many GDB commands can be entered using keybindings or the tool bar but
-sometimes it is quicker to use the fringe.  These commands either
-manipulate breakpoints or control program execution.  When there is no
-fringe, you can use the margin but this is only present when the
-source file already has a breakpoint.
-
-You can click @kbd{Mouse-1} in the fringe or display margin of a
-source buffer to set a breakpoint there and, on a graphical display, a
-red bullet will appear on that line.  If a breakpoint already exists
-on that line, the same click will remove it.  You can also enable or
-disable a breakpoint by clicking @kbd{C-Mouse-1} on the bullet.
-
-If you drag the debugger arrow in the fringe with @kbd{Mouse-1}
-(@code{gdb-mouse-until}), execution will continue to the line where
-you release the button, provided it is still in the same frame.
-Alternatively, you can click @kbd{Mouse-3} at some point in the fringe
-of this buffer and execution will advance to there.  A similar command
-(@code{gdb-mouse-jump}) allows you to jump to a source line without
-executing the intermediate lines by clicking @kbd{C-Mouse-3}.  This
-command allows you to go backwards which can be useful for running
-through code that has already executed, in order to examine its
-execution in more detail.
-
-@table @kbd
-@item Mouse-1
-Set or clear a breakpoint.
-
-@item C-Mouse-1
-Enable or disable a breakpoint.
-
-@item Mouse-3
-Continue execution to here.
-
-@item C-Mouse-3
-Jump to here.
-@end table
-
 @node Watch Expressions
 @subsubsection Watch Expressions
 @cindex Watching expressions in GDB
--- a/man/cmdargs.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/cmdargs.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -1013,7 +1013,9 @@
 @cindex geometry, command-line argument
 Specify the size @var{width} and @var{height} (measured in character
 columns and lines), and positions @var{xoffset} and @var{yoffset}
-(measured in pixels).  This applies to all frames.
+(measured in pixels).  The @var{width} and @var{height} parameters
+apply to all frames, whereas @var{xoffset} and @var{yoffset} only to
+the initial frame.
 
 @item -fs
 @opindex -fs
--- a/man/custom.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/custom.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -2063,9 +2063,8 @@
 @cindex rebinding keys, permanently
 @cindex startup (init file)
 
-  When Emacs is started, it normally loads a Lisp program from the
-file @file{.emacs} or @file{.emacs.el} in your home directory
-(see @ref{General Variables, HOME}, if you don't know where that is).
+  When Emacs is started, it normally loads a Lisp program from the file
+@file{.emacs} or @file{.emacs.el} in your home directory (@pxref{Find Init}).
 We call this file your @dfn{init file} because it specifies how to
 initialize Emacs for you.  You can use the command line switch
 @samp{-q} to prevent loading your init file, and @samp{-u} (or
--- a/man/dired.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/dired.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -325,7 +325,7 @@
   Instead of flagging a file with @samp{D}, you can @dfn{mark} the
 file with some other character (usually @samp{*}).  Most Dired
 commands to operate on files use the files marked with @samp{*}.  The
-only command that operates on flagged flies is @kbd{x}, which expunges
+only command that operates on flagged files is @kbd{x}, which expunges
 them.
 
   Here are some commands for marking with @samp{*}, for unmarking, and
@@ -550,34 +550,38 @@
 @item C @var{new} @key{RET}
 Copy the specified files (@code{dired-do-copy}).  The argument @var{new}
 is the directory to copy into, or (if copying a single file) the new
-name.
+name.  This is like the shell command @code{cp}.
 
 @vindex dired-copy-preserve-time
 If @code{dired-copy-preserve-time} is non-@code{nil}, then copying
 with this command preserves the modification time of the old file in
-the copy.
+the copy, like @samp{cp -p}.
 
 @vindex dired-recursive-copies
 @cindex recursive copying
 The variable @code{dired-recursive-copies} controls whether to copy
-directories recursively.  The default is @code{nil}, which means that
-directories cannot be copied.
+directories recursively (like @samp{cp -r}).  The default is
+@code{nil}, which means that directories cannot be copied.
 
 @item D
 @findex dired-do-delete
 @kindex D @r{(Dired)}
-Delete the specified files (@code{dired-do-delete}).  Like the other
-commands in this section, this command operates on the @emph{marked}
-files, or the next @var{n} files.  By contrast, @kbd{x}
+Delete the specified files (@code{dired-do-delete}).  This is like the
+shell command @code{rm}.
+
+Like the other commands in this section, this command operates on the
+@emph{marked} files, or the next @var{n} files.  By contrast, @kbd{x}
 (@code{dired-do-flagged-delete}) deletes all @dfn{flagged} files.
 
 @findex dired-do-rename
 @kindex R @r{(Dired)}
 @cindex renaming files (in Dired)
+@cindex moving files (in Dired)
 @item R @var{new} @key{RET}
-Rename the specified files (@code{dired-do-rename}).  The argument
-@var{new} is the directory to rename into, or (if renaming a single
-file) the new name.
+Rename the specified files (@code{dired-do-rename}).  If you rename a
+single file, the argument @var{new} is the new name of the file.  If
+you rename several files, the argument @var{new} is the directory into
+which to move the files (this is like the shell command @code{mv}).
 
 Dired automatically changes the visited file name of buffers associated
 with renamed files so that they refer to the new names.
@@ -586,17 +590,19 @@
 @kindex H @r{(Dired)}
 @cindex hard links (in Dired)
 @item H @var{new} @key{RET}
-Make hard links to the specified files (@code{dired-do-hardlink}).  The
-argument @var{new} is the directory to make the links in, or (if making
-just one link) the name to give the link.
+Make hard links to the specified files (@code{dired-do-hardlink}).
+This is like the shell command @code{ln}.  The argument @var{new} is
+the directory to make the links in, or (if making just one link) the
+name to give the link.
 
 @findex dired-do-symlink
 @kindex S @r{(Dired)}
 @cindex symbolic links (creation in Dired)
 @item S @var{new} @key{RET}
 Make symbolic links to the specified files (@code{dired-do-symlink}).
-The argument @var{new} is the directory to make the links in, or (if
-making just one link) the name to give the link.
+This is like @samp{ln -s}.  The argument @var{new} is the directory to
+make the links in, or (if making just one link) the name to give the
+link.
 
 @findex dired-do-chmod
 @kindex M @r{(Dired)}
@@ -631,7 +637,8 @@
 @cindex changing file time (in Dired)
 @item T @var{timestamp} @key{RET}
 Touch the specified files (@code{dired-do-touch}).  This means
-updating their modification times to the present time.
+updating their modification times to the present time.  This is like
+the shell command @code{touch}.
 
 @findex dired-do-print
 @kindex P @r{(Dired)}
--- a/man/display.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/display.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -1215,6 +1215,17 @@
 assume, when resumed, that the screen page it is using still contains
 what Emacs last wrote there.
 
+@vindex overline-margin
+  On graphical display, this variables specifies the number of pixes
+the overline is shown above the text.  The value includes the height of
+the overline itself (1 pixel).  The default value is 2 pixels.
+
+@vindex x-underline-at-descent-line
+  On graphical display, the underline is normally drawn at the
+baseline level of the font.  If @code{x-underline-at-descent-line} is
+non-@code{nil}, the underline is drawn at the same position as the
+font's decent line.
+
 @ignore
    arch-tag: 2219f910-2ff0-4521-b059-1bd231a536c4
 @end ignore
--- a/man/emacs.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/emacs.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -272,9 +272,9 @@
 * Key Help::		Asking what a key does in Emacs.
 * Name Help::		Asking about a command, variable or function name.
 * Apropos::		Asking what pertains to a given topic.
+* Help Mode::           Special features of Help mode and Help buffers.
 * Library Keywords::	Finding Lisp libraries by keywords (topics).
 * Language Help::       Help relating to international language support.
-* Help Mode::           Special features of Help mode and Help buffers.
 * Misc Help::		Other help commands.
 * Help Files::          Commands to display pre-written help files.
 * Help Echo::           Help on active text and tooltips (`balloon help')
--- a/man/entering.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/entering.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -69,20 +69,19 @@
 @cindex leaving Emacs
 @cindex quitting Emacs
 
-  There are two commands for exiting Emacs, and three kinds of exiting:
-@dfn{suspending} Emacs, @dfn{Iconifying} Emacs, and @dfn{killing}
-Emacs.
+  There are two commands for exiting Emacs, and three kinds of
+exiting: @dfn{iconifying} Emacs, @dfn{suspending} Emacs, and
+@dfn{killing} Emacs.
+
+  @dfn{Iconifying} means replacing the Emacs frame with a small box or
+``icon'' on the screen.  This is the usual way to exit Emacs when
+you're using a graphical display---if you bother to ``exit'' at all.
+(Just switching to another application is usually sufficient.)
 
   @dfn{Suspending} means stopping Emacs temporarily and returning
-control to its parent process (usually a shell), allowing you to resume
-editing later in the same Emacs job, with the same buffers, same kill
-ring, same undo history, and so on.  This is the usual way to exit Emacs
-when running on a text terminal.
-
-  @dfn{Iconifying} means replacing the Emacs frame with a small box
-somewhere on the screen.  This is the usual way to exit Emacs when you're
-using a graphics terminal---if you bother to ``exit'' at all.  (Just switching
-to another application is usually sufficient.)
+control to its parent process (usually a shell), allowing you to
+resume editing later in the same Emacs job.  This is the usual way to
+exit Emacs when running it on a text terminal.
 
   @dfn{Killing} Emacs means destroying the Emacs job.  You can run Emacs
 again later, but you will get a fresh Emacs; there is no way to resume
@@ -97,12 +96,18 @@
 @end table
 
 @kindex C-z
+@findex iconify-or-deiconify-frame
+  On graphical displays, @kbd{C-z} runs the command
+@code{iconify-or-deiconify-frame}, which temporarily iconifies (or
+``minimizes'') the selected Emacs frame (@pxref{Frames}).  You can
+then use the window manager to select some other application.  (You
+could select another application without iconifying Emacs first, but
+getting the Emacs frame out of the way can make it more convenient to
+find the other application.)
+
 @findex suspend-emacs
-  To suspend or iconify Emacs, type @kbd{C-z} (@code{suspend-emacs}).
-On text terminals, this suspends Emacs.  On graphical displays,
-it iconifies the Emacs frame.
-
-  Suspending Emacs takes you back to the shell from which you invoked
+  On a text terminal, @kbd{C-z} runs the command @code{suspend-emacs}.
+Suspending Emacs takes you back to the shell from which you invoked
 Emacs.  You can resume Emacs with the shell command @command{%emacs}
 in most common shells.  On systems that don't support suspending
 programs, @kbd{C-z} starts an inferior shell that communicates
@@ -112,19 +117,12 @@
 systems, you can only get back to the shell from which Emacs was run
 (to log out, for example) when you kill Emacs.
 
+@vindex cannot-suspend
   Suspending can fail if you run Emacs under a shell that doesn't
-support suspending programs, even if the system itself does support
-it.  In such a case, you can set the variable @code{cannot-suspend} to
-a non-@code{nil} value to force @kbd{C-z} to start an inferior shell.
-(One might also describe Emacs's parent shell as ``inferior'' for
-failing to support job control properly, but that is a matter of
-taste.)
-
-  On graphical displays, @kbd{C-z} has a different meaning: it runs
-the command @code{iconify-or-deiconify-frame}, which temporarily
-iconifies (or ``minimizes'') the selected Emacs frame
-(@pxref{Frames}).  Then you can use the window manager to get back to
-a shell window.
+support suspendion of its subjobs, even if the system itself does
+support it.  In such a case, you can set the variable
+@code{cannot-suspend} to a non-@code{nil} value to force @kbd{C-z} to
+start an inferior shell.
 
 @kindex C-x C-c
 @findex save-buffers-kill-emacs
--- a/man/erc.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/erc.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -12,7 +12,7 @@
 @syncodeindex fn cp
 
 @copying
-This manual is for ERC version 5.1.3.
+This manual is for ERC version 5.1.4.
 
 Copyright @copyright{} 2005, 2006 Free Software Foundation, Inc.
 
--- a/man/faq.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/faq.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -1146,16 +1146,28 @@
 @cindex Emacs 22, new features in
 @cindex Recently introduced features
 
-@c FIXME: Improve this node before the 22.1 release.
 @cindex Default features
-Font-lock mode, auto-compression mode, and file name shadow mode are now
-enabled by default.  It is now possible to follow links with
-@kbd{mouse-1}.
-
-@cindex Supported systems
-Emacs 22 features support for GNU/Linux systems on S390 and X86-64
-machines, as well as support for the Mac OS X and Cygwin operating
-systems.
+Font Lock mode, auto-compression mode, and file name shadow mode are now
+enabled by default.  On graphics displays it is now possible to follow
+links with @kbd{mouse-1}, and the modeline of the selected window is now
+highlighted.  Window fringes are now customizable.  The minibuffer
+prompt is now displayed in a distinct face.
+
+Emacs now reads abbrev definitions automatically at startup.  The
+maximum size of buffers has been doubled and is now 256M on 32-bit
+machines.  Grep mode is now separate from Compilation mode and has many
+new specific options and commands.
+
+The original Emacs macro system has been replaced by the new Kmacro
+package, which provides many new commands and features and a simple
+interface that uses the function keys F3 and F4.  Macros are now stored
+in a macro ring, and can be debugged and edited interactively.
+
+The GUD (Grand Unified Debugger) package can now be used with a full
+graphical user interface to the debugger which provides many features
+found in traditional development environments, making it easy to
+manipulate breakpoints, add watch points, display the call stack, etc.
+Breakpoints are now displayed in the source buffer.
 
 @cindex GTK+ Toolkit
 @cindex Drag-and-drop
@@ -1164,15 +1176,39 @@
 operation on X.  Mouse wheel support is now enabled by default.
 
 @cindex New modes
-Many new modes and packages have been included in Emacs, such as Leim,
-Calc, Tramp and URL, as well as IDO, CUA, rcirc, ERC, conf-mode,
-python-mode, table, tumme, SES, ruler, Flymake, Org, PGG, etc.
+Many new modes and packages have been included in Emacs, such as Calc,
+Tramp and URL, as well as IDO, CUA, rcirc, ERC, conf-mode, python-mode,
+table, tumme, SES, ruler, Flymake, Org, PGG, wdired, t-mouse, longlines,
+dns-mode, savehist, Password, Printing, Reveal, etc.
+
+@cindex Multilingual Environment
+Leim is now part of Emacs.  Unicode support has been much improved, and
+the following input methods have been added: belarusian, bulgarian-bds,
+bulgarian-phonetic, chinese-sisheng, croatian, dutch, georgian,
+latin-alt-postfix, latin-postfix, latin-prefix, latvian-keyboard,
+lithuanian-numeric, lithuanian-keyboard, malayalam-inscript, rfc1345,
+russian-computer, sgml, slovenian, tamil-inscript ucs,
+ukrainian-computer, vietnamese-telex, and welsh.
+
+The following language environment have also been added: Belarusian,
+Bulgarian, Chinese-EUC-TW, Croatian, French, Georgian, Italian, Latin-6,
+Latin-7, Latvian, Lithuanian, Malayalam, Russian, Russian, Slovenian,
+Swedish, Tajik, Tamil, UTF-8, Ukrainian, Ukrainian, Welsh, and
+Windows-1255.
+
+@cindex Supported systems
+Emacs 22 features support for GNU/Linux systems on S390 and x86-64
+machines, as well as support for the Mac OS X and Cygwin operating
+systems.
 
 @cindex Documentation
 @cindex Emacs Lisp Manual
 In addition, Emacs 22 now includes the Emacs Lisp Reference Manual
 (@pxref{Emacs Lisp documentation}) and the Emacs Lisp Intro.
 
+Many other changes have been made in Emacs 22, use @kbd{C-h n} to get a
+full list.
+
 @c ------------------------------------------------------------
 @node    Common requests, Bugs and problems, Status of Emacs, Top
 @chapter Common requests
@@ -4837,6 +4873,7 @@
 * Inputting eight-bit characters::
 * Kanji and Chinese characters::
 * Right-to-left alphabets::
+* How to add fonts::
 @end menu
 
 @node Emacs does not display 8-bit characters, Inputting eight-bit characters, Alternate character sets, Alternate character sets
@@ -4876,7 +4913,7 @@
 Enhancement to Emacs.  @xref{Installing Emacs}, for information on where
 to find and download the latest version of Emacs.
 
-@node Right-to-left alphabets,  , Kanji and Chinese characters, Alternate character sets
+@node Right-to-left alphabets, How to add fonts, Kanji and Chinese characters, Alternate character sets
 @section Where is an Emacs that can handle Semitic (right-to-left) alphabets?
 @cindex Right-to-left alphabets
 @cindex Hebrew, handling with Emacs
@@ -4896,8 +4933,128 @@
 @file{hebrew.el} requires a Hebrew screen font, but no other hardware support.
 Joel has a screen font for PCs running MS-DOS or GNU/Linux.
 
-You might also try to query archie for files named with @file{hebrew};
-several ftp sites in Israel may also have the necessary files.
+You might also try querying @code{archie} for files named with
+@file{hebrew}; several ftp sites in Israel may also have the necessary
+files.
+
+@node How to add fonts,  , Right-to-left alphabets, Alternate character sets
+@section How do I add fonts for use with Emacs?
+@cindex add fonts for use with Emacs
+@cindex intlfonts
+
+First, download and install the BDF font files and any auxiliary
+packages they need.  The GNU Intlfonts distribution can be found on
+@uref{http://directory.fsf.org/localization/intlfonts.html, the GNU
+Software Directory Web site}.
+
+Next, if you are on X Window system, issue the following two commands
+from the shell's prompt:
+
+@example
+  xset +fp /usr/local/share/emacs/fonts
+  xset fp rehash
+@end example
+
+@noindent
+(Modify the first command if you installed the fonts in a directory
+that is not @file{/usr/local/share/emacs/fonts}.)  You also need to
+arrange for these two commands to run whenever you log in, e.g., by
+adding them to your window-system startup file, such as
+@file{~/.xsessionrc} or @file{~/.gnomerc}.
+
+Now, add the following line to your @file{~/.emacs} init file:
+
+@lisp
+  (add-to-list 'bdf-directory-list "/usr/share/emacs/fonts/bdf")
+@end lisp
+
+@noindent
+(Again, modify the file name if you installed the fonts elsewhere.)
+
+Finally, if you wish to use the installed fonts with @code{ps-print},
+add the following line to your @file{~/.emacs}:
+
+@lisp
+  (setq ps-multibyte-buffer 'bdf-font-except-latin)
+@end lisp
+
+A few additional steps are necessary for MS-Windows; they are listed
+below.
+
+First, make sure @emph{all} the directories with BDF font files are
+mentioned in @code{bdf-directory-list}.  On Unix and GNU/Linux
+systems, one normally runs @kbd{make install} to install the BDF fonts
+in the same directory.  By contrast, Windows users typically don't run
+the Intlfonts installation command, but unpack the distribution in
+some directory, which leaves the BDF fonts in its subdirectories.  For
+example, assume that you unpacked Intlfonts in @file{C:/Intlfonts};
+then you should set @code{bdf-directory-list} as follows:
+
+@lisp
+  (setq bdf-directory-list
+    '("C:/Intlfonts/Asian"
+      "C:/Intlfonts/Chinese" "C:/Intlfonts/Chinese.X"
+      "C:/Intlfonts/Chinese.BIG" "C:/Intlfonts/Ethiopic"
+      "C:/Intlfonts/European" "C:/Intlfonts/European.BIG"
+      "C:/Intlfonts/Japanese" "C:/Intlfonts/Japanese.X"
+      "C:/Intlfonts/Japanese.BIG" "C:/Intlfonts/Korean.X"
+      "C:/Intlfonts/Misc"))
+@end lisp
+
+@cindex @code{w32-bdf-filename-alist}
+@cindex @code{w32-find-bdf-fonts}
+Next, you need to set up the variable @code{w32-bdf-filename-alist} to
+an alist of the BDF fonts and their corresponding file names.
+Assuming you have set @code{bdf-directory-list} to name all the
+directories with the BDF font files, the following Lisp snippet will
+set up @code{w32-bdf-filename-alist}:
+
+@lisp
+  (setq w32-bdf-filename-alist
+     (w32-find-bdf-fonts bdf-directory-list))
+@end lisp
+
+Now, create fontsets for the BDF fonts:
+
+@lisp
+  (create-fontset-from-fontset-spec
+   "-*-fixed-medium-r-normal-*-16-*-*-*-c-*-fontset-bdf,
+   japanese-jisx0208:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1983-*,
+   katakana-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*,
+   latin-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*,
+   japanese-jisx0208-1978:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1978-*,
+   thai-tis620:-misc-fixed-medium-r-normal--16-160-72-72-m-80-tis620.2529-1,
+   lao:-misc-fixed-medium-r-normal--16-160-72-72-m-80-MuleLao-1,
+   tibetan-1-column:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-80-MuleTibetan-1,
+   ethiopic:-Admas-Ethiomx16f-Medium-R-Normal--16-150-100-100-M-160-Ethiopic-Unicode,
+   tibetan:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-160-MuleTibetan-0")
+@end lisp
+
+Many of the international bdf fonts from Intlfonts are type 0, and
+therefore need to be added to font-encoding-alist:
+
+@lisp
+  (setq font-encoding-alist
+        (append '(("MuleTibetan-0" (tibetan . 0))
+                  ("GB2312"        (chinese-gb2312 . 0))
+                  ("JISX0208"      (japanese-jisx0208 . 0))
+                  ("JISX0212"      (japanese-jisx0212 . 0))
+                  ("VISCII"        (vietnamese-viscii-lower . 0))
+                  ("KSC5601"       (korean-ksc5601 . 0))
+                  ("MuleArabic-0"  (arabic-digit . 0))
+                  ("MuleArabic-1"  (arabic-1-column . 0))
+                  ("MuleArabic-2"  (arabic-2-column . 0)))
+                font-encoding-alist))
+@end lisp
+
+You can now use the Emacs font menu to select the @samp{bdf: 16-dot medium}
+fontset, or you can select it by setting the default font in your
+@file{~/.emacs}:
+
+@lisp
+  (set-default-font "fontset-bdf")
+@end lisp
+
 
 @c ------------------------------------------------------------
 @node Mail and news, Concept index, Alternate character sets, Top
--- a/man/gnus.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/gnus.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -9372,11 +9372,15 @@
 
 @item gnus-article-emulate-mime
 @vindex gnus-article-emulate-mime
+@cindex uuencode
+@cindex yEnc
 There are other, non-@acronym{MIME} encoding methods used.  The most common
 is @samp{uuencode}, but yEncode is also getting to be popular.  If
 this variable is non-@code{nil}, Gnus will look in message bodies to
 see if it finds these encodings, and if so, it'll run them through the
-Gnus @acronym{MIME} machinery.  The default is @code{t}.
+Gnus @acronym{MIME} machinery.  The default is @code{t}.  Only
+single-part yEnc encoded attachments can be decoded.  There's no support
+for encoding in Gnus.
 
 @item gnus-unbuttonized-mime-types
 @vindex gnus-unbuttonized-mime-types
@@ -26075,6 +26079,14 @@
 isn't save in general.
 
 @item
+Lisp files are now installed in @file{.../site-lisp/gnus/} by default.
+It defaulted to @file{.../site-lisp/} formerly.  In addition to this,
+the new installer issues a warning if other Gnus installations which
+will shadow the latest one are detected.  You can then remove those
+shadows manually or remove them using @code{make
+remove-installed-shadows}.
+
+@item
 New @file{make.bat} for compiling and installing Gnus under MS Windows
 
 Use @file{make.bat} if you want to install Gnus under MS Windows, the
--- a/man/help.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/help.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -74,9 +74,9 @@
 * Key Help::		Asking what a key does in Emacs.
 * Name Help::		Asking about a command, variable or function name.
 * Apropos::		Asking what pertains to a given topic.
+* Help Mode::           Special features of Help mode and Help buffers.
 * Library Keywords::	Finding Lisp libraries by keywords (topics).
 * Language Help::       Help relating to international language support.
-* Help Mode::           Special features of Help mode and Help buffers.
 * Misc Help::		Other help commands.
 * Help Files::          Commands to display pre-written help files.
 * Help Echo::           Help on active text and tooltips (`balloon help')
@@ -251,6 +251,8 @@
 @kbd{C-h f} command if you don't really want to view the
 documentation.
 
+@kindex C-h v
+@findex describe-variable
   @kbd{C-h v} (@code{describe-variable}) is like @kbd{C-h f} but
 describes Lisp variables instead of Lisp functions.  Its default is
 the Lisp symbol around or before point, if that is the name of a
@@ -388,6 +390,62 @@
 the variable @code{apropos-documentation-sort-by-scores} is
 @code{nil}, apropos lists the symbols found in alphabetical order.
 
+@node Help Mode
+@section Help Mode Commands
+
+  Help buffers provide the same commands as View mode (@pxref{Misc File
+Ops}), plus a few special commands of their own.
+
+@table @kbd
+@item @key{SPC}
+Scroll forward.
+@item @key{DEL}
+Scroll backward.
+@item @key{RET}
+Follow a cross reference at point.
+@item @key{TAB}
+Move point forward to the next cross reference.
+@item S-@key{TAB}
+Move point back to the previous cross reference.
+@item Mouse-1
+@itemx Mouse-2
+Follow a cross reference that you click on.
+@item C-c C-c
+Show all documentation about the symbol at point.
+@end table
+
+  When a function name (@pxref{M-x,, Running Commands by Name}),
+variable name (@pxref{Variables}), or face name (@pxref{Faces})
+appears in the documentation, it normally appears inside paired
+single-quotes.  To view the documentation of that command, variable or
+face, you can click on the name with @kbd{Mouse-1} or @kbd{Mouse-2},
+or move point there and type @key{RET}.  Use @kbd{C-c C-b} to retrace
+your steps.
+
+@cindex URL, viewing in help
+@cindex help, viewing web pages
+@cindex viewing web pages in help
+@cindex web pages, viewing in help
+@findex browse-url
+  You can follow cross references to URLs (web pages) also.  This uses
+the @code{browse-url} command to view the page in the browser you
+choose.  @xref{Browse-URL}.
+
+@kindex @key{TAB} @r{(Help mode)}
+@findex help-next-ref
+@kindex S-@key{TAB} @r{(Help mode)}
+@findex help-previous-ref
+  There are convenient commands to move point to cross references in
+the help text.  @key{TAB} (@code{help-next-ref}) moves point down to
+the next cross reference.  @kbd{S-@key{TAB}} moves up to the previous
+cross reference (@code{help-previous-ref}).
+
+  To view all documentation about any symbol name that appears in the
+text, move point to the symbol name and type @kbd{C-c C-c}
+(@code{help-follow-symbol}).  This shows all available documentation
+about the symbol as a variable, function and/or face.  As above, use
+@kbd{C-c C-b} to retrace your steps.
+
 @node Library Keywords
 @section Keyword Search for Lisp Libraries
 
@@ -458,62 +516,6 @@
 coding systems---either a specified coding system, or the ones
 currently in use.  @xref{Coding Systems}.
 
-@node Help Mode
-@section Help Mode Commands
-
-  Help buffers provide the same commands as View mode (@pxref{Misc File
-Ops}), plus a few special commands of their own.
-
-@table @kbd
-@item @key{SPC}
-Scroll forward.
-@item @key{DEL}
-Scroll backward.
-@item @key{RET}
-Follow a cross reference at point.
-@item @key{TAB}
-Move point forward to the next cross reference.
-@item S-@key{TAB}
-Move point back to the previous cross reference.
-@item Mouse-1
-@itemx Mouse-2
-Follow a cross reference that you click on.
-@item C-c C-c
-Show all documentation about the symbol at point.
-@end table
-
-  When a function name (@pxref{M-x,, Running Commands by Name}),
-variable name (@pxref{Variables}), or face name (@pxref{Faces})
-appears in the documentation, it normally appears inside paired
-single-quotes.  To view the documentation of that command, variable or
-face, you can click on the name with @kbd{Mouse-1} or @kbd{Mouse-2},
-or move point there and type @key{RET}.  Use @kbd{C-c C-b} to retrace
-your steps.
-
-@cindex URL, viewing in help
-@cindex help, viewing web pages
-@cindex viewing web pages in help
-@cindex web pages, viewing in help
-@findex browse-url
-  You can follow cross references to URLs (web pages) also.  This uses
-the @code{browse-url} command to view the page in the browser you
-choose.  @xref{Browse-URL}.
-
-@kindex @key{TAB} @r{(Help mode)}
-@findex help-next-ref
-@kindex S-@key{TAB} @r{(Help mode)}
-@findex help-previous-ref
-  There are convenient commands to move point to cross references in
-the help text.  @key{TAB} (@code{help-next-ref}) moves point down to
-the next cross reference.  @kbd{S-@key{TAB}} moves up to the previous
-cross reference (@code{help-previous-ref}).
-
-  To view all documentation about any symbol name that appears in the
-text, move point to the symbol name and type @kbd{C-c C-c}
-(@code{help-follow-symbol}).  This shows all available documentation
-about the symbol as a variable, function and/or face.  As above, use
-@kbd{C-c C-b} to retrace your steps.
-
 @node Misc Help
 @section Other Help Commands
 
--- a/man/mark.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/mark.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -139,21 +139,23 @@
   On a terminal that supports colors, Emacs has the ability to
 highlight the current region.  But normally it does not.  Why not?
 
-  Once you have set the mark in a buffer, there is @emph{always} a
-region in that buffer.  This is because every command that sets the
-mark also activates it, and nothing ever deactivates it.  Highlighting
-the region all the time would be a nuisance.  So normally Emacs
-highlights the region only immediately after you have selected one
-with the mouse.
+  In the normal mode of use, every command that sets the mark also
+activates it, and nothing ever deactivates it.  Thus, once you have
+set the mark in a buffer, there is @emph{always} a region in that
+buffer.  Highlighting the region all the time would be a nuisance.  So
+normally Emacs highlights the region only immediately after you have
+selected one with the mouse.
 
   If you want region highlighting, you can use Transient Mark mode.
-This is a more rigid mode of operation in which the region always
-``lasts'' only until you use it; you explicitly must set up a region
-for each command that uses one.  In Transient Mark mode, most of the
-time there is no region; therefore, highlighting the region when it
-exists is useful and not annoying.  When Transient Mark mode is
-enabled, Emacs always highlights the region whenever there is a
-region.
+This is a more rigid mode of operation in which the region ``lasts''
+only until you use it; operating on the region text deactivates the
+mark, so there is no region any more.  Therefore, you must explicitly
+set up a region for each command that uses one.
+
+  When Transient Mark mode is enabled, Emacs highlights the region,
+whenever there is a region.  In Transient Mark mode, most of the time
+there is no region; therefore, highlighting the region when it exists
+is useful and not annoying.
 
 @findex transient-mark-mode
   To enable Transient Mark mode, type @kbd{M-x transient-mark-mode}.
@@ -367,7 +369,7 @@
 
   Finally, @kbd{C-x h} (@code{mark-whole-buffer}) sets up the entire
 buffer as the region, by putting point at the beginning and the mark at
-the end.
+the end.  (In some programs this is called ``select all.'')
 
   In Transient Mark mode, all of these commands activate the mark.
 
--- a/man/misc.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/misc.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -1998,8 +1998,9 @@
 @findex desktop-save
 @vindex desktop-save-mode
   You can save the desktop manually with the command @kbd{M-x
-desktop-save}.  You can also enable automatic desktop saving when
-you exit Emacs: use the Customization buffer (@pxref{Easy
+desktop-save}.  You can also enable automatic saving of the desktop
+when you exit Emacs, and automatic restoration of the last saved
+desktop when Emacs starts: use the Customization buffer (@pxref{Easy
 Customization}) to set @code{desktop-save-mode} to @code{t} for future
 sessions, or add this line in your @file{~/.emacs} file:
 
@@ -2009,7 +2010,8 @@
 
 @findex desktop-change-dir
 @findex desktop-revert
-  When Emacs starts, it looks for a saved desktop in the current
+  If you turn on @code{desktop-save-mode} in your @file{~/.emacs},
+then when Emacs starts, it looks for a saved desktop in the current
 directory.  Thus, you can have separate saved desktops in different
 directories, and the starting directory determines which one Emacs
 reloads.  You can save the current desktop and reload one saved in
@@ -2018,7 +2020,10 @@
 
   Specify the option @samp{--no-desktop} on the command line when you
 don't want it to reload any saved desktop.  This turns off
-@code{desktop-save-mode} for the current session.
+@code{desktop-save-mode} for the current session.  Starting Emacs with
+the @samp{--no-init-file} option also disables desktop reloading,
+since it bypasses the @file{.emacs} init file, where
+@code{desktop-save-mode} is usually turned on.
 
 @vindex desktop-restore-eager
   By default, all the buffers in the desktop are restored at one go.
--- a/man/mule.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/mule.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -785,7 +785,7 @@
 correspondence.  There is a special function
 @code{modify-coding-system-alist} for adding elements to this list.  For
 example, to read and write all @samp{.txt} files using the coding system
-@code{china-iso-8bit}, you can execute this Lisp expression:
+@code{chinese-iso-8bit}, you can execute this Lisp expression:
 
 @smallexample
 (modify-coding-system-alist 'file "\\.txt\\'" 'chinese-iso-8bit)
@@ -1003,7 +1003,7 @@
 contains characters that the coding system cannot handle.
 
   Other file commands affected by a specified coding system include
-@kbd{C-x C-i} and @kbd{C-x C-v}, as well as the other-window variants
+@kbd{C-x i} and @kbd{C-x C-v}, as well as the other-window variants
 of @kbd{C-x C-f}.  @kbd{C-x @key{RET} c} also affects commands that
 start subprocesses, including @kbd{M-x shell} (@pxref{Shell}).  If the
 immediately following command does not use the coding system, then
--- a/man/org.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/org.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -3,8 +3,8 @@
 @setfilename ../info/org
 @settitle Org Mode Manual
 
-@set VERSION 4.43
-@set DATE July 2006
+@set VERSION 4.44
+@set DATE August 2006
 
 @dircategory Emacs
 @direntry
@@ -98,7 +98,8 @@
 Introduction
 
 * Summary::                     Brief summary of what Org-mode does
-* Installation::                How to install Org-mode
+* Installation::                How to install a downloaded version of Org-mode
+* Activation::                  How to activate Org-mode for certain buffers.
 * Feedback::                    Bug reports, ideas, patches etc.
 
 Document Structure
@@ -270,7 +271,8 @@
 
 @menu
 * Summary::                     Brief summary of what Org-mode does
-* Installation::                How to install Org-mode
+* Installation::                How to install a downloaded version of Org-mode
+* Activation::                  How to activate Org-mode for certain buffers.
 * Feedback::                    Bug reports, ideas, patches etc.
 @end menu
 
@@ -323,18 +325,68 @@
 
 @page
 
-@node Installation, Feedback, Summary, Introduction
-@section Installation and Activation
+@node Installation, Activation, Summary, Introduction
+@section Installation
 @cindex installation
+@cindex XEmacs
+
+@b{Important:} If Org-mode is part of the Emacs distribution or an
+XEmacs package, please skip this section and go directly to
+@ref{Activation}.
+
+If you have downloaded Org-mode from the Web, you must take the
+following steps to install it: Go into the Org-mode distribution
+directory and edit the top section of the file @file{Makefile}.  You
+must set the name of the Emacs binary (likely either @file{emacs} or
+@file{xemacs}), and the paths to the directories where local Lisp and
+Info files are kept.  If you don't have access to the system-wide
+directories, create your own two directories for these files, enter them
+into the Makefile, and make sure Emacs finds the Lisp files by adding
+the following line to @file{.emacs}:
+
+@example
+(setq load-path (cons "~/path/to/lispdir" load-path))
+@end example
+
+@b{XEmacs users now need to install the file @file{noutline.el} from
+the @file{xemacs} subdirectory of the Org-mode distribution.  Use the
+command:}
+
+@example
+@b{make install-noutline}
+@end example
+
+@noindent Now byte-compile and install the Lisp files with the shell
+commands:
+
+@example
+make
+make install
+@end example
+
+@noindent If you want to install the info documentation, use this command:
+
+@example
+make install-info
+@end example
+
+@noindent Then add to @file{.emacs}:
+
+@lisp
+;; This line only if org-mode is not part of the X/Emacs distribution.
+(require 'org-install)
+@end lisp
+
+@node Activation, Feedback, Installation, Introduction
+@section Activation
+@cindex activation
 @cindex autoload
 @cindex global keybindings
 @cindex keybindings, global
 
-If Org-mode is part of the Emacs distribution or an XEmacs package,
-you only need to copy the following lines to your @file{.emacs} file.
-The last two lines define @emph{global} keys for the commands
-@command{org-store-link} and @command{org-agenda} - please
-choose suitable keys yourself.
+Add the following lines to your @file{.emacs} file.  The last two lines
+define @emph{global} keys for the commands @command{org-store-link} and
+@command{org-agenda} - please choose suitable keys yourself.
 
 @lisp
 ;; The following lines are always needed.  Choose your own keys.
@@ -345,30 +397,17 @@
 
 Furthermore, you must activate @code{font-lock-mode} in org-mode
 buffers, because significant functionality depends on font-locking being
-active.  You can do this with either one of the following two lines:
+active.  You can do this with either one of the following two lines
+(XEmacs user must use the second option):
 @lisp
 (global-font-lock-mode 1)                     ; for all buffers
 (add-hook 'org-mode-hook 'turn-on-font-lock)  ; org-mode buffers only
 @end lisp
 
-If you have downloaded Org-mode from the Web, you must take additional
-action:  Byte-compile @file{org.el} and @file{org-publish.el} and put
-them together with @file{org-install.el} on your load path.  Then add to
-@file{.emacs}:
-
-@lisp
-;; This line only if org-mode is not part of the X/Emacs distribution.
-(require 'org-install)
-@end lisp
-
-If you use Org-mode with XEmacs, you also need to install the file
-@file{noutline.el} from the @file{xemacs} subdirectory of the Org-mode
-distribution.
-
 @cindex org-mode, turning on
-With this setup, all files with extension @samp{.org} will be put into
-Org-mode.  As an alternative, make the first line of a file look like
-this:
+With this setup, all files with extension @samp{.org} will be put
+into Org-mode.  As an alternative, make the first line of a file look
+like this:
 
 @example
 MY PROJECTS    -*- mode: org; -*-
@@ -378,7 +417,7 @@
 the file's name is.  See also the variable
 @code{org-insert-mode-line-in-empty-file}.
 
-@node Feedback,  , Installation, Introduction
+@node Feedback,  , Activation, Introduction
 @section Feedback
 @cindex feedback
 @cindex bug reports
@@ -826,8 +865,14 @@
 @end group
 @end example
 
-Org-mode supports these lists by tuning filling and wrapping commands
-to deal with them correctly.  
+Org-mode supports these lists by tuning filling and wrapping commands to
+deal with them correctly@footnote{Org-mode only changes the filling
+settings for Emacs.  For XEmacs, you should use Kyle E. Jones'
+@file{filladapt.el}.  To turn is on,  put into @file{.emacs}:
+@example
+(require 'filladapt)
+@end example
+}.
 
 The following commands act on items when the cursor is in the first line
 of an item (the line with the bullet or number).
@@ -2160,7 +2205,7 @@
 
 The second possibility is to use TODO keywords to indicate different
 types of action items.  For example, you might want to indicate that
-items are for ``work'' or ``home.''  If you are into David Allen's
+items are for ``work'' or ``home''.  If you are into David Allen's
 @emph{Getting Things DONE}, you might want to use todo types
 @samp{NEXTACTION}, @samp{WAITING}, @samp{MAYBE}.  Or, when you work
 with several people on a single project, you might want to assign
@@ -2547,7 +2592,12 @@
 Stop the clock (clock-out).  The inserts another timestamp at the same
 location where the clock was last started.  It also directly computes
 the resulting time in inserts it after the time range as @samp{=>
-HH:MM}.
+HH:MM}.  
+@kindex C-c C-y
+@item C-c C-y
+Recompute the time interval after changing one of the time stamps.  This
+is only necessary if you edit the time stamps directly.  If you change
+them with @kbd{S-@key{cursor}} keys, the update is automatic.
 @kindex C-c C-t
 @item C-c C-t
 Changing the TODO state of an item to DONE automatically stops the clock
@@ -2565,8 +2615,8 @@
 automatically when the buffer is changed.
 @kindex C-c C-x C-r
 @item C-c C-x C-r
-Insert a dynamic block containing a clock report as an org-mode table
-into the current file.
+Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
+report as an org-mode table into the current file.
 @example
 #+BEGIN: clocktable :maxlevel 2 :emphasize nil
 
@@ -2578,7 +2628,32 @@
 @example
 :maxlevels   @r{Maximum level depth to which times are listed in the table.}
 :emphasize   @r{When @code{t}, emphasize level one and level two items}
+:block       @r{The time block to consider.  This block is specified relative}
+             @r{to the current time and may be any of these keywords:}
+             @r{@code{today}, @code{yesterday}, @code{thisweek}, @code{lastweek},}
+             @r{@code{thismonth}, @code{lastmonth}, @code{thisyear}, or @code{lastyear}}.
+:tstart      @r{A time string specifying when to start considering times}
+:tend        @r{A time string specifying when to stop considering times}
 @end example
+So to get a clock summary for the current day, you could write
+@example
+#+BEGIN: clocktable :maxlevel 2 :block today
+
+#+END: clocktable
+@end example
+and to use a specific time range you could write@footnote{Note that all
+parameters must be specified in a single line - the line is broken here
+only to fit it onto the manual.}
+@example
+#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>" 
+                    :tend "<2006-08-10 Thu 12:00>"
+
+#+END: clocktable
+@end example
+@kindex C-u C-c C-x C-u
+@item C-u C-c C-x C-u
+Update all dynamic blocks (@pxref{Dynamic blocks}).  This is useful if
+you have several clocktable blocks in a buffer.
 @end table
 
 The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
@@ -4653,8 +4728,7 @@
 @item @file{cdlatex.el} by Carsten Dominik
 @cindex @file{cdlatex.el}
 Org-mode can make use of the cdlatex package to efficiently enter
-La@TeX{} fragments into Org-mode files.
-@file{cdlatex.el} is not part of Emacs, find it on the web.
+La@TeX{} fragments into Org-mode files. See @ref{CDLaTeX mode}.
 @item @file{remember.el} by John Wiegley
 @cindex @file{remember.el}
 Org mode cooperates with remember, see @ref{Remember}.
@@ -4784,7 +4858,7 @@
 @url{http://dto.freeshell.org/e/org-publish.el}.
 @cindex @file{org-blog.el}
 @item @file{org-blog.el} by David O'Toole
-A blogging plug-in for @file{org-publish.el}.
+A blogging plug-in for @file{org-publish.el}.@*
 @url{http://dto.freeshell.org/notebook/OrgMode.html}.
 @cindex @file{org-blogging.el}
 @item @file{org-blogging.el} by  Bastien Guerry
@@ -4805,7 +4879,7 @@
 the content of the block.
 
 @example
-#+BEGIN: myblock :parameter1 value1 :parameter2 value2 .....
+#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
 
 #+END:
 @end example
--- a/man/rcirc.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/rcirc.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -501,7 +501,7 @@
 Here is an example to illustrate how you would set it:
 
 @example
-(setq rcirc-startup-channels-alist
+(setq rcirc-authinfo
       '(("freenode" nickserv "bob" "p455w0rd")
         ("freenode" chanserv "bob" "#bobland" "passwd99")
         ("bitlbee" bitlbee "robert" "sekrit")))
--- a/man/search.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/search.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -33,6 +33,8 @@
 
 @node Incremental Search
 @section Incremental Search
+@cindex incremental search
+@cindex isearch
 
   An incremental search begins searching as soon as you type the first
 character of the search string.  As you type in the search string, Emacs
@@ -63,7 +65,6 @@
 
 @node Basic Isearch
 @subsection Basics of Incremental Search
-@cindex incremental search
 
 @kindex C-s
 @findex isearch-forward
@@ -1241,8 +1242,10 @@
 used the minibuffer to read its arguments.  @xref{Repetition, C-x ESC
 ESC}.
 
-  See also @ref{Transforming File Names}, for Dired commands to rename,
-copy, or link files by replacing regexp matches in file names.
+  @xref{Operating on Files}, for the Dired @kbd{Q} command which
+performs query replace on selected files.  See also @ref{Transforming
+File Names}, for Dired commands to rename, copy, or link files by
+replacing regexp matches in file names.
 
 @node Other Repeating Search
 @section Other Search-and-Loop Commands
--- a/man/texinfo.tex	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/texinfo.tex	Sat Oct 14 16:56:21 2006 +0000
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2006-06-19.13}
+\def\texinfoversion{2006-07-17.16}
 %
 % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free
@@ -327,9 +327,9 @@
       \pagebody{#1}%
       \ifdim\ht\footlinebox > 0pt
         % Only leave this space if the footline is nonempty.
-        % (We lessened \vsize for it in \oddfootingxxx.)
+        % (We lessened \vsize for it in \oddfootingyyy.)
         % The \baselineskip=24pt in plain's \makefootline has no effect.
-        \vskip 2\baselineskip
+        \vskip 24pt
         \unvbox\footlinebox
       \fi
       %
@@ -2051,11 +2051,11 @@
 % and arrange explicitly to hyphenate at a dash.
 %  -- rms.
 {
-  \catcode`\-=\active
-  \catcode`\_=\active
+  \catcode`\-=\active \catcode`\_=\active \catcode`\'=\active
   %
   \global\def\code{\begingroup
-    \catcode`\-=\active  \catcode`\_=\active
+    \catcode`\-=\active  \catcode`\_=\active \catcode`\'=\active
+    \let'\singlequotechar
     \ifallowcodebreaks
      \let-\codedash
      \let_\codeunder
@@ -2472,8 +2472,8 @@
   %
   % Leave some space for the footline.  Hopefully ok to assume
   % @evenfooting will not be used by itself.
-  \global\advance\pageheight by -\baselineskip
-  \global\advance\vsize by -\baselineskip
+  \global\advance\pageheight by -12pt
+  \global\advance\vsize by -12pt
 }
 
 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
@@ -5042,7 +5042,7 @@
 {\tentt \global\dimen0 = 3em}% Width of the box.
 \dimen2 = .55pt % Thickness of rules
 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
-\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
+\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt}
 %
 \setbox\errorbox=\hbox to \dimen0{\hfil
    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
@@ -5265,11 +5265,10 @@
 %
 \maketwodispenvs {lisp}{example}{%
   \nonfillstart
-  \tt
+  \tt\quoteexpand
   \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
   \gobble       % eat return
 }
-
 % @display/@smalldisplay: same as @lisp except keep current font.
 %
 \makedispenv {display}{%
@@ -5397,6 +5396,22 @@
 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
 %
 \def\starttabbox{\setbox0=\hbox\bgroup}
+
+% Allow an option to not replace quotes with a regular directed right
+% quote/apostrophe (char 0x27), but instead use the undirected quote
+% from cmtt (char 0x0d).  The undirected quote is ugly, so don't make it
+% the default, but it works for pasting with more pdf viewers (at least
+% evince), the lilypond developers report.  xpdf does work with the
+% regular 0x27.  
+% 
+\def\singlequotechar{%
+  \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
+    '%
+  \else
+    \char'15
+  \fi
+}
+%
 \begingroup
   \catcode`\^^I=\active
   \gdef\tabexpand{%
@@ -5409,7 +5424,13 @@
       \wd0=\dimen0 \box0 \starttabbox
     }%
   }
+  \catcode`\'=\active
+  \gdef\quoteexpand{%
+    \catcode`\'=\active
+    \def'{\singlequotechar}
+  }%
 \endgroup
+%
 \def\setupverbatim{%
   \let\nonarrowing = t%
   \nonfillstart
@@ -5418,6 +5439,7 @@
   \def\par{\leavevmode\egroup\box0\endgraf}%
   \catcode`\`=\active
   \tabexpand
+  \quoteexpand
   % Respect line breaks,
   % print special symbols as themselves, and
   % make each space count
--- a/man/text.texi	Sun Jul 30 10:19:46 2006 +0000
+++ b/man/text.texi	Sat Oct 14 16:56:21 2006 +0000
@@ -2067,59 +2067,61 @@
 @subsection Faces in Formatted Text
 
   The Faces submenu lists various Emacs faces including @code{bold},
-@code{italic}, and @code{underline}.  Selecting one of these adds the
-chosen face to the region.  @xref{Faces}.  You can also specify a face
-with these keyboard commands:
+@code{italic}, and @code{underline} (@pxref{Faces}).  These menu items
+operate on the region if it is active and nonempty.  Otherwise, they
+specify to use that face for an immediately following self-inserting
+character.  Instead of the menu, you can use these keyboard commands:
 
 @table @kbd
 @kindex M-o d @r{(Enriched mode)}
 @findex facemenu-set-default
 @item M-o d
-Set the region, or the next inserted character, to the @code{default} face
-(@code{facemenu-set-default}).
+Remove all @code{face} properties from the region (which includes
+specified colors), or force the following inserted character to have no
+@code{face} property (@code{facemenu-set-default}).
 @kindex M-o b @r{(Enriched mode)}
 @findex facemenu-set-bold
 @item M-o b
-Set the region, or the next inserted character, to the @code{bold} face
-(@code{facemenu-set-bold}).
+Add the face @code{bold} to the region or to the following inserted
+character (@code{facemenu-set-bold}).
 @kindex M-o i @r{(Enriched mode)}
 @findex facemenu-set-italic
 @item M-o i
-Set the region, or the next inserted character, to the @code{italic} face
-(@code{facemenu-set-italic}).
+Add the face @code{italic} to the region or to the following inserted
+character (@code{facemenu-set-italic}).
 @kindex M-o l @r{(Enriched mode)}
 @findex facemenu-set-bold-italic
 @item M-o l
-Set the region, or the next inserted character, to the @code{bold-italic} face
-(@code{facemenu-set-bold-italic}).
+Add the face @code{bold-italic} to the region or to the following
+inserted character (@code{facemenu-set-bold-italic}).
 @kindex M-o u @r{(Enriched mode)}
 @findex facemenu-set-underline
 @item M-o u
-Set the region, or the next inserted character, to the @code{underline} face
-(@code{facemenu-set-underline}).
+Add the face @code{underline} to the region or to the following inserted
+character (@code{facemenu-set-underline}).
 @kindex M-o o @r{(Enriched mode)}
 @findex facemenu-set-face
 @item M-o o @var{face} @key{RET}
-Set the region, or the next inserted character, to the face @var{face}
-(@code{facemenu-set-face}).
+Add the face @var{face} to the region or to the following inserted
+character (@code{facemenu-set-face}).
 @end table
 
-  If you use these commands with a prefix argument---or, in Transient Mark
-mode, if the region is not active---then these commands specify a face
-to use for any immediately following self-inserting input.
-@xref{Transient Mark}.  This applies to both the keyboard commands and
-the menu commands.
-
-  Specifying the @code{default} face also resets foreground and
-background color to their defaults.(@pxref{Format Colors}).
-
-  Any self-inserting character you type inherits, by default, the face
-properties (as well as most other text properties) of the preceding
-character.  Specifying any face property, including foreground or
-background color, for your next self-inserting character will prevent
-it from inheriting any face properties from the preceding character,
-although it will still inherit other text properties.  Characters
-inserted by yanking do not inherit text properties.
+   With a prefix argument, all these commands apply to an immediately
+following self-inserting character, disregarding the region.
+
+  A self-inserting character normally inherits the @code{face}
+property (and most other text properties) from the preceding character
+in the buffer.  If you use the above commands to specify face for the
+next self-inserting character, or the next section's commands to
+specify a foreground or background color for it, then it does not
+inherit the @code{face} property from the preceding character; instead
+it uses whatever you specified.  It will still inherit other text
+properties, though.
+
+  Strictly speaking, these commands apply only to the first following
+self-inserting character that you type.  But if you insert additional
+characters after it, they will inherit from the first one.  So it
+appears that these commands apply to all of them.
 
   Enriched mode defines two additional faces: @code{excerpt} and
 @code{fixed}.  These correspond to codes used in the text/enriched file
@@ -2157,8 +2159,8 @@
 
   If you specify a color with a prefix argument---or, in Transient
 Mark mode, if the region is not active---then it applies to any
-immediately following self-inserting input.  @xref{Transient Mark}.
-Otherwise, the command applies to the region.
+immediately following self-inserting input.  Otherwise, the command
+applies to the region.
 
   Each color menu contains one additional item: @samp{Other}.  You can use
 this item to specify a color that is not listed in the menu; it reads
--- a/src/.gdbinit	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/.gdbinit	Sat Oct 14 16:56:21 2006 +0000
@@ -164,6 +164,10 @@
   if ($it->current.pos.charpos != $it->current.pos.bytepos)
     printf "[%d]", $it->current.pos.bytepos
   end
+  printf " pos=%d", $it->position.charpos
+  if ($it->position.charpos != $it->position.bytepos)
+    printf "[%d]", $it->position.bytepos
+  end
   printf " start=%d", $it->start.pos.charpos
   if ($it->start.pos.charpos != $it->start.pos.bytepos)
     printf "[%d]", $it->start.pos.bytepos
@@ -218,7 +222,7 @@
   printf " max=%d+%d=%d", $it->max_ascent, $it->max_descent, $it->max_ascent+$it->max_descent
   printf "\n"
   set $i = 0
-  while ($i < $it->sp)
+  while ($i < $it->sp && $i < 4)
     set $e = $it->stack[$i]
     printf "stack[%d]: ", $i
     output $e->method
--- a/src/ChangeLog	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/ChangeLog	Sat Oct 14 16:56:21 2006 +0000
@@ -1,3 +1,308 @@
+2006-08-27  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* alloc.c (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Undo previous
+	change.  Move mutex lock/unlock operations inside BLOCK_INPUT.
+
+	* dired.c (directory_files_internal_unwind, directory_files_internal)
+	(file_name_completion): Add BLOCK_INPUT around opendir/closedir.
+
+	* image.c [MAC_OS] (image_load_qt_1): Use ComponentResult instead
+	of OSErr.
+
+	* keyboard.c (in_sighandler): Remove variable.
+	(Fcurrent_idle_time): Add missing `doc:'.
+	(input_available_signal, init_keyboard): Undo previous change.
+
+	* keyboard.h (in_sighandler): Remove extern.
+
+	* mac.c (create_apple_event_from_event_ref, select)
+	(Fmac_get_file_creator, Fmac_get_file_type, Fmac_set_file_creator)
+	(Fmac_set_file_type, cfstring_create_normalized)
+	(mac_get_system_locale, select_and_poll_event, sys_select): Use
+	OSStatus instead of OSErr.
+
+	* macfns.c [TARGET_API_MAC_CARBON] (mac_update_proxy_icon): Don't
+	use FRAME_FILE_NAME.  Use (FS)UpdateAlias.
+	(Fx_create_frame): Apply 2006-07-03 for xfns.c.
+
+	* macselect.c (get_scrap_from_symbol, clear_scrap, put_scrap_string)
+	(put_scrap_private_timestamp, scrap_has_target_type, get_scrap_string)
+	(get_scrap_private_timestamp, get_scrap_target_type_list)
+	(x_own_selection, x_get_foreign_selection)
+	(Fx_disown_selection_internal, Fx_selection_owner_p)
+	(Fx_selection_exists_p): Use OSStatus instead of OSErr.
+
+	* macterm.c (mac_draw_string_common, mac_query_char_extents)
+	(x_iconify_frame, XLoadQueryFont, install_window_handler)
+	(mac_handle_command_event, init_command_handler, init_menu_bar):
+	Use OSStatus instead of OSErr.
+	(x_free_frame_resources) [TARGET_API_MAC_CARBON]: Don't use
+	FRAME_FILE_NAME.
+	(x_query_font): Apply 2006-08-04 change for xterm.c.
+	(Qhi_command): Rename from Qhicommand.  All uses changed.
+
+	* macterm.h (struct mac_output) [TARGET_API_MAC_CARBON]: Remove member
+	file_name.
+	(FRAME_FILE_NAME): Remove macro.
+	(install_window_handler, create_apple_event_from_event_ref):
+	Return OSStatus instead of OSErr.
+
+2006-08-26  Kim F. Storm  <storm@cua.dk>
+
+	* buffer.c (Fset_buffer_multibyte):
+	* editfns.c (Fcurrent_time, Fget_internal_run_time):
+	* macfns.c (Fxw_color_values):
+	* w32fns.c (Fxw_color_values):
+	* xfns.c (Fxw_color_values): Simplify; use list3.
+
+	* fileio.c (Fmake_directory_internal, Fdelete_directory)
+	(Fdelete_file): Simplify; use list1.
+	(Frename_file, Fadd_name_to_file, Fmake_symbolic_link):
+	Simplify; remove NO_ARG_ARRAY stuff, use list2.
+
+2006-08-25  Kim F. Storm  <storm@cua.dk>
+
+	* keyboard.c (Fcurrent_idle_time): Simplify.
+
+2006-08-25  Richard Stallman  <rms@gnu.org>
+
+	* fns.c (sxhash_string): Rotate properly; don't lose bits.
+
+2006-08-24  Francesc Rocher  <francesc.rocher@gmail.com>
+
+	* xdisp.c (overline_margin): New variable.
+	(x_produce_glyphs): Use it.
+	(syms_of_xdisp): DEFVAR_INT it.
+
+	* xterm.c (x_underline_at_descent_line): New variable.
+	(syms_of_xterm): DEFVAR_BOOL it.
+	(x_draw_glyph_string): Use it.
+	Draw underline and overline up to the end of line if the face
+	extends to the end of line.
+
+	* macterm.c: Likewise.
+
+	* w32term.c: Likewise.
+
+2006-08-24  Nick Roberts  <nickrob@snap.net.nz>
+
+	* buffer.c (Fswitch_to_buffer): Move buffer to front of
+	buffer-alist if necessary.
+
+2006-08-22  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (update_tool_bar): Redisplay toolbar also when only
+	number of items changes.
+
+2006-08-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* buffer.c (Fset_buffer_multibyte): Record proper undo entry.
+
+2006-08-21  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* keyboard.c: Clarify difference between in_sighandler and
+	handling_signal.
+
+2006-08-21  Kim F. Storm  <storm@cua.dk>
+
+	* macterm.c (x_draw_stretch_glyph_string):
+	* w32term.c (x_draw_stretch_glyph_string):
+	* xterm.c (x_draw_stretch_glyph_string): It is ok to draw a
+	stretch	glyph in left marginal areas on	header and mode lines.
+
+2006-08-21  Kenichi Handa  <handa@m17n.org>
+
+	* keyboard.c (syms_of_keyboard): Docstring of
+	Vunread_post_input_method_events and Vunread_input_method_events
+	fixed.
+
+2006-08-20  Chong Yidong  <cyd@stupidchicken.com>
+
+	* keyboard.c (show_help_echo): Preserve mouse movement flag if
+	tracking mouse.
+
+2006-08-20  Richard Stallman  <rms@gnu.org>
+
+	* xfaces.c (load_pixmap): Add quotes in error message.
+
+	* keyboard.c (Fcurrent_idle_time): New function.
+	(syms_of_keyboard): defsubr it.
+
+2006-08-18  Nick Roberts  <nickrob@snap.net.nz>
+
+	* window.c (Fset_window_fringes): Do nothing on a tty.
+	(Fwindow_fringes): Put ? operator after the line break.
+
+2006-08-16  Andreas Schwab  <schwab@suse.de>
+
+	* print.c (debug_output_compilation_hack): Fix return type.
+
+2006-08-16  Richard Stallman  <rms@gnu.org>
+
+	* print.c (debug_output_compilation_hack): New function.
+
+2006-08-16  Kenichi Handa  <handa@m17n.org>
+
+	* fileio.c (choose_write_coding_system): Use LF for end-of-line
+	in auto-saving.
+
+2006-08-15  Chong Yidong  <cyd@stupidchicken.com>
+
+	* keyboard.c (read_char): Don't change idle timer state at all if
+	end_time is supplied.
+
+2006-08-15  Kenichi Handa  <handa@m17n.org>
+
+	* coding.c (ONE_MORE_BYTE_CHECK_MULTIBYTE): New arg RET.  If SRC
+	is exhausted, return with RET.
+	(detect_coding_emacs_mule, detect_coding_iso2022)
+	(detect_coding_sjis, detect_coding_big5, detect_coding_utf_8)
+	(detect_coding_utf_16, detect_coding_ccl): Adjusted for the above
+	change.
+
+2006-08-14  Chong Yidong  <cyd@stupidchicken.com>
+
+	* keyboard.c (read_char): Don't reset idle timers if a time limit
+	is supplied.
+
+2006-08-14  Kim F. Storm  <storm@cua.dk>
+
+	* .gdbinit (pitx): Print iterator position.
+	Limit stack dump in case iterator is not initialized.
+
+2006-08-12  Eli Zaretskii  <eliz@gnu.org>
+
+	* frame.c (Fmouse_position, Fmouse_pixel_position)
+	(Fset_mouse_position, Fset_mouse_pixel_position): Doc fix.
+
+2006-08-11  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* xselect.c (Fx_register_dnd_atom): New function.
+	(syms_of_xselect): Defsubr it.
+	(x_handle_dnd_message): Check that message_type is in
+	dpyinfo->x_dnd_atoms before generating lisp event.
+
+	* xterm.h (struct x_display_info): Add x_dnd_atoms* to keep track
+	of drag and drop Atoms.
+
+	* xterm.c (x_term_init): Initialize dpyinfo->x_dnd_atoms*
+
+
+2006-08-10  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* keyboard.c: Define in_sighandler.
+	(input_available_signal): Set in_sighandler.
+	(init_keyboard): Initialize in_sighandler.
+
+	* keyboard.h: Declare in_sighandler.
+
+	* alloc.c (UNBLOCK_INPUT_ALLOC, BLOCK_INPUT_ALLOC): Use in_sighandler
+	to check if mutex should be locked or not.
+
+2006-08-09  Richard Stallman  <rms@gnu.org>
+
+	* keyboard.c (keyremap_step): No-op if fkey->parent = nil.
+	(read_key_sequence): Always start fkey.start and fkey.end at 0,
+	and likewise for keytran.
+
+2006-08-09  Kenichi Handa  <handa@m17n.org>
+
+	* coding.c (syms_of_coding): Improve the docstring
+	file-coding-system-alist.
+
+2006-08-07  Andreas Schwab  <schwab@suse.de>
+
+	* puresize.h (BASE_PURESIZE): Increase to 1120000.
+
+2006-08-06  Chong Yidong  <cyd@stupidchicken.com>
+
+	* buffer.c (Vchange_major_mode_hook, Qchange_major_mode_hook): New vars.
+	(Fkill_all_local_variables): Use it.
+	(syms_of_buffer): Defvar it.
+
+2006-08-05  Eli Zaretskii  <eliz@gnu.org>
+
+	* w32.c (w32_valid_pointer_p): New function.
+
+	* w32.h: Add prototype for w32_valid_pointer_p.
+
+	* alloc.c: Include w32.h.
+	(valid_lisp_object_p) [WINDOWSNT]: Call w32_valid_pointer_p to do
+	the job.
+
+	* keyboard.c (kbd_buffer_get_event): Return Qnil when current time
+	is exactly equal to end_time, not only when it is past that.
+
+2006-08-04  Chong Yidong  <cyd@stupidchicken.com>
+
+	* keyboard.c (read_char): Rebalance specpdl after receiving jump.
+
+	* process.c: Reapply 2006-08-01 change.
+
+2006-08-04  Eli Zaretskii  <eliz@gnu.org>
+
+	* w32fns.c (w32_query_font): Fix last change: use stricmp.
+
+2006-08-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* editfns.c (Fsubst_char_in_region): Redo the setup work after running
+	the before-change-functions since they may have altered the buffer.
+
+2006-08-04  Ralf Angeli  <angeli@caeruleus.net>
+
+	* w32fns.c (w32_createwindow): Handle -geometry command line option
+	and the geometry settings in the Registry.
+
+2006-08-04  Kenichi Handa  <handa@m17n.org>
+
+	* w32fns.c (w32_query_font): Compare names by ignoring case.
+
+	* xterm.c (x_query_font): Compare names by ignoring case.
+
+2006-08-03  Jason Rumney  <jasonr@gnu.org>
+
+	* w32menu.c (w32_menu_show, w32_dialog_show): Call Fsignal to quit
+	when no option selected.
+
+2006-08-03  Chong Yidong  <cyd@stupidchicken.com>
+
+	* process.c: Revert last change.
+
+2006-08-01  Kim F. Storm  <storm@cua.dk>
+
+	* process.c (wait_reading_process_output_unwind): New function.
+	Restores waiting_for_user_input_p to saved value.
+	(wait_reading_process_output): Unwind protect waiting_for_user_input_p
+	instead of save/restore old value on stack.
+
+2006-07-30  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* editfns.c: Undo 2006-06-27 change.
+
+2006-07-29  Eli Zaretskii  <eliz@gnu.org>
+
+	* coding.c (Ffind_operation_coding_system): Revert the change from
+	2006-05-29.
+
+	* alloc.c [WINDOWSNT]: Include fcntl.h, to fix last change.
+
+2006-07-28  Richard Stallman  <rms@gnu.org>
+
+	* xfaces.c (lookup_named_face, Fdisplay_supports_face_attributes_p):
+	Add conditional aborts for clarity.
+
+	* xdisp.c (update_menu_bar): New arg HOOKS_RUN.  Callers changed.
+	Used to avoid running the hooks over and over for each frame.
+	(prepare_menu_bars): Pass value from update_menu_bar
+	as HOOKS_RUN of next call.
+
+	* keyboard.c (safe_run_hooks_1): Don't crash if Vrun_hooks is nil.
+
+2006-07-28  Kim F. Storm  <storm@cua.dk>
+
+	* alloc.c (valid_pointer_p): New function (from valid_lisp_object_p).
+	(valid_lisp_object_p): Use it to check for valid SUBRP obj.
+
 2006-07-26  Chong Yidong  <cyd@stupidchicken.com>
 
 	* keyboard.c (read_char): New arg END_TIME specifying timeout.
@@ -177,6 +482,14 @@
 	(mac_initialize_display_info) [MAC_OSX]: Use CGDisplaySamplesPerPixel.
 	(x_delete_display): Apply 2006-07-04 change for xterm.c.
 
+2006-07-17  Richard Stallman  <rms@gnu.org>
+
+	* keyboard.c (Vcommand_error_function): New variable.
+	(syms_of_keyboard): Defvar it.
+	(cmd_error_internal): Simplify, and handle Vcommand_error_function.
+
+	* dispnew.c (init_display): Mention DISPLAY as well as TERM in err msg.
+
 2006-07-17  Kim F. Storm  <storm@cua.dk>
 
 	* xdisp.c (handle_single_display_spec): Ensure the right value of
@@ -617,8 +930,8 @@
 
 2006-06-14  Chong Yidong  <cyd@stupidchicken.com>
 
-	* xdisp.c (back_to_previous_visible_line_start): Reset
-	it->continuation_lines_width.
+	* xdisp.c (back_to_previous_visible_line_start):
+	Reset it->continuation_lines_width.
 
 2006-06-14  Richard Stallman  <rms@gnu.org>
 
@@ -689,8 +1002,8 @@
 
 2006-06-06  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
-	* macterm.c [USE_MAC_TSM] (mac_handle_text_input_event): Exclude
-	0x7f from ASCII range.
+	* macterm.c [USE_MAC_TSM] (mac_handle_text_input_event):
+	Exclude 0x7f from ASCII range.
 
 2006-06-05  Jason Rumney  <jasonr@gnu.org>
 
--- a/src/alloc.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/alloc.c	Sat Oct 14 16:56:21 2006 +0000
@@ -78,6 +78,11 @@
 #define O_WRONLY 1
 #endif
 
+#ifdef WINDOWSNT
+#include <fcntl.h>
+#include "w32.h"
+#endif
+
 #ifdef DOUG_LEA_MALLOC
 
 #include <malloc.h>
@@ -125,17 +130,17 @@
 #define BLOCK_INPUT_ALLOC                       \
   do                                            \
     {                                           \
-      pthread_mutex_lock (&alloc_mutex);        \
-      if (pthread_self () == main_thread)       \
-        BLOCK_INPUT;                            \
+      if (pthread_self () == main_thread)	\
+	BLOCK_INPUT;				\
+      pthread_mutex_lock (&alloc_mutex);	\
     }                                           \
   while (0)
 #define UNBLOCK_INPUT_ALLOC                     \
   do                                            \
     {                                           \
-      if (pthread_self () == main_thread)       \
-        UNBLOCK_INPUT;                          \
-      pthread_mutex_unlock (&alloc_mutex);      \
+      pthread_mutex_unlock (&alloc_mutex);	\
+      if (pthread_self () == main_thread)	\
+	UNBLOCK_INPUT;				\
     }                                           \
   while (0)
 
@@ -4608,6 +4613,32 @@
 #endif /* GC_MARK_STACK != 0 */
 
 
+/* Determine whether it is safe to access memory at address P.  */
+int
+valid_pointer_p (p)
+     void *p;
+{
+#ifdef WINDOWSNT
+  return w32_valid_pointer_p (p, 16);
+#else
+  int fd;
+
+  /* Obviously, we cannot just access it (we would SEGV trying), so we
+     trick the o/s to tell us whether p is a valid pointer.
+     Unfortunately, we cannot use NULL_DEVICE here, as emacs_write may
+     not validate p in that case.  */
+
+  if ((fd = emacs_open ("__Valid__Lisp__Object__", O_CREAT | O_WRONLY | O_TRUNC, 0666)) >= 0)
+    {
+      int valid = (emacs_write (fd, (char *)p, 16) == 16);
+      emacs_close (fd);
+      unlink ("__Valid__Lisp__Object__");
+      return valid;
+    }
+
+    return -1;
+#endif
+}
 
 /* Return 1 if OBJ is a valid lisp object.
    Return 0 if OBJ is NOT a valid lisp object.
@@ -4620,9 +4651,7 @@
      Lisp_Object obj;
 {
   void *p;
-#if !GC_MARK_STACK
-  int fd;
-#else
+#if GC_MARK_STACK
   struct mem_node *m;
 #endif
 
@@ -4634,26 +4663,22 @@
     return 1;
 
 #if !GC_MARK_STACK
-  /* We need to determine whether it is safe to access memory at
-     address P.  Obviously, we cannot just access it (we would SEGV
-     trying), so we trick the o/s to tell us whether p is a valid
-     pointer.  Unfortunately, we cannot use NULL_DEVICE here, as
-     emacs_write may not validate p in that case.  */
-  if ((fd = emacs_open ("__Valid__Lisp__Object__", O_CREAT | O_WRONLY | O_TRUNC, 0666)) >= 0)
-    {
-      int valid = (emacs_write (fd, (char *)p, 16) == 16);
-      emacs_close (fd);
-      unlink ("__Valid__Lisp__Object__");
-      return valid;
-    }
-
-    return -1;
+  return valid_pointer_p (p);
 #else
 
   m = mem_find (p);
 
   if (m == MEM_NIL)
-    return 0;
+    {
+      int valid = valid_pointer_p (p);
+      if (valid <= 0)
+	return valid;
+
+      if (SUBRP (obj))
+	return 1;
+
+      return 0;
+    }
 
   switch (m->type)
     {
--- a/src/buffer.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/buffer.c	Sat Oct 14 16:56:21 2006 +0000
@@ -146,6 +146,9 @@
 Lisp_Object Vkill_buffer_query_functions;
 Lisp_Object Qkill_buffer_query_functions;
 
+/* Hook run before changing a major mode.  */
+Lisp_Object Vchange_major_mode_hook, Qchange_major_mode_hook;
+
 /* List of functions to call before changing an unmodified buffer.  */
 Lisp_Object Vfirst_change_hook;
 
@@ -1711,9 +1714,18 @@
   char *err;
 
   if (EQ (buffer, Fwindow_buffer (selected_window)))
-    /* Basically a NOP.  Avoid signalling an error if the selected window
-       is dedicated, or a minibuffer, ...  */
-    return Fset_buffer (buffer);
+    {
+      /* Basically a NOP.  Avoid signalling an error in the case where
+	 the selected window is dedicated, or a minibuffer.  */
+
+      /* But do put this buffer at the front of the buffer list,
+	 unless that has been inhibited.  Note that even if
+	 BUFFER is at the front of the main buffer-list already,
+	 we still want to move it to the front of the frame's buffer list.  */
+      if (NILP (norecord))
+	record_buffer (buffer);
+      return Fset_buffer (buffer);
+    }
 
   err = no_switch_window (selected_window);
   if (err) error (err);
@@ -2142,10 +2154,11 @@
 {
   struct Lisp_Marker *tail, *markers;
   struct buffer *other;
-  int undo_enabled_p = !EQ (current_buffer->undo_list, Qt);
   int begv, zv;
   int narrowed = (BEG != BEGV || Z != ZV);
   int modified_p = !NILP (Fbuffer_modified_p (Qnil));
+  Lisp_Object old_undo = current_buffer->undo_list;
+  struct gcpro gcpro1;
 
   if (current_buffer->base_buffer)
     error ("Cannot do `set-buffer-multibyte' on an indirect buffer");
@@ -2154,10 +2167,11 @@
   if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters))
     return flag;
 
-  /* It would be better to update the list,
-     but this is good enough for now.  */
-  if (undo_enabled_p)
-    current_buffer->undo_list = Qt;
+  GCPRO1 (old_undo);
+
+  /* Don't record these buffer changes.  We will put a special undo entry
+     instead.  */
+  current_buffer->undo_list = Qt;
 
   /* If the cached position is for this buffer, clear it out.  */
   clear_charpos_cache (current_buffer);
@@ -2357,8 +2371,17 @@
       set_intervals_multibyte (1);
     }
 
-  if (undo_enabled_p)
-    current_buffer->undo_list = Qnil;
+  if (!EQ (old_undo, Qt))
+    {
+      /* Represent all the above changes by a special undo entry.  */
+      extern Lisp_Object Qapply;
+      current_buffer->undo_list = Fcons (list3 (Qapply,
+						intern ("set-buffer-multibyte"),
+						NILP (flag) ? Qt : Qnil),
+					 old_undo);
+    }
+
+  UNGCPRO;
 
   /* Changing the multibyteness of a buffer means that all windows
      showing that buffer must be updated thoroughly.  */
@@ -2416,7 +2439,7 @@
   Lisp_Object oalist;
 
   if (!NILP (Vrun_hooks))
-    call1 (Vrun_hooks, intern ("change-major-mode-hook"));
+    call1 (Vrun_hooks, Qchange_major_mode_hook);
   oalist = current_buffer->local_var_alist;
 
   /* Make sure none of the bindings in oalist
@@ -6028,6 +6051,13 @@
 	       doc: /* List of functions called with no args to query before killing a buffer.  */);
   Vkill_buffer_query_functions = Qnil;
 
+  DEFVAR_LISP ("change-major-mode-hook", &Vchange_major_mode_hook,
+	       doc: /* Normal hook run before changing the major mode of a buffer.
+The function `kill-all-local-variables' runs this before doing anything else.  */);
+  Vchange_major_mode_hook = Qnil;
+  Qchange_major_mode_hook = intern ("change-major-mode-hook");
+  staticpro (&Qchange_major_mode_hook);
+
   defsubr (&Sbuffer_live_p);
   defsubr (&Sbuffer_list);
   defsubr (&Sget_buffer);
--- a/src/coding.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/coding.c	Sat Oct 14 16:56:21 2006 +0000
@@ -219,14 +219,15 @@
 
 
 /* Like ONE_MORE_BYTE, but 8-bit bytes of data at SRC are in multibyte
-   form if MULTIBYTEP is nonzero.  */
-
-#define ONE_MORE_BYTE_CHECK_MULTIBYTE(c1, multibytep)		\
+   form if MULTIBYTEP is nonzero.  In addition, if SRC is not less
+   than SRC_END, return with RET.  */
+
+#define ONE_MORE_BYTE_CHECK_MULTIBYTE(c1, multibytep, ret)	\
   do {								\
     if (src >= src_end)						\
       {								\
 	coding->result = CODING_FINISH_INSUFFICIENT_SRC;	\
-	goto label_end_of_loop;					\
+	return ret;						\
       }								\
     c1 = *src++;						\
     if (multibytep && c1 == LEADING_CODE_8_BIT_CONTROL)		\
@@ -628,15 +629,15 @@
 
   while (1)
     {
-      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
-
+      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep,
+				     CODING_CATEGORY_MASK_EMACS_MULE);
       if (composing)
 	{
 	  if (c < 0xA0)
 	    composing = 0;
 	  else if (c == 0xA0)
 	    {
-	      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+	      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, 0);
 	      c &= 0x7F;
 	    }
 	  else
@@ -665,8 +666,6 @@
 	    }
 	}
     }
- label_end_of_loop:
-  return CODING_CATEGORY_MASK_EMACS_MULE;
 }
 
 
@@ -1421,9 +1420,9 @@
   Lisp_Object safe_chars;
 
   reg[0] = CHARSET_ASCII, reg[1] = reg[2] = reg[3] = -1;
-  while (mask && src < src_end)
-    {
-      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+  while (mask)
+    {
+      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, mask & mask_found);
     retry:
       switch (c)
 	{
@@ -1431,11 +1430,11 @@
 	  if (inhibit_iso_escape_detection)
 	    break;
 	  single_shifting = 0;
-	  ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+	  ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, mask & mask_found);
 	  if (c >= '(' && c <= '/')
 	    {
 	      /* Designation sequence for a charset of dimension 1.  */
-	      ONE_MORE_BYTE_CHECK_MULTIBYTE (c1, multibytep);
+	      ONE_MORE_BYTE_CHECK_MULTIBYTE (c1, multibytep, mask & mask_found);
 	      if (c1 < ' ' || c1 >= 0x80
 		  || (charset = iso_charset_table[0][c >= ','][c1]) < 0)
 		/* Invalid designation sequence.  Just ignore.  */
@@ -1445,13 +1444,14 @@
 	  else if (c == '$')
 	    {
 	      /* Designation sequence for a charset of dimension 2.  */
-	      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+	      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, mask & mask_found);
 	      if (c >= '@' && c <= 'B')
 		/* Designation for JISX0208.1978, GB2312, or JISX0208.  */
 		reg[0] = charset = iso_charset_table[1][0][c];
 	      else if (c >= '(' && c <= '/')
 		{
-		  ONE_MORE_BYTE_CHECK_MULTIBYTE (c1, multibytep);
+		  ONE_MORE_BYTE_CHECK_MULTIBYTE (c1, multibytep,
+						 mask & mask_found);
 		  if (c1 < ' ' || c1 >= 0x80
 		      || (charset = iso_charset_table[1][c >= ','][c1]) < 0)
 		    /* Invalid designation sequence.  Just ignore.  */
@@ -1626,7 +1626,8 @@
 		  c = -1;
 		  while (src < src_end)
 		    {
-		      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+		      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep,
+						     mask & mask_found);
 		      if (c < 0xA0)
 			break;
 		      i++;
@@ -1644,7 +1645,6 @@
 	  break;
 	}
     }
- label_end_of_loop:
   return (mask & mask_found);
 }
 
@@ -2915,20 +2915,18 @@
 
   while (1)
     {
-      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, CODING_CATEGORY_MASK_SJIS);
       if (c < 0x80)
 	continue;
       if (c == 0x80 || c == 0xA0 || c > 0xEF)
 	return 0;
       if (c <= 0x9F || c >= 0xE0)
 	{
-	  ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+	  ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, 0);
 	  if (c < 0x40 || c == 0x7F || c > 0xFC)
 	    return 0;
 	}
     }
- label_end_of_loop:
-  return CODING_CATEGORY_MASK_SJIS;
 }
 
 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
@@ -2947,17 +2945,15 @@
 
   while (1)
     {
-      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, CODING_CATEGORY_MASK_BIG5);
       if (c < 0x80)
 	continue;
       if (c < 0xA1 || c > 0xFE)
 	return 0;
-      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, 0);
       if (c < 0x40 || (c > 0x7F && c < 0xA1) || c > 0xFE)
 	return 0;
     }
- label_end_of_loop:
-  return CODING_CATEGORY_MASK_BIG5;
 }
 
 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
@@ -2985,7 +2981,7 @@
 
   while (1)
     {
-      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, CODING_CATEGORY_MASK_UTF_8);
       if (UTF_8_1_OCTET_P (c))
 	continue;
       else if (UTF_8_2_OCTET_LEADING_P (c))
@@ -3003,16 +2999,13 @@
 
       do
 	{
-	  ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+	  ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, 0);
 	  if (!UTF_8_EXTRA_OCTET_P (c))
 	    return 0;
 	  seq_maybe_bytes--;
 	}
       while (seq_maybe_bytes > 0);
     }
-
- label_end_of_loop:
-  return CODING_CATEGORY_MASK_UTF_8;
 }
 
 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
@@ -3041,15 +3034,13 @@
   struct coding_system dummy_coding;
   struct coding_system *coding = &dummy_coding;
 
-  ONE_MORE_BYTE_CHECK_MULTIBYTE (c1, multibytep);
-  ONE_MORE_BYTE_CHECK_MULTIBYTE (c2, multibytep);
+  ONE_MORE_BYTE_CHECK_MULTIBYTE (c1, multibytep, 0);
+  ONE_MORE_BYTE_CHECK_MULTIBYTE (c2, multibytep, 0);
 
   if ((c1 == 0xFF) && (c2 == 0xFE))
     return CODING_CATEGORY_MASK_UTF_16_LE;
   else if ((c1 == 0xFE) && (c2 == 0xFF))
     return CODING_CATEGORY_MASK_UTF_16_BE;
-
- label_end_of_loop:
   return 0;
 }
 
@@ -3318,12 +3309,10 @@
   valid = coding_system_table[CODING_CATEGORY_IDX_CCL]->spec.ccl.valid_codes;
   while (1)
     {
-      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, CODING_CATEGORY_MASK_CCL);
       if (! valid[c])
 	return 0;
     }
- label_end_of_loop:
-  return CODING_CATEGORY_MASK_CCL;
 }
 
 
@@ -7547,7 +7536,10 @@
 	    return Fcons (val, val);
 	  if (! NILP (Ffboundp (val)))
 	    {
-	      val = safe_call1 (val, Flist (nargs, args));
+	      /* We use call1 rather than safe_call1
+		 so as to get bug reports about functions called here
+		 which don't handle the current interface.  */
+	      val = call1 (val, Flist (nargs, args));
 	      if (CONSP (val))
 		return val;
 	      if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val)))
@@ -7971,8 +7963,9 @@
 If VAL is a cons of coding systems, the car part is used for decoding,
 and the cdr part is used for encoding.
 If VAL is a function symbol, the function must return a coding system
-or a cons of coding systems which are used as above.  The function gets
-the arguments with which `find-operation-coding-system' was called.
+or a cons of coding systems which are used as above.  The function is
+called with an argument that is a list of the arguments with which
+`find-operation-coding-system' was called.
 
 See also the function `find-operation-coding-system'
 and the variable `auto-coding-alist'.  */);
--- a/src/dired.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/dired.c	Sat Oct 14 16:56:21 2006 +0000
@@ -134,7 +134,9 @@
      Lisp_Object dh;
 {
   DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer;
+  BLOCK_INPUT;
   closedir (d);
+  UNBLOCK_INPUT;
   return Qnil;
 }
 
@@ -196,7 +198,9 @@
   /* Now *bufp is the compiled form of MATCH; don't call anything
      which might compile a new regexp until we're done with the loop!  */
 
+  BLOCK_INPUT;
   d = opendir (SDATA (dirfilename));
+  UNBLOCK_INPUT;
   if (d == NULL)
     report_file_error ("Opening directory", Fcons (directory, Qnil));
 
@@ -321,7 +325,9 @@
 	}
     }
 
+  BLOCK_INPUT;
   closedir (d);
+  UNBLOCK_INPUT;
 
   /* Discard the unwind protect.  */
   specpdl_ptr = specpdl + count;
@@ -508,7 +514,9 @@
     {
       int inner_count = SPECPDL_INDEX ();
 
+      BLOCK_INPUT;
       d = opendir (SDATA (Fdirectory_file_name (encoded_dir)));
+      UNBLOCK_INPUT;
       if (!d)
 	report_file_error ("Opening directory", Fcons (dirname, Qnil));
 
--- a/src/editfns.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/editfns.c	Sat Oct 14 16:56:21 2006 +0000
@@ -629,10 +629,7 @@
 DEFUN ("delete-field", Fdelete_field, Sdelete_field, 0, 1, 0,
        doc: /* Delete the field surrounding POS.
 A field is a region of text with the same `field' property.
-If POS is nil, the value of point is used for POS.
-
-An `args-out-of-range' error is signaled if POS is outside the
-buffer's accessible portion.  */)
+If POS is nil, the value of point is used for POS.  */)
      (pos)
      Lisp_Object pos;
 {
@@ -646,10 +643,7 @@
 DEFUN ("field-string", Ffield_string, Sfield_string, 0, 1, 0,
        doc: /* Return the contents of the field surrounding POS as a string.
 A field is a region of text with the same `field' property.
-If POS is nil, the value of point is used for POS.
-
-An `args-out-of-range' error is signaled if POS is outside the
-buffer's accessible portion.  */)
+If POS is nil, the value of point is used for POS.  */)
      (pos)
      Lisp_Object pos;
 {
@@ -661,10 +655,7 @@
 DEFUN ("field-string-no-properties", Ffield_string_no_properties, Sfield_string_no_properties, 0, 1, 0,
        doc: /* Return the contents of the field around POS, without text-properties.
 A field is a region of text with the same `field' property.
-If POS is nil, the value of point is used for POS.
-
-An `args-out-of-range' error is signaled if POS is outside the
-buffer's accessible portion.  */)
+If POS is nil, the value of point is used for POS.  */)
      (pos)
      Lisp_Object pos;
 {
@@ -680,10 +671,7 @@
 If ESCAPE-FROM-EDGE is non-nil and POS is at the beginning of its
 field, then the beginning of the *previous* field is returned.
 If LIMIT is non-nil, it is a buffer position; if the beginning of the field
-is before LIMIT, then LIMIT will be returned instead.
-
-An `args-out-of-range' error is signaled if POS is outside the
-buffer's accessible portion.  */)
+is before LIMIT, then LIMIT will be returned instead.  */)
      (pos, escape_from_edge, limit)
      Lisp_Object pos, escape_from_edge, limit;
 {
@@ -699,10 +687,7 @@
 If ESCAPE-FROM-EDGE is non-nil and POS is at the end of its field,
 then the end of the *following* field is returned.
 If LIMIT is non-nil, it is a buffer position; if the end of the field
-is after LIMIT, then LIMIT will be returned instead.
-
-An `args-out-of-range' error is signaled if POS is outside the
-buffer's accessible portion.  */)
+is after LIMIT, then LIMIT will be returned instead.  */)
      (pos, escape_from_edge, limit)
      Lisp_Object pos, escape_from_edge, limit;
 {
@@ -1450,14 +1435,11 @@
      ()
 {
   EMACS_TIME t;
-  Lisp_Object result[3];
 
   EMACS_GET_TIME (t);
-  XSETINT (result[0], (EMACS_SECS (t) >> 16) & 0xffff);
-  XSETINT (result[1], (EMACS_SECS (t) >> 0)  & 0xffff);
-  XSETINT (result[2], EMACS_USECS (t));
-
-  return Flist (3, result);
+  return list3 (make_number ((EMACS_SECS (t) >> 16) & 0xffff),
+		make_number ((EMACS_SECS (t) >> 0)  & 0xffff),
+		make_number (EMACS_USECS (t)));
 }
 
 DEFUN ("get-internal-run-time", Fget_internal_run_time, Sget_internal_run_time,
@@ -1475,7 +1457,6 @@
 {
 #ifdef HAVE_GETRUSAGE
   struct rusage usage;
-  Lisp_Object result[3];
   int secs, usecs;
 
   if (getrusage (RUSAGE_SELF, &usage) < 0)
@@ -1491,11 +1472,9 @@
       secs++;
     }
 
-  XSETINT (result[0], (secs >> 16) & 0xffff);
-  XSETINT (result[1], (secs >> 0)  & 0xffff);
-  XSETINT (result[2], usecs);
-
-  return Flist (3, result);
+  return list3 (make_number ((secs >> 16) & 0xffff),
+		make_number ((secs >> 0)  & 0xffff),
+		make_number (usecs));
 #else
   return Fcurrent_time ();
 #endif
@@ -2706,6 +2685,10 @@
      Lisp_Object start, end, fromchar, tochar, noundo;
 {
   register int pos, pos_byte, stop, i, len, end_byte;
+  /* Keep track of the first change in the buffer:
+     if 0 we haven't found it yet.
+     if < 0 we've found it and we've run the before-change-function.
+     if > 0 we've actually performed it and the value is its position.  */
   int changed = 0;
   unsigned char fromstr[MAX_MULTIBYTE_LENGTH], tostr[MAX_MULTIBYTE_LENGTH];
   unsigned char *p;
@@ -2718,6 +2701,8 @@
   int last_changed = 0;
   int multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
 
+ restart:
+
   validate_region (&start, &end);
   CHECK_NUMBER (fromchar);
   CHECK_NUMBER (tochar);
@@ -2755,7 +2740,7 @@
      That's faster than getting rid of things,
      and it prevents even the entry for a first change.
      Also inhibit locking the file.  */
-  if (!NILP (noundo))
+  if (!changed && !NILP (noundo))
     {
       record_unwind_protect (subst_char_in_region_unwind,
 			     current_buffer->undo_list);
@@ -2789,10 +2774,14 @@
 		  && (len == 2 || (p[2] == fromstr[2]
 				 && (len == 3 || p[3] == fromstr[3]))))))
 	{
-	  if (! changed)
+	  if (changed < 0)
+	    /* We've already seen this and run the before-change-function;
+	       this time we only need to record the actual position. */
+	    changed = pos;
+	  else if (!changed)
 	    {
-	      changed = pos;
-	      modify_region (current_buffer, changed, XINT (end));
+	      changed = -1;
+	      modify_region (current_buffer, pos, XINT (end));
 
 	      if (! NILP (noundo))
 		{
@@ -2801,6 +2790,10 @@
 		  if (MODIFF - 1 == current_buffer->auto_save_modified)
 		    current_buffer->auto_save_modified++;
 		}
+
+	      /* The before-change-function may have moved the gap
+		 or even modified the buffer so we should start over. */
+	      goto restart;
 	    }
 
 	  /* Take care of the case where the new character
@@ -2853,7 +2846,7 @@
       pos++;
     }
 
-  if (changed)
+  if (changed > 0)
     {
       signal_after_change (changed,
 			   last_changed - changed, last_changed - changed);
--- a/src/fileio.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/fileio.c	Sat Oct 14 16:56:21 2006 +0000
@@ -2650,7 +2650,7 @@
 #else
   if (mkdir (dir, 0777) != 0)
 #endif
-    report_file_error ("Creating directory", Flist (1, &directory));
+    report_file_error ("Creating directory", list1 (directory));
 
   return Qnil;
 }
@@ -2676,7 +2676,7 @@
   dir = SDATA (encoded_dir);
 
   if (rmdir (dir) != 0)
-    report_file_error ("Removing directory", Flist (1, &directory));
+    report_file_error ("Removing directory", list1 (directory));
 
   return Qnil;
 }
@@ -2707,7 +2707,7 @@
   encoded_file = ENCODE_FILE (filename);
 
   if (0 > unlink (SDATA (encoded_file)))
-    report_file_error ("Removing old name", Flist (1, &filename));
+    report_file_error ("Removing old name", list1 (filename));
   return Qnil;
 }
 
@@ -2741,9 +2741,6 @@
      (file, newname, ok_if_already_exists)
      Lisp_Object file, newname, ok_if_already_exists;
 {
-#ifdef NO_ARG_ARRAY
-  Lisp_Object args[2];
-#endif
   Lisp_Object handler;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   Lisp_Object encoded_file, encoded_newname, symlink_target;
@@ -2812,15 +2809,7 @@
 	  Fdelete_file (file);
 	}
       else
-#ifdef NO_ARG_ARRAY
-	{
-	  args[0] = file;
-	  args[1] = newname;
-	  report_file_error ("Renaming", Flist (2, args));
-	}
-#else
-	report_file_error ("Renaming", Flist (2, &file));
-#endif
+	report_file_error ("Renaming", list2 (file, newname));
     }
   UNGCPRO;
   return Qnil;
@@ -2836,9 +2825,6 @@
      (file, newname, ok_if_already_exists)
      Lisp_Object file, newname, ok_if_already_exists;
 {
-#ifdef NO_ARG_ARRAY
-  Lisp_Object args[2];
-#endif
   Lisp_Object handler;
   Lisp_Object encoded_file, encoded_newname;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
@@ -2878,15 +2864,7 @@
 
   unlink (SDATA (newname));
   if (0 > link (SDATA (encoded_file), SDATA (encoded_newname)))
-    {
-#ifdef NO_ARG_ARRAY
-      args[0] = file;
-      args[1] = newname;
-      report_file_error ("Adding new name", Flist (2, args));
-#else
-      report_file_error ("Adding new name", Flist (2, &file));
-#endif
-    }
+    report_file_error ("Adding new name", list2 (file, newname));
 
   UNGCPRO;
   return Qnil;
@@ -2904,9 +2882,6 @@
      (filename, linkname, ok_if_already_exists)
      Lisp_Object filename, linkname, ok_if_already_exists;
 {
-#ifdef NO_ARG_ARRAY
-  Lisp_Object args[2];
-#endif
   Lisp_Object handler;
   Lisp_Object encoded_filename, encoded_linkname;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
@@ -2962,13 +2937,7 @@
 	    }
 	}
 
-#ifdef NO_ARG_ARRAY
-      args[0] = filename;
-      args[1] = linkname;
-      report_file_error ("Making symbolic link", Flist (2, args));
-#else
-      report_file_error ("Making symbolic link", Flist (2, &filename));
-#endif
+      report_file_error ("Making symbolic link", list2 (filename, linkname));
     }
   UNGCPRO;
   return Qnil;
@@ -4847,6 +4816,8 @@
       /* ... but with the special flag to indicate not to strip off
 	 leading code of eight-bit-control chars.  */
       coding->flags = 1;
+      /* We force LF for end-of-line because that is faster.  */
+      coding->eol_type = CODING_EOL_LF;
       goto done_setup_coding;
     }
   else if (!NILP (Vcoding_system_for_write))
--- a/src/fns.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/fns.c	Sat Oct 14 16:56:21 2006 +0000
@@ -5030,7 +5030,7 @@
       c = *p++;
       if (c >= 0140)
 	c -= 40;
-      hash = ((hash << 3) + (hash >> 28) + c);
+      hash = ((hash << 4) + (hash >> 28) + c);
     }
 
   return hash & INTMASK;
--- a/src/frame.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/frame.c	Sat Oct 14 16:56:21 2006 +0000
@@ -1679,7 +1679,8 @@
 DEFUN ("mouse-position", Fmouse_position, Smouse_position, 0, 0, 0,
        doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
 The position is given in character cells, where (0, 0) is the
-upper-left corner.
+upper-left corner of the frame, X is the horizontal offset, and Y is
+the vertical offset.
 If Emacs is running on a mouseless terminal or hasn't been programmed
 to read the mouse position, it returns the selected frame for FRAME
 and nil for X and Y.
@@ -1727,7 +1728,8 @@
        Smouse_pixel_position, 0, 0, 0,
        doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
 The position is given in pixel units, where (0, 0) is the
-upper-left corner.
+upper-left corner of the frame, X is the horizontal offset, and Y is
+the vertical offset.
 If Emacs is running on a mouseless terminal or hasn't been programmed
 to read the mouse position, it returns the selected frame for FRAME
 and nil for X and Y.  */)
@@ -1760,6 +1762,10 @@
 so the coordinates of the top left character in the frame
 may be nonzero due to left-hand scroll bars or the menu bar.
 
+The position is given in character cells, where (0, 0) is the
+upper-left corner of the frame, X is the horizontal offset, and Y is
+the vertical offset.
+
 This function is a no-op for an X frame that is not visible.
 If you have just created a frame, you must wait for it to become visible
 before calling this function on it, like this.
@@ -1792,6 +1798,9 @@
 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position,
        Sset_mouse_pixel_position, 3, 3, 0,
        doc: /* Move the mouse pointer to pixel position (X,Y) in FRAME.
+The position is given in pixels, where (0, 0) is the upper-left corner
+of the frame, X is the horizontal offset, and Y is the vertical offset.
+
 Note, this is a no-op for an X frame that is not visible.
 If you have just created a frame, you must wait for it to become visible
 before calling this function on it, like this.
--- a/src/image.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/image.c	Sat Oct 14 16:56:21 2006 +0000
@@ -2398,7 +2398,7 @@
      FSSpec *fss;
      Handle dh;
 {
-  OSErr err;
+  ComponentResult err;
   GraphicsImportComponent gi;
   Rect rect;
   int width, height;
--- a/src/keyboard.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/keyboard.c	Sat Oct 14 16:56:21 2006 +0000
@@ -1458,6 +1458,72 @@
   return Qnil;
 }
 
+#ifdef HAVE_MOUSE
+
+/* Restore mouse tracking enablement.  See Ftrack_mouse for the only use
+   of this function.  */
+
+static Lisp_Object
+tracking_off (old_value)
+     Lisp_Object old_value;
+{
+  do_mouse_tracking = old_value;
+  if (NILP (old_value))
+    {
+      /* Redisplay may have been preempted because there was input
+	 available, and it assumes it will be called again after the
+	 input has been processed.  If the only input available was
+	 the sort that we have just disabled, then we need to call
+	 redisplay.  */
+      if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW))
+	{
+	  redisplay_preserve_echo_area (6);
+	  get_input_pending (&input_pending,
+			     READABLE_EVENTS_DO_TIMERS_NOW);
+	}
+    }
+  return Qnil;
+}
+
+DEFUN ("track-mouse", Ftrack_mouse, Strack_mouse, 0, UNEVALLED, 0,
+       doc: /* Evaluate BODY with mouse movement events enabled.
+Within a `track-mouse' form, mouse motion generates input events that
+you can read with `read-event'.
+Normally, mouse motion is ignored.
+usage: (track-mouse BODY ...)  */)
+     (args)
+     Lisp_Object args;
+{
+  int count = SPECPDL_INDEX ();
+  Lisp_Object val;
+
+  record_unwind_protect (tracking_off, do_mouse_tracking);
+
+  do_mouse_tracking = Qt;
+
+  val = Fprogn (args);
+  return unbind_to (count, val);
+}
+
+/* If mouse has moved on some frame, return one of those frames.
+   Return 0 otherwise.  */
+
+static FRAME_PTR
+some_mouse_moved ()
+{
+  Lisp_Object tail, frame;
+
+  FOR_EACH_FRAME (tail, frame)
+    {
+      if (XFRAME (frame)->mouse_moved)
+	return XFRAME (frame);
+    }
+
+  return 0;
+}
+
+#endif	/* HAVE_MOUSE */
+
 /* This is the actual command reading loop,
    sans error-handling encapsulation.  */
 
@@ -2106,6 +2172,8 @@
 safe_run_hooks_1 (hook)
      Lisp_Object hook;
 {
+  if (NILP (Vrun_hooks))
+    return Qnil;
   return call1 (Vrun_hooks, Vinhibit_quit);
 }
 
@@ -2388,7 +2456,17 @@
 
 #ifdef HAVE_MOUSE
   if (!noninteractive && STRINGP (help))
-    help = call1 (Qmouse_fixup_help_message, help);
+    {
+      /* The mouse-fixup-help-message Lisp function can call
+	 mouse_position_hook, which resets the mouse_moved flags.
+	 This causes trouble if we are trying to read a mouse motion
+	 event (i.e., if we are inside a `track-mouse' form), so we
+	 restore the mouse_moved flag.  */
+      FRAME_PTR f = NILP (do_mouse_tracking) ? NULL : some_mouse_moved ();
+      help = call1 (Qmouse_fixup_help_message, help);
+      if (f)
+      	f->mouse_moved = 1;
+    }
 #endif
 
   if (STRINGP (help) || NILP (help))
@@ -2483,7 +2561,7 @@
      EMACS_TIME *end_time;
 {
   volatile Lisp_Object c;
-  int count;
+  int count, jmpcount;
   jmp_buf local_getcjmp;
   jmp_buf save_jump;
   volatile int key_already_recorded = 0;
@@ -2714,12 +2792,14 @@
      around any call to sit_for or kbd_buffer_get_event;
      it *must not* be in effect when we call redisplay.  */
 
+  jmpcount = SPECPDL_INDEX ();
   if (_setjmp (local_getcjmp))
     {
       /* Handle quits while reading the keyboard.  */
       /* We must have saved the outer value of getcjmp here,
 	 so restore it now.  */
       restore_getcjmp (save_jump);
+      unbind_to (jmpcount, Qnil);
       XSETINT (c, quit_char);
       internal_last_event_frame = selected_frame;
       Vlast_event_frame = internal_last_event_frame;
@@ -2760,7 +2840,12 @@
       goto non_reread;
     }
 
-  timer_start_idle ();
+  /* Start idle timers if no time limit is supplied.  We don't do it
+     if a time limit is supplied to avoid an infinite recursion in the
+     situation where an idle timer calls `sit-for'.  */
+
+  if (!end_time)
+    timer_start_idle ();
 
   /* If in middle of key sequence and minibuffer not active,
      start echoing if enough time elapses.  */
@@ -2830,7 +2915,8 @@
       c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu);
 
       /* Now that we have read an event, Emacs is not idle.  */
-      timer_stop_idle ();
+      if (!end_time)
+	timer_stop_idle ();
 
       goto exit;
     }
@@ -2973,7 +3059,8 @@
       /* Actually read a character, waiting if necessary.  */
       save_getcjmp (save_jump);
       restore_getcjmp (local_getcjmp);
-      timer_start_idle ();
+      if (!end_time)
+	timer_start_idle ();
       c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time);
       restore_getcjmp (save_jump);
 
@@ -3025,7 +3112,8 @@
 
  non_reread:
 
-  timer_stop_idle ();
+  if (!end_time)
+    timer_stop_idle ();
   RESUME_POLLING;
 
   if (NILP (c))
@@ -3063,7 +3151,7 @@
       last_input_char = c;
       Fcommand_execute (tem, Qnil, Fvector (1, &last_input_char), Qt);
 
-      if (CONSP (c) && EQ (XCAR (c), Qselect_window))
+      if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time)
 	/* We stopped being idle for this event; undo that.  This
 	   prevents automatic window selection (under
 	   mouse_autoselect_window from acting as a real input event, for
@@ -3272,7 +3360,8 @@
       show_help_echo (help, window, object, position, 0);
 
       /* We stopped being idle for this event; undo that.  */
-      timer_resume_idle ();
+      if (!end_time)
+	timer_resume_idle ();
       goto retry;
     }
 
@@ -3556,72 +3645,6 @@
   bcopy (temp, getcjmp, sizeof getcjmp);
 }
 
-#ifdef HAVE_MOUSE
-
-/* Restore mouse tracking enablement.  See Ftrack_mouse for the only use
-   of this function.  */
-
-static Lisp_Object
-tracking_off (old_value)
-     Lisp_Object old_value;
-{
-  do_mouse_tracking = old_value;
-  if (NILP (old_value))
-    {
-      /* Redisplay may have been preempted because there was input
-	 available, and it assumes it will be called again after the
-	 input has been processed.  If the only input available was
-	 the sort that we have just disabled, then we need to call
-	 redisplay.  */
-      if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW))
-	{
-	  redisplay_preserve_echo_area (6);
-	  get_input_pending (&input_pending,
-			     READABLE_EVENTS_DO_TIMERS_NOW);
-	}
-    }
-  return Qnil;
-}
-
-DEFUN ("track-mouse", Ftrack_mouse, Strack_mouse, 0, UNEVALLED, 0,
-       doc: /* Evaluate BODY with mouse movement events enabled.
-Within a `track-mouse' form, mouse motion generates input events that
-you can read with `read-event'.
-Normally, mouse motion is ignored.
-usage: (track-mouse BODY ...)  */)
-     (args)
-     Lisp_Object args;
-{
-  int count = SPECPDL_INDEX ();
-  Lisp_Object val;
-
-  record_unwind_protect (tracking_off, do_mouse_tracking);
-
-  do_mouse_tracking = Qt;
-
-  val = Fprogn (args);
-  return unbind_to (count, val);
-}
-
-/* If mouse has moved on some frame, return one of those frames.
-   Return 0 otherwise.  */
-
-static FRAME_PTR
-some_mouse_moved ()
-{
-  Lisp_Object tail, frame;
-
-  FOR_EACH_FRAME (tail, frame)
-    {
-      if (XFRAME (frame)->mouse_moved)
-	return XFRAME (frame);
-    }
-
-  return 0;
-}
-
-#endif	/* HAVE_MOUSE */
-
 /* Low level keyboard/mouse input.
    kbd_buffer_store_event places events in kbd_buffer, and
    kbd_buffer_get_event retrieves them.  */
@@ -4056,13 +4079,15 @@
 	{
 	  EMACS_TIME duration;
 	  EMACS_GET_TIME (duration);
-	  EMACS_SUB_TIME (duration, *end_time, duration);
-	  if (EMACS_TIME_NEG_P (duration))
-	    return Qnil;
+	  if (EMACS_TIME_GE (duration, *end_time))
+	    return Qnil;	/* finished waiting */
 	  else
-	    wait_reading_process_output (EMACS_SECS (duration),
-					 EMACS_USECS (duration), 
-					 -1, 1, Qnil, NULL, 0);
+	    {
+	      EMACS_SUB_TIME (duration, *end_time, duration);
+	      wait_reading_process_output (EMACS_SECS (duration),
+					   EMACS_USECS (duration),
+					   -1, 1, Qnil, NULL, 0);
+	    }
 	}
       else
 	wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0);
@@ -4635,6 +4660,32 @@
   UNGCPRO;
   return nexttime;
 }
+
+DEFUN ("current-idle-time", Fcurrent_idle_time, Scurrent_idle_time, 0, 0, 0,
+       doc: /* Return the current length of Emacs idleness.
+The value is returned as a list of three integers.  The first has the
+most significant 16 bits of the seconds, while the second has the
+least significant 16 bits.  The third integer gives the microsecond
+count.
+
+The microsecond count is zero on systems that do not provide
+resolution finer than a second.  */)
+  ()
+{
+  if (! EMACS_TIME_NEG_P (timer_idleness_start_time))
+    {
+      EMACS_TIME now, idleness_now;
+
+      EMACS_GET_TIME (now);
+      EMACS_SUB_TIME (idleness_now, now, timer_idleness_start_time);
+
+      return list3 (make_number ((EMACS_SECS (idleness_now) >> 16) & 0xffff),
+		    make_number ((EMACS_SECS (idleness_now) >> 0)  & 0xffff),
+		    make_number (EMACS_USECS (idleness_now)));
+    }
+
+  return Qnil;
+}
 
 /* Caches for modify_event_symbol.  */
 static Lisp_Object accent_key_syms;
@@ -8565,7 +8616,15 @@
    such as Vfunction_key_map and Vkey_translation_map.  */
 typedef struct keyremap
 {
-  Lisp_Object map, parent;
+  /* This is the map originally specified for this use.  */
+  Lisp_Object parent;
+  /* This is a submap reached by looking up, in PARENT,
+     the events from START to END.  */
+  Lisp_Object map;
+  /* Positions [START, END) in the key sequence buffer
+     are the key that we have scanned so far.
+     Those events are the ones that we will replace
+     if PAREHT maps them into a key sequence.  */
   int start, end;
 } keyremap;
 
@@ -8638,7 +8697,11 @@
   Lisp_Object next, key;
 
   key = keybuf[fkey->end++];
-  next = access_keymap_keyremap (fkey->map, key, prompt, doit);
+
+  if (KEYMAPP (fkey->parent))
+    next = access_keymap_keyremap (fkey->map, key, prompt, doit);
+  else
+    next = Qnil;
 
   /* If keybuf[fkey->start..fkey->end] is bound in the
      map and we're in a position to do the key remapping, replace it with
@@ -8878,9 +8941,8 @@
      reinitialize fkey and keytran before each replay.  */
   fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map;
   keytran.map = keytran.parent = current_kboard->Vlocal_key_translation_map;
-  /* If there is no translation map, turn off scanning.  */
-  fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1;
-  keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1;
+  fkey.start = fkey.end = 0;
+  keytran.start = keytran.end = 0;
 
   starting_buffer = current_buffer;
   first_unbound = bufsize + 1;
@@ -9687,8 +9749,8 @@
 
 	      keybuf[t - 1] = new_key;
 	      mock_input = max (t, mock_input);
-	      fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1;
-	      keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1;
+	      fkey.start = fkey.end = 0;
+	      keytran.start = keytran.end = 0;
 
 	      goto replay_sequence;
 	    }
@@ -11494,6 +11556,7 @@
   menu_bar_items_vector = Qnil;
   staticpro (&menu_bar_items_vector);
 
+  defsubr (&Scurrent_idle_time);
   defsubr (&Sevent_convert_list);
   defsubr (&Sread_key_sequence);
   defsubr (&Sread_key_sequence_vector);
@@ -11555,14 +11618,16 @@
 
   DEFVAR_LISP ("unread-post-input-method-events", &Vunread_post_input_method_events,
 	       doc: /* List of events to be processed as input by input methods.
-These events are processed after `unread-command-events', but
-before actual keyboard input.  */);
+These events are processed before `unread-command-events'
+and actual keyboard input without given to `input-method-function'.  */);
   Vunread_post_input_method_events = Qnil;
 
   DEFVAR_LISP ("unread-input-method-events", &Vunread_input_method_events,
 	       doc: /* List of events to be processed as input by input methods.
 These events are processed after `unread-command-events', but
-before actual keyboard input.  */);
+before actual keyboard input.
+If there's an active input method, the events are given to
+`input-method-function'.  */);
   Vunread_input_method_events = Qnil;
 
   DEFVAR_LISP ("meta-prefix-char", &meta_prefix_char,
--- a/src/mac.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/mac.c	Sat Oct 14 16:56:21 2006 +0000
@@ -831,7 +831,7 @@
   return err;
 }
 
-OSErr
+OSStatus
 create_apple_event_from_event_ref (event, num_params, names, types, result)
      EventRef event;
      UInt32 num_params;
@@ -839,7 +839,7 @@
      EventParamType *types;
      AppleEvent *result;
 {
-  OSErr err;
+  OSStatus err;
   UInt32 i, size;
   CFStringRef string;
   CFDataRef data;
@@ -2424,7 +2424,7 @@
   SELECT_TYPE *efds;
   struct timeval *timeout;
 {
-  OSErr err;
+  OSStatus err;
 #if TARGET_API_MAC_CARBON
   EventTimeout timeout_sec =
     (timeout
@@ -4192,7 +4192,7 @@
      (filename)
      Lisp_Object filename;
 {
-  OSErr	status;
+  OSStatus status;
 #ifdef MAC_OSX
   FSRef fref;
 #else
@@ -4246,7 +4246,7 @@
      (filename)
      Lisp_Object filename;
 {
-  OSErr	status;
+  OSStatus status;
 #ifdef MAC_OSX
   FSRef fref;
 #else
@@ -4302,7 +4302,7 @@
      (filename, code)
      Lisp_Object filename, code;
 {
-  OSErr	status;
+  OSStatus status;
 #ifdef MAC_OSX
   FSRef fref;
 #else
@@ -4362,7 +4362,7 @@
      (filename, code)
      Lisp_Object filename, code;
 {
-  OSErr	status;
+  OSStatus status;
 #ifdef MAC_OSX
   FSRef fref;
 #else
@@ -4775,7 +4775,7 @@
       UnicodeMapping map;
       CFIndex length;
       UniChar *in_text, *buffer = NULL, *out_buf = NULL;
-      OSErr err = noErr;
+      OSStatus err = noErr;
       ByteCount out_read, out_size, out_len;
 
       map.unicodeEncoding = CreateTextEncoding (kTextEncodingUnicodeDefault,
@@ -4910,7 +4910,7 @@
 static Lisp_Object
 mac_get_system_locale ()
 {
-  OSErr err;
+  OSStatus err;
   LangCode lang;
   RegionCode region;
   LocaleRef locale;
@@ -4987,7 +4987,7 @@
      struct timeval *timeout;
 {
   int r;
-  OSErr err;
+  OSStatus err;
 
   r = select (n, rfds, wfds, efds, timeout);
   if (r != -1)
@@ -5017,7 +5017,7 @@
      SELECT_TYPE *efds;
      struct timeval *timeout;
 {
-  OSErr err;
+  OSStatus err;
   int i, r;
   EMACS_TIME select_timeout;
 
--- a/src/macfns.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/macfns.c	Sat Oct 14 16:56:21 2006 +0000
@@ -1945,63 +1945,80 @@
 mac_update_proxy_icon (f)
      struct frame *f;
 {
+  OSStatus err;
   Lisp_Object file_name =
     XBUFFER (XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer)->filename;
   Window w = FRAME_MAC_WINDOW (f);
-
-  if (FRAME_FILE_NAME (f) == NULL && !STRINGP (file_name))
-    return;
-  if (FRAME_FILE_NAME (f) && STRINGP (file_name)
-      && strcmp (FRAME_FILE_NAME (f), SDATA (file_name)) == 0)
-    return;
-
-  if (FRAME_FILE_NAME (f))
-    {
-      xfree (FRAME_FILE_NAME (f));
-      FRAME_FILE_NAME (f) = NULL;
-    }
+  AliasHandle alias = NULL;
 
   BLOCK_INPUT;
 
+  err = GetWindowProxyAlias (w, &alias);
+  if (err == errWindowDoesNotHaveProxy && !STRINGP (file_name))
+    goto out;
+
   if (STRINGP (file_name))
     {
-      OSStatus err;
       AEDesc desc;
+#ifdef MAC_OSX
+      FSRef fref;
+#else
+      FSSpec fss;
+#endif
+      Boolean changed;
       Lisp_Object encoded_file_name = ENCODE_FILE (file_name);
 
-#ifdef MAC_OS8
+#ifdef MAC_OSX
+      err = AECoercePtr (TYPE_FILE_NAME, SDATA (encoded_file_name),
+			 SBYTES (encoded_file_name), typeFSRef, &desc);
+#else
       SetPortWindowPort (w);
+      err = AECoercePtr (TYPE_FILE_NAME, SDATA (encoded_file_name),
+			 SBYTES (encoded_file_name), typeFSS, &desc);
 #endif
-      err = AECoercePtr (TYPE_FILE_NAME, SDATA (encoded_file_name),
-			 SBYTES (encoded_file_name), typeAlias, &desc);
       if (err == noErr)
 	{
-	  Size size = AEGetDescDataSize (&desc);
-	  AliasHandle alias = (AliasHandle) NewHandle (size);
-
-	  if (alias == NULL)
-	    err = memFullErr;
-	  else
-	    {
-	      HLock ((Handle) alias);
-	      err = AEGetDescData (&desc, *alias, size);
-	      HUnlock ((Handle) alias);
-	      if (err == noErr)
-		err = SetWindowProxyAlias (w, alias);
-	      DisposeHandle ((Handle) alias);
-	    }
+#ifdef MAC_OSX
+	  err = AEGetDescData (&desc, &fref, sizeof (FSRef));
+#else
+	  err = AEGetDescData (&desc, &fss, sizeof (FSSpec));
+#endif
 	  AEDisposeDesc (&desc);
 	}
       if (err == noErr)
 	{
-	  FRAME_FILE_NAME (f) = xmalloc (SBYTES (file_name) + 1);
-	  strcpy (FRAME_FILE_NAME (f), SDATA (file_name));
+	  if (alias)
+	    {
+#ifdef MAC_OSX
+	      err = FSUpdateAlias (NULL, &fref, alias, &changed);
+#else
+	      err = UpdateAlias (NULL, &fss, alias, &changed);
+#endif
+	    }
+	  if (err != noErr || alias == NULL)
+	    {
+	      if (alias)
+		DisposeHandle ((Handle) alias);
+#ifdef MAC_OSX
+	      err = FSNewAliasMinimal (&fref, &alias);
+#else
+	      err = NewAliasMinimal (&fss, &alias);
+#endif
+	      changed = true;
+	    }
 	}
+      if (err == noErr)
+	if (changed)
+	  err = SetWindowProxyAlias (w, alias);
     }
 
-  if (FRAME_FILE_NAME (f) == NULL)
+  if (alias)
+    DisposeHandle ((Handle) alias);
+
+  if (err != noErr || !STRINGP (file_name))
     RemoveWindowProxy (w);
 
+ out:
   UNBLOCK_INPUT;
 }
 #endif
@@ -2566,7 +2583,6 @@
   f->output_data.mac = (struct mac_output *) xmalloc (sizeof (struct mac_output));
   bzero (f->output_data.mac, sizeof (struct mac_output));
   FRAME_FONTSET (f) = -1;
-  record_unwind_protect (unwind_create_frame, frame);
 
   f->icon_name
     = mac_get_arg (parms, Qicon_name, "iconName", "Title", RES_TYPE_STRING);
@@ -2574,6 +2590,9 @@
     f->icon_name = Qnil;
 
 /*   FRAME_MAC_DISPLAY_INFO (f) = dpyinfo; */
+
+  /* With FRAME_MAC_DISPLAY_INFO set up, this unwind-protect is safe.  */
+  record_unwind_protect (unwind_create_frame, frame);
 #if GLYPH_DEBUG
   image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
   dpyinfo_refcount = dpyinfo->reference_count;
@@ -2876,14 +2895,9 @@
   CHECK_STRING (color);
 
   if (mac_defined_color (f, SDATA (color), &foo, 0))
-    {
-      Lisp_Object rgb[3];
-
-      rgb[0] = make_number (foo.red);
-      rgb[1] = make_number (foo.green);
-      rgb[2] = make_number (foo.blue);
-      return Flist (3, rgb);
-    }
+    return list3 (make_number (foo.red),
+		  make_number (foo.green),
+		  make_number (foo.blue));
   else
     return Qnil;
 }
--- a/src/macselect.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/macselect.c	Sat Oct 14 16:56:21 2006 +0000
@@ -31,15 +31,15 @@
 typedef ResType ScrapFlavorType;
 #endif /* !TARGET_API_MAC_CARBON */
 
-static OSErr get_scrap_from_symbol P_ ((Lisp_Object, int, ScrapRef *));
+static OSStatus get_scrap_from_symbol P_ ((Lisp_Object, int, ScrapRef *));
 static ScrapFlavorType get_flavor_type_from_symbol P_ ((Lisp_Object));
 static int valid_scrap_target_type_p P_ ((Lisp_Object));
-static OSErr clear_scrap P_ ((ScrapRef *));
-static OSErr put_scrap_string P_ ((ScrapRef, Lisp_Object, Lisp_Object));
-static OSErr put_scrap_private_timestamp P_ ((ScrapRef, unsigned long));
+static OSStatus clear_scrap P_ ((ScrapRef *));
+static OSStatus put_scrap_string P_ ((ScrapRef, Lisp_Object, Lisp_Object));
+static OSStatus put_scrap_private_timestamp P_ ((ScrapRef, unsigned long));
 static ScrapFlavorType scrap_has_target_type P_ ((ScrapRef, Lisp_Object));
 static Lisp_Object get_scrap_string P_ ((ScrapRef, Lisp_Object));
-static OSErr get_scrap_private_timestamp P_ ((ScrapRef, unsigned long *));
+static OSStatus get_scrap_private_timestamp P_ ((ScrapRef, unsigned long *));
 static Lisp_Object get_scrap_target_type_list P_ ((ScrapRef));
 static void x_own_selection P_ ((Lisp_Object, Lisp_Object));
 static Lisp_Object x_get_local_selection P_ ((Lisp_Object, Lisp_Object, int));
@@ -108,13 +108,13 @@
    reference is set to *SCRAP, and it becomes NULL if there's no
    corresponding scrap.  Clear the scrap if CLEAR_P is non-zero.  */
 
-static OSErr
+static OSStatus
 get_scrap_from_symbol (sym, clear_p, scrap)
      Lisp_Object sym;
      int clear_p;
      ScrapRef *scrap;
 {
-  OSErr err = noErr;
+  OSStatus err = noErr;
   Lisp_Object str = Fget (sym, Qmac_scrap_name);
 
   if (!STRINGP (str))
@@ -172,7 +172,7 @@
 
 /* Clear the scrap whose reference is *SCRAP. */
 
-static INLINE OSErr
+static INLINE OSStatus
 clear_scrap (scrap)
      ScrapRef *scrap;
 {
@@ -190,7 +190,7 @@
 /* Put Lisp String STR to the scrap SCRAP.  The target type is
    specified by TYPE. */
 
-static OSErr
+static OSStatus
 put_scrap_string (scrap, type, str)
      ScrapRef scrap;
      Lisp_Object type, str;
@@ -211,7 +211,7 @@
 /* Put TIMESTAMP to the scrap SCRAP.  The timestamp is used for
    checking if the scrap is owned by the process.  */
 
-static INLINE OSErr
+static INLINE OSStatus
 put_scrap_private_timestamp (scrap, timestamp)
      ScrapRef scrap;
      unsigned long timestamp;
@@ -233,7 +233,7 @@
      ScrapRef scrap;
      Lisp_Object type;
 {
-  OSErr err;
+  OSStatus err;
   ScrapFlavorType flavor_type = get_flavor_type_from_symbol (type);
 
   if (flavor_type)
@@ -264,7 +264,7 @@
      ScrapRef scrap;
      Lisp_Object type;
 {
-  OSErr err;
+  OSStatus err;
   Lisp_Object result = Qnil;
   ScrapFlavorType flavor_type = get_flavor_type_from_symbol (type);
 #if TARGET_API_MAC_CARBON
@@ -310,12 +310,12 @@
 
 /* Get timestamp from the scrap SCRAP and set to *TIMPSTAMP.  */
 
-static OSErr
+static OSStatus
 get_scrap_private_timestamp (scrap, timestamp)
      ScrapRef scrap;
      unsigned long *timestamp;
 {
-  OSErr err = noErr;
+  OSStatus err = noErr;
 #if TARGET_API_MAC_CARBON
   ScrapFlavorFlags flags;
 
@@ -365,7 +365,7 @@
 {
   Lisp_Object result = Qnil, rest, target_type;
 #if TARGET_API_MAC_CARBON
-  OSErr err;
+  OSStatus err;
   UInt32 count, i, type;
   ScrapFlavorInfo *flavor_info = NULL;
   Lisp_Object strings = Qnil;
@@ -425,7 +425,7 @@
 x_own_selection (selection_name, selection_value)
      Lisp_Object selection_name, selection_value;
 {
-  OSErr err;
+  OSStatus err;
   ScrapRef scrap;
   struct gcpro gcpro1, gcpro2;
   Lisp_Object rest, handler_fn, value, type;
@@ -671,7 +671,7 @@
 x_get_foreign_selection (selection_symbol, target_type, time_stamp)
      Lisp_Object selection_symbol, target_type, time_stamp;
 {
-  OSErr err;
+  OSStatus err;
   ScrapRef scrap;
   Lisp_Object result = Qnil;
 
@@ -765,7 +765,7 @@
      Lisp_Object selection;
      Lisp_Object time;
 {
-  OSErr err;
+  OSStatus err;
   ScrapRef scrap;
   Lisp_Object local_selection_data;
 
@@ -828,7 +828,7 @@
      (selection)
      Lisp_Object selection;
 {
-  OSErr err;
+  OSStatus err;
   ScrapRef scrap;
   Lisp_Object result = Qnil, local_selection_data;
 
@@ -873,7 +873,7 @@
      (selection)
      Lisp_Object selection;
 {
-  OSErr err;
+  OSStatus err;
   ScrapRef scrap;
   Lisp_Object result = Qnil, rest;
 
@@ -931,7 +931,7 @@
   struct suspended_ae_info *next;
 };
 
-/* List of deferred apple events at the startup time.  */
+/* List of apple events deferred at the startup time.  */
 static struct suspended_ae_info *deferred_apple_events = NULL;
 
 /* List of suspended apple events, in order of expiration_tick.  */
--- a/src/macterm.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/macterm.c	Sat Oct 14 16:56:21 2006 +0000
@@ -902,7 +902,7 @@
 #if USE_ATSUI
   if (GC_FONT (gc)->mac_style)
     {
-      OSErr err;
+      OSStatus err;
       ATSUTextLayout text_layout;
 
       xassert (bytes_per_char == 2);
@@ -1129,7 +1129,7 @@
    the font of the current graphics port.  If CG_GLYPH is not NULL,
    *CG_GLYPH is set to the glyph ID or 0 if it cannot be obtained.  */
 
-static OSErr
+static OSStatus
 mac_query_char_extents (style, c,
 			font_ascent_return, font_descent_return,
 			overall_return, cg_glyph)
@@ -1147,7 +1147,7 @@
      void *cg_glyph;
 #endif
 {
-  OSErr err = noErr;
+  OSStatus err = noErr;
   int width;
   Rect char_bounds;
 
@@ -1193,7 +1193,7 @@
 #if USE_CG_TEXT_DRAWING
 	  if (err == noErr && cg_glyph)
 	    {
-	      OSErr err1;
+	      OSStatus err1;
 	      ATSUGlyphInfoArray glyph_info_array;
 	      ByteCount count = sizeof (ATSUGlyphInfoArray);
 
@@ -3583,7 +3583,9 @@
       int background_width = s->background_width;
       int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
 
-      if (x < left_x)
+      /* Don't draw into left margin, fringe or scrollbar area
+         except for header line and mode line.  */
+      if (x < left_x && !s->row->mode_line_p)
 	{
 	  background_width -= left_x - x;
 	  x = left_x;
@@ -3677,14 +3679,14 @@
 
 	  if (s->face->underline_defaulted_p)
 	    mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy,
-				s->width, h);
+				s->background_width, h);
 	  else
 	    {
 	      XGCValues xgcv;
 	      XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
 	      XSetForeground (s->display, s->gc, s->face->underline_color);
 	      mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy,
-				  s->width, h);
+				  s->background_width, h);
 	      XSetForeground (s->display, s->gc, xgcv.foreground);
 	    }
 	}
@@ -3696,14 +3698,14 @@
 
 	  if (s->face->overline_color_defaulted_p)
 	    mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy,
-				s->width, h);
+				s->background_width, h);
 	  else
 	    {
 	      XGCValues xgcv;
 	      XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
 	      XSetForeground (s->display, s->gc, s->face->overline_color);
 	      mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy,
-				  s->width, h);
+				  s->background_width, h);
 	      XSetForeground (s->display, s->gc, xgcv.foreground);
 	    }
 	}
@@ -6312,7 +6314,7 @@
 x_iconify_frame (f)
      struct frame *f;
 {
-  OSErr err;
+  OSStatus err;
 
   /* A deactivate event does not occur when the last visible frame is
      iconified.  So if we clear the highlight here, it will not be
@@ -6376,11 +6378,6 @@
   if (FRAME_SIZE_HINTS (f))
     xfree (FRAME_SIZE_HINTS (f));
 
-#if TARGET_API_MAC_CARBON
-  if (FRAME_FILE_NAME (f))
-    xfree (FRAME_FILE_NAME (f));
-#endif
-
   xfree (f->output_data.mac);
   f->output_data.mac = NULL;
 
@@ -7198,7 +7195,7 @@
   if (!NILP (assq_no_quit (make_number (kTextEncodingMacUnicode),
 			   text_encoding_info_alist)))
     {
-      OSErr err;
+      OSStatus err;
       struct Lisp_Hash_Table *h;
       unsigned hash_code;
       ItemCount nfonts, i;
@@ -7780,7 +7777,7 @@
 #if USE_ATSUI
   if (strcmp (charset, "iso10646-1") == 0) /* XXX */
     {
-      OSErr err;
+      OSStatus err;
       ATSUAttributeTag tags[] = {kATSUFontTag, kATSUSizeTag,
 				 kATSUQDBoldfaceTag, kATSUQDItalicTag};
       ByteCount sizes[] = {sizeof (ATSUFontID), sizeof (Fixed),
@@ -7863,7 +7860,7 @@
 #if USE_ATSUI
   if (font->mac_style)
     {
-      OSErr err;
+      OSStatus err;
       UniChar c;
 
       font->min_byte1 = 0;
@@ -8342,8 +8339,8 @@
 
   for (i = 0; i < dpyinfo->n_fonts; i++)
     if (dpyinfo->font_table[i].name
-	&& (!strcmp (dpyinfo->font_table[i].name, fontname)
-	    || !strcmp (dpyinfo->font_table[i].full_name, fontname)))
+	&& (!xstricmp (dpyinfo->font_table[i].name, fontname)
+	    || !xstricmp (dpyinfo->font_table[i].full_name, fontname)))
       return (dpyinfo->font_table + i);
   return NULL;
 }
@@ -8537,7 +8534,7 @@
 
 /* Apple Events */
 #if USE_CARBON_EVENTS
-static Lisp_Object Qhicommand;
+static Lisp_Object Qhi_command;
 #ifdef MAC_OSX
 extern Lisp_Object Qwindow;
 static Lisp_Object Qtoolbar_switch_mode;
@@ -8579,7 +8576,7 @@
 static pascal OSStatus mac_handle_window_event (EventHandlerCallRef,
 						EventRef, void *);
 #endif
-OSErr install_window_handler (WindowPtr);
+OSStatus install_window_handler (WindowPtr);
 
 extern void init_emacs_passwd_dir ();
 extern int emacs_main (int, char **, char **);
@@ -9380,15 +9377,15 @@
   if (err != noErr || command.commandID == 0)
     return eventNotHandledErr;
 
-  /* A HICommand event is mapped to an Apple event whose event class
-     symbol is `hicommand' and event ID is its command ID.  */
+  /* A HI command event is mapped to an Apple event whose event class
+     symbol is `hi-command' and event ID is its command ID.  */
   err = mac_store_event_ref_as_apple_event (0, command.commandID,
-					    Qhicommand, Qnil,
+					    Qhi_command, Qnil,
 					    event, num_params, names, types);
   return err == noErr ? noErr : eventNotHandledErr;
 }
 
-static OSErr
+static OSStatus
 init_command_handler ()
 {
   EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}};
@@ -9889,11 +9886,11 @@
 #endif	/* USE_CARBON_EVENTS */
 
 
-OSErr
+OSStatus
 install_window_handler (window)
      WindowPtr window;
 {
-  OSErr err = noErr;
+  OSStatus err = noErr;
 #if USE_CARBON_EVENTS
   EventTypeSpec specs_window[] =
     {{kEventClassWindow, kEventWindowUpdate},
@@ -11327,7 +11324,7 @@
 init_menu_bar ()
 {
 #ifdef MAC_OSX
-  OSErr err;
+  OSStatus err;
   MenuRef menu;
   MenuItemIndex menu_index;
 
@@ -11511,7 +11508,7 @@
   Fput (Qsuper,   Qmodifier_value, make_number (super_modifier));
 
 #if USE_CARBON_EVENTS
-  Qhicommand   = intern ("hicommand");    staticpro (&Qhicommand);
+  Qhi_command   = intern ("hi-command");    staticpro (&Qhi_command);
 #ifdef MAC_OSX
   Qtoolbar_switch_mode = intern ("toolbar-switch-mode");
   staticpro (&Qtoolbar_switch_mode);
--- a/src/macterm.h	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/macterm.h	Sat Oct 14 16:56:21 2006 +0000
@@ -335,11 +335,6 @@
   /* Hints for the size and the position of a window.  */
   XSizeHints *size_hints;
 
-#if TARGET_API_MAC_CARBON
-  /* File name for the proxy icon of this frame.  Might be NULL.  */
-  char *file_name;
-#endif
-
 #if USE_CG_DRAWING
   /* Quartz 2D graphics context.  */
   CGContextRef cg_context;
@@ -362,8 +357,6 @@
 
 #define FRAME_SIZE_HINTS(f) ((f)->output_data.mac->size_hints)
 
-#define FRAME_FILE_NAME(f) ((f)->output_data.mac->file_name)
-
 /* This gives the mac_display_info structure for the display F is on.  */
 #define FRAME_MAC_DISPLAY_INFO(f) (&one_mac_display_info)
 #define FRAME_X_DISPLAY_INFO(f) (&one_mac_display_info)
@@ -631,7 +624,7 @@
 extern int mac_font_panel_visible_p P_ ((void));
 extern OSStatus mac_show_hide_font_panel P_ ((void));
 extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int));
-extern OSErr install_window_handler P_ ((WindowPtr));
+extern OSStatus install_window_handler P_ ((WindowPtr));
 extern void remove_window_handler P_ ((WindowPtr));
 extern void do_menu_choice P_ ((SInt32));
 extern OSStatus mac_post_mouse_moved_event P_ ((void));
@@ -672,10 +665,10 @@
 extern Lisp_Object mac_aedesc_to_lisp P_ ((const AEDesc *));
 extern OSErr mac_ae_put_lisp P_ ((AEDescList *, UInt32, Lisp_Object));
 #if TARGET_API_MAC_CARBON
-extern OSErr create_apple_event_from_event_ref P_ ((EventRef, UInt32,
-						    EventParamName *,
-						    EventParamType *,
-						    AppleEvent *));
+extern OSStatus create_apple_event_from_event_ref P_ ((EventRef, UInt32,
+						       EventParamName *,
+						       EventParamType *,
+						       AppleEvent *));
 extern OSErr create_apple_event_from_drag_ref P_ ((DragRef, UInt32,
 						   FlavorType *,
 						   AppleEvent *));
--- a/src/print.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/print.c	Sat Oct 14 16:56:21 2006 +0000
@@ -924,6 +924,15 @@
   return character;
 }
 
+/* This function is never called.  Its purpose is to prevent
+   print_output_debug_flag from being optimized away.  */
+
+void
+debug_output_compilation_hack (x)
+     int x;
+{
+  print_output_debug_flag = x;
+}
 
 #if defined(GNU_LINUX)
 
--- a/src/process.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/process.c	Sat Oct 14 16:56:21 2006 +0000
@@ -4163,6 +4163,14 @@
    when not inside wait_reading_process_output.  */
 static int waiting_for_user_input_p;
 
+static Lisp_Object
+wait_reading_process_output_unwind (data)
+     Lisp_Object data;
+{
+  waiting_for_user_input_p = XINT (data);
+  return Qnil;
+}
+
 /* This is here so breakpoints can be put on it.  */
 static void
 wait_reading_process_output_1 ()
@@ -4245,9 +4253,7 @@
   EMACS_TIME timeout, end_time;
   int wait_channel = -1;
   int got_some_input = 0;
-  /* Either nil or a cons cell, the car of which is of interest and
-     may be changed outside of this routine.  */
-  int saved_waiting_for_user_input_p = waiting_for_user_input_p;
+  int count = SPECPDL_INDEX ();
 
   FD_ZERO (&Available);
 #ifdef NON_BLOCKING_CONNECT
@@ -4258,6 +4264,8 @@
   if (wait_proc != NULL)
     wait_channel = XINT (wait_proc->infd);
 
+  record_unwind_protect (wait_reading_process_output_unwind,
+			 make_number (waiting_for_user_input_p));
   waiting_for_user_input_p = read_kbd;
 
   /* Since we may need to wait several times,
@@ -4884,7 +4892,7 @@
 	}			/* end for each file descriptor */
     }				/* end while exit conditions not met */
 
-  waiting_for_user_input_p = saved_waiting_for_user_input_p;
+  unbind_to (count, Qnil);
 
   /* If calling from keyboard input, do not quit
      since we want to return C-g as an input character.
--- a/src/puresize.h	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/puresize.h	Sat Oct 14 16:56:21 2006 +0000
@@ -43,7 +43,7 @@
 #endif
 
 #ifndef BASE_PURESIZE
-#define BASE_PURESIZE (1126000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
+#define BASE_PURESIZE (1130000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
 #endif
 
 /* Increase BASE_PURESIZE by a ratio depending on the machine's word size.  */
--- a/src/w32.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/w32.c	Sat Oct 14 16:56:21 2006 +0000
@@ -323,6 +323,28 @@
   return buf;
 }
 
+/* Return 1 if P is a valid pointer to an object of size SIZE.  Return
+   0 if P is NOT a valid pointer.  Return -1 if we cannot validate P.
+
+   This is called from alloc.c:valid_pointer_p.  */
+int
+w32_valid_pointer_p (void *p, int size)
+{
+  SIZE_T done;
+  HANDLE h = OpenProcess (PROCESS_VM_READ, FALSE, GetCurrentProcessId ());
+
+  if (h)
+    {
+      unsigned char *buf = alloca (size);
+      int retval = ReadProcessMemory (h, p, buf, size, &done);
+
+      CloseHandle (h);
+      return retval;
+    }
+  else
+    return -1;
+}
+
 static char startup_dir[MAXPATHLEN];
 
 /* Get the current working directory.  */
--- a/src/w32.h	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/w32.h	Sat Oct 14 16:56:21 2006 +0000
@@ -110,6 +110,9 @@
 /* Equivalent of strerror for W32 error codes.  */
 extern char * w32_strerror (int error_no);
 
+/* Validate a pointer.  */
+extern int w32_valid_pointer_p (void *, int);
+
 /* Get long (aka "true") form of file name, if it exists.  */
 extern BOOL w32_get_long_filename (char * name, char * buf, int size);
 
--- a/src/w32fns.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/w32fns.c	Sat Oct 14 16:56:21 2006 +0000
@@ -2066,7 +2066,8 @@
 {
   HWND hwnd;
   RECT rect;
-  Lisp_Object top, left;
+  Lisp_Object top = Qunbound;
+  Lisp_Object left = Qunbound;
 
   rect.left = rect.top = 0;
   rect.right = FRAME_PIXEL_WIDTH (f);
@@ -2079,13 +2080,41 @@
 
   if (!hprevinst)
     {
+      Lisp_Object ifa;
+
       w32_init_class (hinst);
-    }
-
-  /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero
-     for anything that is not a number and is not Qunbound.  */
-  left = w32_get_arg (Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER);
-  top = w32_get_arg (Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
+
+      /* Handle the -geometry command line option and the geometry
+	 settings in the registry.  They are decoded and put into
+	 initial-frame-alist by w32-win.el:x-handle-geometry.  */
+      ifa = Fsymbol_value (intern ("initial-frame-alist"));
+      if (CONSP (ifa))
+	{
+	  Lisp_Object lt = Fassq (Qleft, ifa);
+	  Lisp_Object tp = Fassq (Qtop,  ifa);
+
+	  if (!NILP (lt))
+	    {
+	      lt = XCDR (lt);
+	      if (INTEGERP (lt))
+		left = lt;
+	    }
+	  if (!NILP (tp))
+	    {
+	      tp = XCDR (tp);
+	      if (INTEGERP (tp))
+		top = tp;
+	    }
+	}
+    }
+
+  if (EQ (left, Qunbound) && EQ (top, Qunbound))
+    {
+      /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero
+	 for anything that is not a number and is not Qunbound.  */
+      left = w32_get_arg (Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER);
+      top = w32_get_arg (Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
+    }
 
   FRAME_W32_WINDOW (f) = hwnd
     = CreateWindow (EMACS_CLASS,
@@ -6207,7 +6236,7 @@
 
   for (i = 0; i < one_w32_display_info.n_fonts ;i++, pfi++)
     {
-      if (strcmp(pfi->name, fontname) == 0) return pfi;
+      if (stricmp(pfi->name, fontname) == 0) return pfi;
     }
 
   return NULL;
@@ -6326,17 +6355,12 @@
   CHECK_STRING (color);
 
   if (w32_defined_color (f, SDATA (color), &foo, 0))
-    {
-      Lisp_Object rgb[3];
-
-      rgb[0] = make_number ((GetRValue (foo.pixel) << 8)
-                            | GetRValue (foo.pixel));
-      rgb[1] = make_number ((GetGValue (foo.pixel) << 8)
-                            | GetGValue (foo.pixel));
-      rgb[2] = make_number ((GetBValue (foo.pixel) << 8)
-                            | GetBValue (foo.pixel));
-      return Flist (3, rgb);
-    }
+    return list3 (make_number ((GetRValue (foo.pixel) << 8)
+			       | GetRValue (foo.pixel)),
+		  make_number ((GetGValue (foo.pixel) << 8)
+			       | GetGValue (foo.pixel)),
+		  make_number ((GetBValue (foo.pixel) << 8)
+			       | GetBValue (foo.pixel)));
   else
     return Qnil;
 }
--- a/src/w32menu.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/w32menu.c	Sat Oct 14 16:56:21 2006 +0000
@@ -1994,6 +1994,9 @@
 	    }
 	}
     }
+  else if (!for_click)
+    /* Make "Cancel" equivalent to C-g.  */
+    Fsignal (Qquit, Qnil);
 
   return Qnil;
 }
@@ -2186,6 +2189,9 @@
 	    }
 	}
     }
+  else
+    /* Make "Cancel" equivalent to C-g.  */
+    Fsignal (Qquit, Qnil);
 
   return Qnil;
 }
--- a/src/w32term.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/w32term.c	Sat Oct 14 16:56:21 2006 +0000
@@ -91,6 +91,10 @@
    (Not yet supported, see TODO in x_draw_glyph_string.)  */
 int x_use_underline_position_properties;
 
+/* Non-zero means to draw the underline at the same place as the descent line.  */
+
+int x_underline_at_descent_line;
+
 extern unsigned int msh_mousewheel;
 
 extern void free_frame_menubar ();
@@ -2418,7 +2422,9 @@
       int background_width = s->background_width;
       int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
 
-      if (x < left_x)
+      /* Don't draw into left margin, fringe or scrollbar area
+         except for header line and mode line.  */
+      if (x < left_x && !s->row->mode_line_p)
 	{
 	  background_width -= left_x - x;
 	  x = left_x;
@@ -2507,21 +2513,27 @@
           && (s->font->bdf || !s->font->tm.tmUnderlined))
         {
           unsigned long h = 1;
-          unsigned long dy = s->height - h;
-
-	  /* TODO: Use font information for positioning and thickness
-	     of underline.  See OUTLINETEXTMETRIC, and xterm.c.
-	     Note: If you make this work, don't forget to change the
-	     doc string of x-use-underline-position-properties below.  */
+          unsigned long dy = 0;
+
+          if (x_underline_at_descent_line)
+            dy = s->height - h;
+          else
+            {
+              /* TODO: Use font information for positioning and thickness of
+                 underline.  See OUTLINETEXTMETRIC, and xterm.c.  Note: If
+                 you make this work, don't forget to change the doc string of
+                 x-use-underline-position-properties below.  */
+              dy = s->height - h;
+            }
           if (s->face->underline_defaulted_p)
             {
               w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x,
-                             s->y + dy, s->width, 1);
+                             s->y + dy, s->background_width, 1);
             }
           else
             {
               w32_fill_area (s->f, s->hdc, s->face->underline_color, s->x,
-                             s->y + dy, s->width, 1);
+                             s->y + dy, s->background_width, 1);
             }
         }
 
@@ -2533,12 +2545,12 @@
           if (s->face->overline_color_defaulted_p)
         {
           w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x,
-                         s->y + dy, s->width, h);
+                         s->y + dy, s->background_width, h);
         }
           else
             {
               w32_fill_area (s->f, s->hdc, s->face->overline_color, s->x,
-                             s->y + dy, s->width, h);
+                             s->y + dy, s->background_width, h);
             }
         }
 
@@ -6509,6 +6521,14 @@
 NOTE: Not supported on MS-Windows yet.  */);
   x_use_underline_position_properties = 0;
 
+  DEFVAR_BOOL ("x-underline-at-descent-line",
+	       &x_underline_at_descent_line,
+     doc: /* *Non-nil means to draw the underline at the same place as the descent line.
+nil means to draw the underline according to the value of the variable
+`x-use-underline-position-properties', which is usually at the baseline
+level.  The default value is nil.  */);
+  x_underline_at_descent_line = 0;
+
   DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
 	       doc: /* If not nil, Emacs uses toolkit scroll bars.  */);
   Vx_toolkit_scroll_bars = Qt;
--- a/src/window.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/window.c	Sat Oct 14 16:56:21 2006 +0000
@@ -6658,10 +6658,12 @@
     CHECK_NATNUM (left_width);
   if (!NILP (right_width))
     CHECK_NATNUM (right_width);
-
-  if (!EQ (w->left_fringe_width, left_width)
-      || !EQ (w->right_fringe_width, right_width)
-      || !EQ (w->fringes_outside_margins, outside_margins))
+ 
+  /* Do nothing on a tty.  */
+  if (FRAME_WINDOW_P (WINDOW_XFRAME (w))
+      && (!EQ (w->left_fringe_width, left_width)
+	  || !EQ (w->right_fringe_width, right_width)
+	  || !EQ (w->fringes_outside_margins, outside_margins)))
     {
       w->left_fringe_width = left_width;
       w->right_fringe_width = right_width;
@@ -6689,10 +6691,11 @@
      Lisp_Object window;
 {
   struct window *w = decode_window (window);
+
   return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
 		Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
-		       Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ?
-			       Qt : Qnil), Qnil)));
+		       Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
+			       ? Qt : Qnil), Qnil)));
 }
 
 
--- a/src/xdisp.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/xdisp.c	Sat Oct 14 16:56:21 2006 +0000
@@ -701,6 +701,10 @@
 
 struct buffer *displayed_buffer;
 
+/* Space between overline and text. */
+
+EMACS_INT overline_margin;
+
 /* Value returned from text property handlers (see below).  */
 
 enum prop_handled
@@ -887,7 +891,7 @@
 static Lisp_Object redisplay_window_error ();
 static Lisp_Object redisplay_window_0 P_ ((Lisp_Object));
 static Lisp_Object redisplay_window_1 P_ ((Lisp_Object));
-static void update_menu_bar P_ ((struct frame *, int));
+static int update_menu_bar P_ ((struct frame *, int, int));
 static int try_window_reusing_current_matrix P_ ((struct window *));
 static int try_window_id P_ ((struct window *));
 static int display_line P_ ((struct it *));
@@ -9038,6 +9042,9 @@
     {
       Lisp_Object tail, frame;
       int count = SPECPDL_INDEX ();
+      /* 1 means that update_menu_bar has run its hooks
+	 so any further calls to update_menu_bar shouldn't do so again.  */
+      int menu_bar_hooks_run = 0;
 
       record_unwind_save_match_data ();
 
@@ -9069,7 +9076,7 @@
 	    }
 
 	  GCPRO1 (tail);
-	  update_menu_bar (f, 0);
+	  menu_bar_hooks_run = update_menu_bar (f, 0, menu_bar_hooks_run);
 #ifdef HAVE_WINDOW_SYSTEM
 	  update_tool_bar (f, 0);
 #ifdef MAC_OS
@@ -9084,7 +9091,7 @@
   else
     {
       struct frame *sf = SELECTED_FRAME ();
-      update_menu_bar (sf, 1);
+      update_menu_bar (sf, 1, 0);
 #ifdef HAVE_WINDOW_SYSTEM
       update_tool_bar (sf, 1);
 #ifdef MAC_OS
@@ -9105,12 +9112,18 @@
    before we start to fill in any display lines, because it can call
    eval.
 
-   If SAVE_MATCH_DATA is non-zero, we must save and restore it here.  */
-
-static void
-update_menu_bar (f, save_match_data)
+   If SAVE_MATCH_DATA is non-zero, we must save and restore it here.
+
+   If HOOKS_RUN is 1, that means a previous call to update_menu_bar
+   already ran the menu bar hooks for this redisplay, so there
+   is no need to run them again.  The return value is the
+   updated value of this flag, to pass to the next call.  */
+
+static int
+update_menu_bar (f, save_match_data, hooks_run)
      struct frame *f;
      int save_match_data;
+     int hooks_run;
 {
   Lisp_Object window;
   register struct window *w;
@@ -9175,15 +9188,21 @@
 	      specbind (Qoverriding_local_map, Qnil);
 	    }
 
-	  /* Run the Lucid hook.  */
-	  safe_run_hooks (Qactivate_menubar_hook);
-
-	  /* If it has changed current-menubar from previous value,
-	     really recompute the menu-bar from the value.  */
-	  if (! NILP (Vlucid_menu_bar_dirty_flag))
-	    call0 (Qrecompute_lucid_menubar);
-
-	  safe_run_hooks (Qmenu_bar_update_hook);
+	  if (!hooks_run)
+	    {
+	      /* Run the Lucid hook.  */
+	      safe_run_hooks (Qactivate_menubar_hook);
+
+	      /* If it has changed current-menubar from previous value,
+		 really recompute the menu-bar from the value.  */
+	      if (! NILP (Vlucid_menu_bar_dirty_flag))
+		call0 (Qrecompute_lucid_menubar);
+
+	      safe_run_hooks (Qmenu_bar_update_hook);
+
+	      hooks_run = 1;
+	    }
+
 	  FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
 
 	  /* Redisplay the menu bar in case we changed it.  */
@@ -9212,6 +9231,8 @@
 	  set_buffer_internal_1 (prev);
 	}
     }
+
+  return hooks_run;
 }
 
 
@@ -9376,7 +9397,8 @@
                                          &new_n_tool_bar);
 
 	  /* Redisplay the tool-bar if we changed it.  */
-	  if (NILP (Fequal (new_tool_bar, f->tool_bar_items)))
+	  if (new_n_tool_bar != f->n_tool_bar_items
+	      || NILP (Fequal (new_tool_bar, f->tool_bar_items)))
             {
               /* Redisplay that happens asynchronously due to an expose event
                  may access f->tool_bar_items.  Make sure we update both
@@ -20354,7 +20376,7 @@
 	  /* If face has an overline, add the height of the overline
 	     (1 pixel) and a 1 pixel margin to the character height.  */
 	  if (face->overline_p)
-	    it->ascent += 2;
+	    it->ascent += overline_margin;
 
 	  if (it->constrain_row_ascent_descent_p)
 	    {
@@ -20556,7 +20578,7 @@
 	  /* If face has an overline, add the height of the overline
 	     (1 pixel) and a 1 pixel margin to the character height.  */
 	  if (face->overline_p)
-	    it->ascent += 2;
+	    it->ascent += overline_margin;
 
 	  take_vertical_position_into_account (it);
 
@@ -20831,7 +20853,7 @@
       /* If face has an overline, add the height of the overline
 	 (1 pixel) and a 1 pixel margin to the character height.  */
       if (face->overline_p)
-	it->ascent += 2;
+	it->ascent += overline_margin;
 
       take_vertical_position_into_account (it);
 
@@ -24108,6 +24130,12 @@
 	       doc: /* Inhibit try_cursor_movement display optimization.  */);
   inhibit_try_cursor_movement = 0;
 #endif /* GLYPH_DEBUG */
+
+  DEFVAR_INT ("overline-margin", &overline_margin,
+	       doc: /* *Space between overline and text, in pixels.
+The default value is 2: the height of the overline (1 pixel) plus 1 pixel
+margin to the caracter height.  */);
+  overline_margin = 2;
 }
 
 
--- a/src/xfaces.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/xfaces.c	Sat Oct 14 16:56:21 2006 +0000
@@ -1192,7 +1192,7 @@
 
   if (bitmap_id < 0)
     {
-      add_to_log ("Invalid or undefined bitmap %s", name, Qnil);
+      add_to_log ("Invalid or undefined bitmap `%s'", name, Qnil);
       bitmap_id = 0;
 
       if (w_ptr)
@@ -5734,6 +5734,8 @@
       if (!realize_basic_faces (f))
 	return -1;
       default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+      if (default_face == NULL)
+	abort ();  /* realize_basic_faces must have set it up  */
     }
 
   if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p))
@@ -6238,6 +6240,8 @@
       if (! realize_basic_faces (f))
 	error ("Cannot realize default face");
       def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+      if (def_face == NULL)
+	abort ();  /* realize_basic_faces must have set it up  */
     }
 
   /* Dispatch to the appropriate handler.  */
--- a/src/xfns.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/xfns.c	Sat Oct 14 16:56:21 2006 +0000
@@ -3495,14 +3495,9 @@
   CHECK_STRING (color);
 
   if (x_defined_color (f, SDATA (color), &foo, 0))
-    {
-      Lisp_Object rgb[3];
-
-      rgb[0] = make_number (foo.red);
-      rgb[1] = make_number (foo.green);
-      rgb[2] = make_number (foo.blue);
-      return Flist (3, rgb);
-    }
+    return list3 (make_number (foo.red),
+		  make_number (foo.green),
+		  make_number (foo.blue));
   else
     return Qnil;
 }
--- a/src/xselect.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/xselect.c	Sat Oct 14 16:56:21 2006 +0000
@@ -2709,8 +2709,48 @@
   return ret;
 }
 
-/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT.
-   TODO: Check if this client event really is a DND event?  */
+DEFUN ("x-register-dnd-atom", Fx_register_dnd_atom,
+       Sx_register_dnd_atom, 1, 2, 0,
+       doc: /* Request that dnd events are made for ClientMessages with ATOM.
+ATOM can be a symbol or a string.  The ATOM is interned on the display that
+FRAME is on.  If FRAME is nil, the selected frame is used.  */)
+    (atom, frame)
+    Lisp_Object atom, frame;
+{
+  Atom x_atom;
+  struct frame *f = check_x_frame (frame);
+  size_t i;
+  struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+
+
+  if (SYMBOLP (atom))
+    x_atom = symbol_to_x_atom (dpyinfo, FRAME_X_DISPLAY (f), atom);
+  else if (STRINGP (atom))
+    {
+      BLOCK_INPUT;
+      x_atom = XInternAtom (FRAME_X_DISPLAY (f), (char *) SDATA (atom), False);
+      UNBLOCK_INPUT;
+    }
+  else
+    error ("ATOM must be a symbol or a string");
+
+  for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i) 
+    if (dpyinfo->x_dnd_atoms[i] == x_atom)
+      return Qnil;
+
+  if (dpyinfo->x_dnd_atoms_length == dpyinfo->x_dnd_atoms_size) 
+    {
+      dpyinfo->x_dnd_atoms_size *= 2;
+      dpyinfo->x_dnd_atoms = xrealloc (dpyinfo->x_dnd_atoms,
+                                       sizeof (*dpyinfo->x_dnd_atoms)
+                                       * dpyinfo->x_dnd_atoms_size);
+    }
+
+  dpyinfo->x_dnd_atoms[dpyinfo->x_dnd_atoms_length++] = x_atom;
+  return Qnil;
+}
+
+/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT.  */
 
 int
 x_handle_dnd_message (f, event, dpyinfo, bufp)
@@ -2726,6 +2766,12 @@
   int x, y;
   unsigned char *data = (unsigned char *) event->data.b;
   int idata[5];
+  size_t i;
+
+  for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i) 
+    if (dpyinfo->x_dnd_atoms[i] == event->message_type) break;
+
+  if (i == dpyinfo->x_dnd_atoms_length) return 0;
 
   XSETFRAME (frame, f);
 
@@ -2899,6 +2945,7 @@
 
   defsubr (&Sx_get_atom_name);
   defsubr (&Sx_send_client_message);
+  defsubr (&Sx_register_dnd_atom);
 
   reading_selection_reply = Fcons (Qnil, Qnil);
   staticpro (&reading_selection_reply);
--- a/src/xterm.c	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/xterm.c	Sat Oct 14 16:56:21 2006 +0000
@@ -181,6 +181,10 @@
 
 int x_use_underline_position_properties;
 
+/* Non-zero means to draw the underline at the same place as the descent line.  */
+
+int x_underline_at_descent_line;
+
 /* This is a chain of structures for all the X displays currently in
    use.  */
 
@@ -2601,7 +2605,9 @@
       int background_width = s->background_width;
       int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
 
-      if (x < left_x)
+      /* Don't draw into left margin, fringe or scrollbar area
+         except for header line and mode line.  */
+      if (x < left_x && !s->row->mode_line_p)
 	{
 	  background_width -= left_x - x;
 	  x = left_x;
@@ -2695,32 +2701,35 @@
 	  if (!XGetFontProperty (s->font, XA_UNDERLINE_THICKNESS, &h))
 	    h = 1;
 
-	  /* Get the underline position.  This is the recommended
-	     vertical offset in pixels from the baseline to the top of
-	     the underline.  This is a signed value according to the
-	     specs, and its default is
-
-	     ROUND ((maximum descent) / 2), with
-	     ROUND(x) = floor (x + 0.5)  */
-
-	  if (x_use_underline_position_properties
-	      && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem))
-	    y = s->ybase + (long) tem;
-	  else if (s->face->font)
-	    y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2;
-	  else
+          if (x_underline_at_descent_line)
 	    y = s->y + s->height - h;
+          else
+            {
+	      /* Get the underline position.  This is the recommended
+                 vertical offset in pixels from the baseline to the top of
+                 the underline.  This is a signed value according to the
+                 specs, and its default is
+
+	         ROUND ((maximum descent) / 2), with
+	         ROUND(x) = floor (x + 0.5)  */
+
+              if (x_use_underline_position_properties
+                  && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem))
+                y = s->ybase + (long) tem;
+              else if (s->face->font)
+                y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2;
+            }
 
 	  if (s->face->underline_defaulted_p)
 	    XFillRectangle (s->display, s->window, s->gc,
-			    s->x, y, s->width, h);
+			    s->x, y, s->background_width, h);
 	  else
 	    {
 	      XGCValues xgcv;
 	      XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
 	      XSetForeground (s->display, s->gc, s->face->underline_color);
 	      XFillRectangle (s->display, s->window, s->gc,
-			      s->x, y, s->width, h);
+			      s->x, y, s->background_width, h);
 	      XSetForeground (s->display, s->gc, xgcv.foreground);
 	    }
 	}
@@ -2732,14 +2741,14 @@
 
 	  if (s->face->overline_color_defaulted_p)
 	    XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy,
-			    s->width, h);
+			    s->background_width, h);
 	  else
 	    {
 	      XGCValues xgcv;
 	      XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
 	      XSetForeground (s->display, s->gc, s->face->overline_color);
 	      XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy,
-			      s->width, h);
+			      s->background_width, h);
 	      XSetForeground (s->display, s->gc, xgcv.foreground);
 	    }
 	}
@@ -10096,8 +10105,8 @@
 
   for (i = 0; i < dpyinfo->n_fonts; i++)
     if (dpyinfo->font_table[i].name
-	&& (!strcmp (dpyinfo->font_table[i].name, fontname)
-	    || !strcmp (dpyinfo->font_table[i].full_name, fontname)))
+	&& (!strcasecmp (dpyinfo->font_table[i].name, fontname)
+	    || !strcasecmp (dpyinfo->font_table[i].full_name, fontname)))
       return (dpyinfo->font_table + i);
   return NULL;
 }
@@ -10644,6 +10653,11 @@
 
   dpyinfo->cut_buffers_initialized = 0;
 
+  dpyinfo->x_dnd_atoms_size = 8;
+  dpyinfo->x_dnd_atoms_length = 0;
+  dpyinfo->x_dnd_atoms = xmalloc (sizeof (*dpyinfo->x_dnd_atoms)
+                                  * dpyinfo->x_dnd_atoms_size);
+
   connection = ConnectionNumber (dpyinfo->display);
   dpyinfo->connection = connection;
 
@@ -11104,6 +11118,14 @@
 to 4.1, set this to nil.  */);
   x_use_underline_position_properties = 1;
 
+  DEFVAR_BOOL ("x-underline-at-descent-line",
+	       &x_underline_at_descent_line,
+     doc: /* *Non-nil means to draw the underline at the same place as the descent line.
+nil means to draw the underline according to the value of the variable
+`x-use-underline-position-properties', which is usually at the baseline
+level.  The default value is nil.  */);
+  x_underline_at_descent_line = 0;
+
   DEFVAR_BOOL ("x-mouse-click-focus-ignore-position",
 	       &x_mouse_click_focus_ignore_position,
     doc: /* Non-nil means that a mouse click to focus a frame does not move point.
--- a/src/xterm.h	Sun Jul 30 10:19:46 2006 +0000
+++ b/src/xterm.h	Sat Oct 14 16:56:21 2006 +0000
@@ -389,6 +389,12 @@
       X_WMTYPE_A,
       X_WMTYPE_B
     } wm_type;
+
+
+    /* Atoms that are drag and drop atoms */
+    Atom *x_dnd_atoms;
+    size_t x_dnd_atoms_size;
+    size_t x_dnd_atoms_length;
 };
 
 #ifdef HAVE_X_I18N