changeset 90918:e9f94688a064

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 781-792) - Update from CVS - Merge from gnus--rel--5.10 - Merge from emacs--rel--22 * emacs--rel--22 (patch 33-41) * gnus--rel--5.10 (patch 226-228) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-219
author Miles Bader <miles@gnu.org>
date Mon, 11 Jun 2007 00:58:11 +0000
parents 9f1c3e957d3e (current diff) 72447e6dd130 (diff)
children 2f257010ddd5
files AUTHORS ChangeLog Makefile.in admin/ChangeLog admin/FOR-RELEASE admin/admin.el admin/notes/copyright admin/nt/README-ftp-server admin/nt/makedist.bat configure configure.in etc/ChangeLog etc/MORE.STUFF etc/NEWS etc/NEWS.22 etc/TODO leim/ChangeLog lib-src/ChangeLog lib-src/etags.c lisp/ChangeLog lisp/ChangeLog.12 lisp/calc/calc-help.el lisp/desktop.el lisp/dired.el lisp/emacs-lisp/bytecomp.el lisp/emacs-lisp/checkdoc.el lisp/faces.el lisp/files.el lisp/gnus/ChangeLog lisp/gnus/gnus-art.el lisp/gnus/gnus-ems.el lisp/gnus/gnus-start.el lisp/gnus/gnus-sum.el lisp/gnus/mail-source.el lisp/gnus/mm-decode.el lisp/help-mode.el lisp/ldefs-boot.el lisp/mail/rmail.el lisp/mail/rmailsum.el lisp/mh-e/ChangeLog lisp/mh-e/mh-mime.el lisp/progmodes/compile.el lisp/progmodes/ebrowse.el lisp/progmodes/idlwave.el lisp/progmodes/mixal-mode.el lisp/ses.el lisp/startup.el lisp/tar-mode.el lisp/textmodes/org-publish.el lisp/textmodes/org.el lisp/version.el lispintro/ChangeLog lispref/ChangeLog lispref/commands.texi lispref/display.texi lispref/elisp.texi lispref/frames.texi lispref/text.texi lwlib/ChangeLog mac/ChangeLog man/ChangeLog man/cc-mode.texi man/display.texi man/gnus.texi man/maintaining.texi man/message.texi man/mh-e.texi msdos/ChangeLog nt/ChangeLog oldXMenu/ChangeLog oldXMenu/ChgPane.c oldXMenu/ChgSel.c src/ChangeLog src/Makefile.in src/alloc.c src/buffer.c src/callint.c src/editfns.c src/emacs.c src/fileio.c src/fns.c src/frame.c src/image.c src/keyboard.c src/keymap.c src/lisp.h src/lread.c src/mac.c src/macfns.c src/macgui.h src/macmenu.c src/macterm.c src/macterm.h src/minibuf.c src/s/ms-w32.h src/search.c src/sunfns.c src/term.c src/w32fns.c src/window.c src/xdisp.c src/xfaces.c src/xfns.c src/xmenu.c src/xselect.c src/xterm.c
diffstat 121 files changed, 10074 insertions(+), 4545 deletions(-) [+]
line wrap: on
line diff
--- a/AUTHORS	Fri Jun 08 12:41:25 2007 +0000
+++ b/AUTHORS	Mon Jun 11 00:58:11 2007 +0000
@@ -333,10 +333,10 @@
   url-file.el url-handlers.el url-http.el url-nfs.el
 
 Chong Yidong: changed cus-edit.el simple.el files.el custom.el
-  display.texi longlines.el xdisp.c files.texi info.el keyboard.c
+  display.texi xdisp.c longlines.el files.texi info.el keyboard.c
   compile.el custom.texi text.texi xterm.c frames.texi image-mode.el
   mouse.el misc.texi startup.el wid-edit.el cus-theme.el
-  and 296 other files
+  and 297 other files
 
 Chris Hanson: changed xscheme.el scheme.el xterm.c hpux.h x11term.c
   hp9000s300.h keyboard.c process.c texinfmt.el emacsclient.c sort.el
@@ -652,8 +652,8 @@
 Eli Zaretskii: wrote codepage.el rxvt.el tty-colors.el
 and changed msdos.c Makefile.in makefile.w32-in files.el info.el fileio.c
   startup.el mainmake.v2 config.bat rmail.el menu-bar.el pc-win.el
-  simple.el msdos.h internal.el xfaces.c emacs.c frame.c dosfns.c
-  faces.el frame.el and 532 other files
+  simple.el msdos.h internal.el xfaces.c emacs.c frame.c INSTALL dosfns.c
+  faces.el and 532 other files
 
 Emanuele Giaquinta: changed rxvt.el configure.in etags.c frame.el
   sh-script.el text.texi
@@ -1699,8 +1699,8 @@
 
 Martin Rudalics: changed cus-edit.el wid-edit.el cus-start.el files.el
   flyspell.el font-lock.el complete.el insdel.c ispell.el macmenu.c
-  syntax.c w32menu.c wdired.el whitespace.el window.el xdisp.c xmenu.c
-  backups.texi buffer.c buffer.h casefiddle.c and 36 other files
+  syntax.c table.el w32menu.c wdired.el whitespace.el window.el xdisp.c
+  xmenu.c backups.texi buffer.c buffer.h and 36 other files
 
 Martin Stjernholm: wrote cc-bytecomp.el
 and changed cc-engine.el cc-cmds.el cc-langs.el cc-defs.el cc-mode.el
@@ -1877,7 +1877,7 @@
 and changed comint.el faces.el simple.el editfns.c xfaces.c info.el
   xdisp.c minibuf.c wid-edit.el xterm.c subr.el window.el cus-edit.el
   diff-mode.el dispextern.h quick-install-emacs xfns.c help.el lisp.h
-  textprop.c bytecomp.el and 241 other files
+  textprop.c bytecomp.el and 242 other files
 
 Miyashita Hisashi: changed ccl.c coding.c coding.h mule-cmds.el
   mule-conf.el mule.el pop3.el
@@ -1942,7 +1942,7 @@
 
 Niklas Morberg: changed nnweb.el gnus-art.el nnimap.el spam.el
 
-Nikolaj Schumacher: changed compile.el
+Nikolaj Schumacher: changed compile.el rx.el
 
 Noah Friedman: wrote eldoc.el rlogin.el rsz-mini.el type-break.el
 and changed comint.el emacs-buffer.gdb files.el mailabbrev.el sendmail.el
@@ -2291,7 +2291,7 @@
 Russ Allbery: changed message.el
 
 Ryan Yeske: wrote rcirc.el
-and changed ffap.el rmailsum.el simple.el testcover.el
+and changed ffap.el ispell.el rmailsum.el simple.el testcover.el
 
 Ryszard Kubiak: changed ogonek.el
 
@@ -2416,9 +2416,9 @@
   log-view.el pcvs-defs.el pcvs-info.el pcvs-parse.el pcvs-util.el
   reveal.el smerge-mode.el
 and changed vc.el font-lock.el pcvs.el newcomment.el subr.el lisp.h
-  keyboard.c keymap.c tex-mode.el fill.el alloc.c compile.el files.el
-  regex.c simple.el easy-mmode.el vc-hooks.el info.el syntax.c xdisp.c
-  sh-script.el and 518 other files
+  keyboard.c fill.el keymap.c tex-mode.el alloc.c compile.el files.el
+  regex.c simple.el easy-mmode.el syntax.c vc-hooks.el info.el xdisp.c
+  sh-script.el and 519 other files
 
 Steinar Bang: changed imap.el
 
@@ -2533,7 +2533,7 @@
 
 Terry Jones: wrote shadow.el
 
-Tetsurou Okazaki: changed xterm.c
+Tetsurou Okazaki: changed log-edit.el xterm.c
 
 Theodore Jump: changed w32-win.el w32faces.c
 
@@ -2614,6 +2614,8 @@
 
 Toshiaki Nomura: changed uxpds.h
 
+Trent Buck: changed rcirc.el
+
 Trey Jackson: changed spam-stat.el
 
 Triet Hoai Lai: changed vntelex.el viet-util.el vietnamese.el
@@ -2636,8 +2638,8 @@
 
 Ulrich Leodolter: changed w32proc.c
 
-Ulrich Mueller: changed gud.el Makefile.in case-table.el fortran.el
-  iso-acc.el sysdep.c
+Ulrich Mueller: changed gud.el Makefile.in XMakeAssoc.c case-table.el
+  fortran.el iso-acc.el sysdep.c
 
 Ulrik Vieth: wrote meta-mode.el
 and changed files.el
@@ -2734,7 +2736,7 @@
 
 Yamamoto Mitsuharu: changed macterm.c macfns.c mac-win.el mac.c macterm.h
   macmenu.c macgui.h image.c macselect.c keyboard.c xdisp.c makefile.MPW
-  config.h emacs.c Makefile.in macos.texi INSTALL darwin.h xfaces.c
+  config.h emacs.c INSTALL Makefile.in macos.texi darwin.h xfaces.c
   dispnew.c alloc.c and 77 other files
 
 Yann Dirson: changed imenu.el
--- a/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,19 @@
+2007-06-08  Glenn Morris  <rgm@gnu.org>
+
+	* configure.in: Make gtk the default toolkit.
+
+2007-06-07  Glenn Morris  <rgm@gnu.org>
+
+	* configure.in (NON_GNU_CPP): On Solaris, set using a proper check
+	for a Sun C compiler.
+
+	* Makefile.in (install-arch-indep): Install only the DOC- file
+	specific to the build, if possible, rather than DOC-*.
+
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
 2007-05-25  Chong Yidong  <cyd@stupidchicken.com>
 
 	* mkinstalldirs: Sync to version in automake CVS.
--- a/Makefile.in	Fri Jun 08 12:41:25 2007 +0000
+++ b/Makefile.in	Mon Jun 11 00:58:11 2007 +0000
@@ -409,10 +409,8 @@
 ## Note that we copy DOC* and then delete DOC
 ## as a workaround for a bug in tar on Ultrix 4.2.
 
-## FIXME
-## Should only install the DOC- file appropriate to this build, not DOC-*.
-## http://lists.gnu.org/archive/html/emacs-pretest-bug/2007-01/msg00417.html
-## (fix available for consideration post-release).
+## We install only the relevant DOC file if possible
+## (ie DOC-${version}.buildnumber), otherwise DOC-${version}*.
 
 ## If people complain about the h flag in tar command, take that out.
 ## That flag is also used in leim/Makefile.in
@@ -474,8 +472,15 @@
 	-unset CDPATH; \
 	if [ `(cd ./etc; /bin/pwd)` != `(cd $(DESTDIR)${docdir}; /bin/pwd)` ]; \
 	then \
-	   echo "Copying etc/DOC-* to $(DESTDIR)${docdir} ..." ; \
-	   (cd ./etc; tar -chf - DOC*) \
+	   fullversion=`./src/emacs --version | sed -n '1 s/GNU Emacs *//p'`; \
+	   if [ -f "./etc/DOC-$${fullversion}" ]; \
+	   then \
+	     docfile="DOC-$${fullversion}"; \
+	   else \
+	     docfile="DOC-${version}*"; \
+	   fi; \
+	   echo "Copying etc/$${docfile} to $(DESTDIR)${docdir} ..." ; \
+	   (cd ./etc; tar -chf - $${docfile}) \
 	     |(cd $(DESTDIR)${docdir}; umask 022; tar -xvf - && cat > /dev/null) || exit 1; \
 	   (cd $(DESTDIR)$(docdir); chown $${LOGNAME:-$$USERNAME} DOC*; chmod a+r DOC*; \
 	    if test "`echo DOC-*`" != "DOC-*"; then rm DOC; fi); \
--- a/admin/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/admin/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,7 +1,15 @@
+2007-06-07  Glenn Morris  <rgm@gnu.org>
+
+	* admin.el (set-copyright): New function.
+
 2007-04-25  Nick Roberts  <nickrob@snap.net.nz>
 
 	* make-tarball.txt: Add note about cutting the branch.
 
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
 2007-02-03  Eli Zaretskii  <eliz@gnu.org>
 
 	* nt/makedist.bat: Change EOL format to DOS.  Don't use
--- a/admin/FOR-RELEASE	Fri Jun 08 12:41:25 2007 +0000
+++ b/admin/FOR-RELEASE	Mon Jun 11 00:58:11 2007 +0000
@@ -55,7 +55,7 @@
 ** Changes to six pbm icons in etc/images.
 Sync change from trunk 2007-05-19.
 
-** viper and tramp should not load cl at run time.
+** viper should not load cl at run time.
 
 ** yamaoka@jpl.org's patch for mail-extract-address-components problem.
 
--- a/admin/admin.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/admin/admin.el	Mon Jun 11 00:58:11 2007 +0000
@@ -24,6 +24,8 @@
 
 ;; add-release-logs	Add ``Version X released'' change log entries.
 ;; set-version		Change Emacs version number in source tree.
+;; set-copyright        Change emacs short copyright string (eg as
+;;                      printed by --version) in source tree.
 
 ;;; Code:
 
@@ -158,5 +160,50 @@
        (rx (and (submatch (1+ (in "a-z"))) (0+ space) ?\, (0+ space)
 		"/* development, alpha, beta, or final (release) */"))))))
 
+;; Note this makes some assumptions about form of short copyright.
+(defun set-copyright (root copyright)
+  "Set Emacs short copyright to COPYRIGHT in relevant files under ROOT.
+Root must be the root of an Emacs source tree."
+  (interactive (list
+                (read-directory-name "Emacs root directory: " nil nil t)
+                (read-string
+                 "Short copyright string: "
+                 (format "Copyright (C) %s Free Software Foundation, Inc."
+                         (format-time-string "%Y")))))
+  (unless (file-exists-p (expand-file-name "src/emacs.c" root))
+    (error "%s doesn't seem to be the root of an Emacs source tree" root))
+  (set-version-in-file root "lisp/version.el" copyright
+		       (rx (and "emacs-copyright" (0+ space)
+				?\" (submatch (1+ (not (in ?\")))) ?\")))
+  (set-version-in-file root "lib-src/etags.c" copyright
+                       (rx (and "emacs_copyright" (0+ (not (in ?\")))
+				?\" (submatch (1+ (not (in ?\")))) ?\")))
+  (set-version-in-file root "lib-src/rcs2log" copyright
+		       (rx (and "Copyright" (0+ space) ?= (0+ space)
+				?\' (submatch (1+ nonl)))))
+  (set-version-in-file
+   root "mac/Emacs.app/Contents/Resources/English.lproj/InfoPlist.strings"
+   copyright (rx (and "CFBundleGetInfoString" (0+ space) ?= (0+ space) ?\"
+                      (1+ anything)
+                      (submatch "Copyright" (1+ (not (in ?\")))))))
+  ;; This one is a nuisance, as it needs to be split over two lines.
+  (string-match "\\(.*[0-9]\\{4\\} *\\)\\(.*\\)" copyright)
+  (let ((csign "\\0xa9")
+        (cyear (match-string 1 copyright))  ; "Copyright (C) 2007 "
+        (owner (match-string 2 copyright))) ; "Free Software Foundation, Inc."
+    (set-version-in-file root "mac/src/Emacs.r"
+                         (regexp-quote
+                          (replace-regexp-in-string "(C)"
+                                                    (regexp-quote csign) cyear))
+                         (rx (and
+                              (submatch "Copyright" (0+ space) (eval csign)
+                                        (0+ space) (= 4 num)
+                                        (0+ (not (in ?\")))) ?\")))
+    (set-version-in-file root "mac/src/Emacs.r" owner
+                         (rx (and ?\"
+                              (submatch (1+ (not (in ?\"))))
+                              ?\" (0+ space)
+                              "/* Long version number */")))))
+
 ;;; arch-tag: 4ea83636-2293-408b-884e-ad64f22a3bf5
 ;; admin.el ends here.
--- a/admin/notes/copyright	Fri Jun 08 12:41:25 2007 +0000
+++ b/admin/notes/copyright	Mon Jun 11 00:58:11 2007 +0000
@@ -131,7 +131,7 @@
 mac/src/Emacs.r           # resource 'vers'
 src/emacs.c
   - remember to change the latest copyright year in the --version output.
-  [Post-release, will automate this like set-version does for version.]
+   `set-copyright' in admin.el will do all the above.
 
 <top-level>/install-sh
 lispintro/install-sh
--- a/admin/nt/README-ftp-server	Fri Jun 08 12:41:25 2007 +0000
+++ b/admin/nt/README-ftp-server	Mon Jun 11 00:58:11 2007 +0000
@@ -35,6 +35,72 @@
   old binaries.
 
 
+* Files in this directory
+
+  + emacs-22.1-bin-i386.zip
+    Windows binaries of Emacs-22.1, with all lisp code and documentation
+    included.
+
+    Download this file if you want a single installation package, and
+    are not interested in the C source code for Emacs. After
+    unpacking, you can optionally run the file bin/addpm.exe to have
+    Emacs add icons to the Start Menu.
+
+    If you need the C source code at a later date, it will be safe to
+    unpack the source distribution on top of this installation.
+
+  + emacs-22.1-barebin-i386.zip
+    Windows binaries of Emacs-22.1, without lisp code or documentation.
+
+    Download this file if you already have the source distribution, or
+    if you need to redump the emacs.exe executable.
+
+    Unpack this over the top of either the source distribution or the
+    bin distribution above. It contains the bin subdirectory and etc/DOC
+    file, plus temacs.exe and dump.bat, which are required if you want to
+    redump emacs without recompiling it.
+
+  + emacs-21.3-bin-i386.tar.gz
+    Windows binaries of Emacs 21.3, with compiled lisp code and some
+    documentation included.
+
+    This is provided for users who require the older version.
+
+  + emacs-21.3-leim.tar.gz
+    Compiled lisp input methods. This optional addition to Emacs-21.3
+    is required if you want to enter languages that are not directly
+    supported by your keyboard.
+
+* Image support
+
+  Emacs 22.1 contains support for images, however for most image formats
+  supporting libraries are required.  This distribution has been tested
+  with the libraries that are distributed with GTK for Windows, and the
+  libraries found at http://gnuwin32.sourceforge.net/. The following image
+  formats are supported:
+
+      PBM/PGM/PPM: Supported natively by Emacs. This format is used for
+      the black and white versions of the toolbar icons.
+
+      XPM: requires a Windows port of the XPM library 3.4 or later,
+      which will be named xpm4.dll, libxpm-nox4.dll or
+      libxpm.dll. This format is used for the color versions of the
+      toolbar icons, and other images in Emacs.
+
+      PNG: requires the PNG reference library 1.2 or later, which will
+      be named libpng13d.dll, libpng13.dll, libpng12d.dll, libpng12.dll
+      or libpng.dll. LibPNG requires zlib, which should come from the same
+      source as you got libpng.
+
+      JPEG: requires the Independant JPEG Group's libjpeg 6b or later,
+      which will be called jpeg62.dll, libjpeg.dll, jpeg-62.dll or jpeg.dll.
+
+      TIFF: requires libTIFF 3.0 or later, which will be called libtiff3.dll
+      or libtiff.dll.
+
+      GIF: requires libungif or giflib 4.1 or later, which will be
+      called giflib4.dll, libungif4.dll or libungif.dll.
+
 * Distributions in .tar.gz and .zip format
 
   Emacs is distributed primarily as source code in a large gzipped tar file
@@ -46,23 +112,6 @@
   but since there are no longer legal problems with .zip files, and the
   latest versions of Windows support these natively, the Windows binaries
   of Emacs are now distributed as .zip files.
-  Here are the combinations (i386 in the name indicates a zipfile contains
-  executables compiled for Intel-compatible x86 systems):
-
-  + Primary precompiled distribution, including lisp source:
-
-      emacs-22.1-bin-i386.zip
-
-  NB: If you just want to run Emacs, get the distribution above.
-
-  + Bare executables, useful if you want to get the complete source
-    release, but can't compile Emacs yourself:
-
-      emacs-22.1-barebin-i386.zip  (requires ../emacs-22.1.tar.gz)
-
-  + The complete official source for Emacs:
-
-      ../emacs-22.1.tar.gz
 
 * Distributions for non-x86 platforms
 
@@ -108,7 +157,7 @@
   You may be prompted to rename or overwrite directories when using
   djtarnt: simply type return to continue (this is harmless).
 
-  The precompiled binaries can be unpacked using unzip.exe from info-zip.org
+  Zip files can be unpacked using unzip.exe from info-zip.org
   if you do not already have other tools to do this.
 
     % unzip some.zip
@@ -170,7 +219,10 @@
 	http://www.gnu.org/software/emacs/windows/ntemacs.html
 
   This document serves as an FAQ and a source for further information
-  about the Windows port and related software packages.
+  about the Windows port and related software packages. Note that as
+  of writing, most of the information in that FAQ was for Emacs-21.3
+  and earlier versions, so some information may not be relevant to
+  Emacs-22.1.
 
   In addition to the FAQ, there is a mailing list for discussing issues
   related to the Windows port of Emacs.  For information about the
--- a/admin/nt/makedist.bat	Fri Jun 08 12:41:25 2007 +0000
+++ b/admin/nt/makedist.bat	Mon Jun 11 00:58:11 2007 +0000
@@ -36,7 +36,7 @@
 rem It always writes to zip.zip and treats the zipfile argument as one
 rem of the files to go in it.
 rem zip -9 -r %2-bin-i386 emacs-%1/BUGS emacs-%1/README emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc emacs-%1/info emacs-%1/lisp emacs-%1/leim -x emacs.mdp *.pdb *.opt *~ CVS
-7z a -tZIP -mx=9 -xr!emacs.mdp -xr!*.pdb -xr!*.opt -xr!*~ -xr!CVS -xr!.arch-inventory %2-bin-i386.zip emacs-%1/BUGS emacs-%1/README emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc emacs-%1/info emacs-%1/lisp emacs-%1/leim 
+7z a -tZIP -mx=9 -xr!emacs.mdp -xr!*.pdb -xr!*.opt -xr!*~ -xr!CVS -xr!.arch-inventory %2-bin-i386.zip emacs-%1/BUGS emacs-%1/README emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc emacs-%1/info emacs-%1/lisp emacs-%1/leim emacs-%1/site-lisp
 del emacs-%1\README.W32
 if not (%4) == () goto end
 
--- a/configure	Fri Jun 08 12:41:25 2007 +0000
+++ b/configure	Mon Jun 11 00:58:11 2007 +0000
@@ -412,10 +412,10 @@
 fi
 
 test \$exitcode = 0") || {
-  echo No shell found that supports shell functions.
-  echo Please tell autoconf@gnu.org about your system,
-  echo including any error possibly output before this
-  echo message
+  echo Please tell bug-autoconf@gnu.org about your system,
+  echo including any error possibly output before this message.
+  echo This can help us improve future autoconf versions.
+  echo Configuration will now proceed without shell functions.
 }
 
 
@@ -1901,7 +1901,7 @@
 # Check whether --with-x-toolkit was given.
 if test "${with_x_toolkit+set}" = set; then
   withval=$with_x_toolkit; 	  case "${withval}" in
-	    y | ye | yes )	val=athena ;;
+	    y | ye | yes )	val=gtk ;;
 	    n | no )		val=no  ;;
 	    l | lu | luc | luci | lucid )	val=lucid ;;
 	    a | at | ath | athe | athen | athena )	val=athena ;;
@@ -1910,10 +1910,10 @@
 	    * )
 { { echo "$as_me:$LINENO: error: \`--with-x-toolkit=$withval' is invalid\;
 this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif' or \`gtk'.
-Currently, \`yes', \`athena' and \`lucid' are synonyms." >&5
+Currently, \`yes' and \`gtk', and \`athena' and \`lucid' are synonyms." >&5
 echo "$as_me: error: \`--with-x-toolkit=$withval' is invalid\;
 this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif' or \`gtk'.
-Currently, \`yes', \`athena' and \`lucid' are synonyms." >&2;}
+Currently, \`yes' and \`gtk', and \`athena' and \`lucid' are synonyms." >&2;}
    { (exit 1); exit 1; }; }
 	    ;;
 	  esac
@@ -3032,14 +3032,8 @@
 		;;
       *-sunos5* | *-solaris* )
 		opsys=sol2-6
-## FIXME: make this into a proper fix that checks the compiler type,
-## rather than relying on path. Or is /usr/ccs/lib/cpp a bad default now?
-		if [ "x$CC" = x/opt/SUNWspro/bin/cc ]; then
-		  ## -Xs prevents spurious whitespace.
-		  NON_GNU_CPP="/opt/SUNWspro/bin/cc -E -Xs"
-		else
-		  NON_GNU_CPP=/usr/ccs/lib/cpp
-		fi
+		emacs_check_sunpro_c=yes
+		NON_GNU_CPP=/usr/ccs/lib/cpp
 		;;
       *			  ) opsys=bsd4-2   ;;
     esac
@@ -4195,6 +4189,72 @@
   CPP=
 fi
 
+## If not using gcc, and on Solaris, and no CPP specified, see if
+## using a Sun compiler, which needs -Xs to prevent whitespace.
+if test x"$GCC" != xyes && test x"$emacs_check_sunpro_c" = xyes && \
+ test x"$CPP" = x; then
+  { echo "$as_me:$LINENO: checking whether we are using a Sun C compiler" >&5
+echo $ECHO_N "checking whether we are using a Sun C compiler... $ECHO_C" >&6; }
+
+if test "${emacs_cv_sunpro_c+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __SUNPRO_C
+fail;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  emacs_cv_sunpro_c=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	emacs_cv_sunpro_c=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+
+  { echo "$as_me:$LINENO: result: $emacs_cv_sunpro_c" >&5
+echo "${ECHO_T}$emacs_cv_sunpro_c" >&6; }
+
+  if test x"$emacs_cv_sunpro_c" = xyes; then
+    NON_GNU_CPP="$CC -E -Xs"
+  fi
+fi
+
 #### Some systems specify a CPP to use unless we are using GCC.
 #### Now that we know whether we are using GCC, we can decide whether
 #### to use that one.
@@ -4222,7 +4282,6 @@
   CC="$CC $NON_GCC_TEST_OPTIONS"
 fi
 
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -9539,7 +9598,13 @@
       gtk ) with_gtk=yes
             USE_X_TOOLKIT=none ;;
       no ) USE_X_TOOLKIT=none ;;
-      * ) USE_X_TOOLKIT=maybe ;;
+      * )
+          if test x"$with_gtk" = xyes; then
+             USE_X_TOOLKIT=none
+          else
+             USE_X_TOOLKIT=maybe
+          fi
+          ;;
     esac
   ;;
   mac | none )
@@ -10974,7 +11039,8 @@
 if test "${with_gtk}" = "yes" && test "$USE_X_TOOLKIT" = "gtk"; then
   USE_X_TOOLKIT=none
 fi
-if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk"; then
+if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk" || \
+ test "$USE_X_TOOLKIT" = "maybe"; then
   if test "$USE_X_TOOLKIT" != "none" && test "$USE_X_TOOLKIT" != "maybe"; then
     { { echo "$as_me:$LINENO: error: Conflicting options, --with-gtk is incompatible with --with-x-toolkit=${with_x_toolkit}" >&5
 echo "$as_me: error: Conflicting options, --with-gtk is incompatible with --with-x-toolkit=${with_x_toolkit}" >&2;}
@@ -11035,11 +11101,7 @@
   fi
 
   if test "$PKG_CONFIG" = "no" ; then
-     { { echo "$as_me:$LINENO: error:
-      *** The pkg-config script could not be found. Make sure it is in your path, or give the full path to pkg-config with the PKG_CONFIG environment variable or --with-pkg-config-prog.  Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." >&5
-echo "$as_me: error:
-      *** The pkg-config script could not be found. Make sure it is in your path, or give the full path to pkg-config with the PKG_CONFIG environment variable or --with-pkg-config-prog.  Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." >&2;}
-   { (exit 1); exit 1; }; }
+     pkg_check_gtk=no
   else
      PKG_CONFIG_MIN_VERSION=0.9.0
      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
@@ -11070,7 +11132,7 @@
             ## If we have a custom action on failure, don't print errors, but
             ## do set a variable so people can do so.
             GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$GTK_MODULES"`
-            echo $GTK_PKG_ERRORS
+
         fi
 
 
@@ -11082,12 +11144,20 @@
   fi
 
   if test $succeeded = yes; then
-     :
+     pkg_check_gtk=yes
   else
-     { { echo "$as_me:$LINENO: error: Library requirements ($GTK_MODULES) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
-echo "$as_me: error: Library requirements ($GTK_MODULES) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+     pkg_check_gtk=no
+  fi
+
+  if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
+     { { echo "$as_me:$LINENO: error: $GTK_PKG_ERRORS" >&5
+echo "$as_me: error: $GTK_PKG_ERRORS" >&2;}
    { (exit 1); exit 1; }; }
   fi
+fi
+
+
+if test x"$pkg_check_gtk" = xyes; then
 
 
 
@@ -11190,18 +11260,25 @@
 done
 
   if test "${GTK_COMPILES}" != "yes"; then
-    { { echo "$as_me:$LINENO: error: Gtk+ wanted, but it does not compile, see config.log.  Maybe some x11-devel files missing?" >&5
+    if test "$USE_X_TOOLKIT" != "maybe"; then
+      { { echo "$as_me:$LINENO: error: Gtk+ wanted, but it does not compile, see config.log.  Maybe some x11-devel files missing?" >&5
 echo "$as_me: error: Gtk+ wanted, but it does not compile, see config.log.  Maybe some x11-devel files missing?" >&2;}
    { (exit 1); exit 1; }; };
-  fi
-
-  HAVE_GTK=yes
+    fi
+  else
+    HAVE_GTK=yes
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_GTK 1
 _ACEOF
 
-  USE_X_TOOLKIT=none
+    USE_X_TOOLKIT=none
+  fi
+
+fi
+
+
+if test "${HAVE_GTK}" = "yes"; then
 
       if test "$with_toolkit_scroll_bars" != no; then
     with_toolkit_scroll_bars=yes
--- a/configure.in	Fri Jun 08 12:41:25 2007 +0000
+++ b/configure.in	Mon Jun 11 00:58:11 2007 +0000
@@ -84,7 +84,7 @@
 [  --with-x-toolkit=KIT    use an X toolkit
                               (KIT = yes/lucid/athena/motif/gtk/no)],
 [	  case "${withval}" in
-	    y | ye | yes )	val=athena ;;
+	    y | ye | yes )	val=gtk ;;
 	    n | no )		val=no  ;;
 	    l | lu | luc | luci | lucid )	val=lucid ;;
 	    a | at | ath | athe | athen | athena )	val=athena ;;
@@ -98,7 +98,7 @@
 dnl which is `yes', `no', `lucid', `athena', `motif' or `open-look'.])
 AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid\;
 this option's value should be `yes', `no', `lucid', `athena', `motif' or `gtk'.
-Currently, `yes', `athena' and `lucid' are synonyms.])
+Currently, `yes' and `gtk', and `athena' and `lucid' are synonyms.])
 	    ;;
 	  esac
 	  with_x_toolkit=$val
@@ -1041,14 +1041,8 @@
 		;;
       *-sunos5* | *-solaris* )
 		opsys=sol2-6
-## FIXME: make this into a proper fix that checks the compiler type,
-## rather than relying on path. Or is /usr/ccs/lib/cpp a bad default now?
-		if [ "x$CC" = x/opt/SUNWspro/bin/cc ]; then
-		  ## -Xs prevents spurious whitespace.
-		  NON_GNU_CPP="/opt/SUNWspro/bin/cc -E -Xs"
-		else
-		  NON_GNU_CPP=/usr/ccs/lib/cpp
-		fi
+		emacs_check_sunpro_c=yes
+		NON_GNU_CPP=/usr/ccs/lib/cpp
 		;;
       *			  ) opsys=bsd4-2   ;;
     esac
@@ -1284,6 +1278,24 @@
   CPP=
 fi
 
+## If not using gcc, and on Solaris, and no CPP specified, see if
+## using a Sun compiler, which needs -Xs to prevent whitespace.
+if test x"$GCC" != xyes && test x"$emacs_check_sunpro_c" = xyes && \
+ test x"$CPP" = x; then
+  AC_MSG_CHECKING([whether we are using a Sun C compiler])
+  AC_CACHE_VAL(emacs_cv_sunpro_c,
+  [AC_TRY_LINK([],
+[#ifndef __SUNPRO_C
+fail;
+#endif
+], emacs_cv_sunpro_c=yes, emacs_cv_sunpro_c=no)])
+  AC_MSG_RESULT($emacs_cv_sunpro_c)
+
+  if test x"$emacs_cv_sunpro_c" = xyes; then
+    NON_GNU_CPP="$CC -E -Xs"
+  fi
+fi
+
 #### Some systems specify a CPP to use unless we are using GCC.
 #### Now that we know whether we are using GCC, we can decide whether
 #### to use that one.
@@ -1877,9 +1889,15 @@
 dnl USE_X_TOOLKIT is set.
             USE_X_TOOLKIT=none ;;
       no ) USE_X_TOOLKIT=none ;;
-dnl If user did not say whether to use a toolkit,
-dnl make this decision later: use the toolkit if we have X11R5 or newer.
-      * ) USE_X_TOOLKIT=maybe ;;
+dnl If user did not say whether to use a toolkit, make this decision later:
+dnl use the toolkit if we have gtk, or X11R5 or newer.
+      * ) 
+          if test x"$with_gtk" = xyes; then
+             USE_X_TOOLKIT=none
+          else
+             USE_X_TOOLKIT=maybe
+          fi
+          ;;
     esac
   ;;
   mac | none )
@@ -2107,7 +2125,8 @@
 if test "${with_gtk}" = "yes" && test "$USE_X_TOOLKIT" = "gtk"; then
   USE_X_TOOLKIT=none
 fi
-if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk"; then
+if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk" || \
+ test "$USE_X_TOOLKIT" = "maybe"; then
   if test "$USE_X_TOOLKIT" != "none" && test "$USE_X_TOOLKIT" != "maybe"; then
     AC_MSG_ERROR([Conflicting options, --with-gtk is incompatible with --with-x-toolkit=${with_x_toolkit}]);
   fi
@@ -2120,7 +2139,15 @@
     PKG_CONFIG="${with_pkg_config_prog}"
   fi
   dnl Checks for libraries.
-  PKG_CHECK_MODULES(GTK, $GTK_MODULES)
+  PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
+  if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
+     AC_MSG_ERROR($GTK_PKG_ERRORS)
+  fi
+fi
+
+
+if test x"$pkg_check_gtk" = xyes; then
+
   AC_SUBST(GTK_CFLAGS)
   AC_SUBST(GTK_LIBS)
   C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
@@ -2130,12 +2157,19 @@
   GTK_COMPILES=no
   AC_CHECK_FUNCS(gtk_main, GTK_COMPILES=yes)
   if test "${GTK_COMPILES}" != "yes"; then
-    AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log.  Maybe some x11-devel files missing?]);
+    if test "$USE_X_TOOLKIT" != "maybe"; then
+      AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log.  Maybe some x11-devel files missing?]);
+    fi
+  else
+    HAVE_GTK=yes
+    AC_DEFINE(HAVE_GTK, 1, [Define to 1 if using GTK.])
+    USE_X_TOOLKIT=none
   fi
-  
-  HAVE_GTK=yes
-  AC_DEFINE(HAVE_GTK, 1, [Define to 1 if using GTK.])
-  USE_X_TOOLKIT=none
+
+fi
+
+
+if test "${HAVE_GTK}" = "yes"; then
 
   dnl  GTK scrollbars resemble toolkit scrollbars a lot, so to avoid
   dnl  a lot if #ifdef:s, say we have toolkit scrollbars.
--- a/etc/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/etc/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,34 @@
+2007-06-07  Mark H. Weaver  <mhw@netris.org>  (tiny change)
+
+	* NEWS (set-mark-command-repeat-pop): Fix duplicate entry.
+
+2007-06-07  Michael Olson  <mwolson@gnu.org>
+
+	* MORE.STUFF: Update eshell URL.
+
+2007-06-06  Carsten Dominik  <dominik@science.uva.nl>
+
+	* orgcard.tex: Version 4.77.
+
+2007-06-05  Michael Albinus  <michael.albinus@gmx.de>
+
+	* NEWS: Add socks.el as new package.
+
+2007-06-02  Thien-Thi Nguyen  <ttn@gnuvola.org>
+
+	* MORE.STUFF (Hideshow): Delete.
+	(EDB, Go in a buffer): Update urls.
+	Suggested by CHENG Gao <chenggao@gmail.com>.
+
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
+2007-06-02  CHENG Gao  <chenggao@gmail.com>
+
+	* MORE.STUFF: Remove dead URL for Fortune, and update URLs for
+	Hideshow, Org, EDB, and Remember.
+
 2007-05-29  Robert J. Chassell  <bob@rattlesnake.com>
 
 	* NEWS: Fix instances of `allow' without object.
@@ -254,7 +285,7 @@
 
 2007-02-19  Kenichi Handa  <handa@m17n.org>
 
-	* NEWS (New language environmets): Add "Esperanto".
+	* NEWS (New language environments): Add "Esperanto".
 
 2007-02-16  Dale Gulledge  <dsplat@rochester.rr.com>
 
--- a/etc/MORE.STUFF	Fri Jun 08 12:41:25 2007 +0000
+++ b/etc/MORE.STUFF	Mon Jun 11 00:58:11 2007 +0000
@@ -63,25 +63,25 @@
  * ERC: IRC client:
    <URL:http://www.emacswiki.org/cgi-bin/wiki?EmacsIRCClient>
 
- * EShell: <URL:http://www.newartisans.com/johnw/emacs.html>
+ * EShell: <URL:http://johnwiegley.com/eshell.html>
 
  * Etags: <URL:ftp://pot.potorti.it/pub/software/unix/etags.tar.gz>
 
  * Expand: <URL:http://w3.teaser.fr/%7Eflepied/expand.el.gz>
 
- * Fortune: <URL:http://www.coling.uni-freiburg.de/%7Eschauer/emacs.html>
-
  * Gnus: <URL:http://www.gnus.org/>
 
  * Ffap: <URL:http://www.mathcs.emory.edu/%7Emic/ftp/emacs/>
    (And some addons for it.)
 
- * Hideshow: <URL:http://www.glug.org/people/ttn/software/hideshow/>
+ * Hideshow: <URL:http://staff.science.uva.nl/~dominik/Tools/org/>
 
  * Ispell: <URL:http://www.eng.utah.edu/~kstevens/ispell-page.html>
 
  * MH-E: <URL:http://mh-e.sourceforge.net/>
 
+ * Org mode: <URL:http://staff.science.uva.nl/~dominik/Tools/org/>
+
  * PS mode: <URL:http://odur.let.rug.nl/%7Ekleiweg/postscript/>
 
  * PS-print: <URL:http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage>
@@ -148,7 +148,7 @@
 
  * ECB: Emacs Code Browser: <URL:http://ecb.sourceforge.net/>
 
- * EDB: database: <URL:http://www.glug.org/people/ttn/software/edb/>
+ * EDB: database: <URL:http://www.gnuvola.org/software/edb/>
 
  * Ee: categorizing information manager:
    <URL:http://www.jurta.org/emacs/ee/>
@@ -185,7 +185,7 @@
    page: eiffel-mode.el.
 
  * Go in a buffer: Go Text Protocol client:
-   <URL:http://www.glug.org/people/ttn/software/personal-elisp/standalone/>
+   <URL:http://www.gnuvola.org/software/personal-elisp/standalone/>
    A modified version is also bundled with GNU Go:
    <URL:http://www.gnu.org/software/gnugo/gnugo.html>
 
@@ -228,10 +228,10 @@
    DTD-aware serious SGML/XML editing.
 
  * Quack: <URL:http://www.neilvandyke.org/quack/>
-   Quack enhances Emacs support for Scheme
+   Quack enhances Emacs support for Scheme.
 
- * Remember:
-   <URL:http://sacha.free.net.ph/notebook/wiki/RememberEl.php>
+ * Remember: <URL:https://gna.org/p/remember-el>
+   A Personal Information Manager (PIM) for Emacs.
 
  * Session: <URL:http://emacs-session.sourceforge.net/>
    Session Management for Emacs.
--- a/etc/NEWS	Fri Jun 08 12:41:25 2007 +0000
+++ b/etc/NEWS	Mon Jun 11 00:58:11 2007 +0000
@@ -19,6 +19,8 @@
 
 * Installation Changes in Emacs 23.1
 
+** The default X toolkit has changed from Lucid to Gtk+.
+
 
 * Startup Changes in Emacs 23.1
 
@@ -28,9 +30,15 @@
 
 * Editing Changes in Emacs 23.1
 
+** New command kill-matching-buffers kills buffers whose name matches a regexp.
+
 
 * New Modes and Packages in Emacs 23.1
 
+** css-mode to edit Cascading Style Sheets.
+
+** socks.el (which had been part of W3) is now part of Emacs.
+
 
 * Changes in Specialized Modes and Packages in Emacs 23.1
 
--- a/etc/NEWS.22	Fri Jun 08 12:41:25 2007 +0000
+++ b/etc/NEWS.22	Mon Jun 11 00:58:11 2007 +0000
@@ -33,6 +33,24 @@
 ** Semantic (used by CEDET, ECB, JDEE): upgrade to latest version.
 
 ** cua.el, cua-mode.el: remove old versions.
+
+* Installation Changes in Emacs 22.2
+
+* Changes in Emacs 22.2
+
+** The values of `dired-recursive-deletes' and `dired-recursive-copies'
+have been changed to `top'.  This means that the user is asked once,
+before deleting/copying the indicated directory recursively.
+
+** In Image mode, whenever the displayed image is wider and/or higher
+than the window, the usual keys for moving the cursor cause the image
+to be scrolled horizontally or vertically instead.
+
+* New Modes and Packages in Emacs 22.2
+
+** The new package css-mode.el provides a major mode for editing CSS files.
+
+** The new package socks.el implements the SOCKS v5 protocol.
 
 
 * Installation Changes in Emacs 22.1
@@ -280,11 +298,6 @@
 doublequotes make no difference in the shell, but they prevent
 special treatment in `dired-do-shell-command'.
 
-** A prefix argument is no longer required to repeat a jump to a
-previous mark if you set `set-mark-command-repeat-pop' to t.  I.e. C-u
-C-SPC C-SPC C-SPC ... cycles through the mark ring.  Use C-u C-u C-SPC
-to set the mark immediately after a jump.
-
 ** The info-search bindings on C-h C-f, C-h C-k and C-h C-i
 have been moved to C-h F, C-h K and C-h S.
 
@@ -451,8 +464,9 @@
 ** Mark command changes:
 
 *** A prefix argument is no longer required to repeat a jump to a
-previous mark, i.e. C-u C-SPC C-SPC C-SPC ... cycles through the
-mark ring.  Use C-u C-u C-SPC to set the mark immediately after a jump.
+previous mark if you set `set-mark-command-repeat-pop' to t.  I.e. C-u
+C-SPC C-SPC C-SPC ... cycles through the mark ring.  Use C-u C-u C-SPC
+to set the mark immediately after a jump.
 
 *** Marking commands extend the region when invoked multiple times.
 
--- a/etc/TODO	Fri Jun 08 12:41:25 2007 +0000
+++ b/etc/TODO	Mon Jun 11 00:58:11 2007 +0000
@@ -19,6 +19,8 @@
 latter need not be installed.  As a result, all the source files that
 look for include files in X11/Xaw should look in X11/Xaw3d if we are
 using Xaw3d.
+http://lists.gnu.org/archive/html/emacs-pretest-bug/2007-04/msg00396.html
+http://lists.gnu.org/archive/html/emacs-devel/2006-03/msg01150.html ?
 
 ** Compute the list of active keymaps *after* reading the first event.
 
@@ -32,8 +34,6 @@
 but if you type M-n you should get the visited file name of the
 current buffer.
 
-** 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?).
 
@@ -100,9 +100,6 @@
 
 ** make back_comment use syntax-ppss or equivalent.
 
-** Improve configure's treatment of NON_GNU_CPP on Solaris.
-(patch available for after Emacs 22)
-
 ** Consider improving src/sysdep.c's search for a fqdn.
 http://lists.gnu.org/archive/html/emacs-devel/2007-04/msg00782.html
 
@@ -179,6 +176,7 @@
 
 ** Remove the default toggling behavior of minor modes when called from elisp
 rather than interactively.  This a trivial one-liner in easy-mode.el.
+
 ** Create a category of errors called `user-error' for errors which are
 typically due to pilot errors and should thus be in debug-ignored-errors.
 
@@ -381,15 +379,6 @@
 ** Allow unknown image types to be rendered via an external program
   converting them to, say, PBM (in the same way as PostScript?).
 
-** Display images with alpha channels, such as png, with the current
-background color of whatever frame it is displayed in.  Currently, we
-use the default background color if specified in the png file, or, if
-that is unspecified, the background color of the frame in which the
-image was first created.  Ideally, the image should display the
-background color of whichever frame it is being displayed in.  The
-main complication is that this will require the loading of a new image
-object for each different background color.
-
 ** Allow displaying an X window from an external program in a buffer,
   e.g. to render graphics from Java applets.  [gerd and/or wmperry
   thought this was feasible.]
--- a/etc/orgcard.tex	Fri Jun 08 12:41:25 2007 +0000
+++ b/etc/orgcard.tex	Mon Jun 11 00:58:11 2007 +0000
@@ -1,27 +1,27 @@
 % Reference Card for Org Mode
-\def\orgversionnumber{4.67}
+\def\orgversionnumber{4.77}
 \def\versionyear{2007}          % latest update
 \def\year{2007}                 % latest copyright year
-%
+
 %**start of header
 \newcount\columnsperpage
+\newcount\letterpaper
 
 % This file can be printed with 1, 2, or 3 columns per page (see below).
-% At the moment this card works quite nicely in 3 column format and
-% currently takes 2 full pages.  It is thus suited to producing one 
-% double-side page when printed.
-
-% There are a couple of tweaks in the format of this card which make it work
-% slightly better on A4 paper.  The changes due, I think, to Stephen Eglen,
-% are commented below.  Revert the changes if you want letter sized paper.
-
-% Try running something like
-% tex org-mode-ref.tex; dvips -t landscape org-mode-ref.dvi
-% to print the card
+% Specify how many you want here.
 
 \columnsperpage=3
 
-% Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc
+% Set letterpapaer to 0 for A4 paper, 1 for letter (US) paper.  Useful
+% only when columnsperpage is 2 or 3.
+
+\letterpaper=0
+
+% Nothing else needs to be changed below this line.
+% Copyright (C) 1987, 1993, 1996, 1997, 2001, 2002, 2003, 2004,
+%   2005, 2006, 2007  Free Software Foundation, Inc.
+
+% This file is part of GNU Emacs.
 
 % GNU Emacs is free software; you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -35,8 +35,8 @@
 
 % You should have received a copy of the GNU General Public License
 % along with GNU Emacs; see the file COPYING.  If not, write to
-% the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-% Boston, MA 02111-1307, USA.
+% the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+% Boston, MA 02110-1301, USA.
 
 % This file is intended to be processed by plain TeX (TeX82).
 %
@@ -54,6 +54,10 @@
 %    For this you need a dvi device driver that can print sideways.
 % Which mode to use is controlled by setting \columnsperpage above.
 %
+% To compile and print this document:
+% tex refcard.tex
+% dvips -t landscape refcard.dvi
+%
 % Author:
 %  Stephen Gildea
 %  Internet: gildea@stop.mail-abuse.org
@@ -82,20 +86,20 @@
 % can be scanned without complaint.
 \def\bye{\par\vfill\supereject\end}
 
-\newdimen\intercolumnskip       %horizontal space between columns
-\newbox\columna                 %boxes to hold columns already built
+\newdimen\intercolumnskip	%horizontal space between columns
+\newbox\columna			%boxes to hold columns already built
 \newbox\columnb
 
 \def\ncolumns{\the\columnsperpage}
 
-\message{[\ncolumns\space 
+\message{[\ncolumns\space
   column\if 1\ncolumns\else s\fi\space per page]}
 
 \def\scaledmag#1{ scaled \magstep #1}
 
 % This multi-way format was designed by Stephen Gildea October 1986.
 % Note that the 1-column format is fontfamily-independent.
-\if 1\ncolumns                  %one-column format uses normal size
+\if 1\ncolumns			%one-column format uses normal size
   \hsize 4in
   \vsize 10in
   \voffset -.7in
@@ -106,14 +110,14 @@
 
   \footline{\hss\folio}
   \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
-\else                           %2 or 3 columns uses prereduced size
+\else				%2 or 3 columns uses prereduced size
   \hsize 3.2in
-
-% FIXME - Try to make things more A4 friendly
-%  \vsize 7.95in
-  \vsize 7.65in
-%  \hoffset -.75in
-  \hoffset -.25in
+  \if 1\the\letterpaper
+     \vsize 7.95in
+  \else
+     \vsize 7.65in
+  \fi
+  \hoffset -.75in
   \voffset -.745in
   \font\titlefont=cmbx10 \scaledmag2
   \font\headingfont=cmbx10 \scaledmag1
@@ -132,13 +136,14 @@
   \def\bf{\eightbf}
   \def\it{\eightit}
   \def\tt{\eighttt}
-
-% FIXME - Try to make things more A4 friendly
-%  \normalbaselineskip=.8\normalbaselineskip
-  \normalbaselineskip=.7\normalbaselineskip
+  \if 1\the\letterpaper
+     \normalbaselineskip=.8\normalbaselineskip
+  \else
+     \normalbaselineskip=.7\normalbaselineskip
+  \fi
   \normallineskip=.8\normallineskip
   \normallineskiplimit=.8\normallineskiplimit
-  \normalbaselines\rm           %make definitions take effect
+  \normalbaselines\rm		%make definitions take effect
 
   \if 2\ncolumns
     \let\maxcolumn=b
@@ -154,16 +159,16 @@
 
   \intercolumnskip=.46in
   \def\abc{a}
-  \output={%                    %see The TeXbook page 257
+  \output={%			%see The TeXbook page 257
       % This next line is useful when designing the layout.
       %\immediate\write16{Column \folio\abc\space starts with \firstmark}
       \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
       \else\if a\abc
-        \global\setbox\columna\columnbox \global\def\abc{b}
+	\global\setbox\columna\columnbox \global\def\abc{b}
         %% in case we never use \columnb (two-column mode)
         \global\setbox\columnb\hbox to -\intercolumnskip{}
       \else
-        \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
+	\global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
   \def\multicolumnformat{\shipout\vbox{\makeheadline
       \hbox{\box\columna\hskip\intercolumnskip
         \box\columnb\hskip\intercolumnskip\columnbox}
@@ -173,7 +178,7 @@
   \def\bye{\par\vfill\supereject
     \if a\abc \else\null\vfill\eject\fi
     \if a\abc \else\null\vfill\eject\fi
-    \end}  
+    \end}
 \fi
 
 % we won't be using math mode much, so redefine some of the characters
@@ -225,7 +230,7 @@
 \def\<#1>{{\it #1\/}}
 
 % kbd - argument is characters typed literally.  Like the Texinfo command.
-\def\kbd#1{{\tt#1}\null}        %\null so not an abbrev even if period follows
+\def\kbd#1{{\tt#1}\null}	%\null so not an abbrev even if period follows
 
 % beginexample...endexample - surrounds literal text, such a code example.
 % typeset in a typewriter font with line breaks preserved
@@ -316,15 +321,15 @@
 \section{Archiving}
 
 \key{toggle ARCHIVE tag}{C-c C-x C-a}
-\metax{mark fully done children}{C-u C-c C-x C-a}
+%\metax{mark fully done children}{C-u C-c C-x C-a}
 \key{force cycling of an ARCHIVEd tree}{C-TAB}
 \key{move subtree to archive file}{C-c C-x C-s}
-\metax{move all fully done children}{C-u C-c C-x C-s}
-To set archive location for current file, add a line like$^2$:
-\vskip -1mm
-\beginexample%
-\#+ARCHIVE: archfile::* Archived Tasks
-\endexample
+%\metax{move all fully done children}{C-u C-c C-x C-s}
+%To set archive location for current file, add a line like$^2$:
+%\vskip -1mm
+%\beginexample%
+%\#+ARCHIVE: archfile::* Archived Tasks
+%\endexample
 
 \section{Filtering and Sparse Trees}
 
@@ -359,13 +364,11 @@
 
 {\bf Row and column editing}
 
-\key{move the current column left}{M-LEFT}
-\key{move the current column right}{M-RIGHT}
+\key{move the current column left}{M-LEFT/RIGHT}
 \key{kill the current column}{M-S-LEFT}
 \key{insert new column to left of cursor position}{M-S-RIGHT}
 
-\key{move the current row up}{M-UP}
-\key{move the current row down}{M-DOWN}
+\key{move the current row up/down}{M-UP/DOWN}
 \key{kill the current row or horizontal line}{M-S-UP}
 \key{insert new row above the current row}{M-S-DOWN}
 \key{insert hline below (\kbd{C-u} : above) current row}{C-c -}
@@ -378,34 +381,6 @@
 \key{paste rectangular region}{C-c C-x C-y}
 \key{fill paragraph across selected cells}{C-c C-q}
 
-{\bf Calculations} (in combination with Emacs \kbd{calc} package)
-
-\key{set and eval column formula}{C-c =}
-\key{set and eval field formula}{C-u C-c =}
-\key{edit formulas in separate buffer}{C-c '}
-\key{re-apply all stored equations to current line}{C-c *}
-\key{re-apply all stored equations to entire table}{C-u C-c *}
-\key{iterate table to stability}{C-u C-u C-c *}
-
-%\kbd{TAB}, \kbd{RET} and \kbd{C-c C-c} trigger automatic recalculation
-%in lines starting with: {\tt | \# |}.
-
-\key{rotate calculation mark through \# * ! \^ \_ \$}{C-\#}
-
-\key{show line, column, formula reference}{C-c ?}
-\key{sum numbers in current column/rectangle}{C-c +}
-\key{copy down with increment}{S-RET$^3$}
-
-Formulas typed in field are executed by \kbd{TAB},
-\kbd{RET} and \kbd{C-c C-c}.  \kbd{=} introduces a column
-formula, \kbd{:=} a named-field formula.
-
-\key{Example: Add Col1 and Col2}{=\$1+\$2}
-\key{... with printf format specification}{=\$1+\$2;\%.2f}
-\key{... with constants from constants.el}{=\$1/\$c/\$cm}
-\metax{sum from 2nd to 3rd hline}{:=vsum(@II..@III)}
-\key{apply current column formula}{=}
-
 {\bf Miscellaneous}
 
 \key{to limit column width to \kbd{N} characters, use}{...| <N> |...}
@@ -413,6 +388,7 @@
 \key{make current field fully visible}{C-u TAB}
 \metax{export as tab-separated file}{M-x org-table-export}
 \metax{import tab-separated file}{M-x org-table-import}
+\key{sum numbers in current column/rectangle}{C-c +}
 
 {\bf Tables created with the \kbd{table.el} package}
 
@@ -420,6 +396,42 @@
 \key{recognize existing table.el table}{C-c C-c}
 \key{convert table (Org-mode $\leftrightarrow$ table.el)}{C-c ~}
 
+{\bf Spreadsheet}
+
+Formulas typed in field are executed by \kbd{TAB},
+\kbd{RET} and \kbd{C-c C-c}.  \kbd{=} introduces a column
+formula, \kbd{:=} a field formula.
+
+\key{Example: Add Col1 and Col2}{|=\$1+\$2      |}
+\key{... with printf format specification}{|=\$1+\$2;\%.2f|}
+\key{... with constants from constants.el}{|=\$1/\$c/\$cm |}
+\metax{sum from 2nd to 3rd hline}{|:=vsum(@II..@III)|}
+\key{apply current column formula}{| = |}
+
+\key{set and eval column formula}{C-c =}
+\key{set and eval field formula}{C-u C-c =}
+\key{re-apply all stored equations to current line}{C-c *}
+\key{re-apply all stored equations to entire table}{C-u C-c *}
+\key{iterate table to stability}{C-u C-u C-c *}
+\key{rotate calculation mark through \# * ! \^ \_ \$}{C-\#}
+\key{show line, column, formula reference}{C-c ?}
+\key{toggle coordinate grid}{C-c \}}
+\key{toggle formula debugger}{C-c \{}
+
+{\it Formula Editor}
+
+\key{edit formulas in separate buffer}{C-c '}
+\key{exit and install new formulas}{C-c C-c}
+\key{exit, install, and apply new formulas}{C-u C-c C-c}
+\key{abort}{C-c C-q}
+\key{toggle reference style}{C-c C-r}
+\key{pretty-print Lisp formula}{TAB}
+\key{complete Lisp symbol}{M-TAB}
+\key{shift reference point}{S-cursor}
+\key{shift test line for column references}{M-up/down}
+\key{scroll the window showing the table}{M-S-up/down}
+\key{toggle table coordinate grid}{C-c \}}
+
 \section{Links}
 
 \key{globally store link to the current location}{C-c l$^1$}
@@ -466,24 +478,24 @@
 %\key{\kbd{vm://myself@some.where.org/folder\#id}}{\rm VM remote}
 
 
-\section{Remember-mode Integration}
+% \section{Remember-mode Integration}
 
-See the manual for how to make remember.el use Org-mode links and
-files.  The note-finishing command \kbd{C-c C-c} will first prompt for
-an org file. In the file, find a location with:
+% See the manual for how to make remember.el use Org-mode links and
+% files.  The note-finishing command \kbd{C-c C-c} will first prompt for
+% an org file. In the file, find a location with:
 
-\key{rotate subtree visibility}{TAB}
-\key{next heading}{DOWN}
-\key{previous heading}{UP}
+% \key{rotate subtree visibility}{TAB}
+% \key{next heading}{DOWN}
+% \key{previous heading}{UP}
 
-Insert the note with one of the following: 
+% Insert the note with one of the following: 
 
-\key{as sublevel of heading at cursor}{RET}
-\key{right here (cursor not on heading)}{RET}
-\key{before current heading}{LEFT}
-\key{after current heading}{RIGHT}
-\key{shortcut to end of buffer (cursor at buf-start)}{RET}
-\key{Abort}{q}
+% \key{as sublevel of heading at cursor}{RET}
+% \key{right here (cursor not on heading)}{RET}
+% \key{before current heading}{LEFT}
+% \key{after current heading}{RIGHT}
+% \key{shortcut to end of buffer (cursor at buf-start)}{RET}
+% \key{Abort}{q}
 
 \section{Completion}
 
@@ -502,16 +514,18 @@
 \section{TODO Items and Checkboxes}
 
 \key{rotate the state of the current item}{C-c C-t}
+\metax{select next/previous state}{S-LEFT/RIGHT}
+\metax{select next/previous set}{C-S-LEFT/RIGHT}
 \key{view TODO items in a sparse tree}{C-c C-v}
 \key{view 3rd TODO keyword's sparse tree}{C-3 C-c C-v}
 
 \key{set the priority of the current item}{C-c , [ABC]}
 \key{remove priority cookie from current item}{C-c , SPC}
-\key{raise priority of current item}{S-UP$^3$}
-\key{lower priority of current item}{S-DOWN$^3$}
+\key{raise/lower priority of current item}{S-UP/DOWN$^3$}
+%\key{lower priority of current item}{S-DOWN$^3$}
 
-\key{\kbd{\#+SEQ_TODO: TODO TRY BLUFF DONE}}{\rm todo workflow}
-\key{\kbd{\#+TYP_TODO: Phil home work DONE}}{\rm todo types}
+%\key{\kbd{\#+SEQ_TODO: TODO TRY BLUFF DONE}}{\rm todo workflow}
+%\key{\kbd{\#+TYP_TODO: Phil home work DONE}}{\rm todo types}
 
 \key{insert new checkbox item in plain list}{M-S-RET}
 \key{toggle checkbox(es) in region/entry/at point}{C-c C-x C-b}
@@ -548,13 +562,11 @@
 %\key{... forward/backward one month}{M-S-LEFT/RIGT}
 \key{Toggle custom format display for dates/times}{C-c C-x C-t}
 
-
-\section{Clocking Time}
+{\bf Clocking time}
 
 \key{start clock on current item}{C-c C-x C-i}
 \key{stop clock on current item}{C-c C-x C-o}
 \key{cancel current clock}{C-c C-x C-x}
-
 \key{display total subtree times}{C-c C-x C-d}
 \key{remove displayed times}{C-c C-c}
 \key{insert/update table with clock report}{C-c C-x C-r}
@@ -720,21 +732,6 @@
 
 \key{toggle COMMENT keyword on entry}{C-c ;}
 
-
-%\section{CUA and pc-select compatibility}%
-
-%Configure the variable {\tt org-CUA-compatibility} to make Org-mode
-%avoid the \kbd{S-<cursor>} bindings used by these modes.  When set,
-%Org-mode will change the following keybindings (also in the agenda
-%buffer, but not during date selection). See note mark four$^3$
-%throughout the reference card.
-%%\vskip-mm
-%\beginexample
-%S-UP    $\to$ M-p             S-DOWN  $\to$ M-n
-%S-LEFT  $\to$ M--             S-RIGHT $\to$ M-+
-%S-RET   $\to$ C-S-RET
-%\endexample
-
 \section{Dynamic Blocks}
 
 \key{update dynamic block at point}{C-c C-x C-u}
@@ -753,10 +750,8 @@
 
 \bye
 
+% Local variables:
+% compile-command: "tex refcard"
+% End:
 
 % arch-tag: 139f6750-5cfc-49ca-92b5-237fe5795290
-
-%%% Local Variables: 
-%%% mode: latex
-%%% TeX-master: t
-%%% End: 
--- a/leim/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/leim/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,7 @@
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
 2007-01-30  Kenichi Handa  <handa@m17n.org>
 
 	* CXTERM-DIC/CCDOSPY.tit, CXTERM-DIC/PY-b5.tit, CXTERM-DIC/SW.tit,
--- a/lib-src/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/lib-src/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,8 @@
+2007-06-07  Glenn Morris  <rgm@gnu.org>
+
+	* etags.c (print_version): Add `emacs_copyright' string, for
+	easier automatic updating.
+
 2007-05-18  Francesco Potort,Al(B  <pot@gnu.org>
 
 	* etags.c: Extern definitions of some more pointer functions for
@@ -10,6 +15,10 @@
 
 	* makefile.w32-in (VERSION): Increase to 22.1.50.
 
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
 2007-02-26  Francesco Potort,Al(B  <pot@gnu.org>
 
 	* Makefile.in (etags, ctags): Define EMACS_NAME as "GNU Emacs".
--- a/lib-src/etags.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/lib-src/etags.c	Mon Jun 11 00:58:11 2007 +0000
@@ -887,8 +887,11 @@
 static void
 print_version ()
 {
+  /* Makes it easier to update automatically. */
+  char emacs_copyright[] = "Copyright (C) 2007 Free Software Foundation, Inc.";
+
   printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION);
-  puts ("Copyright (C) 2007 Free Software Foundation, Inc.");
+  puts (emacs_copyright);
   puts ("This program is distributed under the terms in ETAGS.README");
 
   exit (EXIT_SUCCESS);
--- a/lisp/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,267 @@
+2007-06-10  Martin Rudalics  <rudalics@gmx.at>
+
+	* emacs-lisp/bytecomp.el (byte-compile-find-cl-functions): Match
+	against file-name-nondirectory.
+	Fix text on user customization variables.
+	Reported by Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se>.
+
+2007-06-09  Alfred M. Szmidt  <ams@gnu.org>  (tiny change)
+
+	* mail/rmail.el (rmail-movemail-variant-in-use): Fix doc typo.
+
+2007-06-09  Davis Herring  <herring@lanl.gov>
+
+	* desktop.el (desktop-minor-mode-table): Doc fix.
+
+2007-06-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* textmodes/css-mode.el (css-navigation-syntax-table):
+	Use set-char-table-range so it also works in the unicode branch.
+
+2007-06-08  Nick Roberts  <nickrob@snap.net.nz>
+
+	* help-mode.el (help-xref-forward-stack)
+	(help-xref-stack-forward-item, help-forward-label): New variables.
+	(help-forward): New button type.
+	(help-setup-xref): Initialise help-xref-forward-stack.
+	(help-make-xrefs): Add forward button, if appropriate.
+	(help-xref-go-back): Push item on forward stack.
+	(help-xref-go-forward, help-go-forward): New functions.
+
+2007-06-07  Chong Yidong  <cyd@stupidchicken.com>
+
+	* dired.el (dired-mode-map): Remove spurious separator.
+
+2007-06-07  Juanma Barranquero  <lekktu@gmail.com>
+
+	* progmodes/ebrowse.el (ebrowse-draw-file-member-info): Doc fix.
+
+	* progmodes/mixal-mode.el (mixal-operation-codes-alist):
+	* progmodes/idlwave.el (idlwave-one-key-select): Fix typo in docstring.
+
+2007-06-07  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el: Version number fixed.
+
+2007-06-07  Glenn Morris  <rgm@gnu.org>
+
+	* version.el (emacs-copyright): New constant.
+	* startup.el (fancy-splash-tail): Use emacs-copyright.
+	* calc/calc-help.el (calc-full-help): Use emacs-copyright.
+
+	* emacs-lisp/bytecomp.el (byte-compile-warnings): Add new option
+	`make-local'.
+	(byte-compile-warnings-safe-p): Add `make-local'.
+	(byte-compile-make-variable-buffer-local):
+	Allow byte-compile-warnings to suppress this warning.
+
+	* tutorial.el (tutorial--describe-nonstandard-key): Adjust for new
+	format of "menu" description.
+	(tutorial--find-changed-keys): Describe the specific menu a
+	command is in.
+
+	* dframe.el (dframe-frame-parameter, dframe-mouse-event-p):
+	Rewrite compatibility functions to silence byte-compiler.
+
+2007-06-07  Alfred M. Szmidt  <ams@gnu.org>  (tiny change)
+
+	* mail/rmailsum.el (rmail-summary-save-buffer): New command.
+	(rmail-summary-mode-map): Add rmail-summary-save-buffer.
+
+2007-06-07  Eric M. Ludlam  <eric@siege-engine.com>
+
+	* emacs-lisp/checkdoc.el (checkdoc-ispell-lisp-words): Remove "iff".
+
+2007-06-07  Juanma Barranquero  <lekktu@gmail.com>
+
+	* progmodes/ebrowse.el (ebrowse-member-table):
+	* textmodes/org.el (org-export-ascii-bullets, org-batch-agenda)
+	(org-batch-agenda-csv): Fix typos in docstrings.
+
+2007-06-06  Juanma Barranquero  <lekktu@gmail.com>
+
+	* international/mule-cmds.el (toggle-enable-multibyte-characters)
+	(sort-coding-systems, search-unencodable-char): Doc fixes.
+	(coding-system-change-eol-conversion, set-default-coding-systems)
+	(prefer-coding-system, find-multibyte-characters, princ-list)
+	(leim-list-entry-regexp, set-input-method, locale-language-names)
+	(input-method-exit-on-first-char, exit-language-environment-hook)
+	(locale-charset-language-names): Fix typos in docstrings.
+
+2007-06-06  Juanma Barranquero  <lekktu@gmail.com>
+
+	* pgg.el (pgg-sign-region, pgg-sign):
+	* ses.el (ses-call-printer):
+	* calendar/icalendar.el (icalendar--diarytime-to-isotime):
+	* textmodes/org.el (org-cycle): Fix typos in docstrings.
+
+2007-06-06  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el
+	(org-export-region-as-html, org-replace-region-by-html)
+	(org-number-to-letters, org-table-fedit-finish)
+	(org-normalize-color, org-table-fedit-ref-right)
+	(org-date-to-gregorian, org-table-fedit-move)
+	(org-table-convert-refs-to-rc, org-calendar-holiday)
+	(org-table-fedit-toggle-ref-type, org-write-agenda)
+	(org-colgroup-info-to-vline-list, org-agenda-todo-previousset)
+	(org-defkey, org-encode-for-stdout)
+	(org-indent-line-function, org-export-as-html-to-buffer)
+	(org-store-agenda-views, org-update-mode-line)
+	(org-find-if, org-delete-all)
+	(org-table-fedit-convert-buffer, org-emphasize)
+	(org-uniquify, org-table-fedit-lisp-indent)
+	(org-table-fedit-scroll, org-get-todo-sequence-head)
+	(org-table-fedit-scroll-down, org-table-fedit-line-down)
+	(org-table-fedit-ref-left, org-agenda-export-csv-mapper)
+	(org-table-fedit-toggle-coordinates, org-dvipng-color)
+	(org-table-fedit-line-up, org-table-fedit-ref-down)
+	(org-table-formula-from-user, org-mode-flyspell-verify)
+	(org-cycle-show-empty-lines, org-ctrl-c-ret)
+	(org-table-formula-to-user, org-diary-to-ical-string)
+	(orgtbl-export, org-table-fedit-post-command)
+	(org-closed-in-range, org-shiftcontrolright)
+	(org-table-convert-refs-to-an, org-table-hline-and-move)
+	(org-table-formula-less-p, org-format-table-ascii)
+	(org-agenda-get-sexps, org-shift-refpart)
+	(org-diary-sexp-entry, org-time-string-to-absolute)
+	(org-table-show-reference, org-letters-to-number)
+	(org-fix-agenda-info, org-table-fedit-ref-up)
+	(org-table-fedit-shift-reference, org-table-fedit-abort)
+	(org-closest-date, org-shiftcontrolleft)
+	(org-at-heading-or-item-p, org-rematch-and-replace)
+	(org-agenda-todo-nextset, org-export-grab-title-from-buffer):
+	New functions.
+	(org-table-edit-scroll-down, org-finish-edit-formulas)
+	(org-table-edit-next-field, org-abort-edit-formulas)
+	(org-font-lock-level, org-export-find-first-heading-line)
+	(org-table-edit-line-down, org-table-edit-backward-field)
+	(org-edit-formula-lisp-indent, org-table-edit-move)
+	(org-check-log-option, org-this-word)
+	(org-table-edit-line-up, org-table-edit-formulas-post-command)
+	(org-agenda-file-to-end, org-expand-file-name)
+	(org-fake-empty-table-line, org-table-edit-scroll)
+	(org-toggle-log-option, org-show-reference): Function removed.
+	(org-inhibit-invisibility, org-table-formula-make-cmp-string):
+	New defsubsts.
+	(org-unmodified, org-batch-store-agenda-views)
+	(org-batch-agenda-csv): New macro.
+	(org-agenda-export): New customization group.
+	(org-agenda-skip-deadline-if-done, org-agenda-remove-tags)
+	(org-highest-priority, org-agenda-exporter-settings)
+	(org-log-done-with-time, org-replace-disputed-keys)
+	(org-format-latex-header, org-export-table-header-tags)
+	(org-cycle-separator-lines, org-export-table-data-tags)
+	(org-icalendar-include-sexps)
+	(org-empty-line-terminates-plain-lists)
+	(org-log-repeat, org-special-ctrl-a)
+	(org-table-use-standard-references, org-disputed-keys)
+	(org-export-skip-text-before-1st-heading, org-agenda-with-colors)
+	(org-agenda-export-html-style): New option.
+	(org-allow-auto-repeat,  org-agenda-remove-tags-when-in-prefix)
+	(org-CUA-compatible): Option removed.
+	(org-agenda-structure,  org-sexp-date): New face.
+	(org-todo-keywords-for-agenda, org-not-done-keywords)
+	(org-planning-or-clock-line-re, org-agenda-name)
+	(org-table-colgroup-info, org-todo-sets)
+	(constants-unit-system, org-clock-mode-line-entry)
+	(org-mode-line-timer, org-table-current-begin-pos)
+	(org-todo-keywords-1, org-mode-line-string)
+	(org-table-clean-did-remove-column, org-table-fedit-map)
+	(org-clock-heading, org-table-buffer-is-an)
+	(org-agenda-info, org-done-keywords)
+	(org-done-keywords-for-agenda, org-todo-heads)
+	(org-todo-kwd-alist, org-clock-start-time): New variable.
+	(org-todo-kwd-priority-p, org-edit-formulas-map)
+	(org-repeat-re, org-todo-kwd-max-priority)
+	(org-version, org-done-string)
+	(org-table-clean-did-remove-column-1, org-disputed-keys):
+	Remove Variables.
+	(org-table-translate-regexp, org-repeat-re, org-version): New consts.
+	(org-ts-lengths): Constant removed.
+	(org-follow-gnus-link): Don't ask how many articles to read.
+	(org-export-find-first-export-line): Rename from
+	`org-export-find-first-heading'.
+	Use `org-export-skip-text-before-1st-heading'.
+	(org-table-fedit-post-command): Rename from
+	`org-table-edit-formulas-post-command'.
+	(org-table-fedit-finish): Rename from `org-finish-edit-formulas'.
+	(org-table-fedit-abort): Rename from `org-abort-edit-formulas'.
+	(org-table-fedit-lisp-indent): Rename from
+	`org-edit-formula-lisp-indent'.
+	(org-table-show-reference): Rename from `org-show-reference'.
+	(org-table-store-formulas): Use `org-table-formula-less-p'.
+	(org-table-edit-formulas): Position cursor to current field equation.
+	(org-update-checkbox-count, org-hide-archived-subtrees)
+	(org-timestamp-up-day, org-timestamp-down-day)
+	(org-shiftmetaleft, org-shiftmetaright, org-shiftmetaup)
+	(org-shiftmetadown, org-metaleft, org-metaright, org-metaup)
+	(org-metadown, org-shiftup, org-shiftdown, org-shiftright)
+	(org-shiftleft, org-ctrl-c-ctrl-c, org-context):
+	Let `org-on-heading-p' also check for invisible heading.
+	(org-read-date): Match am/pm times.
+	(org-eval-in-calendar): Fix default date in prompt.
+
+2007-06-05  Chong Yidong  <cyd@stupidchicken.com>
+
+	* files.el (auto-mode-alist): Separate "ChangeLog.1" and
+	"ChangeLog.a" entries, giving the latter lower priority.
+
+2007-06-05  Juanma Barranquero  <lekktu@gmail.com>
+
+	* faces.el (face-id): If the argument is a face alias,
+	return the ID of the target face.
+
+2007-06-05  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/socks.el (top): Remove unnecessary copyright line.
+
+2007-06-04  Chong Yidong  <cyd@stupidchicken.com>
+
+	* longlines.el (longlines-auto-wrap): Handle argument correctly.
+
+2007-06-04  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/socks.el: New file, taken from w3 repository.
+	(top): Update Copyright.  Don't load cl.el.
+	(all): Replace `case' by `cond', `string-to-int' by
+	`string-to-number', and `process-kill-without-query' by
+	`set-process-query-on-exit-flag'.
+	(socks-char-int): Remove defalias and all occurencies.
+
+2007-06-04  Juanma Barranquero  <lekktu@gmail.com>
+
+	* progmodes/compile.el (compilation-find-file, compilation-handle-exit):
+	Fix typos in docstrings.
+	(compilation-search-path, compilation-buffer-name-function): Doc fixes.
+	(compilation-finish-function): Fix typo in obsolescence declaration.
+
+2007-06-03  Sam Steingold  <sds@gnu.org>
+
+	* progmodes/compile.el: Add TIMESTAMP to the LOC data structure, to
+	handle unending automatic recompilation of changed files (`omake -P').
+	(compilation-loop): VISITED is now 5th CDR.
+	(compilation-next-error-function): Set TIMESTAMP.
+
+2007-06-03  Sam Steingold  <sds@gnu.org>
+
+	* files.el (kill-buffer-ask): New function.
+	(kill-some-buffers): Use it.
+	(kill-matching-buffers): New user command.
+
+2007-06-01  David Kastrup  <dak@gnu.org>
+
+	* dired.el (dired-recursive-deletes, dired-recursive-copies):
+	Change default to `top'.
+
+2007-05-31  Richard Stallman  <rms@gnu.org>
+
+	* dired.el (dired-do-flagged-delete, dired-do-delete): Doc fix.
+
+2007-05-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* textmodes/css-mode.el: New file.
+
 2007-05-30  Michael Olson  <mwolson@gnu.org>
 
 	* emacs-lisp/tq.el (tq-queue-pop): Stifle error when a process has
@@ -9,8 +273,8 @@
 2007-05-29  Martin Rudalics  <rudalics@gmx.at>
 
 	* textmodes/table.el (table--point-entered-cell-function)
-	(table--point-left-cell-function): Bind
-	`inhibit-point-motion-hooks' to t.
+	(table--point-left-cell-function):
+	Bind `inhibit-point-motion-hooks' to t.
 
 2007-05-29  Nikolaj Schumacher  <n_schumacher@web.de>  (tiny change)
 
@@ -35,18 +299,17 @@
 
 	* net/tramp.el (top): Make `set-buffer-multibyte' an alias if it
 	doesn't exist.
-	(with-parsed-tramp-file-name): Protect debug spec during
-	compilation.
+	(with-parsed-tramp-file-name): Protect debug spec during compilation.
 	(tramp-handle-insert-directory): Check (featurep 'ls-lisp).
 	(tramp-file-name-p, tramp-file-name-multi-method)
 	(tramp-file-name-method, tramp-file-name-user)
 	(tramp-file-name-host, tramp-file-name-localname): New defuns,
 	replacing defstruct `tramp-file-name'.
 	(tramp-handle-file-remote-p, tramp-completion-dissect-file-name1)
-	(tramp-dissect-file-name, tramp-dissect-multi-file-name): Apply
-	`vector' instead of `make-tramp-file-name'.
-	(tramp-handle-make-auto-save-file-name): Apply
-	`tramp-temporary-file-directory' for compatibility reasons.
+	(tramp-dissect-file-name, tramp-dissect-multi-file-name):
+	Apply `vector' instead of `make-tramp-file-name'.
+	(tramp-handle-make-auto-save-file-name):
+	Apply `tramp-temporary-file-directory' for compatibility reasons.
 	(tramp-completion-mode): Use `natnump' instead of `wholenump'
 	because of XEmacs.
 	(tramp-completion-mode): `last-input-event' is nil when XEmacs is
@@ -170,8 +433,8 @@
 
 2007-05-22  Katsumi Yamaoka  <yamaoka@jpl.org>  (tiny change)
 
-	* mail/mail-extr.el (mail-extract-address-components): Recognize
-	non-ASCII characters except for NBSP as words.
+	* mail/mail-extr.el (mail-extract-address-components):
+	Recognize non-ASCII characters except for NBSP as words.
 
 2007-05-21  Trent Buck  <trentbuck@gmail.com>  (tiny change)
 
@@ -182,8 +445,8 @@
 2007-05-21  Chong Yidong  <cyd@stupidchicken.com>
 
 	* image-mode.el (image-toggle-display): Don't clear image cache.
-	Only use filename in image spec if the file is readable.  Call
-	image-refresh.
+	Only use filename in image spec if the file is readable.
+	Call image-refresh.
 
 	* image.el (image-type-from-file-name, image-type): Simplify.
 	(image-type-auto-detected-p): Don't scan auto-mode-alist.
@@ -211,6 +474,10 @@
 	* files.el (auto-mode-alist): Change the regexp so that
 	ChangeLog.unicode and ChangeLog.multi-tty use change-log-mode.
 
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
 2007-05-19  Chong Yidong  <cyd@stupidchicken.com>
 
 	* paren.el (show-paren-function): Undo 2007-04-19 and 2007-04-20
@@ -230,7 +497,7 @@
 
 2007-05-18  Rob Riepel  <riepel@Stanford.EDU>
 
-	* emulation/tpu-edt.el (CSI-map, SS3-map): Moved from global-map to
+	* emulation/tpu-edt.el (CSI-map, SS3-map): Move from global-map to
 	tpu-global-map.
 	(tpu-original-global-map): Variable deleted.
 	(tpu-control-keys-map): New keymap variable.
--- a/lisp/ChangeLog.12	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/ChangeLog.12	Mon Jun 11 00:58:11 2007 +0000
@@ -271,7 +271,7 @@
 2007-04-14  Nick Roberts  <nickrob@snap.net.nz>
 
 	* tmm.el (tmm-get-keybind): Use copy-sequence to ensure that the
-	global map isn't modified
+	global map isn't modified.
 
 2007-04-14  Glenn Morris  <rgm@gnu.org>
 
@@ -1413,7 +1413,7 @@
 	* progmodes/python.el (python-quote-syntax): Don't bother with
 	syntax-ppss-context.
 	(python-fill-paragraph): Make sure that fenced-string delimiters that
-	stand on their own line stay there
+	stand on their own line stay there.
 
 2007-03-01  Lennart Borgman  <lennart.borgman.073@student.lu.se>
 
@@ -2549,7 +2549,7 @@
 	* type-break.el (type-break-demo-hanoi, type-break-demo-life)
 	(type-break-demo-boring): Call read-event instead of read-char.
 
-2007-01-19  Daniel Pfeiffer  <occitan@esperanto.org>  (small change)
+2007-01-19  Daniel Pfeiffer  <occitan@esperanto.org>  (tiny change)
 
 	* progmodes/compile.el: Add handling for makepplog.
 
@@ -3414,7 +3414,7 @@
 	(wdired-search-and-rename): Simplify code.
 	(wdired-preprocess-files, wdired-preprocess-perms): Make
 	read-only property of preceding character rear-nonsticky to
-	avoid that it can be modified.	Put old-name and old-link
+	avoid that it can be modified.  Put old-name and old-link
 	properties on character preceding name and replace
 	put-text-property by add-text-properties.
 	(wdired-get-filename, wdired-get-previous-link): Get old-name
@@ -3605,7 +3605,7 @@
 	allout-mode-map.  Call it on file load, so the mode docstring
 	substitutions work even if allout mode has not yet been invoked.
 	(allout-mode): Use new allout-setup-mode-map to track any keybinding
-	customizations since the map was last processed.  Also,	refine the
+	customizations since the map was last processed.  Also, refine the
 	docstring so it's ship-shape for release.
 	(allout-default-layout, allout-beginning-of-line-cycles)
 	(allout-distinctive-bullets-string, allout-use-mode-specific-leader)
@@ -5281,7 +5281,7 @@
 	New C-c key bindings: for `cperl-find-bad-style',
 	`cperl-pod-spell', `cperl-here-doc-spell', `cperl-narrow-to-here-doc',
 	`cperl-perdoc', and `cperl-perldoc-at-point'.
-	CPerl Mode menu changes:	"Fix style by spaces", "Imenu on Perl Info"
+	CPerl Mode menu changes: "Fix style by spaces", "Imenu on Perl Info"
 	moved, new submenu of Tools with Ispell entries and narrowing.
 	(cperl-after-sub-regexp): New defsubst.
 	(cperl-imenu--function-name-regexp-perl): Use `cperl-after-sub-regexp'.
@@ -5304,7 +5304,7 @@
 	(cperl-calculate-indent): Try to allow '_' be non-word char
 		Support subs with attributes.
 	(cperl-where-am-i): Quiet (?) a warning.
-	(cperl-cached-syntax-table)	New function.
+	(cperl-cached-syntax-table): New function.
 	(cperl-forward-re): Use `cperl-cached-syntax-table'.
 	(cperl-unwind-to-safe): Recognize `syntax-type' property
 		changing in a middle of line.
@@ -5478,7 +5478,7 @@
 	(cperl-string-syntax-table): Make { and } not-grouping
 	  (Sometimes they ARE grouping in RExen, but matching them would only
 	   confuse in many situations when they are not)
-	(beginning-of-buffer): Replace two occurences with goto-char...
+	(beginning-of-buffer): Replace two occurrences with goto-char...
 	(cperl-calculate-indent): `char-after' could be nil...
 	(cperl-find-pods-heres): REx can start after "[" too.
 		Hightlight (??{}) in RExen too.
@@ -5551,7 +5551,7 @@
 	(cperl-next-interpolated-REx): New function.
 	(cperl-next-interpolated-REx-0): Likewise.
 	(cperl-next-interpolated-REx-1): Likewise.
-	"\C-c\C-x", "\C-c\C-y", "\C-c\C-v":	New keybinding for these functions.
+	"\C-c\C-x", "\C-c\C-y", "\C-c\C-v": New keybinding for these functions.
 	Perl/Regexp menu: 3 new entries for `cperl-next-interpolated-REx'.
 	(cperl-praise): Mention finded interpolated RExen.
 
@@ -5797,7 +5797,7 @@
 
 	* wid-edit.el (widget-button-click-moves-point): New variable.
 	(widget-button-click): If widget-button-click-moves-point is
-	non-nil, set point after performing the button action
+	non-nil, set point after performing the button action.
 
 	* cus-edit.el (custom-mode): Set widget-button-click-moves-point.
 
@@ -6069,8 +6069,8 @@
 	buffer-read-only isn't set.
 	(allout-annotate-hidden): Enable topic annotation during copies even
 	when the buffer is read-only, eg for topic copies.  Ensure that the loop
-	advances, even when the span extends beyond the	deletion region.
-	(allout-toggle-subtree-encryption): Use	allout-structure-added-hook
+	advances, even when the span extends beyond the deletion region.
+	(allout-toggle-subtree-encryption): Use allout-structure-added-hook
 	rather than allout-exposure-changed-hook, as a stronger assertion.
 	(allout-keybindings-list): Add bindings for
 	allout-copy-line-as-kill and allout-copy-topic-as-kill.
@@ -6121,7 +6121,7 @@
 
 	* cus-start.el (all): Rename x-gtk-show-chooser-help-text to
 	x-gtk-file-dialog-help-text.  Rename x-use-old-gtk-file-dialog
-	to x-gtk-use-old-file-dialog
+	to x-gtk-use-old-file-dialog.
 
 2006-09-18  Richard Stallman  <rms@gnu.org>
 
@@ -8116,7 +8116,7 @@
 
 	* tumme.el (tumme-create-thumb, tumme-thumbnail-display-external)
 	(tumme-display-image, tumme-rotate-thumbnail, tumme-rotate-original)
-	(tumme-set-exif-data, tumme-get-exif-data): Use	shell-command-switch.
+	(tumme-set-exif-data, tumme-get-exif-data): Use shell-command-switch.
 
 	* thumbs.el (thumbs-call-convert): Use shell-command-switch.
 
@@ -8652,7 +8652,7 @@
 	(viper-next-line-at-bol): If point is on a widget or a button, simulate
 	clicking on that widget/button.
 
-	* viper.el (viper-mode): Allow a separate cursor color in Emacs	state.
+	* viper.el (viper-mode): Allow a separate cursor color in Emacs state.
 
 	* ediff-diff (ediff-test-patch-utility): Catch errors.
 	(ediff-actual-diff-options, ediff-actual-diff3-options): New variables.
@@ -9203,7 +9203,7 @@
 	(ewoc--wrap): New func.
 	(ewoc-create): Take additional arg NOSEP.  If nil, wrap node and
 	header/footer pretty-printers.  Save header/footer pretty-printer.
-	(ewoc-set-hf): Use ewoc's header/footer pretty-printer.  *
+	(ewoc-set-hf): Use ewoc's header/footer pretty-printer.
 
 	* pcvs.el (cvs-make-cvs-buffer): Specify NOSEP to `ewoc-create'.
 
@@ -10152,7 +10152,7 @@
 2006-05-05  Eli Zaretskii  <eliz@gnu.org>
 
 	* startup.el (command-line): On MS-Windows, probe "~", not
-	"~USER", for warning about non-existent home directory
+	"~USER", for warning about non-existent home directory.
 
 	* arc-mode.el (archive-l-e): New optional argument `float' means
 	generate a float value.
@@ -12103,7 +12103,7 @@
 	preserve window-start.
 	(speedbar-update-directory-contents): Try to preserve window-start
 	and window-point.
-	(speedbar-update-special-contents): Don't move back to start of	window.
+	(speedbar-update-special-contents): Don't move back to start of window.
 
 	* progmodes/gdb-ui.el (gdb-speedbar-refresh): Rename from
 	gdb-speedbar-timer-fn.  Use speedbar-refresh instead of
@@ -12729,7 +12729,7 @@
 
 	(allout-mode): Explicitly specify the mode map in the docstring.
 	Clarify provision for various write-file hook var names.
-	Adjusted for invisible-text overlays instead of	selective-display.
+	Adjusted for invisible-text overlays instead of selective-display.
 
 	(allout-depth): Really return 0 if not within any topic.  This
 	rectifies `allout-beginning-of-level' and sequence numbering
@@ -15747,10 +15747,10 @@
 2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
 
 	* progmodes/cc-fix.el: Add definitions of the macros push and pop
-	(for GNU Emacs 20.4)
+	(for GNU Emacs 20.4).
 
 	* progmodes/cc-defs.el:
-	(i): Load cc-fix.elc for `push' and `pop' (for GNU Emacs 20.4)
+	(i): Load cc-fix.elc for `push' and `pop' (for GNU Emacs 20.4).
 
 	* progmodes/cc-cmds.el (c-show-syntactic-information): Change the
 	highlighting mechanism so it will work in XEmacs too.
@@ -16051,7 +16051,7 @@
 
 	Introduce an "awk" style, mainly for auto-newline and clean-ups.
 
-	* progmodes/cc-align.el: New function c-snug-1line-defun-close
+	* progmodes/cc-align.el: New function c-snug-1line-defun-close.
 
 	* progmodes/cc-cmds.el: In c-electric-brace, add code for new
 	clean-up one-liner-defun.
@@ -16185,7 +16185,7 @@
 
 	* progmodes/cc-awk.el: Move regexps for analysing AWK code to near the
 	start of the file.  ^L now separate sections of the file.
-	(c-awk-non-eol-esc-pair-re,	c-awk-blank-or-comment-line-re)
+	(c-awk-non-eol-esc-pair-re, c-awk-blank-or-comment-line-re)
 	(c-awk-one-line-possibly-open-string-re)
 	(c-awk-regexp-one-line-possibly-open-char-class-re)
 	(c-awk-one-line-possibly-open-regexp-re)
@@ -17298,7 +17298,7 @@
 
 2005-11-30  Kim F. Storm  <storm@cua.dk>
 
-	* emulation/cua-rect.el (cua--rectangle-overlays): Make	permanent-local.
+	* emulation/cua-rect.el (cua--rectangle-overlays): Make permanent-local.
 	(cua--rectangle-post-command): Cleanup overlays and deactivate mark
 	after revert-buffer (or anything else which kills all local variables).
 
@@ -18540,7 +18540,7 @@
 	(pgg-pgp5-sign-region, pgg-pgp5-sign): Add optional PASSPHRASE
 	argument to all these routines, so the passphrase can be managed
 	externally and passed in to the system.
-	(pgg-pgp5-sign-region): Use new name of	pgg-add-passphrase-to-cache
+	(pgg-pgp5-sign-region): Use new name of pgg-add-passphrase-to-cache
 	function.
 
 2005-11-04  Dan Nicolaescu  <dann@ics.uci.edu>
@@ -18762,7 +18762,7 @@
 	(pgg-pgp5-sign-region, pgg-pgp5-sign): Add optional PASSPHRASE
 	argument to all these routines, so the passphrase can be managed
 	externally and passed in to the system.
-	(pgg-pgp5-sign-region): Use new name of	pgg-add-passphrase-to-cache
+	(pgg-pgp5-sign-region): Use new name of pgg-add-passphrase-to-cache
 	function.
 
 2005-11-04  Edward O'Connor  <hober0@gmail.com>  (tiny change)
@@ -19664,14 +19664,14 @@
 	New defvar.  Replaces `dired-move-to-filename-regexp' from dired.el.
 
 	* dired.el (dired-move-to-filename-regexp): Remove.
-	All occurences replaced by `directory-listing-before-filename-regexp'.
+	All occurrences replaced by `directory-listing-before-filename-regexp'.
 
 	* dired-x.el, locate.el, vc.el:
 	Replace `dired-move-to-filename-regexp' by
 	`directory-listing-before-filename-regexp'.  In vc.el it is
 	overwritten locally; maybe this can be handled in files.el too.
 
-	* net/ange-ftp.el (ange-ftp-date-regexp): Remove.  All occurences
+	* net/ange-ftp.el (ange-ftp-date-regexp): Remove.  All occurrences
 	replaced by `directory-listing-before-filename-regexp'.
 
 2005-10-23  Andreas Schwab  <schwab@suse.de>
@@ -19923,7 +19923,7 @@
 	(outlineify-sticky): Use the file vars mechanism.
 	(allout-inhibit-protection, allout-during-write-cue)
 	(allout-override-protect, allout-before-change-protect): Remove.
-	(allout-flag-region, allout-open-topic): Adjust	read-only text.
+	(allout-flag-region, allout-open-topic): Adjust read-only text.
 	(allout-open-line-not-read-only): Add to facilitate read-only
 	text based protection.
 	(allout-kill-line): Revise to adjust read-only text, clue the
@@ -20402,7 +20402,7 @@
 
 2005-10-12  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
-	* startup.el (command-line-x-option-alist): -nb => -nbi
+	* startup.el (command-line-x-option-alist): -nb => -nbi.
 
 2005-10-12  Kim F. Storm  <storm@cua.dk>
 
@@ -20580,7 +20580,7 @@
 	* term/x-win.el: Remove -i, --icon-type from comment.
 
 	* startup.el (command-line-x-option-alist): Remove options -i,
-	-itype, --icon-type, added -nb, --no-bitmap-icon
+	-itype, --icon-type, added -nb, --no-bitmap-icon.
 
 2005-10-09  Nick Roberts  <nickrob@snap.net.nz>
 
@@ -20866,7 +20866,7 @@
 	* textmodes/ispell.el (ispell-word, ispell-region):
 	Call ispell-maybe-find-aspell-dictionaries.
 	(ispell-accept-buffer-local-defs):
-	Don't call ispell-maybe-find-aspell-dictionaries
+	Don't call ispell-maybe-find-aspell-dictionaries.
 
 2005-10-04  Richard M. Stallman  <rms@gnu.org>
 
@@ -22474,7 +22474,7 @@
 
 	* calendar/diary-lib.el (diary-modify-entry-list-string-function):
 	New hook.
-	(add-to-diary-list): Call `diary-modify-entry-list-string-function'
+	(add-to-diary-list): Call `diary-modify-entry-list-string-function'.
 
 2005-08-24  Stefan Monnier  <monnier@iro.umontreal.ca>
 
@@ -24379,7 +24379,7 @@
 	* viper-init.el: Get rid of -face in face names.
 
 	* ediff-diff.el (ediff-extract-diffs, ediff-extract-diffs3):
-	Make it work with longlines mode
+	Make it work with longlines mode.
 
 	* ediff-mult.el (ediff-meta-mode-hook): New variable.
 
@@ -27807,7 +27807,7 @@
 	(reftex-unhighlight): Use `reftex-delete-overlay'.
 	(reftex-uniq): Function removed.  Use `reftex-uniquify' instead.
 	(reftex-access-search-path): Use `reftex-uniquify' instead of
-	`reftex-uniq'
+	`reftex-uniq'.
 
 	* textmodes/reftex-sel.el (reftex-select-unmark): Overlay
 	`before-string' property modification enables for Emacs as well.
@@ -29286,7 +29286,7 @@
 
 	* isearch.el (isearch-edit-string): Make the search-ring available for
 	minibuffer history commands.
-	(minibuffer-local-isearch-map): Remove bindings for M-p	and M-n,
+	(minibuffer-local-isearch-map): Remove bindings for M-p and M-n,
 	the default history commands now work just as well.
 	(isearch-ring-retreat-edit, isearch-ring-advance-edit): Remove.
 
@@ -29446,7 +29446,7 @@
 	`org-insert-mode-line-in-empty-file' has been set.
 	(org-agenda-todo, org-agenda-priority): Modify to use
 	`org-agenda-change-all-lines'.
-	(org-warning-face): Change color on dark background
+	(org-warning-face): Change color on dark background.
 
 2005-04-14  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
@@ -29570,7 +29570,7 @@
 
 2005-04-11  Rajesh Vaidheeswarran  <rv@gnu.org>
 
-	* whitespace.el (whitespace-version): Bump to 3.5
+	* whitespace.el (whitespace-version): Bump to 3.5.
 
 	(whitespace-buffer-leading, whitespace-buffer-trailing):
 	Invert sense of the test to highlight the whitespace.
@@ -29598,7 +29598,7 @@
 
 	* dired.el (dired-mode): Use dnd-* instead of x-dnd-*
 	(dired-dnd-handle-local-file): Call dnd-get-local-file-name.
-	(dired-dnd-handle-file): Call dnd-get-local-file-uri
+	(dired-dnd-handle-file): Call dnd-get-local-file-uri.
 
 	* cus-edit.el (dnd): New group.
 
@@ -32014,7 +32014,7 @@
 	(calcFunc-sech, calcFunc-csch, calcFunc-coth, math-sec-raw)
 	(math-csc-raw, math-cot-raw): New functions.
 
-	* calc/calc-rules.el (calc-DistribRules, calc-NegateRules): Add	rules.
+	* calc/calc-rules.el (calc-DistribRules, calc-NegateRules): Add rules.
 
 	* calc/calc-undo.el (calc-handle-undo): Remove prefix from
 	the variable name in a message.
@@ -32589,7 +32589,7 @@
 2005-01-21  Ren,Ai(B Kyllingstad  <listmailxemacs@kyllingstad.com>
 
 	* pcomplete.el: Define pcomplete-read-event instead of read-event,
-	since it's not a complete read-event implementation
+	since it's not a complete read-event implementation.
 
 2005-01-20  Jay Belanger  <belanger@truman.edu>
 
--- a/lisp/calc/calc-help.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/calc/calc-help.el	Mon Jun 11 00:58:11 2007 +0000
@@ -414,7 +414,7 @@
     (princ (format "GNU Emacs Calculator version %s.\n"
 		   calc-version))
     (princ "  By Dave Gillespie.\n")
-    (princ "  Copyright (C) 2007 Free Software Foundation, Inc.\n\n")
+    (princ (format "  %s\n\n" emacs-copyright))
     (princ "Type `h s' for a more detailed summary.\n")
     (princ "Or type `h i' to read the full Calc manual on-line.\n\n")
     (princ "Basic keys:\n")
--- a/lisp/calendar/icalendar.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/calendar/icalendar.el	Mon Jun 11 00:58:11 2007 +0000
@@ -678,7 +678,7 @@
       nil)))
 
 (defun icalendar--diarytime-to-isotime (timestring ampmstring)
-  "Convert a a time like 9:30pm to an iso-conform string like T213000.
+  "Convert a time like 9:30pm to an iso-conform string like T213000.
 In this example the TIMESTRING would be \"9:30\" and the AMPMSTRING
 would be \"pm\"."
   (if timestring
--- a/lisp/desktop.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/desktop.el	Mon Jun 11 00:58:11 2007 +0000
@@ -423,7 +423,7 @@
 Each entry has the form (NAME RESTORE-FUNCTION).
 NAME is the name of the buffer-local variable indicating that the minor
 mode is active.  RESTORE-FUNCTION is the function to activate the minor mode.
-called.  RESTORE-FUNCTION nil means don't try to restore the minor mode.
+RESTORE-FUNCTION nil means don't try to restore the minor mode.
 Only minor modes for which the name of the buffer-local variable
 and the name of the minor mode function are different have to be added to
 this table.  See also `desktop-minor-mode-handlers'."
--- a/lisp/dframe.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/dframe.el	Mon Jun 11 00:58:11 2007 +0000
@@ -152,13 +152,11 @@
 
 ;;; Compatibility functions
 ;;
-(if (fboundp 'frame-parameter)
-
-    (defalias 'dframe-frame-parameter 'frame-parameter)
-
-  (defun dframe-frame-parameter (frame parameter)
-    "Return FRAME's PARAMETER value."
-    (cdr (assoc parameter (frame-parameters frame)))))
+(defun dframe-frame-parameter (frame parameter)
+  "Return FRAME's PARAMETER value."
+  (if (fboundp 'frame-parameter)
+      (frame-parameter frame parameter)
+    (cdr (assoc parameter (frame-parameters frame))))) ; XEmacs
 
 
 ;;; Variables
@@ -887,10 +885,10 @@
 
 ;;; Interactive user functions for the mouse
 ;;
-(if dframe-xemacsp
-    (defalias 'dframe-mouse-event-p 'button-press-event-p)
-  (defun dframe-mouse-event-p (event)
-    "Return t if the event is a mouse related event."
+(defun dframe-mouse-event-p (event)
+  "Return t if the event is a mouse related event."
+  (if (fboundp 'button-press-event-p)
+      (button-press-event-p event)      ; XEmacs
     (if (and (listp event)
 	     (member (event-basic-type event)
 		     '(mouse-1 mouse-2 mouse-3)))
--- a/lisp/dired.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/dired.el	Mon Jun 11 00:58:11 2007 +0000
@@ -1452,9 +1452,6 @@
     (define-key map [menu-bar operate]
       (cons "Operate" (make-sparse-keymap "Operate")))
 
-    (define-key map [menu-bar operate dashes-2]
-      '("--"))
-
     (define-key map
       [menu-bar operate image-dired-delete-tag]
       '(menu-item "Delete Image Tag..." image-dired-delete-tag
@@ -2362,7 +2359,7 @@
 
 ;; Deleting files
 
-(defcustom dired-recursive-deletes nil ; Default only delete empty directories.
+(defcustom dired-recursive-deletes 'top ; Default only delete empty directories.
   "*Decide whether recursive deletes are allowed.
 A value of nil means no recursive deletes.
 `always' means delete recursively without asking.  This is DANGEROUS!
@@ -2410,7 +2407,9 @@
 (defun dired-do-flagged-delete (&optional nomessage)
   "In Dired, delete the files flagged for deletion.
 If NOMESSAGE is non-nil, we don't display any message
-if there are no flagged files."
+if there are no flagged files.
+`dired-recursive-deletes' controls whether 
+deletion of non-empty directories is allowed."
   (interactive)
   (let* ((dired-marker-char dired-del-marker)
 	 (regexp (dired-marker-regexp))
@@ -2426,7 +2425,9 @@
 	  (message "(No deletions requested)")))))
 
 (defun dired-do-delete (&optional arg)
-  "Delete all marked (or next ARG) files."
+  "Delete all marked (or next ARG) files.
+`dired-recursive-deletes' controls whether 
+deletion of non-empty directories is allowed."
   ;; This is more consistent with the file marking feature than
   ;; dired-do-flagged-delete.
   (interactive "P")
@@ -3206,7 +3207,7 @@
 
 ;;;;  Drag and drop support
 
-(defcustom dired-recursive-copies nil
+(defcustom dired-recursive-copies 'top
   "*Decide whether recursive copies are allowed.
 A value of nil means no recursive copies.
 `always' means copy recursively without asking.
--- a/lisp/emacs-lisp/bytecomp.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Mon Jun 11 00:58:11 2007 +0000
@@ -98,9 +98,11 @@
 ;;				`obsolete'  (obsolete variables and functions)
 ;;				`noruntime' (calls to functions only defined
 ;;					     within `eval-when-compile')
-;;				`cl-warnings' (calls to CL functions)
+;;				`cl-functions' (calls to CL functions)
 ;;				`interactive-only' (calls to commands that are
 ;;						   not good to call from Lisp)
+;;				`make-local' (dubious calls to
+;;					      `make-variable-buffer-local')
 ;; byte-compile-compatibility	Whether the compiler should
 ;;				generate .elc files which can be loaded into
 ;;				generic emacs 18.
@@ -356,14 +358,16 @@
   cl-functions    calls to runtime functions from the CL package (as
 		  distinguished from macros and aliases).
   interactive-only
-	      commands that normally shouldn't be called from Lisp code."
+	      commands that normally shouldn't be called from Lisp code.
+  make-local  calls to make-variable-buffer-local that may be incorrect."
   :group 'bytecomp
   :type `(choice (const :tag "All" t)
 		 (set :menu-tag "Some"
 		      (const free-vars) (const unresolved)
 		      (const callargs) (const redefine)
 		      (const obsolete) (const noruntime)
-		      (const cl-functions) (const interactive-only))))
+		      (const cl-functions) (const interactive-only)
+		      (const make-local))))
 (put 'byte-compile-warnings 'safe-local-variable 'byte-compile-warnings-safe-p)
 ;;;###autoload
 (defun byte-compile-warnings-safe-p (x)
@@ -374,7 +378,7 @@
 		     (when (memq e '(free-vars unresolved
 				     callargs redefine
 				     obsolete noruntime
-				     cl-functions interactive-only))
+				     cl-functions interactive-only make-local))
 		       e))
 		   x)
 		  x))))
@@ -1344,7 +1348,8 @@
   (unless byte-compile-cl-functions
     (dolist (elt load-history)
       (when (and (stringp (car elt))
-		 (string-match "^cl\\>" (car elt)))
+		 (string-match
+		  "^cl\\>" (file-name-nondirectory (car elt))))
 	(setq byte-compile-cl-functions
 	      (append byte-compile-cl-functions
 		      (cdr elt)))))
@@ -3890,7 +3895,8 @@
 ;; Warn about misuses of make-variable-buffer-local.
 (byte-defop-compiler-1 make-variable-buffer-local byte-compile-make-variable-buffer-local)
 (defun byte-compile-make-variable-buffer-local (form)
-  (if (eq (car-safe (car-safe (cdr-safe form))) 'quote)
+  (if (and (eq (car-safe (car-safe (cdr-safe form))) 'quote)
+           (memq 'make-local byte-compile-warnings))
       (byte-compile-warn
        "`make-variable-buffer-local' should be called at toplevel"))
   (byte-compile-normal-call form))
--- a/lisp/emacs-lisp/checkdoc.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/emacs-lisp/checkdoc.el	Mon Jun 11 00:58:11 2007 +0000
@@ -263,7 +263,7 @@
 		 (const t)))
 
 (defvar checkdoc-ispell-lisp-words
-  '("alist" "emacs" "etags" "iff" "keymap" "paren" "regexp" "sexp" "xemacs")
+  '("alist" "emacs" "etags" "keymap" "paren" "regexp" "sexp" "xemacs")
   "List of words that are correct when spell-checking Lisp documentation.")
 
 (defcustom checkdoc-max-keyref-before-warn 10
--- a/lisp/erc/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/erc/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,8 @@
+2007-06-06  Juanma Barranquero  <lekktu@gmail.com>
+
+	* erc.el (erc-show-channel-key-p, erc-startup-file-list):
+	Fix typo in docstring.
+
 2007-04-01  Michael Olson  <mwolson@gnu.org>
 
 	* erc.el (erc-version-string): Release ERC 5.2.
--- a/lisp/erc/erc.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/erc/erc.el	Mon Jun 11 00:58:11 2007 +0000
@@ -842,7 +842,7 @@
 The first existent and readable one will get executed.
 
 If the filename ends with `.el' it is presumed to be an Emacs Lisp
-script and it gets (load)ed.  Otherwise is is treated as a bunch of
+script and it gets (load)ed.  Otherwise it is treated as a bunch of
 regular IRC commands."
   :group 'erc-scripts
   :type '(repeat file))
@@ -5756,7 +5756,7 @@
 		 (function :tag "Call a function")))
 
 (defcustom erc-show-channel-key-p t
-  "Show the the channel key in the header line."
+  "Show the channel key in the header line."
   :group 'erc-paranoia
   :type 'boolean)
 
--- a/lisp/faces.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/faces.el	Mon Jun 11 00:58:11 2007 +0000
@@ -292,11 +292,12 @@
 
 (defun face-id (face &optional frame)
   "Return the internal ID of face with name FACE.
+If FACE is a face-alias, return the ID of the target face.
 The optional argument FRAME is ignored, since the internal face ID
 of a face name is the same for all frames."
   (check-face face)
-  (get face 'face))
-
+  (or (get face 'face)
+      (face-id (get face 'face-alias))))
 
 (defun face-equal (face1 face2 &optional frame)
   "Non-nil if faces FACE1 and FACE2 are equal.
--- a/lisp/files.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/files.el	Mon Jun 11 00:58:11 2007 +0000
@@ -1924,7 +1924,7 @@
      ("\\.[sS]\\'" . asm-mode)
      ("\\.asm\\'" . asm-mode)
      ("[cC]hange\\.?[lL]og?\\'" . change-log-mode)
-     ("[cC]hange[lL]og[-.][-0-9a-z]+\\'" . change-log-mode)
+     ("[cC]hange[lL]og[-.][0-9]+\\'" . change-log-mode)
      ("\\$CHANGE_LOG\\$\\.TXT" . change-log-mode)
      ("\\.scm\\.[0-9]*\\'" . scheme-mode)
      ("\\.[ck]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode)
@@ -2012,6 +2012,9 @@
      ("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-mode)
      ("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\(?:\\.d/.+\\)?\\|protocols\\|rpc\\|services\\)\\'" . conf-space-mode)
      ("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'" . conf-mode)
+     ;; ChangeLog.old etc.  Other change-log-mode entries are above;
+     ;; this has lower priority to avoid matching changelog.sgml etc.
+     ("[cC]hange[lL]og[-.][-0-9a-z]+\\'" . change-log-mode)
      ;; either user's dot-files or under /etc or some such
      ("/\\.?\\(?:gnokiirc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'" . conf-mode)
      ;; alas not all ~/.*rc files are like this
@@ -4389,6 +4392,14 @@
 	    (message "No files can be recovered from this session now")))
       (kill-buffer buffer))))
 
+(defun kill-buffer-ask (buffer)
+  "Kill buffer if confirmed."
+  (when (yes-or-no-p
+         (format "Buffer %s %s.  Kill? " (buffer-name buffer)
+                 (if (buffer-modified-p buffer)
+                     "HAS BEEN EDITED" "is unmodified")))
+    (kill-buffer buffer)))
+
 (defun kill-some-buffers (&optional list)
   "Kill some buffers.  Asks the user whether to kill each one of them.
 Non-interactively, if optional argument LIST is non-nil, it
@@ -4403,13 +4414,20 @@
 					; if we killed the base buffer.
 	   (not (string-equal name ""))
 	   (/= (aref name 0) ?\s)
-	   (yes-or-no-p
-	    (format "Buffer %s %s.  Kill? "
-		    name
-		    (if (buffer-modified-p buffer)
-			"HAS BEEN EDITED" "is unmodified")))
-	   (kill-buffer buffer)))
+	   (kill-buffer-ask buffer)))
     (setq list (cdr list))))
+
+(defun kill-matching-buffers (regexp &optional internal-too)
+  "Kill buffers whose name matches the specified regexp.
+The optional second argument indicates whether to kill internal buffers too."
+  (interactive "sKill buffers matching this regular expression: \nP")
+  (dolist (buffer (buffer-list))
+    (let ((name (buffer-name buffer)))
+      (when (and name (not (string-equal name ""))
+                 (or internal-too (/= (aref name 0) ?\s))
+                 (string-match regexp name))
+        (kill-buffer-ask buffer)))))
+
 
 (defun auto-save-mode (arg)
   "Toggle auto-saving of contents of current buffer.
--- a/lisp/gnus/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/gnus/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,34 @@
+2007-06-08  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-ems.el (gnus-x-splash): Make it work.
+
+	* gnus-start.el (gnus-1): Relax restrictions that prevent gnus-x-splash
+	from being used.
+
+	* gnus-art.el (gnus-article-summary-command-nosave): Correct the order
+	of the arguments passed to pop-to-buffer.
+	(gnus-article-read-summary-keys): Ditto.
+
+2007-06-07  Juanma Barranquero  <lekktu@gmail.com>
+
+	* gnus-art.el (gnus-split-methods): Fix typo in docstring.
+
+2007-06-06  Juanma Barranquero  <lekktu@gmail.com>
+
+	* gnus-diary.el (gnus-diary-time-format, gnus-summary-sort-by-schedule):
+	* gnus-sum.el (gnus-summary-highlight):
+	* mail-source.el (mail-source-delete-old-incoming-confirm):
+	* nndiary.el (nndiary-reminders): Fix typos in docstrings.
+
+2007-06-04  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-art.el (gnus-mime-view-part-externally)
+	(gnus-mime-view-part-internally): Fix predicate function passed to
+	completing-read.
+
+	* mm-decode.el (mm-image-fit-p): Return t if argument is not an image;
+	return t if image size is just the same as window size.
+
 2007-05-28  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* message.el (message-pop-to-buffer): Add switch-function argument.
@@ -355,7 +386,7 @@
 	(message-simplify-subject): New function to remove duplicate code.
 	(message-reply, message-followup): Use it.
 	(message-simplify-subject-functions): New variable.
-	(message-strip-subject-encoded-words): New function
+	(message-strip-subject-encoded-words): New function.
 
 2006-11-08  Wolfgang Jenkner  <wjenkner@inode.at>  (tiny change)
 
@@ -1195,8 +1226,7 @@
 	* mm-view.el (mm-fill-flowed): New variable.
 	(mm-inline-text): Use it.
 
-2006-02-21  Wolfram Fenske  <wolfram.fenske@student.uni-magdeburg.de>
-	(tiny change)
+2006-02-21  Wolfram Fenske  <wolfram.fenske@student.uni-magdeburg.de>  (tiny change)
 
 	* nnimap.el (nnimap-request-move-article): Change folder back to
 	source group before deleting.
@@ -1758,7 +1788,7 @@
 	(pgg-pgp5-sign-region, pgg-pgp5-sign): Add optional 'passphrase'
 	argument to all these routines, so the passphrase can be managed
 	externally and passed in to the system.
-	(pgg-pgp5-sign-region): Use new name of	pgg-add-passphrase-to-cache
+	(pgg-pgp5-sign-region): Use new name of pgg-add-passphrase-to-cache
 	function.
 
 2005-10-29  Ken Manheimer  <ken.manheimer@gmail.com>
@@ -3633,7 +3663,7 @@
 	* nnmail.el (nnmail-split-fancy-with-parent-ignore-groups)
 	(nnmail-cache-ignore-groups, nnmail-spool-hook)
 	(nnmail-split-fancy-match-partial-words)
-	(nnmail-split-lowercase-expanded):
+	(nnmail-split-lowercase-expanded): Add :version.
 
 	* nndiary.el (nndiary): Add :version.
 
@@ -3909,7 +3939,7 @@
 	* gnus-int.el (gnus-request-delete-group):
 	Use gnus-cache-delete-group and gnus-agent-delete-group to keep the
 	local disk in sync with the server.
-	 (gnus-request-rename-group):
+	(gnus-request-rename-group):
 	Use gnus-cache-rename-group and gnus-agent-rename-group to keep the
 	local disk in sync with the server.
 
@@ -4036,7 +4066,7 @@
 
 	* gnus-sum.el (gnus-select-newgroup): Replace inline code with
 	gnus-agent-possibly-alter-active.
-	(gnus-adjust-marked-articles): Faster handling of simple lists
+	(gnus-adjust-marked-articles): Faster handling of simple lists.
 
 2004-10-18  David Edmondson  <dme@dme.org>
 
@@ -4179,7 +4209,7 @@
 
 	* gnus-fun.el: Require gnus-ems and gnus-util.
 
-	* gnus-diary.el (gnus-diary-header-schedule): caddr -> car (cddr
+	* gnus-diary.el (gnus-diary-header-schedule): caddr -> car (cddr).
 
 	* gnus-art.el (gnus-article-edit-mode): Define before first reference.
 
@@ -4262,6 +4292,7 @@
 
 	* nnmail.el (nnmail-fancy-expiry-targets)
 	(nnmail-mail-splitting-charset, nnmail-mail-splitting-decodes):
+	Add :version.
 
 	* nnimap.el (nnimap-split-download-body, nnimap-dont-close)
 	(nnimap-retrieve-groups-asynchronous): Add :version.
@@ -4270,7 +4301,7 @@
 	* mml.el (mml-content-disposition-parameters)
 	(mml-insert-mime-headers-always): Add :version.
 
-	* mm-util.el (mm-coding-system-priorities):
+	* mm-util.el (mm-coding-system-priorities): Add :version.
 
 	* mm-decode.el (mm-inline-text-html-with-images)
 	(mm-keep-viewer-alive-types, mm-external-terminal-program)
@@ -4327,7 +4358,7 @@
 	* gnus-srvr.el (gnus-server-browse-in-group-buffer)
 	(gnus-server-offline-face): Add :version.
 
-	* gnus-score.el (gnus-adaptive-word-length-limit):
+	* gnus-score.el (gnus-adaptive-word-length-limit): Add :version.
 
 	* gnus-msg.el (gnus-gcc-externalize-attachments)
 	(gnus-debug-files, gnus-debug-exclude-variables)
@@ -4349,7 +4380,7 @@
 	* gnus-delay.el (gnus-delay-default-hour): Add :version.
 
 	* gnus-cite.el (gnus-cite-blank-line-after-header)
-	(gnus-article-boring-faces):
+	(gnus-article-boring-faces): Add :version.
 
 	* gnus-art.el (gnus-buttonized-mime-types)
 	(gnus-inhibit-mime-unbuttonizing)
@@ -4413,10 +4444,10 @@
 2004-09-10  Teodor Zlatanov  <tzz@lifelogs.com>
 
 	* nnimap.el (nnimap-open-connection): Allow 'imaps' as a synonym
-	for the 'imap' port in netrc files
+	for the 'imap' port in netrc files.
 
 	* gnus-registry.el (gnus-registry-trim): Watch out for negatives
-	in gnus-registry-trim
+	in gnus-registry-trim.
 
 2004-09-10  Simon Josefsson  <jas@extundo.com>
 
--- a/lisp/gnus/gnus-art.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/gnus/gnus-art.el	Mon Jun 11 00:58:11 2007 +0000
@@ -651,7 +651,7 @@
 If the match is a string, it is used as a regexp match on the
 article.  If the match is a symbol, that symbol will be funcalled
 from the buffer of the article to be saved with the newsgroup as the
-parameter.  If it is a list, it will be evaled in the same buffer.
+parameter.  If it is a list, it will be evalled in the same buffer.
 
 If this form or function returns a string, this string will be used as
 a possible file name; and if it returns a non-nil list, that list will
@@ -4674,7 +4674,7 @@
          (mm-enable-external t))
     (if (not (stringp method))
 	(gnus-mime-view-part-as-type
-	 nil (lambda (type) (stringp (mailcap-mime-info type))))
+	 nil (lambda (types) (stringp (mailcap-mime-info (car types)))))
       (when handle
 	(if (mm-handle-undisplayer handle)
 	    (mm-remove-part handle)
@@ -4695,7 +4695,7 @@
 	 (inhibit-read-only t))
     (if (not (mm-inlinable-p handle))
         (gnus-mime-view-part-as-type
-         nil (lambda (type) (mm-inlinable-p handle type)))
+         nil (lambda (types) (mm-inlinable-p handle (car types))))
       (when handle
 	(if (mm-handle-undisplayer handle)
 	    (mm-remove-part handle)
@@ -5607,7 +5607,7 @@
   "Execute the last keystroke in the summary buffer."
   (interactive)
   (let (func)
-    (pop-to-buffer gnus-article-current-summary 'norecord)
+    (pop-to-buffer gnus-article-current-summary nil 'norecord)
     (setq func (lookup-key (current-local-map) (this-command-keys)))
     (call-interactively func)))
 
@@ -5646,7 +5646,7 @@
 	    (member keys nosave-in-article))
 	(let (func)
 	  (save-window-excursion
-	    (pop-to-buffer gnus-article-current-summary 'norecord)
+	    (pop-to-buffer gnus-article-current-summary nil 'norecord)
 	    ;; We disable the pick minor mode commands.
 	    (let (gnus-pick-mode)
 	      (setq func (lookup-key (current-local-map) keys))))
@@ -5658,14 +5658,14 @@
 	    (call-interactively func)
 	    (setq new-sum-point (point)))
 	  (when (member keys nosave-but-article)
-	    (pop-to-buffer gnus-article-buffer 'norecord)))
+	    (pop-to-buffer gnus-article-buffer nil 'norecord)))
       ;; These commands should restore window configuration.
       (let ((obuf (current-buffer))
 	    (owin (current-window-configuration))
 	    (opoint (point))
 	    win func in-buffer selected new-sum-start new-sum-hscroll)
 	(cond (not-restore-window
-	       (pop-to-buffer gnus-article-current-summary 'norecord))
+	       (pop-to-buffer gnus-article-current-summary nil 'norecord))
 	      ((setq win (get-buffer-window gnus-article-current-summary))
 	       (select-window win))
 	      (t
--- a/lisp/gnus/gnus-diary.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/gnus/gnus-diary.el	Mon Jun 11 00:58:11 2007 +0000
@@ -59,7 +59,7 @@
   :group 'gnus-summary-format)
 
 (defcustom gnus-diary-time-format "%a, %b %e %y, %H:%M"
-  "*Time format to display appointements in nndiary summary buffers.
+  "*Time format to display appointments in nndiary summary buffers.
 Please refer to `format-time-string' for information on possible values."
   :type 'string
   :group 'gnus-diary)
@@ -224,7 +224,7 @@
 				 (gnus-thread-header h2)))
 
 (defun gnus-summary-sort-by-schedule (&optional reverse)
-  "Sort nndiary summary buffers by schedule of appointements.
+  "Sort nndiary summary buffers by schedule of appointments.
 Optional prefix (or REVERSE argument) means sort in reverse order."
   (interactive "P")
   (gnus-summary-sort 'schedule reverse))
--- a/lisp/gnus/gnus-ems.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/gnus/gnus-ems.el	Mon Jun 11 00:58:11 2007 +0000
@@ -172,40 +172,95 @@
 
 (defun gnus-x-splash ()
   "Show a splash screen using a pixmap in the current buffer."
-  (let ((dir (nnheader-find-etc-directory "gnus"))
-	pixmap file height beg i)
-    (save-excursion
-      (switch-to-buffer (gnus-get-buffer-create gnus-group-buffer))
-      (let ((buffer-read-only nil)
-	    width height)
-	(erase-buffer)
-	(when (and dir
-		   (file-exists-p (setq file
-					(expand-file-name "x-splash" dir))))
-	  (let ((coding-system-for-read 'raw-text)
-		default-enable-multibyte-characters)
-	    (with-temp-buffer
-	      (insert-file-contents file)
-	      (goto-char (point-min))
-	      (ignore-errors
-		(setq pixmap (read (current-buffer)))))))
-	(when pixmap
-	  (make-face 'gnus-splash)
-	  (setq height (/ (car pixmap) (frame-char-height))
-		width (/ (cadr pixmap) (frame-char-width)))
-	  (set-face-foreground 'gnus-splash "Brown")
-	  (set-face-stipple 'gnus-splash pixmap)
-	  (insert-char ?\n (* (/ (window-height) 2 height) height))
-	  (setq i height)
-	  (while (> i 0)
-	    (insert-char ?\  (* (/ (window-width) 2 width) width))
-	    (setq beg (point))
-	    (insert-char ?\  width)
-	    (set-text-properties beg (point) '(face gnus-splash))
-	    (insert ?\n)
-	    (decf i))
-	  (goto-char (point-min))
-	  (sit-for 0))))))
+  (interactive)
+  (unless window-system
+    (error "`gnus-x-splash' requires running on the window system"))
+  (switch-to-buffer (gnus-get-buffer-create (if (or (gnus-alive-p)
+						    (interactive-p))
+						"*gnus-x-splash*"
+					      gnus-group-buffer)))
+  (let ((inhibit-read-only nil)
+	(file (nnheader-find-etc-directory "images/gnus/x-splash" t))
+	pixmap fcw fch width height fringes sbars left yoffset top ls)
+    (erase-buffer)
+    (when (and file
+	       (ignore-errors
+		(let ((coding-system-for-read 'raw-text)
+		      default-enable-multibyte-characters)
+		  (with-temp-buffer
+		    (insert-file-contents file)
+		    (goto-char (point-min))
+		    (setq pixmap (read (current-buffer)))))))
+      (setq fcw (float (frame-char-width))
+	    fch (float (frame-char-height))
+	    width (/ (car pixmap) fcw)
+	    height (/ (cadr pixmap) fch)
+	    fringes (if (fboundp 'window-fringes)
+			(eval '(window-fringes))
+		      '(10 11 nil))
+	    sbars (frame-parameter nil 'vertical-scroll-bars))
+      (cond ((eq sbars 'right)
+	     (setq sbars
+		   (cons 0 (/ (or (frame-parameter nil 'scroll-bar-width) 14)
+			      fcw))))
+	    (sbars
+	     (setq sbars
+		   (cons (/ (or (frame-parameter nil 'scroll-bar-width) 14)
+			    fcw)
+			 0))))
+      (setq left (- (* (round (/ (1- (/ (+ (window-width)
+					   (car sbars) (cdr sbars)
+					   (/ (+ (or (car fringes) 0)
+						 (or (cadr fringes) 0))
+					      fcw))
+					width))
+				 2))
+		       width)
+		    (car sbars)
+		    (/ (or (car fringes) 0) fcw))
+	    yoffset (cadr (window-edges))
+	    top (max 0 (- (* (max (if (and tool-bar-mode
+					   (not (featurep 'gtk))
+					   (eq (frame-first-window)
+					       (selected-window)))
+				      1 0)
+				  (round (/ (1- (/ (+ (1- (window-height))
+						      (* 2 yoffset))
+						   height))
+					    2)))
+			     height)
+			  yoffset))
+	    ls (/ (or line-spacing 0) fch)
+	    height (max 0 (- height ls)))
+      (cond ((>= (- top ls) 1)
+	     (insert
+	      (propertize
+	       " "
+	       'display `(space :width 0 :ascent 100))
+	      "\n"
+	      (propertize
+	       " "
+	       'display `(space :width 0 :height ,(- top ls 1) :ascent 100))
+	      "\n"))
+	    ((> (- top ls) 0)
+	     (insert
+	      (propertize
+	       " "
+	       'display `(space :width 0 :height ,(- top ls) :ascent 100))
+	      "\n")))
+      (if (and (> width 0) (> left 0))
+	  (insert (propertize
+		   " "
+		   'display `(space :width ,left :height ,height :ascent 0)))
+	(setq width (+ width left)))
+      (when (> width 0)
+	(insert (propertize
+		 " "
+		 'display `(space :width ,width :height ,height :ascent 0)
+		 'face `(gnus-splash :stipple ,pixmap))))
+      (goto-char (if (<= (- top ls) 0) (1- (point)) (point-min)))
+      (redraw-frame (selected-frame))
+      (sit-for 0))))
 
 ;;; Image functions.
 
--- a/lisp/gnus/gnus-start.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/gnus/gnus-start.el	Mon Jun 11 00:58:11 2007 +0000
@@ -760,8 +760,7 @@
       (cond
        ((featurep 'xemacs)
 	(gnus-xmas-splash))
-       ((and window-system
-	     (= (frame-height) (1+ (window-height))))
+       (window-system
 	(gnus-x-splash))))
 
     (let ((level (and (numberp arg) (> arg 0) arg))
--- a/lisp/gnus/gnus-sum.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/gnus/gnus-sum.el	Mon Jun 11 00:58:11 2007 +0000
@@ -973,14 +973,14 @@
      . gnus-summary-normal-read))
   "*Controls the highlighting of summary buffer lines.
 
-A list of (FORM . FACE) pairs.  When deciding how a a particular
+A list of (FORM . FACE) pairs.  When deciding how a particular
 summary line should be displayed, each form is evaluated.  The content
 of the face field after the first true form is used.  You can change
 how those summary lines are displayed, by editing the face field.
 
 You can use the following variables in the FORM field.
 
-score:        The article's score
+score:        The article's score.
 default:      The default article score.
 default-high: The default score for high scored articles.
 default-low:  The default score for low scored articles.
--- a/lisp/gnus/mail-source.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/gnus/mail-source.el	Mon Jun 11 00:58:11 2007 +0000
@@ -284,7 +284,7 @@
 		 (integer :tag "days")))
 
 (defcustom mail-source-delete-old-incoming-confirm t
-  "*If non-nil, ask for for confirmation before deleting old incoming files.
+  "*If non-nil, ask for confirmation before deleting old incoming files.
 This variable only applies when `mail-source-delete-incoming' is a positive
 number."
   :version "22.1"
--- a/lisp/gnus/mm-decode.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/gnus/mm-decode.el	Mon Jun 11 00:58:11 2007 +0000
@@ -1371,18 +1371,19 @@
 (defun mm-image-fit-p (handle)
   "Say whether the image in HANDLE will fit the current window."
   (let ((image (mm-get-image handle)))
-    (if (fboundp 'glyph-width)
-	;; XEmacs' glyphs can actually tell us about their width, so
-	;; lets be nice and smart about them.
-	(or mm-inline-large-images
-	    (and (< (glyph-width image) (window-pixel-width))
-		 (< (glyph-height image) (window-pixel-height))))
-      (let* ((size (image-size image))
-	     (w (car size))
-	     (h (cdr size)))
-	(or mm-inline-large-images
-	    (and (< h (1- (window-height))) ; Don't include mode line.
-		 (< w (window-width))))))))
+    (or (not image)
+	(if (fboundp 'glyph-width)
+	    ;; XEmacs' glyphs can actually tell us about their width, so
+	    ;; lets be nice and smart about them.
+	    (or mm-inline-large-images
+		(and (<= (glyph-width image) (window-pixel-width))
+		     (<= (glyph-height image) (window-pixel-height))))
+	  (let* ((size (image-size image))
+		 (w (car size))
+		 (h (cdr size)))
+	    (or mm-inline-large-images
+		(and (<= h (1- (window-height))) ; Don't include mode line.
+		     (<= w (window-width)))))))))
 
 (defun mm-valid-image-format-p (format)
   "Say whether FORMAT can be displayed natively by Emacs."
--- a/lisp/gnus/nndiary.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/gnus/nndiary.el	Mon Jun 11 00:58:11 2007 +0000
@@ -131,7 +131,7 @@
 
 
 (defcustom nndiary-reminders '((0 . day))
-  "*Different times when you want to be reminded of your appointements.
+  "*Different times when you want to be reminded of your appointments.
 Diary articles will appear again, as if they'd been just received.
 
 Entries look like (3 . day) which means something like \"Please
@@ -145,7 +145,7 @@
 NOTE: the units of measure actually express dates, not durations: if you
 use 'week, messages will pop up on Sundays at 00:00 (or Mondays if
 `nndiary-week-starts-on-monday' is non-nil) and *not* 7 days before the
-appointement, if you use 'month, messages will pop up on the first day of
+appointment, if you use 'month, messages will pop up on the first day of
 each months, at 00:00 and so on.
 
 If you really want to specify a duration (like 24 hours exactly), you can
@@ -155,15 +155,15 @@
 In order to make this clear, here are some examples:
 
 - '(0 . day): this is the default value of `nndiary-reminders'.  It means
-  pop up the appointements of the day each morning at 00:00.
+  pop up the appointments of the day each morning at 00:00.
 
-- '(1 . day): this means pop up the appointements the day before, at 00:00.
+- '(1 . day): this means pop up the appointments the day before, at 00:00.
 
-- '(6 . hour): for an appointement at 18:30, this would pop up the
-  appointement message at 12:00.
+- '(6 . hour): for an appointment at 18:30, this would pop up the
+  appointment message at 12:00.
 
-- '(360 . minute): for an appointement at 18:30 and 15 seconds, this would
-  pop up the appointement message at 12:30."
+- '(360 . minute): for an appointment at 18:30 and 15 seconds, this would
+  pop up the appointment message at 12:30."
   :group 'nndiary
   :type '(repeat (cons :format "%v\n"
 		       (integer :format "%v")
--- a/lisp/help-mode.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/help-mode.el	Mon Jun 11 00:58:11 2007 +0000
@@ -40,6 +40,7 @@
 
 (define-key help-mode-map [mouse-2] 'help-follow-mouse)
 (define-key help-mode-map "\C-c\C-b" 'help-go-back)
+(define-key help-mode-map "\C-c\C-f" 'help-go-forward)
 (define-key help-mode-map "\C-c\C-c" 'help-follow-symbol)
 ;; Documentation only, since we use minor-mode-overriding-map-alist.
 (define-key help-mode-map "\r" 'help-follow)
@@ -52,13 +53,28 @@
 (put 'help-xref-stack 'permanent-local t)
 (make-variable-buffer-local 'help-xref-stack)
 
+(defvar help-xref-forward-stack nil
+  "The stack of used to navigate help forwards  after using the back button.
+Used by `help-follow' and `help-xref-go-forward'.
+An element looks like (POSITION FUNCTION ARGS...).
+To use the element, do (apply FUNCTION ARGS) then goto the point.")
+(put 'help-xref-forward-stack 'permanent-local t)
+(make-variable-buffer-local 'help-xref-forward-stack)
+
 (defvar help-xref-stack-item nil
   "An item for `help-follow' in this buffer to push onto `help-xref-stack'.
 The format is (FUNCTION ARGS...).")
 (put 'help-xref-stack-item 'permanent-local t)
 (make-variable-buffer-local 'help-xref-stack-item)
 
+(defvar help-xref-stack-forward-item nil
+  "An item for `help-go-back' to push onto `help-xref-forward-stack'.
+The format is (FUNCTION ARGS...).")
+(put 'help-xref-stack-forward-item 'permanent-local t)
+(make-variable-buffer-local 'help-xref-stack-forward-item)
+
 (setq-default help-xref-stack nil help-xref-stack-item nil)
+(setq-default help-xref-forward-stack nil help-xref-forward-stack-item nil)
 
 (defcustom help-mode-hook nil
   "Hook run by `help-mode'."
@@ -123,6 +139,11 @@
   'help-function #'help-xref-go-back
   'help-echo (purecopy "mouse-2, RET: go back to previous help buffer"))
 
+(define-button-type 'help-forward
+  :supertype 'help-xref
+  'help-function #'help-xref-go-forward
+  'help-echo (purecopy "mouse-2, RET: move forward to next help buffer"))
+
 (define-button-type 'help-info
   :supertype 'help-xref
   'help-function #'info
@@ -242,6 +263,9 @@
 (defvar help-back-label (purecopy "[back]")
   "Label to use by `help-make-xrefs' for the go-back reference.")
 
+(defvar help-forward-label (purecopy "[forward]")
+  "Label to use by `help-make-xrefs' for the go-forward reference.")
+
 (defconst help-xref-symbol-regexp
   (purecopy (concat "\\(\\<\\(\\(variable\\|option\\)\\|"  ; Link to var
  		    "\\(function\\|command\\)\\|"          ; Link to function
@@ -286,7 +310,8 @@
 restore it properly when going back."
   (with-current-buffer (help-buffer)
     (when help-xref-stack-item
-      (push (cons (point) help-xref-stack-item) help-xref-stack))
+      (push (cons (point) help-xref-stack-item) help-xref-stack)
+      (setq help-xref-forward-stack nil))
     (when interactive-p
       (let ((tail (nthcdr 10 help-xref-stack)))
 	;; Truncate the stack.
@@ -480,6 +505,11 @@
 	  (insert "\n")
 	  (help-insert-xref-button help-back-label 'help-back
 				   (current-buffer))
+          (insert "\t"))
+        ;; Make a forward-reference in this buffer if appropriate.
+        (when help-xref-forward-stack
+	  (help-insert-xref-button help-forward-label 'help-forward
+				   (current-buffer))
           (insert "\n")))
       ;; View mode steals RET from us.
       (set (make-local-variable 'minor-mode-overriding-map-alist)
@@ -598,6 +628,7 @@
   "From BUFFER, go back to previous help buffer text using `help-xref-stack'."
   (let (item position method args)
     (with-current-buffer buffer
+      (push (cons (point) help-xref-stack-item) help-xref-forward-stack)
       (when help-xref-stack
 	(setq item (pop help-xref-stack)
 	      ;; Clear the current item so that it won't get pushed
@@ -613,12 +644,39 @@
 	  (set-window-point (get-buffer-window buffer) position)
 	(goto-char position)))))
 
+(defun help-xref-go-forward (buffer)
+  "From BUFFER, go forward to next help buffer."
+  (let (item position method args)
+    (with-current-buffer buffer
+      (push (cons (point) help-xref-stack-item) help-xref-stack)
+      (when help-xref-forward-stack
+	(setq item (pop help-xref-forward-stack)
+	      ;; Clear the current item so that it won't get pushed
+	      ;; by the function we're about to call.  TODO: We could also
+	      ;; push it onto a "forward" stack and add a `forw' button.
+	      help-xref-stack-item nil
+	      position (car item)
+	      method (cadr item)
+	      args (cddr item))))
+    (apply method args)
+    (with-current-buffer buffer
+      (if (get-buffer-window buffer)
+	  (set-window-point (get-buffer-window buffer) position)
+	(goto-char position)))))
+ 
 (defun help-go-back ()
   "Go back to previous topic in this help buffer."
   (interactive)
   (if help-xref-stack
       (help-xref-go-back (current-buffer))
     (error "No previous help buffer")))
+ 
+(defun help-go-forward ()
+  "Go back to next topic in this help buffer."
+  (interactive)
+  (if help-xref-forward-stack
+      (help-xref-go-forward (current-buffer))
+    (error "No next help buffer")))
 
 (defun help-do-xref (pos function args)
   "Call the help cross-reference function FUNCTION with args ARGS.
--- a/lisp/ldefs-boot.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/ldefs-boot.el	Mon Jun 11 00:58:11 2007 +0000
@@ -4,7 +4,7 @@
 
 ;;;### (autoloads (5x5-crack 5x5-crack-xor-mutate 5x5-crack-mutating-best
 ;;;;;;  5x5-crack-mutating-current 5x5-crack-randomly 5x5) "5x5"
-;;;;;;  "play/5x5.el" (17941 5494))
+;;;;;;  "play/5x5.el" (17941 38806))
 ;;; Generated autoloads from play/5x5.el
 
 (autoload (quote 5x5) "5x5" "\
@@ -63,14 +63,14 @@
 
 ;;;***
 
-;;;### (autoloads nil "abbrev" "abbrev.el" (17939 56016))
+;;;### (autoloads nil "abbrev" "abbrev.el" (17905 55681))
 ;;; Generated autoloads from abbrev.el
 (put 'abbrev-mode 'safe-local-variable 'booleanp)
 
 ;;;***
 
 ;;;### (autoloads (list-one-abbrev-table) "abbrevlist" "abbrevlist.el"
-;;;;;;  (17843 45609))
+;;;;;;  (17842 58280))
 ;;; Generated autoloads from abbrevlist.el
 
 (autoload (quote list-one-abbrev-table) "abbrevlist" "\
@@ -81,7 +81,7 @@
 ;;;***
 
 ;;;### (autoloads (ada-mode ada-add-extensions) "ada-mode" "progmodes/ada-mode.el"
-;;;;;;  (17843 45626))
+;;;;;;  (17842 56333))
 ;;; Generated autoloads from progmodes/ada-mode.el
 
 (autoload (quote ada-add-extensions) "ada-mode" "\
@@ -142,7 +142,7 @@
 ;;;***
 
 ;;;### (autoloads (ada-header) "ada-stmt" "progmodes/ada-stmt.el"
-;;;;;;  (17843 45626))
+;;;;;;  (17842 56333))
 ;;; Generated autoloads from progmodes/ada-stmt.el
 
 (autoload (quote ada-header) "ada-stmt" "\
@@ -153,7 +153,7 @@
 ;;;***
 
 ;;;### (autoloads (ada-find-file) "ada-xref" "progmodes/ada-xref.el"
-;;;;;;  (17843 45626))
+;;;;;;  (17842 56333))
 ;;; Generated autoloads from progmodes/ada-xref.el
 
 (autoload (quote ada-find-file) "ada-xref" "\
@@ -168,7 +168,7 @@
 ;;;;;;  change-log-mode add-change-log-entry-other-window add-change-log-entry
 ;;;;;;  find-change-log prompt-for-change-log-name add-log-mailing-address
 ;;;;;;  add-log-full-name add-log-current-defun-function) "add-log"
-;;;;;;  "add-log.el" (17939 56016))
+;;;;;;  "add-log.el" (17851 44469))
 ;;; Generated autoloads from add-log.el
 
 (defvar add-log-current-defun-function nil "\
@@ -306,7 +306,7 @@
 
 ;;;### (autoloads (defadvice ad-activate ad-add-advice ad-disable-advice
 ;;;;;;  ad-enable-advice ad-default-compilation-action ad-redefinition-action)
-;;;;;;  "advice" "emacs-lisp/advice.el" (17843 45615))
+;;;;;;  "advice" "emacs-lisp/advice.el" (17992 30878))
 ;;; Generated autoloads from emacs-lisp/advice.el
 
 (defvar ad-redefinition-action (quote warn) "\
@@ -434,7 +434,7 @@
 
 ;;;### (autoloads (align-newline-and-indent align-unhighlight-rule
 ;;;;;;  align-highlight-rule align-current align-entire align-regexp
-;;;;;;  align) "align" "align.el" (17843 45609))
+;;;;;;  align) "align" "align.el" (17842 58280))
 ;;; Generated autoloads from align.el
 
 (autoload (quote align) "align" "\
@@ -524,7 +524,7 @@
 ;;;***
 
 ;;;### (autoloads (outlineify-sticky allout-mode) "allout" "allout.el"
-;;;;;;  (17939 56016))
+;;;;;;  (17892 52945))
 ;;; Generated autoloads from allout.el
 
 (put (quote allout-show-bodies) (quote safe-local-variable) (if (fboundp (quote booleanp)) (quote booleanp) (quote (lambda (x) (member x (quote (t nil)))))))
@@ -830,7 +830,7 @@
 ;;;***
 
 ;;;### (autoloads (ange-ftp-hook-function ange-ftp-reread-dir) "ange-ftp"
-;;;;;;  "net/ange-ftp.el" (17939 56022))
+;;;;;;  "net/ange-ftp.el" (17905 9579))
 ;;; Generated autoloads from net/ange-ftp.el
 
 (defalias (quote ange-ftp-re-read-dir) (quote ange-ftp-reread-dir))
@@ -852,7 +852,7 @@
 ;;;***
 
 ;;;### (autoloads (animate-birthday-present animate-sequence animate-string)
-;;;;;;  "animate" "play/animate.el" (17941 5494))
+;;;;;;  "animate" "play/animate.el" (17941 38806))
 ;;; Generated autoloads from play/animate.el
 
 (autoload (quote animate-string) "animate" "\
@@ -880,7 +880,7 @@
 ;;;***
 
 ;;;### (autoloads (ansi-color-process-output ansi-color-for-comint-mode-on)
-;;;;;;  "ansi-color" "ansi-color.el" (17843 45609))
+;;;;;;  "ansi-color" "ansi-color.el" (17842 58280))
 ;;; Generated autoloads from ansi-color.el
 
 (autoload (quote ansi-color-for-comint-mode-on) "ansi-color" "\
@@ -906,7 +906,7 @@
 ;;;***
 
 ;;;### (autoloads (antlr-set-tabs antlr-mode antlr-show-makefile-rules)
-;;;;;;  "antlr-mode" "progmodes/antlr-mode.el" (17838 18033))
+;;;;;;  "antlr-mode" "progmodes/antlr-mode.el" (17833 42928))
 ;;; Generated autoloads from progmodes/antlr-mode.el
 
 (autoload (quote antlr-show-makefile-rules) "antlr-mode" "\
@@ -945,7 +945,7 @@
 ;;;### (autoloads (appt-activate appt-make-list appt-delete appt-add
 ;;;;;;  appt-display-diary appt-display-duration appt-display-mode-line
 ;;;;;;  appt-msg-window appt-visible appt-audible appt-message-warning-time
-;;;;;;  appt-issue-message) "appt" "calendar/appt.el" (17953 11485))
+;;;;;;  appt-issue-message) "appt" "calendar/appt.el" (17952 17513))
 ;;; Generated autoloads from calendar/appt.el
 
 (defvar appt-issue-message t "\
@@ -1033,7 +1033,7 @@
 
 ;;;### (autoloads (apropos-documentation apropos-value apropos apropos-documentation-property
 ;;;;;;  apropos-command apropos-variable apropos-read-pattern) "apropos"
-;;;;;;  "apropos.el" (17843 45609))
+;;;;;;  "apropos.el" (17842 58280))
 ;;; Generated autoloads from apropos.el
 
 (autoload (quote apropos-read-pattern) "apropos" "\
@@ -1130,7 +1130,7 @@
 ;;;***
 
 ;;;### (autoloads (archive-mode) "arc-mode" "arc-mode.el" (17960
-;;;;;;  114))
+;;;;;;  49045))
 ;;; Generated autoloads from arc-mode.el
 
 (autoload (quote archive-mode) "arc-mode" "\
@@ -1150,7 +1150,7 @@
 
 ;;;***
 
-;;;### (autoloads (array-mode) "array" "array.el" (17843 45609))
+;;;### (autoloads (array-mode) "array" "array.el" (17842 58280))
 ;;; Generated autoloads from array.el
 
 (autoload (quote array-mode) "array" "\
@@ -1221,8 +1221,8 @@
 
 ;;;***
 
-;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (17843
-;;;;;;  45629))
+;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (17842
+;;;;;;  58277))
 ;;; Generated autoloads from textmodes/artist.el
 
 (autoload (quote artist-mode) "artist" "\
@@ -1427,8 +1427,8 @@
 
 ;;;***
 
-;;;### (autoloads (asm-mode) "asm-mode" "progmodes/asm-mode.el" (17843
-;;;;;;  45626))
+;;;### (autoloads (asm-mode) "asm-mode" "progmodes/asm-mode.el" (17842
+;;;;;;  56333))
 ;;; Generated autoloads from progmodes/asm-mode.el
 
 (autoload (quote asm-mode) "asm-mode" "\
@@ -1456,12 +1456,12 @@
 ;;;***
 
 ;;;### (autoloads (autoarg-kp-mode autoarg-mode) "autoarg" "autoarg.el"
-;;;;;;  (17843 45609))
+;;;;;;  (17842 58280))
 ;;; Generated autoloads from autoarg.el
 
 (defvar autoarg-mode nil "\
 Non-nil if Autoarg mode is enabled.
-See the command `autoarg-mode' for a description of this minor-mode.")
+See the command `autoarg-mode' for a description of this minor mode.")
 
 (custom-autoload (quote autoarg-mode) "autoarg" nil)
 
@@ -1489,7 +1489,7 @@
 
 (defvar autoarg-kp-mode nil "\
 Non-nil if Autoarg-Kp mode is enabled.
-See the command `autoarg-kp-mode' for a description of this minor-mode.
+See the command `autoarg-kp-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `autoarg-kp-mode'.")
@@ -1510,7 +1510,7 @@
 ;;;***
 
 ;;;### (autoloads (autoconf-mode) "autoconf" "progmodes/autoconf.el"
-;;;;;;  (17843 45626))
+;;;;;;  (17842 56333))
 ;;; Generated autoloads from progmodes/autoconf.el
 
 (autoload (quote autoconf-mode) "autoconf" "\
@@ -1521,7 +1521,7 @@
 ;;;***
 
 ;;;### (autoloads (auto-insert-mode define-auto-insert auto-insert)
-;;;;;;  "autoinsert" "autoinsert.el" (17843 45609))
+;;;;;;  "autoinsert" "autoinsert.el" (17842 58280))
 ;;; Generated autoloads from autoinsert.el
 
 (autoload (quote auto-insert) "autoinsert" "\
@@ -1539,7 +1539,7 @@
 
 (defvar auto-insert-mode nil "\
 Non-nil if Auto-Insert mode is enabled.
-See the command `auto-insert-mode' for a description of this minor-mode.
+See the command `auto-insert-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `auto-insert-mode'.")
@@ -1560,7 +1560,7 @@
 
 ;;;### (autoloads (batch-update-autoloads update-directory-autoloads
 ;;;;;;  update-file-autoloads) "autoload" "emacs-lisp/autoload.el"
-;;;;;;  (17939 56021))
+;;;;;;  (17860 50557))
 ;;; Generated autoloads from emacs-lisp/autoload.el
 
 (autoload (quote update-file-autoloads) "autoload" "\
@@ -1595,7 +1595,7 @@
 
 ;;;### (autoloads (global-auto-revert-mode turn-on-auto-revert-tail-mode
 ;;;;;;  auto-revert-tail-mode turn-on-auto-revert-mode auto-revert-mode)
-;;;;;;  "autorevert" "autorevert.el" (17939 56016))
+;;;;;;  "autorevert" "autorevert.el" (17925 15265))
 ;;; Generated autoloads from autorevert.el
 
 (autoload (quote auto-revert-mode) "autorevert" "\
@@ -1645,7 +1645,7 @@
 
 (defvar global-auto-revert-mode nil "\
 Non-nil if Global-Auto-Revert mode is enabled.
-See the command `global-auto-revert-mode' for a description of this minor-mode.
+See the command `global-auto-revert-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `global-auto-revert-mode'.")
@@ -1664,7 +1664,7 @@
 ;;;***
 
 ;;;### (autoloads (mouse-avoidance-mode mouse-avoidance-mode) "avoid"
-;;;;;;  "avoid.el" (17843 45609))
+;;;;;;  "avoid.el" (17842 58280))
 ;;; Generated autoloads from avoid.el
 
 (defvar mouse-avoidance-mode nil "\
@@ -1705,7 +1705,7 @@
 ;;;***
 
 ;;;### (autoloads (backquote) "backquote" "emacs-lisp/backquote.el"
-;;;;;;  (17843 45615))
+;;;;;;  (17842 54152))
 ;;; Generated autoloads from emacs-lisp/backquote.el
 
 (autoload (quote backquote) "backquote" "\
@@ -1730,7 +1730,7 @@
 ;;;***
 
 ;;;### (autoloads (display-battery-mode battery) "battery" "battery.el"
-;;;;;;  (17843 45609))
+;;;;;;  (17842 58280))
 ;;; Generated autoloads from battery.el
  (put 'battery-mode-line-string 'risky-local-variable t)
 
@@ -1743,7 +1743,7 @@
 
 (defvar display-battery-mode nil "\
 Non-nil if Display-Battery mode is enabled.
-See the command `display-battery-mode' for a description of this minor-mode.
+See the command `display-battery-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `display-battery-mode'.")
@@ -1762,7 +1762,7 @@
 ;;;***
 
 ;;;### (autoloads (benchmark benchmark-run-compiled benchmark-run)
-;;;;;;  "benchmark" "emacs-lisp/benchmark.el" (17843 45615))
+;;;;;;  "benchmark" "emacs-lisp/benchmark.el" (17842 54152))
 ;;; Generated autoloads from emacs-lisp/benchmark.el
 
 (autoload (quote benchmark-run) "benchmark" "\
@@ -1795,7 +1795,7 @@
 ;;;***
 
 ;;;### (autoloads (bibtex-mode) "bibtex" "textmodes/bibtex.el" (17956
-;;;;;;  60684))
+;;;;;;  21270))
 ;;; Generated autoloads from textmodes/bibtex.el
 
 (autoload (quote bibtex-mode) "bibtex" "\
@@ -1857,7 +1857,7 @@
 
 ;;;### (autoloads (binhex-decode-region binhex-decode-region-external
 ;;;;;;  binhex-decode-region-internal) "binhex" "gnus/binhex.el"
-;;;;;;  (17843 45616))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/binhex.el
 
 (defconst binhex-begin-line "^:...............................................................$")
@@ -1880,8 +1880,8 @@
 
 ;;;***
 
-;;;### (autoloads (blackbox) "blackbox" "play/blackbox.el" (17843
-;;;;;;  45625))
+;;;### (autoloads (blackbox) "blackbox" "play/blackbox.el" (17842
+;;;;;;  55395))
 ;;; Generated autoloads from play/blackbox.el
 
 (autoload (quote blackbox) "blackbox" "\
@@ -2003,7 +2003,7 @@
 ;;;### (autoloads (bookmark-bmenu-list bookmark-load bookmark-save
 ;;;;;;  bookmark-write bookmark-delete bookmark-insert bookmark-rename
 ;;;;;;  bookmark-insert-location bookmark-relocate bookmark-jump
-;;;;;;  bookmark-set) "bookmark" "bookmark.el" (17843 45609))
+;;;;;;  bookmark-set) "bookmark" "bookmark.el" (17842 58280))
 ;;; Generated autoloads from bookmark.el
  (define-key ctl-x-map "rb" 'bookmark-jump)
  (define-key ctl-x-map "rm" 'bookmark-set)
@@ -2193,7 +2193,7 @@
 ;;;;;;  browse-url browse-url-of-region browse-url-of-dired-file
 ;;;;;;  browse-url-of-buffer browse-url-of-file browse-url-url-at-point
 ;;;;;;  browse-url-galeon-program browse-url-firefox-program browse-url-browser-function)
-;;;;;;  "browse-url" "net/browse-url.el" (17843 45624))
+;;;;;;  "browse-url" "net/browse-url.el" (17842 55218))
 ;;; Generated autoloads from net/browse-url.el
 
 (defvar browse-url-browser-function (cond ((memq system-type (quote (windows-nt ms-dos cygwin))) (quote browse-url-default-windows-browser)) ((memq system-type (quote (darwin))) (quote browse-url-default-macosx-browser)) (t (quote browse-url-default-browser))) "\
@@ -2524,8 +2524,8 @@
 
 ;;;***
 
-;;;### (autoloads (snarf-bruces bruce) "bruce" "play/bruce.el" (17843
-;;;;;;  45625))
+;;;### (autoloads (snarf-bruces bruce) "bruce" "play/bruce.el" (17842
+;;;;;;  55395))
 ;;; Generated autoloads from play/bruce.el
 
 (autoload (quote bruce) "bruce" "\
@@ -2541,7 +2541,7 @@
 ;;;***
 
 ;;;### (autoloads (bs-show bs-customize bs-cycle-previous bs-cycle-next)
-;;;;;;  "bs" "bs.el" (17843 45609))
+;;;;;;  "bs" "bs.el" (17842 58280))
 ;;; Generated autoloads from bs.el
 
 (autoload (quote bs-cycle-next) "bs" "\
@@ -2582,8 +2582,8 @@
 ;;;***
 
 ;;;### (autoloads (insert-text-button make-text-button insert-button
-;;;;;;  make-button define-button-type) "button" "button.el" (17970
-;;;;;;  17147))
+;;;;;;  make-button define-button-type) "button" "button.el" (17992
+;;;;;;  30877))
 ;;; Generated autoloads from button.el
 
 (defvar button-map (let ((map (make-sparse-keymap))) (define-key map "
" (quote push-button)) (define-key map [mouse-2] (quote push-button)) map) "\
@@ -2671,7 +2671,7 @@
 ;;;;;;  batch-byte-compile-if-not-done display-call-tree byte-compile
 ;;;;;;  compile-defun byte-compile-file byte-recompile-directory
 ;;;;;;  byte-force-recompile byte-compile-warnings-safe-p) "bytecomp"
-;;;;;;  "emacs-lisp/bytecomp.el" (17949 5807))
+;;;;;;  "emacs-lisp/bytecomp.el" (17949 41467))
 ;;; Generated autoloads from emacs-lisp/bytecomp.el
 (put 'byte-compile-dynamic 'safe-local-variable 'booleanp)
 (put 'byte-compile-disable-print-circle 'safe-local-variable 'booleanp)
@@ -2777,7 +2777,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "cal-dst" "calendar/cal-dst.el" (17956 60684))
+;;;### (autoloads nil "cal-dst" "calendar/cal-dst.el" (17956 13479))
 ;;; Generated autoloads from calendar/cal-dst.el
 
 (put (quote calendar-daylight-savings-starts) (quote risky-local-variable) t)
@@ -2787,7 +2787,7 @@
 ;;;***
 
 ;;;### (autoloads (list-yahrzeit-dates) "cal-hebrew" "calendar/cal-hebrew.el"
-;;;;;;  (17956 60684))
+;;;;;;  (17956 13479))
 ;;; Generated autoloads from calendar/cal-hebrew.el
 
 (autoload (quote list-yahrzeit-dates) "cal-hebrew" "\
@@ -2802,7 +2802,7 @@
 ;;;### (autoloads (defmath calc-embedded-activate calc-embedded calc-grab-rectangle
 ;;;;;;  calc-grab-region full-calc-keypad calc-keypad calc-eval quick-calc
 ;;;;;;  full-calc calc calc-dispatch calc-settings-file) "calc" "calc/calc.el"
-;;;;;;  (17966 9916))
+;;;;;;  (17965 11665))
 ;;; Generated autoloads from calc/calc.el
 
 (defvar calc-settings-file (convert-standard-filename "~/.calc.el") "\
@@ -2880,8 +2880,8 @@
 
 ;;;***
 
-;;;### (autoloads (calculator) "calculator" "calculator.el" (17939
-;;;;;;  56016))
+;;;### (autoloads (calculator) "calculator" "calculator.el" (17870
+;;;;;;  28179))
 ;;; Generated autoloads from calculator.el
 
 (autoload (quote calculator) "calculator" "\
@@ -2909,7 +2909,7 @@
 ;;;;;;  mark-holidays-in-calendar view-calendar-holidays-initially
 ;;;;;;  calendar-remove-frame-by-deleting mark-diary-entries-in-calendar
 ;;;;;;  view-diary-entries-initially calendar-offset) "calendar"
-;;;;;;  "calendar/calendar.el" (17956 60684))
+;;;;;;  "calendar/calendar.el" (17956 13479))
 ;;; Generated autoloads from calendar/calendar.el
 
 (defvar calendar-offset 0 "\
@@ -3482,7 +3482,7 @@
 ;;;***
 
 ;;;### (autoloads (canlock-verify canlock-insert-header) "canlock"
-;;;;;;  "gnus/canlock.el" (17843 45616))
+;;;;;;  "gnus/canlock.el" (17842 54741))
 ;;; Generated autoloads from gnus/canlock.el
 
 (autoload (quote canlock-insert-header) "canlock" "\
@@ -3499,15 +3499,15 @@
 
 ;;;***
 
-;;;### (autoloads nil "cc-compat" "progmodes/cc-compat.el" (17958
-;;;;;;  39758))
+;;;### (autoloads nil "cc-compat" "progmodes/cc-compat.el" (17842
+;;;;;;  56333))
 ;;; Generated autoloads from progmodes/cc-compat.el
 (put 'c-indent-level 'safe-local-variable 'integerp)
 
 ;;;***
 
 ;;;### (autoloads (c-guess-basic-syntax) "cc-engine" "progmodes/cc-engine.el"
-;;;;;;  (17958 39759))
+;;;;;;  (17942 63381))
 ;;; Generated autoloads from progmodes/cc-engine.el
 
 (autoload (quote c-guess-basic-syntax) "cc-engine" "\
@@ -3519,7 +3519,7 @@
 
 ;;;### (autoloads (pike-mode idl-mode java-mode objc-mode c++-mode
 ;;;;;;  c-mode c-initialize-cc-mode) "cc-mode" "progmodes/cc-mode.el"
-;;;;;;  (17988 52353))
+;;;;;;  (17992 30878))
 ;;; Generated autoloads from progmodes/cc-mode.el
 
 (autoload (quote c-initialize-cc-mode) "cc-mode" "\
@@ -3677,7 +3677,7 @@
 ;;;***
 
 ;;;### (autoloads (c-set-offset c-add-style c-set-style) "cc-styles"
-;;;;;;  "progmodes/cc-styles.el" (17958 39759))
+;;;;;;  "progmodes/cc-styles.el" (17842 56333))
 ;;; Generated autoloads from progmodes/cc-styles.el
 
 (autoload (quote c-set-style) "cc-styles" "\
@@ -3728,14 +3728,14 @@
 
 ;;;***
 
-;;;### (autoloads nil "cc-subword" "progmodes/cc-subword.el" (17958
-;;;;;;  39759))
+;;;### (autoloads nil "cc-subword" "progmodes/cc-subword.el" (17949
+;;;;;;  41467))
 ;;; Generated autoloads from progmodes/cc-subword.el
  (autoload 'c-subword-mode "cc-subword" "Mode enabling subword movement and editing keys." t)
 
 ;;;***
 
-;;;### (autoloads nil "cc-vars" "progmodes/cc-vars.el" (17958 39759))
+;;;### (autoloads nil "cc-vars" "progmodes/cc-vars.el" (17941 38806))
 ;;; Generated autoloads from progmodes/cc-vars.el
 (put 'c-basic-offset 'safe-local-variable 'integerp)
 (put 'c-backslash-column 'safe-local-variable 'integerp)
@@ -3745,7 +3745,7 @@
 
 ;;;### (autoloads (ccl-execute-with-args check-ccl-program define-ccl-program
 ;;;;;;  declare-ccl-program ccl-dump ccl-compile) "ccl" "international/ccl.el"
-;;;;;;  (17843 45618))
+;;;;;;  (17842 54888))
 ;;; Generated autoloads from international/ccl.el
 
 (autoload (quote ccl-compile) "ccl" "\
@@ -4004,7 +4004,7 @@
 ;;;***
 
 ;;;### (autoloads (cfengine-mode) "cfengine" "progmodes/cfengine.el"
-;;;;;;  (17843 45627))
+;;;;;;  (17842 56333))
 ;;; Generated autoloads from progmodes/cfengine.el
 
 (autoload (quote cfengine-mode) "cfengine" "\
@@ -4026,7 +4026,7 @@
 ;;;;;;  checkdoc-comments checkdoc-continue checkdoc-start checkdoc-current-buffer
 ;;;;;;  checkdoc-eval-current-buffer checkdoc-message-interactive
 ;;;;;;  checkdoc-interactive checkdoc) "checkdoc" "emacs-lisp/checkdoc.el"
-;;;;;;  (17843 45615))
+;;;;;;  (17842 54152))
 ;;; Generated autoloads from emacs-lisp/checkdoc.el
 
 (autoload (quote checkdoc) "checkdoc" "\
@@ -4209,8 +4209,8 @@
 ;;;***
 
 ;;;### (autoloads (encode-hz-buffer encode-hz-region decode-hz-buffer
-;;;;;;  decode-hz-region) "china-util" "language/china-util.el" (17843
-;;;;;;  45620))
+;;;;;;  decode-hz-region) "china-util" "language/china-util.el" (17842
+;;;;;;  58278))
 ;;; Generated autoloads from language/china-util.el
 
 (autoload (quote decode-hz-region) "china-util" "\
@@ -4238,7 +4238,7 @@
 ;;;***
 
 ;;;### (autoloads (command-history list-command-history repeat-matching-complex-command)
-;;;;;;  "chistory" "chistory.el" (17843 45609))
+;;;;;;  "chistory" "chistory.el" (17842 58280))
 ;;; Generated autoloads from chistory.el
 
 (autoload (quote repeat-matching-complex-command) "chistory" "\
@@ -4277,7 +4277,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "cl" "emacs-lisp/cl.el" (17843 45615))
+;;;### (autoloads nil "cl" "emacs-lisp/cl.el" (17842 54152))
 ;;; Generated autoloads from emacs-lisp/cl.el
 
 (defvar custom-print-functions nil "\
@@ -4293,7 +4293,7 @@
 ;;;***
 
 ;;;### (autoloads (common-lisp-indent-function) "cl-indent" "emacs-lisp/cl-indent.el"
-;;;;;;  (17843 45615))
+;;;;;;  (17842 54152))
 ;;; Generated autoloads from emacs-lisp/cl-indent.el
 
 (autoload (quote common-lisp-indent-function) "cl-indent" "\
@@ -4304,7 +4304,7 @@
 ;;;***
 
 ;;;### (autoloads (c-macro-expand) "cmacexp" "progmodes/cmacexp.el"
-;;;;;;  (17843 45627))
+;;;;;;  (17842 56333))
 ;;; Generated autoloads from progmodes/cmacexp.el
 
 (autoload (quote c-macro-expand) "cmacexp" "\
@@ -4324,8 +4324,8 @@
 
 ;;;***
 
-;;;### (autoloads (run-scheme) "cmuscheme" "cmuscheme.el" (17843
-;;;;;;  45609))
+;;;### (autoloads (run-scheme) "cmuscheme" "cmuscheme.el" (17842
+;;;;;;  58280))
 ;;; Generated autoloads from cmuscheme.el
 
 (autoload (quote run-scheme) "cmuscheme" "\
@@ -4348,7 +4348,7 @@
 
 ;;;### (autoloads (codepage-setup cp-supported-codepages cp-offset-for-codepage
 ;;;;;;  cp-language-for-codepage cp-charset-for-codepage cp-make-coding-systems-for-codepage)
-;;;;;;  "codepage" "international/codepage.el" (17843 45618))
+;;;;;;  "codepage" "international/codepage.el" (17842 54888))
 ;;; Generated autoloads from international/codepage.el
 
 (autoload (quote cp-make-coding-systems-for-codepage) "codepage" "\
@@ -4407,7 +4407,7 @@
 ;;;### (autoloads (comint-redirect-results-list-from-process comint-redirect-results-list
 ;;;;;;  comint-redirect-send-command-to-process comint-redirect-send-command
 ;;;;;;  comint-run make-comint make-comint-in-buffer) "comint" "comint.el"
-;;;;;;  (17939 56016))
+;;;;;;  (17937 3189))
 ;;; Generated autoloads from comint.el
 
 (defvar comint-output-filter-functions (quote (comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt)) "\
@@ -4497,8 +4497,8 @@
 
 ;;;***
 
-;;;### (autoloads (compare-windows) "compare-w" "compare-w.el" (17939
-;;;;;;  56016))
+;;;### (autoloads (compare-windows) "compare-w" "compare-w.el" (17926
+;;;;;;  45410))
 ;;; Generated autoloads from compare-w.el
 
 (autoload (quote compare-windows) "compare-w" "\
@@ -4535,7 +4535,7 @@
 ;;;;;;  compilation-shell-minor-mode compilation-mode compilation-start
 ;;;;;;  compile compilation-disable-input compile-command compilation-search-path
 ;;;;;;  compilation-ask-about-save compilation-window-height compilation-mode-hook)
-;;;;;;  "compile" "progmodes/compile.el" (17996 37926))
+;;;;;;  "compile" "progmodes/compile.el" (18006 55797))
 ;;; Generated autoloads from progmodes/compile.el
 
 (defvar compilation-mode-hook nil "\
@@ -4698,12 +4698,12 @@
 ;;;***
 
 ;;;### (autoloads (partial-completion-mode) "complete" "complete.el"
-;;;;;;  (17953 25415))
+;;;;;;  (17954 15344))
 ;;; Generated autoloads from complete.el
 
 (defvar partial-completion-mode nil "\
 Non-nil if Partial-Completion mode is enabled.
-See the command `partial-completion-mode' for a description of this minor-mode.
+See the command `partial-completion-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `partial-completion-mode'.")
@@ -4740,12 +4740,12 @@
 ;;;***
 
 ;;;### (autoloads (dynamic-completion-mode) "completion" "completion.el"
-;;;;;;  (17843 45609))
+;;;;;;  (17842 58280))
 ;;; Generated autoloads from completion.el
 
 (defvar dynamic-completion-mode nil "\
 Non-nil if Dynamic-Completion mode is enabled.
-See the command `dynamic-completion-mode' for a description of this minor-mode.
+See the command `dynamic-completion-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `dynamic-completion-mode'.")
@@ -4762,7 +4762,7 @@
 ;;;### (autoloads (decompose-composite-char compose-last-chars compose-chars-after
 ;;;;;;  find-composition compose-chars decompose-string compose-string
 ;;;;;;  decompose-region compose-region encode-composition-rule)
-;;;;;;  "composite" "composite.el" (17843 45609))
+;;;;;;  "composite" "composite.el" (17842 58280))
 ;;; Generated autoloads from composite.el
 
 (defconst reference-point-alist (quote ((tl . 0) (tc . 1) (tr . 2) (Bl . 3) (Bc . 4) (Br . 5) (bl . 6) (bc . 7) (br . 8) (cl . 9) (cc . 10) (cr . 11) (top-left . 0) (top-center . 1) (top-right . 2) (base-left . 3) (base-center . 4) (base-right . 5) (bottom-left . 6) (bottom-center . 7) (bottom-right . 8) (center-left . 9) (center-center . 10) (center-right . 11) (ml . 3) (mc . 10) (mr . 5) (mid-left . 3) (mid-center . 10) (mid-right . 5))) "\
@@ -4984,7 +4984,7 @@
 ;;;### (autoloads (conf-xdefaults-mode conf-ppd-mode conf-colon-mode
 ;;;;;;  conf-space-keywords conf-space-mode conf-javaprop-mode conf-windows-mode
 ;;;;;;  conf-unix-mode conf-mode) "conf-mode" "textmodes/conf-mode.el"
-;;;;;;  (17843 45630))
+;;;;;;  (17842 58277))
 ;;; Generated autoloads from textmodes/conf-mode.el
 
 (autoload (quote conf-mode) "conf-mode" "\
@@ -5140,7 +5140,7 @@
 ;;;***
 
 ;;;### (autoloads (shuffle-vector cookie-snarf cookie-insert cookie)
-;;;;;;  "cookie1" "play/cookie1.el" (17843 45625))
+;;;;;;  "cookie1" "play/cookie1.el" (17842 55395))
 ;;; Generated autoloads from play/cookie1.el
 
 (autoload (quote cookie) "cookie1" "\
@@ -5172,7 +5172,7 @@
 ;;;***
 
 ;;;### (autoloads (copyright copyright-fix-years copyright-update)
-;;;;;;  "copyright" "emacs-lisp/copyright.el" (17843 45615))
+;;;;;;  "copyright" "emacs-lisp/copyright.el" (17842 54152))
 ;;; Generated autoloads from emacs-lisp/copyright.el
 
 (autoload (quote copyright-update) "copyright" "\
@@ -5200,7 +5200,7 @@
 ;;;***
 
 ;;;### (autoloads (cperl-perldoc-at-point cperl-perldoc cperl-mode)
-;;;;;;  "cperl-mode" "progmodes/cperl-mode.el" (17955 48757))
+;;;;;;  "cperl-mode" "progmodes/cperl-mode.el" (17955 36604))
 ;;; Generated autoloads from progmodes/cperl-mode.el
 
 (autoload (quote cperl-mode) "cperl-mode" "\
@@ -5391,7 +5391,7 @@
 ;;;***
 
 ;;;### (autoloads (cpp-parse-edit cpp-highlight-buffer) "cpp" "progmodes/cpp.el"
-;;;;;;  (17843 45627))
+;;;;;;  (17842 56333))
 ;;; Generated autoloads from progmodes/cpp.el
 
 (autoload (quote cpp-highlight-buffer) "cpp" "\
@@ -5410,7 +5410,7 @@
 ;;;***
 
 ;;;### (autoloads (crisp-mode crisp-mode) "crisp" "emulation/crisp.el"
-;;;;;;  (17843 45615))
+;;;;;;  (17842 54264))
 ;;; Generated autoloads from emulation/crisp.el
 
 (defvar crisp-mode nil "\
@@ -5434,7 +5434,7 @@
 ;;;***
 
 ;;;### (autoloads (completing-read-multiple) "crm" "emacs-lisp/crm.el"
-;;;;;;  (17843 45615))
+;;;;;;  (17842 54152))
 ;;; Generated autoloads from emacs-lisp/crm.el
 
 (autoload (quote completing-read-multiple) "crm" "\
@@ -5470,12 +5470,12 @@
 ;;;***
 
 ;;;### (autoloads (cua-selection-mode cua-mode) "cua-base" "emulation/cua-base.el"
-;;;;;;  (17939 56021))
+;;;;;;  (17888 45995))
 ;;; Generated autoloads from emulation/cua-base.el
 
 (defvar cua-mode nil "\
 Non-nil if Cua mode is enabled.
-See the command `cua-mode' for a description of this minor-mode.
+See the command `cua-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `cua-mode'.")
@@ -5538,7 +5538,7 @@
 ;;;;;;  customize-mode customize customize-save-variable customize-set-variable
 ;;;;;;  customize-set-value custom-menu-sort-alphabetically custom-buffer-sort-alphabetically
 ;;;;;;  custom-browse-sort-alphabetically) "cus-edit" "cus-edit.el"
-;;;;;;  (17951 39252))
+;;;;;;  (17952 11093))
 ;;; Generated autoloads from cus-edit.el
 
 (defvar custom-browse-sort-alphabetically nil "\
@@ -5836,7 +5836,7 @@
 ;;;***
 
 ;;;### (autoloads (custom-reset-faces custom-theme-reset-faces custom-set-faces
-;;;;;;  custom-declare-face) "cus-face" "cus-face.el" (17843 45609))
+;;;;;;  custom-declare-face) "cus-face" "cus-face.el" (17842 58280))
 ;;; Generated autoloads from cus-face.el
 
 (autoload (quote custom-declare-face) "cus-face" "\
@@ -5906,7 +5906,7 @@
 ;;;***
 
 ;;;### (autoloads (customize-create-theme) "cus-theme" "cus-theme.el"
-;;;;;;  (17843 45609))
+;;;;;;  (17842 58280))
 ;;; Generated autoloads from cus-theme.el
 
 (autoload (quote customize-create-theme) "cus-theme" "\
@@ -5917,7 +5917,7 @@
 ;;;***
 
 ;;;### (autoloads (cvs-status-mode) "cvs-status" "cvs-status.el"
-;;;;;;  (17843 45609))
+;;;;;;  (17842 58280))
 ;;; Generated autoloads from cvs-status.el
 
 (autoload (quote cvs-status-mode) "cvs-status" "\
@@ -5928,7 +5928,7 @@
 ;;;***
 
 ;;;### (autoloads (global-cwarn-mode turn-on-cwarn-mode cwarn-mode)
-;;;;;;  "cwarn" "progmodes/cwarn.el" (17939 56022))
+;;;;;;  "cwarn" "progmodes/cwarn.el" (17860 50532))
 ;;; Generated autoloads from progmodes/cwarn.el
 
 (autoload (quote cwarn-mode) "cwarn" "\
@@ -5952,7 +5952,7 @@
 
 (defvar global-cwarn-mode nil "\
 Non-nil if Global-Cwarn mode is enabled.
-See the command `global-cwarn-mode' for a description of this minor-mode.
+See the command `global-cwarn-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `global-cwarn-mode'.")
@@ -5960,10 +5960,10 @@
 (custom-autoload (quote global-cwarn-mode) "cwarn" nil)
 
 (autoload (quote global-cwarn-mode) "cwarn" "\
-Toggle Cwarn mode in every buffer.
+Toggle Cwarn mode in every possible buffer.
 With prefix ARG, turn Global-Cwarn mode on if and only if ARG is positive.
-Cwarn mode is actually not turned on in every buffer but only in those
-in which `turn-on-cwarn-mode-if-enabled' turns it on.
+Cwarn mode is enabled in all buffers where `turn-on-cwarn-mode-if-enabled' would do it.
+See `cwarn-mode' for more information on Cwarn mode.
 
 \(fn &optional ARG)" t nil)
 
@@ -5971,7 +5971,7 @@
 
 ;;;### (autoloads (standard-display-cyrillic-translit cyrillic-encode-alternativnyj-char
 ;;;;;;  cyrillic-encode-koi8-r-char) "cyril-util" "language/cyril-util.el"
-;;;;;;  (17843 45620))
+;;;;;;  (17842 58278))
 ;;; Generated autoloads from language/cyril-util.el
 
 (autoload (quote cyrillic-encode-koi8-r-char) "cyril-util" "\
@@ -6000,7 +6000,7 @@
 ;;;***
 
 ;;;### (autoloads (dabbrev-expand dabbrev-completion) "dabbrev" "dabbrev.el"
-;;;;;;  (17995 6542))
+;;;;;;  (18006 55794))
 ;;; Generated autoloads from dabbrev.el
  (define-key esc-map "/" 'dabbrev-expand)
  (define-key esc-map [?\C-/] 'dabbrev-completion)
@@ -6044,8 +6044,8 @@
 
 ;;;***
 
-;;;### (autoloads (dcl-mode) "dcl-mode" "progmodes/dcl-mode.el" (17947
-;;;;;;  44454))
+;;;### (autoloads (dcl-mode) "dcl-mode" "progmodes/dcl-mode.el" (17949
+;;;;;;  41468))
 ;;; Generated autoloads from progmodes/dcl-mode.el
 
 (autoload (quote dcl-mode) "dcl-mode" "\
@@ -6172,7 +6172,7 @@
 ;;;***
 
 ;;;### (autoloads (cancel-debug-on-entry debug-on-entry debug) "debug"
-;;;;;;  "emacs-lisp/debug.el" (17843 45615))
+;;;;;;  "emacs-lisp/debug.el" (17842 54152))
 ;;; Generated autoloads from emacs-lisp/debug.el
 
 (setq debugger (quote debug))
@@ -6216,7 +6216,7 @@
 ;;;***
 
 ;;;### (autoloads (decipher-mode decipher) "decipher" "play/decipher.el"
-;;;;;;  (17843 45625))
+;;;;;;  (17842 55395))
 ;;; Generated autoloads from play/decipher.el
 
 (autoload (quote decipher) "decipher" "\
@@ -6245,8 +6245,8 @@
 ;;;***
 
 ;;;### (autoloads (delimit-columns-rectangle delimit-columns-region
-;;;;;;  delimit-columns-customize) "delim-col" "delim-col.el" (17843
-;;;;;;  45609))
+;;;;;;  delimit-columns-customize) "delim-col" "delim-col.el" (17842
+;;;;;;  58280))
 ;;; Generated autoloads from delim-col.el
 
 (autoload (quote delimit-columns-customize) "delim-col" "\
@@ -6270,8 +6270,8 @@
 
 ;;;***
 
-;;;### (autoloads (delphi-mode) "delphi" "progmodes/delphi.el" (17843
-;;;;;;  45627))
+;;;### (autoloads (delphi-mode) "delphi" "progmodes/delphi.el" (17842
+;;;;;;  56333))
 ;;; Generated autoloads from progmodes/delphi.el
 
 (autoload (quote delphi-mode) "delphi" "\
@@ -6321,15 +6321,15 @@
 
 ;;;***
 
-;;;### (autoloads (delete-selection-mode) "delsel" "delsel.el" (17843
-;;;;;;  45609))
+;;;### (autoloads (delete-selection-mode) "delsel" "delsel.el" (17842
+;;;;;;  58280))
 ;;; Generated autoloads from delsel.el
 
 (defalias (quote pending-delete-mode) (quote delete-selection-mode))
 
 (defvar delete-selection-mode nil "\
 Non-nil if Delete-Selection mode is enabled.
-See the command `delete-selection-mode' for a description of this minor-mode.
+See the command `delete-selection-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `delete-selection-mode'.")
@@ -6351,7 +6351,7 @@
 ;;;***
 
 ;;;### (autoloads (derived-mode-init-mode-variables define-derived-mode)
-;;;;;;  "derived" "emacs-lisp/derived.el" (17843 45615))
+;;;;;;  "derived" "emacs-lisp/derived.el" (17842 54152))
 ;;; Generated autoloads from emacs-lisp/derived.el
 
 (autoload (quote define-derived-mode) "derived" "\
@@ -6416,7 +6416,7 @@
 ;;;***
 
 ;;;### (autoloads (describe-char describe-text-properties) "descr-text"
-;;;;;;  "descr-text.el" (17939 56016))
+;;;;;;  "descr-text.el" (17874 62047))
 ;;; Generated autoloads from descr-text.el
 
 (autoload (quote describe-text-properties) "descr-text" "\
@@ -6442,12 +6442,12 @@
 ;;;### (autoloads (desktop-revert desktop-save-in-desktop-dir desktop-change-dir
 ;;;;;;  desktop-load-default desktop-read desktop-remove desktop-save
 ;;;;;;  desktop-clear desktop-locals-to-save desktop-save-mode) "desktop"
-;;;;;;  "desktop.el" (17949 5807))
+;;;;;;  "desktop.el" (17949 41467))
 ;;; Generated autoloads from desktop.el
 
 (defvar desktop-save-mode nil "\
 Non-nil if Desktop-Save mode is enabled.
-See the command `desktop-save-mode' for a description of this minor-mode.")
+See the command `desktop-save-mode' for a description of this minor mode.")
 
 (custom-autoload (quote desktop-save-mode) "desktop" nil)
 
@@ -6625,7 +6625,7 @@
 
 ;;;### (autoloads (gnus-article-outlook-deuglify-article gnus-outlook-deuglify-article
 ;;;;;;  gnus-article-outlook-repair-attribution gnus-article-outlook-unwrap-lines)
-;;;;;;  "deuglify" "gnus/deuglify.el" (17843 45616))
+;;;;;;  "deuglify" "gnus/deuglify.el" (17842 54741))
 ;;; Generated autoloads from gnus/deuglify.el
 
 (autoload (quote gnus-article-outlook-unwrap-lines) "deuglify" "\
@@ -6658,7 +6658,7 @@
 ;;;***
 
 ;;;### (autoloads (devanagari-post-read-conversion devanagari-compose-region)
-;;;;;;  "devan-util" "language/devan-util.el" (17843 45620))
+;;;;;;  "devan-util" "language/devan-util.el" (17842 58278))
 ;;; Generated autoloads from language/devan-util.el
 
 (defconst devanagari-consonant "[\x51ad5-\x51af9\x51b38-\x51b3f]")
@@ -6676,7 +6676,7 @@
 ;;;***
 
 ;;;### (autoloads (diary-mode diary-mail-entries diary) "diary-lib"
-;;;;;;  "calendar/diary-lib.el" (17958 15315))
+;;;;;;  "calendar/diary-lib.el" (17958 11887))
 ;;; Generated autoloads from calendar/diary-lib.el
 
 (autoload (quote diary) "diary-lib" "\
@@ -6722,7 +6722,7 @@
 ;;;***
 
 ;;;### (autoloads (diff-backup diff diff-command diff-switches) "diff"
-;;;;;;  "diff.el" (17843 45609))
+;;;;;;  "diff.el" (17992 30877))
 ;;; Generated autoloads from diff.el
 
 (defvar diff-switches "-c" "\
@@ -6756,7 +6756,7 @@
 ;;;***
 
 ;;;### (autoloads (diff-minor-mode diff-mode) "diff-mode" "diff-mode.el"
-;;;;;;  (17942 38318))
+;;;;;;  (17992 30877))
 ;;; Generated autoloads from diff-mode.el
 
 (autoload (quote diff-mode) "diff-mode" "\
@@ -6788,7 +6788,7 @@
 ;;;;;;  dired dired-copy-preserve-time dired-dwim-target dired-keep-marker-symlink
 ;;;;;;  dired-keep-marker-hardlink dired-keep-marker-copy dired-keep-marker-rename
 ;;;;;;  dired-trivial-filenames dired-ls-F-marks-symlinks dired-listing-switches)
-;;;;;;  "dired" "dired.el" (17995 6542))
+;;;;;;  "dired" "dired.el" (18015 32019))
 ;;; Generated autoloads from dired.el
 
 (defvar dired-listing-switches "-al" "\
@@ -6993,7 +6993,7 @@
 ;;;;;;  dired-run-shell-command dired-do-shell-command dired-clean-directory
 ;;;;;;  dired-do-print dired-do-touch dired-do-chown dired-do-chgrp
 ;;;;;;  dired-do-chmod dired-compare-directories dired-backup-diff
-;;;;;;  dired-diff) "dired-aux" "dired-aux.el" (17939 56016))
+;;;;;;  dired-diff) "dired-aux" "dired-aux.el" (17859 20444))
 ;;; Generated autoloads from dired-aux.el
 
 (autoload (quote dired-diff) "dired-aux" "\
@@ -7408,7 +7408,7 @@
 ;;;***
 
 ;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el"
-;;;;;;  (17988 52353))
+;;;;;;  (17992 30877))
 ;;; Generated autoloads from dired-x.el
 
 (autoload (quote dired-jump) "dired-x" "\
@@ -7437,7 +7437,7 @@
 
 ;;;***
 
-;;;### (autoloads (dirtrack) "dirtrack" "dirtrack.el" (17843 45609))
+;;;### (autoloads (dirtrack) "dirtrack" "dirtrack.el" (17842 58280))
 ;;; Generated autoloads from dirtrack.el
 
 (autoload (quote dirtrack) "dirtrack" "\
@@ -7456,8 +7456,8 @@
 
 ;;;***
 
-;;;### (autoloads (disassemble) "disass" "emacs-lisp/disass.el" (17843
-;;;;;;  45615))
+;;;### (autoloads (disassemble) "disass" "emacs-lisp/disass.el" (17842
+;;;;;;  54152))
 ;;; Generated autoloads from emacs-lisp/disass.el
 
 (autoload (quote disassemble) "disass" "\
@@ -7476,7 +7476,7 @@
 ;;;;;;  standard-display-g1 standard-display-ascii standard-display-default
 ;;;;;;  standard-display-8bit describe-current-display-table describe-display-table
 ;;;;;;  set-display-table-slot display-table-slot make-display-table)
-;;;;;;  "disp-table" "disp-table.el" (17939 56016))
+;;;;;;  "disp-table" "disp-table.el" (17874 62056))
 ;;; Generated autoloads from disp-table.el
 
 (autoload (quote make-display-table) "disp-table" "\
@@ -7592,7 +7592,7 @@
 ;;;***
 
 ;;;### (autoloads (dissociated-press) "dissociate" "play/dissociate.el"
-;;;;;;  (17941 5494))
+;;;;;;  (17941 38806))
 ;;; Generated autoloads from play/dissociate.el
 
 (autoload (quote dissociated-press) "dissociate" "\
@@ -7608,7 +7608,7 @@
 
 ;;;***
 
-;;;### (autoloads (dnd-protocol-alist) "dnd" "dnd.el" (17950 27944))
+;;;### (autoloads (dnd-protocol-alist) "dnd" "dnd.el" (17949 41467))
 ;;; Generated autoloads from dnd.el
 
 (defvar dnd-protocol-alist (quote (("^file:///" . dnd-open-local-file) ("^file://" . dnd-open-file) ("^file:" . dnd-open-local-file) ("^\\(https?\\|ftp\\|file\\|nfs\\)://" . dnd-open-file))) "\
@@ -7629,7 +7629,7 @@
 ;;;***
 
 ;;;### (autoloads (dns-mode-soa-increment-serial dns-mode) "dns-mode"
-;;;;;;  "textmodes/dns-mode.el" (17843 45630))
+;;;;;;  "textmodes/dns-mode.el" (17842 58277))
 ;;; Generated autoloads from textmodes/dns-mode.el
 
 (autoload (quote dns-mode) "dns-mode" "\
@@ -7653,7 +7653,7 @@
 
 ;;;***
 
-;;;### (autoloads (doctor) "doctor" "play/doctor.el" (17941 5494))
+;;;### (autoloads (doctor) "doctor" "play/doctor.el" (17941 38806))
 ;;; Generated autoloads from play/doctor.el
 
 (autoload (quote doctor) "doctor" "\
@@ -7664,7 +7664,7 @@
 ;;;***
 
 ;;;### (autoloads (double-mode double-mode) "double" "double.el"
-;;;;;;  (17843 45610))
+;;;;;;  (17842 58280))
 ;;; Generated autoloads from double.el
 
 (defvar double-mode nil "\
@@ -7685,7 +7685,7 @@
 
 ;;;***
 
-;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (17843 45625))
+;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (17842 55395))
 ;;; Generated autoloads from play/dunnet.el
 
 (autoload (quote dunnet) "dunnet" "\
@@ -7696,7 +7696,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-earcon-display) "earcon" "gnus/earcon.el"
-;;;;;;  (17843 45616))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/earcon.el
 
 (autoload (quote gnus-earcon-display) "earcon" "\
@@ -7708,7 +7708,7 @@
 
 ;;;### (autoloads (easy-mmode-defsyntax easy-mmode-defmap easy-mmode-define-keymap
 ;;;;;;  define-globalized-minor-mode define-minor-mode) "easy-mmode"
-;;;;;;  "emacs-lisp/easy-mmode.el" (17988 52353))
+;;;;;;  "emacs-lisp/easy-mmode.el" (17992 30878))
 ;;; Generated autoloads from emacs-lisp/easy-mmode.el
 
 (defalias (quote easy-mmode-define-minor-mode) (quote define-minor-mode))
@@ -7802,8 +7802,8 @@
 ;;;***
 
 ;;;### (autoloads (easy-menu-change easy-menu-create-menu easy-menu-do-define
-;;;;;;  easy-menu-define) "easymenu" "emacs-lisp/easymenu.el" (17843
-;;;;;;  45615))
+;;;;;;  easy-menu-define) "easymenu" "emacs-lisp/easymenu.el" (17842
+;;;;;;  54152))
 ;;; Generated autoloads from emacs-lisp/easymenu.el
 
 (put (quote easy-menu-define) (quote lisp-indent-function) (quote defun))
@@ -7952,7 +7952,7 @@
 ;;;;;;  ebnf-eps-directory ebnf-spool-region ebnf-spool-buffer ebnf-spool-file
 ;;;;;;  ebnf-spool-directory ebnf-print-region ebnf-print-buffer
 ;;;;;;  ebnf-print-file ebnf-print-directory ebnf-customize) "ebnf2ps"
-;;;;;;  "progmodes/ebnf2ps.el" (17951 39252))
+;;;;;;  "progmodes/ebnf2ps.el" (17952 11093))
 ;;; Generated autoloads from progmodes/ebnf2ps.el
 
 (autoload (quote ebnf-customize) "ebnf2ps" "\
@@ -8219,8 +8219,8 @@
 ;;;;;;  ebrowse-tags-find-declaration-other-window ebrowse-tags-find-definition
 ;;;;;;  ebrowse-tags-view-definition ebrowse-tags-find-declaration
 ;;;;;;  ebrowse-tags-view-declaration ebrowse-member-mode ebrowse-electric-choose-tree
-;;;;;;  ebrowse-tree-mode) "ebrowse" "progmodes/ebrowse.el" (17827
-;;;;;;  37447))
+;;;;;;  ebrowse-tree-mode) "ebrowse" "progmodes/ebrowse.el" (17821
+;;;;;;  5918))
 ;;; Generated autoloads from progmodes/ebrowse.el
 
 (autoload (quote ebrowse-tree-mode) "ebrowse" "\
@@ -8371,7 +8371,7 @@
 ;;;***
 
 ;;;### (autoloads (electric-buffer-list) "ebuff-menu" "ebuff-menu.el"
-;;;;;;  (17843 45610))
+;;;;;;  (17842 58280))
 ;;; Generated autoloads from ebuff-menu.el
 
 (autoload (quote electric-buffer-list) "ebuff-menu" "\
@@ -8396,7 +8396,7 @@
 ;;;***
 
 ;;;### (autoloads (Electric-command-history-redo-expression) "echistory"
-;;;;;;  "echistory.el" (17843 45610))
+;;;;;;  "echistory.el" (17842 58280))
 ;;; Generated autoloads from echistory.el
 
 (autoload (quote Electric-command-history-redo-expression) "echistory" "\
@@ -8409,7 +8409,7 @@
 
 ;;;### (autoloads (edebug-all-forms edebug-all-defs edebug-eval-top-level-form
 ;;;;;;  edebug-basic-spec edebug-all-forms edebug-all-defs) "edebug"
-;;;;;;  "emacs-lisp/edebug.el" (17951 39252))
+;;;;;;  "emacs-lisp/edebug.el" (17952 11093))
 ;;; Generated autoloads from emacs-lisp/edebug.el
 
 (defvar edebug-all-defs nil "\
@@ -8482,7 +8482,7 @@
 ;;;;;;  ediff-merge-directory-revisions ediff-merge-directories-with-ancestor
 ;;;;;;  ediff-merge-directories ediff-directories3 ediff-directory-revisions
 ;;;;;;  ediff-directories ediff-buffers3 ediff-buffers ediff-backup
-;;;;;;  ediff-files3 ediff-files) "ediff" "ediff.el" (17939 56017))
+;;;;;;  ediff-files3 ediff-files) "ediff" "ediff.el" (17846 30361))
 ;;; Generated autoloads from ediff.el
 
 (autoload (quote ediff-files) "ediff" "\
@@ -8714,7 +8714,7 @@
 ;;;***
 
 ;;;### (autoloads (ediff-customize) "ediff-help" "ediff-help.el"
-;;;;;;  (17843 45610))
+;;;;;;  (17842 58280))
 ;;; Generated autoloads from ediff-help.el
 
 (autoload (quote ediff-customize) "ediff-help" "\
@@ -8724,7 +8724,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "ediff-hook" "ediff-hook.el" (17843 45610))
+;;;### (autoloads nil "ediff-hook" "ediff-hook.el" (17842 58280))
 ;;; Generated autoloads from ediff-hook.el
 
 (defvar ediff-window-setup-function)
@@ -8737,7 +8737,7 @@
 ;;;***
 
 ;;;### (autoloads (ediff-show-registry) "ediff-mult" "ediff-mult.el"
-;;;;;;  (17843 45610))
+;;;;;;  (17842 58279))
 ;;; Generated autoloads from ediff-mult.el
 
 (autoload (quote ediff-show-registry) "ediff-mult" "\
@@ -8750,7 +8750,7 @@
 ;;;***
 
 ;;;### (autoloads (ediff-toggle-use-toolbar ediff-toggle-multiframe)
-;;;;;;  "ediff-util" "ediff-util.el" (17939 56016))
+;;;;;;  "ediff-util" "ediff-util.el" (17846 30361))
 ;;; Generated autoloads from ediff-util.el
 
 (autoload (quote ediff-toggle-multiframe) "ediff-util" "\
@@ -8771,7 +8771,7 @@
 
 ;;;### (autoloads (format-kbd-macro read-kbd-macro edit-named-kbd-macro
 ;;;;;;  edit-last-kbd-macro edit-kbd-macro) "edmacro" "edmacro.el"
-;;;;;;  (17843 45610))
+;;;;;;  (17842 58279))
 ;;; Generated autoloads from edmacro.el
 
 (defvar edmacro-eight-bits nil "\
@@ -8824,7 +8824,7 @@
 ;;;***
 
 ;;;### (autoloads (edt-emulation-on edt-set-scroll-margins) "edt"
-;;;;;;  "emulation/edt.el" (17843 45615))
+;;;;;;  "emulation/edt.el" (17842 54264))
 ;;; Generated autoloads from emulation/edt.el
 
 (autoload (quote edt-set-scroll-margins) "edt" "\
@@ -8842,7 +8842,7 @@
 ;;;***
 
 ;;;### (autoloads (electric-helpify with-electric-help) "ehelp" "ehelp.el"
-;;;;;;  (17939 56017))
+;;;;;;  (17873 45892))
 ;;; Generated autoloads from ehelp.el
 
 (autoload (quote with-electric-help) "ehelp" "\
@@ -8879,7 +8879,7 @@
 ;;;***
 
 ;;;### (autoloads (turn-on-eldoc-mode eldoc-mode eldoc-minor-mode-string)
-;;;;;;  "eldoc" "emacs-lisp/eldoc.el" (17988 52353))
+;;;;;;  "eldoc" "emacs-lisp/eldoc.el" (17992 30878))
 ;;; Generated autoloads from emacs-lisp/eldoc.el
 
 (defvar eldoc-minor-mode-string " ElDoc" "\
@@ -8917,8 +8917,8 @@
 
 ;;;***
 
-;;;### (autoloads (elide-head) "elide-head" "elide-head.el" (17843
-;;;;;;  45610))
+;;;### (autoloads (elide-head) "elide-head" "elide-head.el" (17842
+;;;;;;  58279))
 ;;; Generated autoloads from elide-head.el
 
 (autoload (quote elide-head) "elide-head" "\
@@ -8934,7 +8934,7 @@
 ;;;***
 
 ;;;### (autoloads (elint-initialize) "elint" "emacs-lisp/elint.el"
-;;;;;;  (17843 45615))
+;;;;;;  (17842 54152))
 ;;; Generated autoloads from emacs-lisp/elint.el
 
 (autoload (quote elint-initialize) "elint" "\
@@ -8945,8 +8945,8 @@
 ;;;***
 
 ;;;### (autoloads (elp-results elp-instrument-package elp-instrument-list
-;;;;;;  elp-instrument-function) "elp" "emacs-lisp/elp.el" (17843
-;;;;;;  45615))
+;;;;;;  elp-instrument-function) "elp" "emacs-lisp/elp.el" (17842
+;;;;;;  54152))
 ;;; Generated autoloads from emacs-lisp/elp.el
 
 (autoload (quote elp-instrument-function) "elp" "\
@@ -8980,7 +8980,7 @@
 ;;;***
 
 ;;;### (autoloads (report-emacs-bug) "emacsbug" "mail/emacsbug.el"
-;;;;;;  (17939 56022))
+;;;;;;  (17907 23437))
 ;;; Generated autoloads from mail/emacsbug.el
 
 (autoload (quote report-emacs-bug) "emacsbug" "\
@@ -9073,12 +9073,12 @@
 ;;;***
 
 ;;;### (autoloads (encoded-kbd-mode) "encoded-kb" "international/encoded-kb.el"
-;;;;;;  (17843 45618))
+;;;;;;  (17842 54888))
 ;;; Generated autoloads from international/encoded-kb.el
 
 (defvar encoded-kbd-mode nil "\
 Non-nil if Encoded-Kbd mode is enabled.
-See the command `encoded-kbd-mode' for a description of this minor-mode.
+See the command `encoded-kbd-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `encoded-kbd-mode'.")
@@ -9102,7 +9102,7 @@
 ;;;***
 
 ;;;### (autoloads (enriched-decode enriched-encode enriched-mode)
-;;;;;;  "enriched" "textmodes/enriched.el" (17843 45630))
+;;;;;;  "enriched" "textmodes/enriched.el" (17842 58277))
 ;;; Generated autoloads from textmodes/enriched.el
 
 (autoload (quote enriched-mode) "enriched" "\
@@ -9133,7 +9133,7 @@
 ;;;***
 
 ;;;### (autoloads (erc-handle-irc-url erc erc-select-read-args) "erc"
-;;;;;;  "erc/erc.el" (17939 56021))
+;;;;;;  "erc/erc.el" (17935 53318))
 ;;; Generated autoloads from erc/erc.el
 
 (autoload (quote erc-select-read-args) "erc" "\
@@ -9175,33 +9175,33 @@
 
 ;;;***
 
-;;;### (autoloads nil "erc-autoaway" "erc/erc-autoaway.el" (17939
-;;;;;;  56021))
+;;;### (autoloads nil "erc-autoaway" "erc/erc-autoaway.el" (17935
+;;;;;;  53318))
 ;;; Generated autoloads from erc/erc-autoaway.el
  (autoload 'erc-autoaway-mode "erc-autoaway")
 
 ;;;***
 
-;;;### (autoloads nil "erc-button" "erc/erc-button.el" (17939 56021))
+;;;### (autoloads nil "erc-button" "erc/erc-button.el" (17935 53318))
 ;;; Generated autoloads from erc/erc-button.el
  (autoload 'erc-button-mode "erc-button" nil t)
 
 ;;;***
 
-;;;### (autoloads nil "erc-capab" "erc/erc-capab.el" (17939 56021))
+;;;### (autoloads nil "erc-capab" "erc/erc-capab.el" (17935 53318))
 ;;; Generated autoloads from erc/erc-capab.el
  (autoload 'erc-capab-identify-mode "erc-capab" nil t)
 
 ;;;***
 
-;;;### (autoloads nil "erc-compat" "erc/erc-compat.el" (17939 56021))
+;;;### (autoloads nil "erc-compat" "erc/erc-compat.el" (17935 53318))
 ;;; Generated autoloads from erc/erc-compat.el
  (autoload 'erc-define-minor-mode "erc-compat")
 
 ;;;***
 
 ;;;### (autoloads (erc-ctcp-query-DCC pcomplete/erc-mode/DCC erc-cmd-DCC)
-;;;;;;  "erc-dcc" "erc/erc-dcc.el" (17843 45616))
+;;;;;;  "erc-dcc" "erc/erc-dcc.el" (17842 54344))
 ;;; Generated autoloads from erc/erc-dcc.el
 
 (autoload (quote erc-cmd-DCC) "erc-dcc" "\
@@ -9233,7 +9233,7 @@
 ;;;;;;  erc-ezb-add-session erc-ezb-end-of-session-list erc-ezb-init-session-list
 ;;;;;;  erc-ezb-identify erc-ezb-notice-autodetect erc-ezb-lookup-action
 ;;;;;;  erc-ezb-get-login erc-cmd-ezb) "erc-ezbounce" "erc/erc-ezbounce.el"
-;;;;;;  (17843 45616))
+;;;;;;  (17842 54344))
 ;;; Generated autoloads from erc/erc-ezbounce.el
 
 (autoload (quote erc-cmd-ezb) "erc-ezbounce" "\
@@ -9295,8 +9295,8 @@
 
 ;;;***
 
-;;;### (autoloads (erc-fill) "erc-fill" "erc/erc-fill.el" (17939
-;;;;;;  56021))
+;;;### (autoloads (erc-fill) "erc-fill" "erc/erc-fill.el" (17935
+;;;;;;  53318))
 ;;; Generated autoloads from erc/erc-fill.el
  (autoload 'erc-fill-mode "erc-fill" nil t)
 
@@ -9308,15 +9308,15 @@
 
 ;;;***
 
-;;;### (autoloads nil "erc-hecomplete" "erc/erc-hecomplete.el" (17843
-;;;;;;  45616))
+;;;### (autoloads nil "erc-hecomplete" "erc/erc-hecomplete.el" (17842
+;;;;;;  54344))
 ;;; Generated autoloads from erc/erc-hecomplete.el
  (autoload 'erc-hecomplete-mode "erc-hecomplete" nil t)
 
 ;;;***
 
 ;;;### (autoloads (erc-identd-stop erc-identd-start) "erc-identd"
-;;;;;;  "erc/erc-identd.el" (17939 56021))
+;;;;;;  "erc/erc-identd.el" (17935 53318))
 ;;; Generated autoloads from erc/erc-identd.el
  (autoload 'erc-identd-mode "erc-identd")
 
@@ -9338,7 +9338,7 @@
 ;;;***
 
 ;;;### (autoloads (erc-create-imenu-index) "erc-imenu" "erc/erc-imenu.el"
-;;;;;;  (17843 45616))
+;;;;;;  (17842 54344))
 ;;; Generated autoloads from erc/erc-imenu.el
 
 (autoload (quote erc-create-imenu-index) "erc-imenu" "\
@@ -9348,14 +9348,14 @@
 
 ;;;***
 
-;;;### (autoloads nil "erc-join" "erc/erc-join.el" (17843 45616))
+;;;### (autoloads nil "erc-join" "erc/erc-join.el" (17842 54344))
 ;;; Generated autoloads from erc/erc-join.el
  (autoload 'erc-autojoin-mode "erc-join" nil t)
 
 ;;;***
 
 ;;;### (autoloads (erc-save-buffer-in-logs erc-logging-enabled) "erc-log"
-;;;;;;  "erc/erc-log.el" (17939 56021))
+;;;;;;  "erc/erc-log.el" (17935 53318))
 ;;; Generated autoloads from erc/erc-log.el
  (autoload 'erc-log-mode "erc-log" nil t)
 
@@ -9387,7 +9387,7 @@
 ;;;### (autoloads (erc-delete-dangerous-host erc-add-dangerous-host
 ;;;;;;  erc-delete-keyword erc-add-keyword erc-delete-fool erc-add-fool
 ;;;;;;  erc-delete-pal erc-add-pal) "erc-match" "erc/erc-match.el"
-;;;;;;  (17939 56021))
+;;;;;;  (17935 53318))
 ;;; Generated autoloads from erc/erc-match.el
  (autoload 'erc-match-mode "erc-match")
 
@@ -9433,14 +9433,14 @@
 
 ;;;***
 
-;;;### (autoloads nil "erc-menu" "erc/erc-menu.el" (17939 56021))
+;;;### (autoloads nil "erc-menu" "erc/erc-menu.el" (17935 53318))
 ;;; Generated autoloads from erc/erc-menu.el
  (autoload 'erc-menu-mode "erc-menu" nil t)
 
 ;;;***
 
 ;;;### (autoloads (erc-cmd-WHOLEFT) "erc-netsplit" "erc/erc-netsplit.el"
-;;;;;;  (17939 56021))
+;;;;;;  (17935 53318))
 ;;; Generated autoloads from erc/erc-netsplit.el
  (autoload 'erc-netsplit-mode "erc-netsplit")
 
@@ -9452,7 +9452,7 @@
 ;;;***
 
 ;;;### (autoloads (erc-server-select erc-determine-network) "erc-networks"
-;;;;;;  "erc/erc-networks.el" (17939 56021))
+;;;;;;  "erc/erc-networks.el" (17935 53318))
 ;;; Generated autoloads from erc/erc-networks.el
 
 (autoload (quote erc-determine-network) "erc-networks" "\
@@ -9470,7 +9470,7 @@
 ;;;***
 
 ;;;### (autoloads (pcomplete/erc-mode/NOTIFY erc-cmd-NOTIFY) "erc-notify"
-;;;;;;  "erc/erc-notify.el" (17939 56021))
+;;;;;;  "erc/erc-notify.el" (17935 53318))
 ;;; Generated autoloads from erc/erc-notify.el
  (autoload 'erc-notify-mode "erc-notify" nil t)
 
@@ -9488,33 +9488,33 @@
 
 ;;;***
 
-;;;### (autoloads nil "erc-page" "erc/erc-page.el" (17843 45616))
+;;;### (autoloads nil "erc-page" "erc/erc-page.el" (17842 54344))
 ;;; Generated autoloads from erc/erc-page.el
  (autoload 'erc-page-mode "erc-page")
 
 ;;;***
 
-;;;### (autoloads nil "erc-pcomplete" "erc/erc-pcomplete.el" (17939
-;;;;;;  56021))
+;;;### (autoloads nil "erc-pcomplete" "erc/erc-pcomplete.el" (17935
+;;;;;;  53318))
 ;;; Generated autoloads from erc/erc-pcomplete.el
  (autoload 'erc-completion-mode "erc-pcomplete" nil t)
 
 ;;;***
 
-;;;### (autoloads nil "erc-replace" "erc/erc-replace.el" (17843 45616))
+;;;### (autoloads nil "erc-replace" "erc/erc-replace.el" (17842 54344))
 ;;; Generated autoloads from erc/erc-replace.el
  (autoload 'erc-replace-mode "erc-replace")
 
 ;;;***
 
-;;;### (autoloads nil "erc-ring" "erc/erc-ring.el" (17939 56021))
+;;;### (autoloads nil "erc-ring" "erc/erc-ring.el" (17935 53318))
 ;;; Generated autoloads from erc/erc-ring.el
  (autoload 'erc-ring-mode "erc-ring" nil t)
 
 ;;;***
 
 ;;;### (autoloads (erc-nickserv-identify erc-nickserv-identify-mode)
-;;;;;;  "erc-services" "erc/erc-services.el" (17939 56021))
+;;;;;;  "erc-services" "erc/erc-services.el" (17935 53318))
 ;;; Generated autoloads from erc/erc-services.el
  (autoload 'erc-services-mode "erc-services" nil t)
 
@@ -9531,14 +9531,14 @@
 
 ;;;***
 
-;;;### (autoloads nil "erc-sound" "erc/erc-sound.el" (17843 45616))
+;;;### (autoloads nil "erc-sound" "erc/erc-sound.el" (17842 54344))
 ;;; Generated autoloads from erc/erc-sound.el
  (autoload 'erc-sound-mode "erc-sound")
 
 ;;;***
 
 ;;;### (autoloads (erc-speedbar-browser) "erc-speedbar" "erc/erc-speedbar.el"
-;;;;;;  (17939 56021))
+;;;;;;  (17935 53318))
 ;;; Generated autoloads from erc/erc-speedbar.el
 
 (autoload (quote erc-speedbar-browser) "erc-speedbar" "\
@@ -9549,26 +9549,26 @@
 
 ;;;***
 
-;;;### (autoloads nil "erc-spelling" "erc/erc-spelling.el" (17939
-;;;;;;  56021))
+;;;### (autoloads nil "erc-spelling" "erc/erc-spelling.el" (17935
+;;;;;;  53318))
 ;;; Generated autoloads from erc/erc-spelling.el
  (autoload 'erc-spelling-mode "erc-spelling" nil t)
 
 ;;;***
 
-;;;### (autoloads nil "erc-stamp" "erc/erc-stamp.el" (17939 56021))
+;;;### (autoloads nil "erc-stamp" "erc/erc-stamp.el" (17935 53318))
 ;;; Generated autoloads from erc/erc-stamp.el
  (autoload 'erc-timestamp-mode "erc-stamp" nil t)
 
 ;;;***
 
 ;;;### (autoloads (erc-track-minor-mode) "erc-track" "erc/erc-track.el"
-;;;;;;  (17939 56021))
+;;;;;;  (17935 53318))
 ;;; Generated autoloads from erc/erc-track.el
 
 (defvar erc-track-minor-mode nil "\
 Non-nil if Erc-Track minor mode is enabled.
-See the command `erc-track-minor-mode' for a description of this minor-mode.")
+See the command `erc-track-minor-mode' for a description of this minor mode.")
 
 (custom-autoload (quote erc-track-minor-mode) "erc-track" nil)
 
@@ -9586,7 +9586,7 @@
 ;;;***
 
 ;;;### (autoloads (erc-truncate-buffer erc-truncate-buffer-to-size)
-;;;;;;  "erc-truncate" "erc/erc-truncate.el" (17843 45616))
+;;;;;;  "erc-truncate" "erc/erc-truncate.el" (17842 54344))
 ;;; Generated autoloads from erc/erc-truncate.el
  (autoload 'erc-truncate-mode "erc-truncate" nil t)
 
@@ -9606,7 +9606,7 @@
 ;;;***
 
 ;;;### (autoloads (erc-xdcc-add-file) "erc-xdcc" "erc/erc-xdcc.el"
-;;;;;;  (17843 45616))
+;;;;;;  (17842 54344))
 ;;; Generated autoloads from erc/erc-xdcc.el
 
 (autoload (quote erc-xdcc-add-file) "erc-xdcc" "\
@@ -9616,8 +9616,8 @@
 
 ;;;***
 
-;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (17939
-;;;;;;  56021))
+;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (17914
+;;;;;;  52082))
 ;;; Generated autoloads from eshell/esh-mode.el
 
 (autoload (quote eshell-mode) "esh-mode" "\
@@ -9629,8 +9629,8 @@
 
 ;;;***
 
-;;;### (autoloads (eshell-test) "esh-test" "eshell/esh-test.el" (17843
-;;;;;;  45616))
+;;;### (autoloads (eshell-test) "esh-test" "eshell/esh-test.el" (17842
+;;;;;;  54411))
 ;;; Generated autoloads from eshell/esh-test.el
 
 (autoload (quote eshell-test) "esh-test" "\
@@ -9641,7 +9641,7 @@
 ;;;***
 
 ;;;### (autoloads (eshell-report-bug eshell-command-result eshell-command
-;;;;;;  eshell) "eshell" "eshell/eshell.el" (17843 45616))
+;;;;;;  eshell) "eshell" "eshell/eshell.el" (17842 54411))
 ;;; Generated autoloads from eshell/eshell.el
 
 (autoload (quote eshell) "eshell" "\
@@ -9687,7 +9687,7 @@
 ;;;;;;  visit-tags-table tags-table-mode find-tag-default-function
 ;;;;;;  find-tag-hook tags-add-tables tags-compression-info-list
 ;;;;;;  tags-table-list tags-case-fold-search) "etags" "progmodes/etags.el"
-;;;;;;  (17843 45627))
+;;;;;;  (17842 56333))
 ;;; Generated autoloads from progmodes/etags.el
 
 (defvar tags-file-name nil "\
@@ -9989,7 +9989,7 @@
 ;;;;;;  ethio-fidel-to-sera-buffer ethio-fidel-to-sera-region ethio-sera-to-fidel-marker
 ;;;;;;  ethio-sera-to-fidel-mail ethio-sera-to-fidel-mail-or-marker
 ;;;;;;  ethio-sera-to-fidel-buffer ethio-sera-to-fidel-region setup-ethiopic-environment-internal)
-;;;;;;  "ethio-util" "language/ethio-util.el" (17843 45620))
+;;;;;;  "ethio-util" "language/ethio-util.el" (17842 58278))
 ;;; Generated autoloads from language/ethio-util.el
 
 (autoload (quote setup-ethiopic-environment-internal) "ethio-util" "\
@@ -10184,7 +10184,7 @@
 
 ;;;### (autoloads (eudc-load-eudc eudc-query-form eudc-expand-inline
 ;;;;;;  eudc-get-phone eudc-get-email eudc-set-server) "eudc" "net/eudc.el"
-;;;;;;  (17843 45624))
+;;;;;;  (17842 55218))
 ;;; Generated autoloads from net/eudc.el
 
 (autoload (quote eudc-set-server) "eudc" "\
@@ -10240,7 +10240,7 @@
 
 ;;;### (autoloads (eudc-display-jpeg-as-button eudc-display-jpeg-inline
 ;;;;;;  eudc-display-sound eudc-display-mail eudc-display-url eudc-display-generic-binary)
-;;;;;;  "eudc-bob" "net/eudc-bob.el" (17843 45624))
+;;;;;;  "eudc-bob" "net/eudc-bob.el" (17842 55218))
 ;;; Generated autoloads from net/eudc-bob.el
 
 (autoload (quote eudc-display-generic-binary) "eudc-bob" "\
@@ -10276,7 +10276,7 @@
 ;;;***
 
 ;;;### (autoloads (eudc-try-bbdb-insert eudc-insert-record-at-point-into-bbdb)
-;;;;;;  "eudc-export" "net/eudc-export.el" (17843 45624))
+;;;;;;  "eudc-export" "net/eudc-export.el" (17842 55218))
 ;;; Generated autoloads from net/eudc-export.el
 
 (autoload (quote eudc-insert-record-at-point-into-bbdb) "eudc-export" "\
@@ -10293,7 +10293,7 @@
 ;;;***
 
 ;;;### (autoloads (eudc-edit-hotlist) "eudc-hotlist" "net/eudc-hotlist.el"
-;;;;;;  (17843 45624))
+;;;;;;  (17842 55218))
 ;;; Generated autoloads from net/eudc-hotlist.el
 
 (autoload (quote eudc-edit-hotlist) "eudc-hotlist" "\
@@ -10303,8 +10303,8 @@
 
 ;;;***
 
-;;;### (autoloads (ewoc-create) "ewoc" "emacs-lisp/ewoc.el" (17939
-;;;;;;  56021))
+;;;### (autoloads (ewoc-create) "ewoc" "emacs-lisp/ewoc.el" (17933
+;;;;;;  14283))
 ;;; Generated autoloads from emacs-lisp/ewoc.el
 
 (autoload (quote ewoc-create) "ewoc" "\
@@ -10333,7 +10333,7 @@
 ;;;### (autoloads (executable-make-buffer-file-executable-if-script-p
 ;;;;;;  executable-self-display executable-set-magic executable-interpret
 ;;;;;;  executable-command-find-posix-p) "executable" "progmodes/executable.el"
-;;;;;;  (17843 45627))
+;;;;;;  (17842 56333))
 ;;; Generated autoloads from progmodes/executable.el
 
 (autoload (quote executable-command-find-posix-p) "executable" "\
@@ -10376,7 +10376,7 @@
 
 ;;;### (autoloads (expand-jump-to-next-slot expand-jump-to-previous-slot
 ;;;;;;  expand-abbrev-hook expand-add-abbrevs) "expand" "expand.el"
-;;;;;;  (17939 56017))
+;;;;;;  (17925 52793))
 ;;; Generated autoloads from expand.el
 
 (autoload (quote expand-add-abbrevs) "expand" "\
@@ -10425,7 +10425,7 @@
 
 ;;;***
 
-;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (17843 45627))
+;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (17842 56333))
 ;;; Generated autoloads from progmodes/f90.el
 
 (autoload (quote f90-mode) "f90" "\
@@ -10492,7 +10492,7 @@
 ;;;;;;  facemenu-remove-all facemenu-remove-face-props facemenu-set-read-only
 ;;;;;;  facemenu-set-intangible facemenu-set-invisible facemenu-set-face-from-menu
 ;;;;;;  facemenu-set-background facemenu-set-foreground facemenu-set-face)
-;;;;;;  "facemenu" "facemenu.el" (17843 45610))
+;;;;;;  "facemenu" "facemenu.el" (17842 58279))
 ;;; Generated autoloads from facemenu.el
  (define-key global-map "\M-o" 'facemenu-keymap)
  (autoload 'facemenu-keymap "facemenu" "Keymap for face-changing commands." t 'keymap)
@@ -10661,7 +10661,7 @@
 
 ;;;### (autoloads (feedmail-queue-reminder feedmail-run-the-queue
 ;;;;;;  feedmail-run-the-queue-global-prompt feedmail-run-the-queue-no-prompts
-;;;;;;  feedmail-send-it) "feedmail" "mail/feedmail.el" (17939 56022))
+;;;;;;  feedmail-send-it) "feedmail" "mail/feedmail.el" (17888 29839))
 ;;; Generated autoloads from mail/feedmail.el
 
 (autoload (quote feedmail-send-it) "feedmail" "\
@@ -10715,7 +10715,7 @@
 ;;;***
 
 ;;;### (autoloads (ffap-bindings dired-at-point ffap-at-mouse ffap-menu
-;;;;;;  find-file-at-point ffap-next) "ffap" "ffap.el" (17943 51387))
+;;;;;;  find-file-at-point ffap-next) "ffap" "ffap.el" (17943 4602))
 ;;; Generated autoloads from ffap.el
 
 (autoload (quote ffap-next) "ffap" "\
@@ -10774,7 +10774,7 @@
 ;;;### (autoloads (file-cache-minibuffer-complete file-cache-add-directory-recursively
 ;;;;;;  file-cache-add-directory-using-locate file-cache-add-directory-using-find
 ;;;;;;  file-cache-add-file file-cache-add-directory-list file-cache-add-directory)
-;;;;;;  "filecache" "filecache.el" (17843 45610))
+;;;;;;  "filecache" "filecache.el" (17842 58279))
 ;;; Generated autoloads from filecache.el
 
 (autoload (quote file-cache-add-directory) "filecache" "\
@@ -10833,8 +10833,8 @@
 
 ;;;***
 
-;;;### (autoloads (filesets-init) "filesets" "filesets.el" (17843
-;;;;;;  45610))
+;;;### (autoloads (filesets-init) "filesets" "filesets.el" (17842
+;;;;;;  58279))
 ;;; Generated autoloads from filesets.el
 
 (autoload (quote filesets-init) "filesets" "\
@@ -10845,7 +10845,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "fill" "textmodes/fill.el" (17988 52354))
+;;;### (autoloads nil "fill" "textmodes/fill.el" (18007 39658))
 ;;; Generated autoloads from textmodes/fill.el
 (put 'colon-double-space 'safe-local-variable 'booleanp)
 
@@ -10853,7 +10853,7 @@
 
 ;;;### (autoloads (find-grep-dired find-name-dired find-dired find-grep-options
 ;;;;;;  find-ls-subdir-switches find-ls-option) "find-dired" "find-dired.el"
-;;;;;;  (17988 52353))
+;;;;;;  (17992 30877))
 ;;; Generated autoloads from find-dired.el
 
 (defvar find-ls-option (if (eq system-type (quote berkeley-unix)) (quote ("-ls" . "-gilsb")) (quote ("-exec ls -ld {} \\;" . "-ld"))) "\
@@ -10914,7 +10914,7 @@
 
 ;;;### (autoloads (ff-mouse-find-other-file-other-window ff-mouse-find-other-file
 ;;;;;;  ff-find-other-file ff-get-other-file) "find-file" "find-file.el"
-;;;;;;  (17843 45610))
+;;;;;;  (17842 58279))
 ;;; Generated autoloads from find-file.el
 
 (defvar ff-special-constructs (quote (("^#\\s *\\(include\\|import\\)\\s +[<\"]\\(.*\\)[>\"]" lambda nil (buffer-substring (match-beginning 2) (match-end 2))))) "\
@@ -11008,7 +11008,7 @@
 ;;;;;;  find-variable find-variable-noselect find-function-other-frame
 ;;;;;;  find-function-other-window find-function find-function-noselect
 ;;;;;;  find-function-search-for-symbol find-library) "find-func"
-;;;;;;  "emacs-lisp/find-func.el" (17843 45615))
+;;;;;;  "emacs-lisp/find-func.el" (17842 54152))
 ;;; Generated autoloads from emacs-lisp/find-func.el
 
 (autoload (quote find-library) "find-func" "\
@@ -11162,7 +11162,7 @@
 ;;;***
 
 ;;;### (autoloads (find-lisp-find-dired-filter find-lisp-find-dired-subdirectories
-;;;;;;  find-lisp-find-dired) "find-lisp" "find-lisp.el" (17939 56017))
+;;;;;;  find-lisp-find-dired) "find-lisp" "find-lisp.el" (17893 23802))
 ;;; Generated autoloads from find-lisp.el
 
 (autoload (quote find-lisp-find-dired) "find-lisp" "\
@@ -11183,7 +11183,7 @@
 ;;;***
 
 ;;;### (autoloads (finder-by-keyword finder-commentary finder-list-keywords)
-;;;;;;  "finder" "finder.el" (17843 45610))
+;;;;;;  "finder" "finder.el" (17842 58279))
 ;;; Generated autoloads from finder.el
 
 (autoload (quote finder-list-keywords) "finder" "\
@@ -11205,7 +11205,7 @@
 ;;;***
 
 ;;;### (autoloads (enable-flow-control-on enable-flow-control) "flow-ctrl"
-;;;;;;  "flow-ctrl.el" (17843 45610))
+;;;;;;  "flow-ctrl.el" (17842 58279))
 ;;; Generated autoloads from flow-ctrl.el
 
 (autoload (quote enable-flow-control) "flow-ctrl" "\
@@ -11227,7 +11227,7 @@
 ;;;***
 
 ;;;### (autoloads (fill-flowed fill-flowed-encode) "flow-fill" "gnus/flow-fill.el"
-;;;;;;  (17843 45616))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/flow-fill.el
 
 (autoload (quote fill-flowed-encode) "flow-fill" "\
@@ -11243,7 +11243,7 @@
 ;;;***
 
 ;;;### (autoloads (flymake-mode-off flymake-mode-on flymake-mode)
-;;;;;;  "flymake" "progmodes/flymake.el" (17939 56022))
+;;;;;;  "flymake" "progmodes/flymake.el" (17934 27588))
 ;;; Generated autoloads from progmodes/flymake.el
 
 (autoload (quote flymake-mode) "flymake" "\
@@ -11267,7 +11267,7 @@
 
 ;;;### (autoloads (flyspell-buffer flyspell-region flyspell-mode-off
 ;;;;;;  turn-off-flyspell turn-on-flyspell flyspell-mode flyspell-prog-mode)
-;;;;;;  "flyspell" "textmodes/flyspell.el" (17970 18176))
+;;;;;;  "flyspell" "textmodes/flyspell.el" (18006 55797))
 ;;; Generated autoloads from textmodes/flyspell.el
 
 (autoload (quote flyspell-prog-mode) "flyspell" "\
@@ -11336,7 +11336,7 @@
 
 ;;;### (autoloads (follow-delete-other-windows-and-split follow-mode
 ;;;;;;  turn-off-follow-mode turn-on-follow-mode) "follow" "follow.el"
-;;;;;;  (17843 45610))
+;;;;;;  (17842 58279))
 ;;; Generated autoloads from follow.el
 
 (autoload (quote turn-on-follow-mode) "follow" "\
@@ -11410,8 +11410,8 @@
 
 ;;;***
 
-;;;### (autoloads (footnote-mode) "footnote" "mail/footnote.el" (17955
-;;;;;;  48757))
+;;;### (autoloads (footnote-mode) "footnote" "mail/footnote.el" (17954
+;;;;;;  24686))
 ;;; Generated autoloads from mail/footnote.el
 
 (autoload (quote footnote-mode) "footnote" "\
@@ -11432,7 +11432,7 @@
 ;;;***
 
 ;;;### (autoloads (forms-find-file-other-window forms-find-file forms-mode)
-;;;;;;  "forms" "forms.el" (17843 45610))
+;;;;;;  "forms" "forms.el" (17842 58279))
 ;;; Generated autoloads from forms.el
 
 (autoload (quote forms-mode) "forms" "\
@@ -11469,7 +11469,7 @@
 ;;;***
 
 ;;;### (autoloads (fortran-mode fortran-tab-mode-default) "fortran"
-;;;;;;  "progmodes/fortran.el" (17843 45628))
+;;;;;;  "progmodes/fortran.el" (17842 56333))
 ;;; Generated autoloads from progmodes/fortran.el
 
 (defvar fortran-tab-mode-default nil "\
@@ -11555,7 +11555,7 @@
 ;;;***
 
 ;;;### (autoloads (fortune fortune-to-signature fortune-compile fortune-from-region
-;;;;;;  fortune-add-fortune) "fortune" "play/fortune.el" (17843 45625))
+;;;;;;  fortune-add-fortune) "fortune" "play/fortune.el" (17842 55395))
 ;;; Generated autoloads from play/fortune.el
 
 (autoload (quote fortune-add-fortune) "fortune" "\
@@ -11605,7 +11605,7 @@
 ;;;***
 
 ;;;### (autoloads (gdb-enable-debug gdba) "gdb-ui" "progmodes/gdb-ui.el"
-;;;;;;  (17941 5494))
+;;;;;;  (17941 38806))
 ;;; Generated autoloads from progmodes/gdb-ui.el
 
 (autoload (quote gdba) "gdb-ui" "\
@@ -11668,8 +11668,8 @@
 ;;;***
 
 ;;;### (autoloads (generic-make-keywords-list generic-mode generic-mode-internal
-;;;;;;  define-generic-mode) "generic" "emacs-lisp/generic.el" (17843
-;;;;;;  45615))
+;;;;;;  define-generic-mode) "generic" "emacs-lisp/generic.el" (17842
+;;;;;;  54152))
 ;;; Generated autoloads from emacs-lisp/generic.el
 
 (defvar generic-mode-list nil "\
@@ -11744,7 +11744,7 @@
 ;;;***
 
 ;;;### (autoloads (glasses-mode) "glasses" "progmodes/glasses.el"
-;;;;;;  (17843 45628))
+;;;;;;  (17842 56333))
 ;;; Generated autoloads from progmodes/glasses.el
 
 (autoload (quote glasses-mode) "glasses" "\
@@ -11757,7 +11757,7 @@
 ;;;***
 
 ;;;### (autoloads (gmm-tool-bar-from-list gmm-widget-p gmm-error
-;;;;;;  gmm-message) "gmm-utils" "gnus/gmm-utils.el" (17939 56021))
+;;;;;;  gmm-message) "gmm-utils" "gnus/gmm-utils.el" (17934 27588))
 ;;; Generated autoloads from gnus/gmm-utils.el
 
 (autoload (quote gmm-message) "gmm-utils" "\
@@ -11804,7 +11804,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus gnus-other-frame gnus-slave gnus-no-server
-;;;;;;  gnus-slave-no-server) "gnus" "gnus/gnus.el" (17843 45617))
+;;;;;;  gnus-slave-no-server) "gnus" "gnus/gnus.el" (17842 54741))
 ;;; Generated autoloads from gnus/gnus.el
 (when (fboundp 'custom-autoload)
  (custom-autoload 'gnus-select-method "gnus"))
@@ -11857,7 +11857,7 @@
 ;;;;;;  gnus-agent-get-undownloaded-list gnus-agent-delete-group
 ;;;;;;  gnus-agent-rename-group gnus-agent-possibly-save-gcc gnus-agentize
 ;;;;;;  gnus-slave-unplugged gnus-plugged gnus-unplugged) "gnus-agent"
-;;;;;;  "gnus/gnus-agent.el" (17843 45616))
+;;;;;;  "gnus/gnus-agent.el" (17842 54741))
 ;;; Generated autoloads from gnus/gnus-agent.el
 
 (autoload (quote gnus-unplugged) "gnus-agent" "\
@@ -11948,7 +11948,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-article-prepare-display) "gnus-art" "gnus/gnus-art.el"
-;;;;;;  (17959 36648))
+;;;;;;  (17960 49045))
 ;;; Generated autoloads from gnus/gnus-art.el
 
 (autoload (quote gnus-article-prepare-display) "gnus-art" "\
@@ -11959,7 +11959,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-audio-play) "gnus-audio" "gnus/gnus-audio.el"
-;;;;;;  (17843 45616))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/gnus-audio.el
 
 (autoload (quote gnus-audio-play) "gnus-audio" "\
@@ -11971,8 +11971,8 @@
 
 ;;;### (autoloads (gnus-cache-delete-group gnus-cache-rename-group
 ;;;;;;  gnus-cache-generate-nov-databases gnus-cache-generate-active
-;;;;;;  gnus-jog-cache) "gnus-cache" "gnus/gnus-cache.el" (17843
-;;;;;;  45616))
+;;;;;;  gnus-jog-cache) "gnus-cache" "gnus/gnus-cache.el" (17842
+;;;;;;  54741))
 ;;; Generated autoloads from gnus/gnus-cache.el
 
 (autoload (quote gnus-jog-cache) "gnus-cache" "\
@@ -12014,7 +12014,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-delay-initialize gnus-delay-send-queue gnus-delay-article)
-;;;;;;  "gnus-delay" "gnus/gnus-delay.el" (17843 45616))
+;;;;;;  "gnus-delay" "gnus/gnus-delay.el" (17842 54741))
 ;;; Generated autoloads from gnus/gnus-delay.el
 
 (autoload (quote gnus-delay-article) "gnus-delay" "\
@@ -12050,7 +12050,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-user-format-function-D gnus-user-format-function-d)
-;;;;;;  "gnus-diary" "gnus/gnus-diary.el" (17988 52353))
+;;;;;;  "gnus-diary" "gnus/gnus-diary.el" (17992 30878))
 ;;; Generated autoloads from gnus/gnus-diary.el
 
 (autoload (quote gnus-user-format-function-d) "gnus-diary" "\
@@ -12066,7 +12066,7 @@
 ;;;***
 
 ;;;### (autoloads (turn-on-gnus-dired-mode) "gnus-dired" "gnus/gnus-dired.el"
-;;;;;;  (17843 45616))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/gnus-dired.el
 
 (autoload (quote turn-on-gnus-dired-mode) "gnus-dired" "\
@@ -12077,7 +12077,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-draft-reminder) "gnus-draft" "gnus/gnus-draft.el"
-;;;;;;  (17843 45616))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/gnus-draft.el
 
 (autoload (quote gnus-draft-reminder) "gnus-draft" "\
@@ -12089,8 +12089,8 @@
 
 ;;;### (autoloads (gnus-convert-png-to-face gnus-convert-face-to-png
 ;;;;;;  gnus-face-from-file gnus-x-face-from-file gnus-insert-random-x-face-header
-;;;;;;  gnus-random-x-face) "gnus-fun" "gnus/gnus-fun.el" (17843
-;;;;;;  45616))
+;;;;;;  gnus-random-x-face) "gnus-fun" "gnus/gnus-fun.el" (17842
+;;;;;;  54741))
 ;;; Generated autoloads from gnus/gnus-fun.el
 
 (autoload (quote gnus-random-x-face) "gnus-fun" "\
@@ -12129,7 +12129,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-fetch-group-other-frame gnus-fetch-group)
-;;;;;;  "gnus-group" "gnus/gnus-group.el" (17843 45617))
+;;;;;;  "gnus-group" "gnus/gnus-group.el" (17842 54741))
 ;;; Generated autoloads from gnus/gnus-group.el
 
 (autoload (quote gnus-fetch-group) "gnus-group" "\
@@ -12146,7 +12146,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-batch-score) "gnus-kill" "gnus/gnus-kill.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/gnus-kill.el
 
 (defalias (quote gnus-batch-kill) (quote gnus-batch-score))
@@ -12161,7 +12161,7 @@
 
 ;;;### (autoloads (gnus-mailing-list-mode gnus-mailing-list-insinuate
 ;;;;;;  turn-on-gnus-mailing-list-mode) "gnus-ml" "gnus/gnus-ml.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/gnus-ml.el
 
 (autoload (quote turn-on-gnus-mailing-list-mode) "gnus-ml" "\
@@ -12186,7 +12186,7 @@
 
 ;;;### (autoloads (gnus-group-split-fancy gnus-group-split gnus-group-split-update
 ;;;;;;  gnus-group-split-setup) "gnus-mlspl" "gnus/gnus-mlspl.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/gnus-mlspl.el
 
 (autoload (quote gnus-group-split-setup) "gnus-mlspl" "\
@@ -12287,7 +12287,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-change-server) "gnus-move" "gnus/gnus-move.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/gnus-move.el
 
 (autoload (quote gnus-change-server) "gnus-move" "\
@@ -12299,7 +12299,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-button-reply gnus-button-mailto gnus-msg-mail)
-;;;;;;  "gnus-msg" "gnus/gnus-msg.el" (17949 5807))
+;;;;;;  "gnus-msg" "gnus/gnus-msg.el" (17949 41467))
 ;;; Generated autoloads from gnus/gnus-msg.el
 
 (autoload (quote gnus-msg-mail) "gnus-msg" "\
@@ -12324,7 +12324,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-nocem-load-cache gnus-nocem-scan-groups)
-;;;;;;  "gnus-nocem" "gnus/gnus-nocem.el" (17843 45617))
+;;;;;;  "gnus-nocem" "gnus/gnus-nocem.el" (17842 54741))
 ;;; Generated autoloads from gnus/gnus-nocem.el
 
 (autoload (quote gnus-nocem-scan-groups) "gnus-nocem" "\
@@ -12341,7 +12341,7 @@
 
 ;;;### (autoloads (gnus-treat-newsgroups-picon gnus-treat-mail-picon
 ;;;;;;  gnus-treat-from-picon) "gnus-picon" "gnus/gnus-picon.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/gnus-picon.el
 
 (autoload (quote gnus-treat-from-picon) "gnus-picon" "\
@@ -12368,7 +12368,7 @@
 ;;;;;;  gnus-sorted-nintersection gnus-sorted-range-intersection
 ;;;;;;  gnus-sorted-intersection gnus-intersection gnus-sorted-complement
 ;;;;;;  gnus-sorted-ndifference gnus-sorted-difference) "gnus-range"
-;;;;;;  "gnus/gnus-range.el" (17843 45617))
+;;;;;;  "gnus/gnus-range.el" (17842 54741))
 ;;; Generated autoloads from gnus/gnus-range.el
 
 (autoload (quote gnus-sorted-difference) "gnus-range" "\
@@ -12436,7 +12436,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-registry-install-hooks gnus-registry-initialize)
-;;;;;;  "gnus-registry" "gnus/gnus-registry.el" (17939 56021))
+;;;;;;  "gnus-registry" "gnus/gnus-registry.el" (17934 27588))
 ;;; Generated autoloads from gnus/gnus-registry.el
 
 (autoload (quote gnus-registry-initialize) "gnus-registry" "\
@@ -12452,8 +12452,8 @@
 ;;;***
 
 ;;;### (autoloads (gnus-sieve-article-add-rule gnus-sieve-generate
-;;;;;;  gnus-sieve-update) "gnus-sieve" "gnus/gnus-sieve.el" (17843
-;;;;;;  45617))
+;;;;;;  gnus-sieve-update) "gnus-sieve" "gnus/gnus-sieve.el" (17842
+;;;;;;  54741))
 ;;; Generated autoloads from gnus/gnus-sieve.el
 
 (autoload (quote gnus-sieve-update) "gnus-sieve" "\
@@ -12481,7 +12481,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-batch-brew-soup) "gnus-soup" "gnus/gnus-soup.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/gnus-soup.el
 
 (autoload (quote gnus-batch-brew-soup) "gnus-soup" "\
@@ -12501,7 +12501,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-update-format) "gnus-spec" "gnus/gnus-spec.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/gnus-spec.el
 
 (autoload (quote gnus-update-format) "gnus-spec" "\
@@ -12512,8 +12512,8 @@
 ;;;***
 
 ;;;### (autoloads (gnus-fixup-nnimap-unread-after-getting-new-news
-;;;;;;  gnus-declare-backend) "gnus-start" "gnus/gnus-start.el" (17843
-;;;;;;  45617))
+;;;;;;  gnus-declare-backend) "gnus-start" "gnus/gnus-start.el" (17842
+;;;;;;  54741))
 ;;; Generated autoloads from gnus/gnus-start.el
 
 (autoload (quote gnus-declare-backend) "gnus-start" "\
@@ -12529,7 +12529,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-add-configuration) "gnus-win" "gnus/gnus-win.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/gnus-win.el
 
 (autoload (quote gnus-add-configuration) "gnus-win" "\
@@ -12539,7 +12539,7 @@
 
 ;;;***
 
-;;;### (autoloads (gomoku) "gomoku" "play/gomoku.el" (17941 5494))
+;;;### (autoloads (gomoku) "gomoku" "play/gomoku.el" (17941 38806))
 ;;; Generated autoloads from play/gomoku.el
 
 (autoload (quote gomoku) "gomoku" "\
@@ -12566,7 +12566,7 @@
 ;;;***
 
 ;;;### (autoloads (goto-address goto-address-at-point) "goto-addr"
-;;;;;;  "net/goto-addr.el" (17843 45624))
+;;;;;;  "net/goto-addr.el" (17842 55218))
 ;;; Generated autoloads from net/goto-addr.el
 
 (define-obsolete-function-alias (quote goto-address-at-mouse) (quote goto-address-at-point) "22.1")
@@ -12596,7 +12596,7 @@
 
 ;;;### (autoloads (rgrep lgrep grep-find grep grep-mode grep-compute-defaults
 ;;;;;;  grep-process-setup grep-setup-hook grep-find-command grep-command
-;;;;;;  grep-window-height) "grep" "progmodes/grep.el" (17943 52506))
+;;;;;;  grep-window-height) "grep" "progmodes/grep.el" (17944 20144))
 ;;; Generated autoloads from progmodes/grep.el
 
 (defvar grep-window-height nil "\
@@ -12736,7 +12736,7 @@
 
 ;;;***
 
-;;;### (autoloads (gs-load-image) "gs" "gs.el" (17843 45610))
+;;;### (autoloads (gs-load-image) "gs" "gs.el" (17842 58279))
 ;;; Generated autoloads from gs.el
 
 (autoload (quote gs-load-image) "gs" "\
@@ -12750,7 +12750,7 @@
 ;;;***
 
 ;;;### (autoloads (gdb-script-mode jdb pdb perldb xdb dbx sdb gdb)
-;;;;;;  "gud" "progmodes/gud.el" (17988 52353))
+;;;;;;  "gud" "progmodes/gud.el" (17992 30878))
 ;;; Generated autoloads from progmodes/gud.el
 
 (autoload (quote gdb) "gud" "\
@@ -12833,8 +12833,8 @@
 
 ;;;***
 
-;;;### (autoloads (handwrite) "handwrite" "play/handwrite.el" (17843
-;;;;;;  45626))
+;;;### (autoloads (handwrite) "handwrite" "play/handwrite.el" (17842
+;;;;;;  55395))
 ;;; Generated autoloads from play/handwrite.el
 
 (autoload (quote handwrite) "handwrite" "\
@@ -12852,7 +12852,7 @@
 ;;;***
 
 ;;;### (autoloads (hanoi-unix-64 hanoi-unix hanoi) "hanoi" "play/hanoi.el"
-;;;;;;  (17743 18144))
+;;;;;;  (17742 40275))
 ;;; Generated autoloads from play/hanoi.el
 
 (autoload (quote hanoi) "hanoi" "\
@@ -12882,7 +12882,7 @@
 ;;;### (autoloads (scan-buf-previous-region scan-buf-next-region
 ;;;;;;  scan-buf-move-to-region help-at-pt-display-when-idle help-at-pt-set-timer
 ;;;;;;  help-at-pt-cancel-timer display-local-help help-at-pt-kbd-string
-;;;;;;  help-at-pt-string) "help-at-pt" "help-at-pt.el" (17843 45610))
+;;;;;;  help-at-pt-string) "help-at-pt" "help-at-pt.el" (17842 58279))
 ;;; Generated autoloads from help-at-pt.el
 
 (autoload (quote help-at-pt-string) "help-at-pt" "\
@@ -13012,7 +13012,7 @@
 ;;;### (autoloads (describe-categories describe-syntax describe-variable
 ;;;;;;  variable-at-point describe-function-1 describe-simplify-lib-file-name
 ;;;;;;  help-C-file-name describe-function) "help-fns" "help-fns.el"
-;;;;;;  (17939 56017))
+;;;;;;  (17845 46651))
 ;;; Generated autoloads from help-fns.el
 
 (autoload (quote describe-function) "help-fns" "\
@@ -13069,7 +13069,7 @@
 ;;;***
 
 ;;;### (autoloads (three-step-help) "help-macro" "help-macro.el"
-;;;;;;  (17843 45610))
+;;;;;;  (17842 58279))
 ;;; Generated autoloads from help-macro.el
 
 (defvar three-step-help nil "\
@@ -13085,7 +13085,7 @@
 
 ;;;### (autoloads (help-xref-on-pp help-insert-xref-button help-xref-button
 ;;;;;;  help-make-xrefs help-setup-xref help-mode-finish help-mode-setup
-;;;;;;  help-mode) "help-mode" "help-mode.el" (17843 45610))
+;;;;;;  help-mode) "help-mode" "help-mode.el" (17842 58279))
 ;;; Generated autoloads from help-mode.el
 
 (autoload (quote help-mode) "help-mode" "\
@@ -13168,7 +13168,7 @@
 ;;;***
 
 ;;;### (autoloads (Helper-help Helper-describe-bindings) "helper"
-;;;;;;  "emacs-lisp/helper.el" (17843 45615))
+;;;;;;  "emacs-lisp/helper.el" (17842 54152))
 ;;; Generated autoloads from emacs-lisp/helper.el
 
 (autoload (quote Helper-describe-bindings) "helper" "\
@@ -13184,7 +13184,7 @@
 ;;;***
 
 ;;;### (autoloads (hexlify-buffer hexl-find-file hexl-mode) "hexl"
-;;;;;;  "hexl.el" (17844 62922))
+;;;;;;  "hexl.el" (17844 53657))
 ;;; Generated autoloads from hexl.el
 
 (autoload (quote hexl-mode) "hexl" "\
@@ -13281,7 +13281,7 @@
 ;;;### (autoloads (hi-lock-write-interactive-patterns hi-lock-unface-buffer
 ;;;;;;  hi-lock-face-phrase-buffer hi-lock-face-buffer hi-lock-line-face-buffer
 ;;;;;;  global-hi-lock-mode hi-lock-mode) "hi-lock" "hi-lock.el"
-;;;;;;  (17970 17147))
+;;;;;;  (17992 30877))
 ;;; Generated autoloads from hi-lock.el
 
 (autoload (quote hi-lock-mode) "hi-lock" "\
@@ -13411,7 +13411,7 @@
 ;;;***
 
 ;;;### (autoloads (hide-ifdef-lines hide-ifdef-read-only hide-ifdef-initially
-;;;;;;  hide-ifdef-mode) "hideif" "progmodes/hideif.el" (17843 45628))
+;;;;;;  hide-ifdef-mode) "hideif" "progmodes/hideif.el" (17842 56333))
 ;;; Generated autoloads from progmodes/hideif.el
 
 (autoload (quote hide-ifdef-mode) "hideif" "\
@@ -13466,7 +13466,7 @@
 ;;;***
 
 ;;;### (autoloads (turn-off-hideshow hs-minor-mode) "hideshow" "progmodes/hideshow.el"
-;;;;;;  (17939 56022))
+;;;;;;  (17934 43341))
 ;;; Generated autoloads from progmodes/hideshow.el
 
 (defvar hs-special-modes-alist (quote ((c-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning) (c++-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning) (bibtex-mode ("^@\\S(*\\(\\s(\\)" 1)) (java-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning))) "\
@@ -13529,7 +13529,7 @@
 ;;;;;;  highlight-compare-buffers highlight-changes-rotate-faces
 ;;;;;;  highlight-changes-previous-change highlight-changes-next-change
 ;;;;;;  highlight-changes-mode highlight-changes-remove-highlight)
-;;;;;;  "hilit-chg" "hilit-chg.el" (17843 45610))
+;;;;;;  "hilit-chg" "hilit-chg.el" (17842 58279))
 ;;; Generated autoloads from hilit-chg.el
 
 (autoload (quote highlight-changes-remove-highlight) "hilit-chg" "\
@@ -13659,7 +13659,7 @@
 ;;;;;;  hippie-expand-ignore-buffers hippie-expand-max-buffers hippie-expand-no-restriction
 ;;;;;;  hippie-expand-dabbrev-as-symbol hippie-expand-dabbrev-skip-space
 ;;;;;;  hippie-expand-verbose hippie-expand-try-functions-list) "hippie-exp"
-;;;;;;  "hippie-exp.el" (17843 45610))
+;;;;;;  "hippie-exp.el" (17842 58279))
 ;;; Generated autoloads from hippie-exp.el
 
 (defvar hippie-expand-try-functions-list (quote (try-complete-file-name-partially try-complete-file-name try-expand-all-abbrevs try-expand-list try-expand-line try-expand-dabbrev try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-lisp-symbol-partially try-complete-lisp-symbol)) "\
@@ -13732,7 +13732,7 @@
 ;;;***
 
 ;;;### (autoloads (global-hl-line-mode hl-line-mode) "hl-line" "hl-line.el"
-;;;;;;  (17843 45610))
+;;;;;;  (17842 58279))
 ;;; Generated autoloads from hl-line.el
 
 (autoload (quote hl-line-mode) "hl-line" "\
@@ -13754,7 +13754,7 @@
 
 (defvar global-hl-line-mode nil "\
 Non-nil if Global-Hl-Line mode is enabled.
-See the command `global-hl-line-mode' for a description of this minor-mode.
+See the command `global-hl-line-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `global-hl-line-mode'.")
@@ -13773,7 +13773,7 @@
 ;;;***
 
 ;;;### (autoloads (list-holidays holidays) "holidays" "calendar/holidays.el"
-;;;;;;  (17956 60684))
+;;;;;;  (17956 13479))
 ;;; Generated autoloads from calendar/holidays.el
 
 (autoload (quote holidays) "holidays" "\
@@ -13809,8 +13809,8 @@
 
 ;;;***
 
-;;;### (autoloads (html2text) "html2text" "gnus/html2text.el" (17843
-;;;;;;  45617))
+;;;### (autoloads (html2text) "html2text" "gnus/html2text.el" (17842
+;;;;;;  54741))
 ;;; Generated autoloads from gnus/html2text.el
 
 (autoload (quote html2text) "html2text" "\
@@ -13842,7 +13842,7 @@
 ;;;;;;  ibuffer-backward-filter-group ibuffer-forward-filter-group
 ;;;;;;  ibuffer-toggle-filter-group ibuffer-mouse-toggle-filter-group
 ;;;;;;  ibuffer-interactive-filter-by-mode ibuffer-mouse-filter-by-mode
-;;;;;;  ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" (17843 45610))
+;;;;;;  ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" (17842 58279))
 ;;; Generated autoloads from ibuf-ext.el
 
 (autoload (quote ibuffer-auto-mode) "ibuf-ext" "\
@@ -14208,8 +14208,8 @@
 ;;;***
 
 ;;;### (autoloads (define-ibuffer-filter define-ibuffer-op define-ibuffer-sorter
-;;;;;;  define-ibuffer-column) "ibuf-macs" "ibuf-macs.el" (17843
-;;;;;;  45610))
+;;;;;;  define-ibuffer-column) "ibuf-macs" "ibuf-macs.el" (17842
+;;;;;;  58279))
 ;;; Generated autoloads from ibuf-macs.el
 
 (autoload (quote define-ibuffer-column) "ibuf-macs" "\
@@ -14298,7 +14298,7 @@
 ;;;***
 
 ;;;### (autoloads (ibuffer ibuffer-other-window ibuffer-list-buffers)
-;;;;;;  "ibuffer" "ibuffer.el" (17843 45610))
+;;;;;;  "ibuffer" "ibuffer.el" (17842 58279))
 ;;; Generated autoloads from ibuffer.el
 
 (autoload (quote ibuffer-list-buffers) "ibuffer" "\
@@ -14339,7 +14339,7 @@
 
 ;;;### (autoloads (icalendar-import-buffer icalendar-import-file
 ;;;;;;  icalendar-export-region icalendar-export-file) "icalendar"
-;;;;;;  "calendar/icalendar.el" (17939 56021))
+;;;;;;  "calendar/icalendar.el" (17921 16827))
 ;;; Generated autoloads from calendar/icalendar.el
 
 (autoload (quote icalendar-export-file) "icalendar" "\
@@ -14391,13 +14391,13 @@
 
 ;;;***
 
-;;;### (autoloads (icomplete-mode) "icomplete" "icomplete.el" (17939
-;;;;;;  56017))
+;;;### (autoloads (icomplete-mode) "icomplete" "icomplete.el" (17907
+;;;;;;  1407))
 ;;; Generated autoloads from icomplete.el
 
 (defvar icomplete-mode nil "\
 Non-nil if Icomplete mode is enabled.
-See the command `icomplete-mode' for a description of this minor-mode.
+See the command `icomplete-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `icomplete-mode'.")
@@ -14412,7 +14412,7 @@
 
 ;;;***
 
-;;;### (autoloads (icon-mode) "icon" "progmodes/icon.el" (17843 45628))
+;;;### (autoloads (icon-mode) "icon" "progmodes/icon.el" (17842 56333))
 ;;; Generated autoloads from progmodes/icon.el
 
 (autoload (quote icon-mode) "icon" "\
@@ -14453,7 +14453,7 @@
 ;;;***
 
 ;;;### (autoloads (idlwave-shell) "idlw-shell" "progmodes/idlw-shell.el"
-;;;;;;  (17966 9916))
+;;;;;;  (17965 23638))
 ;;; Generated autoloads from progmodes/idlw-shell.el
 
 (autoload (quote idlwave-shell) "idlw-shell" "\
@@ -14479,7 +14479,7 @@
 ;;;***
 
 ;;;### (autoloads (idlwave-mode) "idlwave" "progmodes/idlwave.el"
-;;;;;;  (17970 17147))
+;;;;;;  (17992 30878))
 ;;; Generated autoloads from progmodes/idlwave.el
 
 (autoload (quote idlwave-mode) "idlwave" "\
@@ -14614,8 +14614,8 @@
 ;;;;;;  ido-find-alternate-file ido-find-file-other-window ido-find-file
 ;;;;;;  ido-find-file-in-dir ido-switch-buffer-other-frame ido-insert-buffer
 ;;;;;;  ido-kill-buffer ido-display-buffer ido-switch-buffer-other-window
-;;;;;;  ido-switch-buffer ido-mode ido-mode) "ido" "ido.el" (17966
-;;;;;;  9915))
+;;;;;;  ido-switch-buffer ido-mode ido-mode) "ido" "ido.el" (17963
+;;;;;;  25911))
 ;;; Generated autoloads from ido.el
 
 (defvar ido-mode nil "\
@@ -14876,7 +14876,7 @@
 
 ;;;***
 
-;;;### (autoloads (ielm) "ielm" "ielm.el" (17843 45610))
+;;;### (autoloads (ielm) "ielm" "ielm.el" (17842 58279))
 ;;; Generated autoloads from ielm.el
  (add-hook 'same-window-buffer-names "*ielm*")
 
@@ -14889,7 +14889,7 @@
 ;;;***
 
 ;;;### (autoloads (iimage-mode turn-on-iimage-mode) "iimage" "iimage.el"
-;;;;;;  (17843 45610))
+;;;;;;  (17842 58279))
 ;;; Generated autoloads from iimage.el
 
 (autoload (quote turn-on-iimage-mode) "iimage" "\
@@ -14908,7 +14908,7 @@
 ;;;;;;  insert-image put-image create-image image-type-auto-detected-p
 ;;;;;;  image-type-available-p image-type image-type-from-file-name
 ;;;;;;  image-type-from-file-header image-type-from-buffer image-type-from-data)
-;;;;;;  "image" "image.el" (17939 56017))
+;;;;;;  "image" "image.el" (17868 42568))
 ;;; Generated autoloads from image.el
 
 (autoload (quote image-type-from-data) "image" "\
@@ -15089,7 +15089,7 @@
 ;;;;;;  image-dired-jump-thumbnail-buffer image-dired-delete-tag
 ;;;;;;  image-dired-tag-files image-dired-show-all-from-dir image-dired-display-thumbs
 ;;;;;;  image-dired-dired-with-window-configuration image-dired-dired-insert-marked-thumbs)
-;;;;;;  "image-dired" "image-dired.el" (17988 52353))
+;;;;;;  "image-dired" "image-dired.el" (17992 30877))
 ;;; Generated autoloads from image-dired.el
 
 (autoload (quote image-dired-dired-insert-marked-thumbs) "image-dired" "\
@@ -15223,7 +15223,7 @@
 
 ;;;### (autoloads (auto-image-file-mode insert-image-file image-file-name-regexp
 ;;;;;;  image-file-name-regexps image-file-name-extensions) "image-file"
-;;;;;;  "image-file.el" (17843 45610))
+;;;;;;  "image-file.el" (17842 58279))
 ;;; Generated autoloads from image-file.el
 
 (defvar image-file-name-extensions (quote ("png" "jpeg" "jpg" "gif" "tiff" "tif" "xbm" "xpm" "pbm" "pgm" "ppm" "pnm")) "\
@@ -15264,7 +15264,7 @@
 
 (defvar auto-image-file-mode nil "\
 Non-nil if Auto-Image-File mode is enabled.
-See the command `auto-image-file-mode' for a description of this minor-mode.
+See the command `auto-image-file-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `auto-image-file-mode'.")
@@ -15285,7 +15285,7 @@
 ;;;***
 
 ;;;### (autoloads (image-mode-maybe image-minor-mode image-mode)
-;;;;;;  "image-mode" "image-mode.el" (17943 53704))
+;;;;;;  "image-mode" "image-mode.el" (17868 42581))
 ;;; Generated autoloads from image-mode.el
  (push '("\\.jpe?g\\'"    . image-mode) auto-mode-alist)
  (push '("\\.png\\'"      . image-mode) auto-mode-alist)
@@ -15323,7 +15323,7 @@
 ;;;***
 
 ;;;### (autoloads (imenu imenu-add-menubar-index imenu-add-to-menubar
-;;;;;;  imenu-sort-function) "imenu" "imenu.el" (17843 45610))
+;;;;;;  imenu-sort-function) "imenu" "imenu.el" (17842 58279))
 ;;; Generated autoloads from imenu.el
 
 (defvar imenu-sort-function nil "\
@@ -15438,7 +15438,7 @@
 
 ;;;### (autoloads (indian-char-glyph indian-glyph-char in-is13194-pre-write-conversion
 ;;;;;;  in-is13194-post-read-conversion indian-compose-string indian-compose-region)
-;;;;;;  "ind-util" "language/ind-util.el" (17843 45620))
+;;;;;;  "ind-util" "language/ind-util.el" (17842 58278))
 ;;; Generated autoloads from language/ind-util.el
 
 (autoload (quote indian-compose-region) "ind-util" "\
@@ -15481,7 +15481,7 @@
 
 ;;;### (autoloads (inferior-lisp inferior-lisp-prompt inferior-lisp-load-command
 ;;;;;;  inferior-lisp-program inferior-lisp-filter-regexp) "inf-lisp"
-;;;;;;  "progmodes/inf-lisp.el" (17843 45628))
+;;;;;;  "progmodes/inf-lisp.el" (17842 56332))
 ;;; Generated autoloads from progmodes/inf-lisp.el
 
 (defvar inferior-lisp-filter-regexp "\\`\\s *\\(:\\(\\w\\|\\s_\\)\\)?\\s *\\'" "\
@@ -15548,7 +15548,7 @@
 ;;;### (autoloads (Info-speedbar-browser Info-goto-emacs-key-command-node
 ;;;;;;  Info-goto-emacs-command-node Info-mode info-apropos Info-index
 ;;;;;;  Info-directory Info-on-current-buffer info-standalone info-emacs-manual
-;;;;;;  info info-other-window) "info" "info.el" (17995 6542))
+;;;;;;  info info-other-window) "info" "info.el" (18006 55795))
 ;;; Generated autoloads from info.el
 
 (autoload (quote info-other-window) "info" "\
@@ -15714,7 +15714,7 @@
 
 ;;;### (autoloads (info-complete-file info-complete-symbol info-lookup-file
 ;;;;;;  info-lookup-symbol info-lookup-reset) "info-look" "info-look.el"
-;;;;;;  (17939 56017))
+;;;;;;  (17878 61008))
 ;;; Generated autoloads from info-look.el
 
 (autoload (quote info-lookup-reset) "info-look" "\
@@ -15762,7 +15762,7 @@
 ;;;***
 
 ;;;### (autoloads (info-xref-check-all-custom info-xref-check-all
-;;;;;;  info-xref-check) "info-xref" "info-xref.el" (17843 45610))
+;;;;;;  info-xref-check) "info-xref" "info-xref.el" (17842 58279))
 ;;; Generated autoloads from info-xref.el
 
 (autoload (quote info-xref-check) "info-xref" "\
@@ -15789,7 +15789,7 @@
 ;;;***
 
 ;;;### (autoloads (batch-info-validate Info-validate Info-split Info-tagify)
-;;;;;;  "informat" "informat.el" (17843 45610))
+;;;;;;  "informat" "informat.el" (17842 58279))
 ;;; Generated autoloads from informat.el
 
 (autoload (quote Info-tagify) "informat" "\
@@ -15830,7 +15830,7 @@
 
 ;;;### (autoloads (isearch-process-search-multibyte-characters isearch-toggle-input-method
 ;;;;;;  isearch-toggle-specified-input-method) "isearch-x" "international/isearch-x.el"
-;;;;;;  (17939 56022))
+;;;;;;  (17903 2305))
 ;;; Generated autoloads from international/isearch-x.el
 
 (autoload (quote isearch-toggle-specified-input-method) "isearch-x" "\
@@ -15850,8 +15850,8 @@
 
 ;;;***
 
-;;;### (autoloads (isearchb-activate) "isearchb" "isearchb.el" (17939
-;;;;;;  56017))
+;;;### (autoloads (isearchb-activate) "isearchb" "isearchb.el" (17918
+;;;;;;  44913))
 ;;; Generated autoloads from isearchb.el
 
 (autoload (quote isearchb-activate) "isearchb" "\
@@ -15867,7 +15867,7 @@
 ;;;### (autoloads (iso-cvt-define-menu iso-cvt-write-only iso-cvt-read-only
 ;;;;;;  iso-sgml2iso iso-iso2sgml iso-iso2duden iso-iso2gtex iso-gtex2iso
 ;;;;;;  iso-tex2iso iso-iso2tex iso-german iso-spanish) "iso-cvt"
-;;;;;;  "international/iso-cvt.el" (17988 52353))
+;;;;;;  "international/iso-cvt.el" (17992 30878))
 ;;; Generated autoloads from international/iso-cvt.el
 
 (autoload (quote iso-spanish) "iso-cvt" "\
@@ -15951,7 +15951,7 @@
 ;;;***
 
 ;;;### (autoloads nil "iso-transl" "international/iso-transl.el"
-;;;;;;  (17843 45618))
+;;;;;;  (17842 54888))
 ;;; Generated autoloads from international/iso-transl.el
  (or key-translation-map (setq key-translation-map (make-sparse-keymap)))
  (define-key key-translation-map "\C-x8" 'iso-transl-ctl-x-8-map)
@@ -15964,7 +15964,7 @@
 ;;;;;;  ispell-region ispell-change-dictionary ispell-kill-ispell
 ;;;;;;  ispell-help ispell-pdict-save ispell-word ispell-local-dictionary-alist
 ;;;;;;  ispell-personal-dictionary) "ispell" "textmodes/ispell.el"
-;;;;;;  (17996 37926))
+;;;;;;  (18006 55797))
 ;;; Generated autoloads from textmodes/ispell.el
 (put 'ispell-check-comments 'safe-local-variable (lambda (a) (memq a '(nil t exclusive))))
 
@@ -16251,13 +16251,13 @@
 
 ;;;***
 
-;;;### (autoloads (iswitchb-mode) "iswitchb" "iswitchb.el" (17827
-;;;;;;  37446))
+;;;### (autoloads (iswitchb-mode) "iswitchb" "iswitchb.el" (17819
+;;;;;;  9451))
 ;;; Generated autoloads from iswitchb.el
 
 (defvar iswitchb-mode nil "\
 Non-nil if Iswitchb mode is enabled.
-See the command `iswitchb-mode' for a description of this minor-mode.
+See the command `iswitchb-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `iswitchb-mode'.")
@@ -16277,7 +16277,7 @@
 ;;;### (autoloads (read-hiragana-string japanese-zenkaku-region japanese-hankaku-region
 ;;;;;;  japanese-hiragana-region japanese-katakana-region japanese-zenkaku
 ;;;;;;  japanese-hankaku japanese-hiragana japanese-katakana setup-japanese-environment-internal)
-;;;;;;  "japan-util" "language/japan-util.el" (17843 45620))
+;;;;;;  "japan-util" "language/japan-util.el" (17842 58278))
 ;;; Generated autoloads from language/japan-util.el
 
 (autoload (quote setup-japanese-environment-internal) "japan-util" "\
@@ -16355,7 +16355,7 @@
 ;;;***
 
 ;;;### (autoloads (jka-compr-uninstall jka-compr-handler) "jka-compr"
-;;;;;;  "jka-compr.el" (17939 56017))
+;;;;;;  "jka-compr.el" (17853 24893))
 ;;; Generated autoloads from jka-compr.el
 
 (defvar jka-compr-inhibit nil "\
@@ -16380,7 +16380,7 @@
 
 ;;;### (autoloads (keypad-setup keypad-numlock-shifted-setup keypad-shifted-setup
 ;;;;;;  keypad-numlock-setup keypad-setup) "keypad" "emulation/keypad.el"
-;;;;;;  (17838 18033))
+;;;;;;  (17833 41203))
 ;;; Generated autoloads from emulation/keypad.el
 
 (defvar keypad-setup nil "\
@@ -16436,7 +16436,7 @@
 ;;;***
 
 ;;;### (autoloads (kinsoku) "kinsoku" "international/kinsoku.el"
-;;;;;;  (17843 45618))
+;;;;;;  (17842 54888))
 ;;; Generated autoloads from international/kinsoku.el
 
 (autoload (quote kinsoku) "kinsoku" "\
@@ -16457,8 +16457,8 @@
 
 ;;;***
 
-;;;### (autoloads (kkc-region) "kkc" "international/kkc.el" (17843
-;;;;;;  45618))
+;;;### (autoloads (kkc-region) "kkc" "international/kkc.el" (17842
+;;;;;;  54888))
 ;;; Generated autoloads from international/kkc.el
 
 (defvar kkc-after-update-conversion-functions nil "\
@@ -16483,7 +16483,7 @@
 ;;;### (autoloads (kmacro-end-call-mouse kmacro-end-and-call-macro
 ;;;;;;  kmacro-end-or-call-macro kmacro-start-macro-or-insert-counter
 ;;;;;;  kmacro-call-macro kmacro-end-macro kmacro-start-macro) "kmacro"
-;;;;;;  "kmacro.el" (17838 18033))
+;;;;;;  "kmacro.el" (17833 41350))
 ;;; Generated autoloads from kmacro.el
  (global-set-key "\C-x(" 'kmacro-start-macro)
  (global-set-key "\C-x)" 'kmacro-end-macro)
@@ -16590,7 +16590,7 @@
 
 ;;;### (autoloads (kannada-post-read-conversion kannada-compose-string
 ;;;;;;  kannada-compose-region) "knd-util" "language/knd-util.el"
-;;;;;;  (17843 45620))
+;;;;;;  (17842 58278))
 ;;; Generated autoloads from language/knd-util.el
 
 (defconst kannada-consonant "[\x51f75-\x51fb9]")
@@ -16613,7 +16613,7 @@
 ;;;***
 
 ;;;### (autoloads (setup-korean-environment-internal) "korea-util"
-;;;;;;  "language/korea-util.el" (17843 45620))
+;;;;;;  "language/korea-util.el" (17842 58278))
 ;;; Generated autoloads from language/korea-util.el
 
 (defvar default-korean-keyboard (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") "")) "3" "") "\
@@ -16628,7 +16628,7 @@
 ;;;***
 
 ;;;### (autoloads (lm lm-test-run) "landmark" "play/landmark.el"
-;;;;;;  (17941 5494))
+;;;;;;  (17941 38806))
 ;;; Generated autoloads from play/landmark.el
 
 (defalias (quote landmark-repeat) (quote lm-test-run))
@@ -16662,8 +16662,8 @@
 
 ;;;### (autoloads (lao-compose-region lao-composition-function lao-post-read-conversion
 ;;;;;;  lao-transcribe-roman-to-lao-string lao-transcribe-single-roman-syllable-to-lao
-;;;;;;  lao-compose-string) "lao-util" "language/lao-util.el" (17843
-;;;;;;  45620))
+;;;;;;  lao-compose-string) "lao-util" "language/lao-util.el" (17842
+;;;;;;  58278))
 ;;; Generated autoloads from language/lao-util.el
 
 (autoload (quote lao-compose-string) "lao-util" "\
@@ -16712,7 +16712,7 @@
 
 ;;;### (autoloads (latexenc-find-file-coding-system latexenc-coding-system-to-inputenc
 ;;;;;;  latexenc-inputenc-to-coding-system latex-inputenc-coding-alist)
-;;;;;;  "latexenc" "international/latexenc.el" (17843 45618))
+;;;;;;  "latexenc" "international/latexenc.el" (17842 54888))
 ;;; Generated autoloads from international/latexenc.el
 
 (defvar latex-inputenc-coding-alist (quote (("ansinew" . windows-1252) ("applemac" . mac-roman) ("ascii" . us-ascii) ("cp1250" . windows-1250) ("cp1252" . windows-1252) ("cp1257" . cp1257) ("cp437de" . cp437) ("cp437" . cp437) ("cp850" . cp850) ("cp852" . cp852) ("cp858" . cp858) ("cp865" . cp865) ("latin1" . iso-8859-1) ("latin2" . iso-8859-2) ("latin3" . iso-8859-3) ("latin4" . iso-8859-4) ("latin5" . iso-8859-5) ("latin9" . iso-8859-15) ("next" . next) ("utf8" . utf-8) ("utf8x" . utf-8))) "\
@@ -16744,7 +16744,7 @@
 ;;;***
 
 ;;;### (autoloads (latin1-display-ucs-per-lynx latin1-display latin1-display)
-;;;;;;  "latin1-disp" "international/latin1-disp.el" (17939 56022))
+;;;;;;  "latin1-disp" "international/latin1-disp.el" (17874 62081))
 ;;; Generated autoloads from international/latin1-disp.el
 
 (defvar latin1-display nil "\
@@ -16788,7 +16788,7 @@
 ;;;***
 
 ;;;### (autoloads (ld-script-mode) "ld-script" "progmodes/ld-script.el"
-;;;;;;  (17843 45628))
+;;;;;;  (17842 56332))
 ;;; Generated autoloads from progmodes/ld-script.el
 
 (add-to-list (quote auto-mode-alist) (quote ("\\.ld[si]?\\>" . ld-script-mode)))
@@ -16803,7 +16803,7 @@
 ;;;***
 
 ;;;### (autoloads (ledit-from-lisp-mode ledit-mode) "ledit" "ledit.el"
-;;;;;;  (17843 45610))
+;;;;;;  (17842 58279))
 ;;; Generated autoloads from ledit.el
 
 (defconst ledit-save-files t "\
@@ -16838,7 +16838,7 @@
 
 ;;;***
 
-;;;### (autoloads (life) "life" "play/life.el" (17843 45626))
+;;;### (autoloads (life) "life" "play/life.el" (17842 55395))
 ;;; Generated autoloads from play/life.el
 
 (autoload (quote life) "life" "\
@@ -16852,7 +16852,7 @@
 ;;;***
 
 ;;;### (autoloads (unload-feature) "loadhist" "loadhist.el" (17942
-;;;;;;  34668))
+;;;;;;  63381))
 ;;; Generated autoloads from loadhist.el
 
 (autoload (quote unload-feature) "loadhist" "\
@@ -16875,7 +16875,7 @@
 ;;;***
 
 ;;;### (autoloads (locate-with-filter locate locate-ls-subdir-switches)
-;;;;;;  "locate" "locate.el" (17988 52353))
+;;;;;;  "locate" "locate.el" (17992 30877))
 ;;; Generated autoloads from locate.el
 
 (defvar locate-ls-subdir-switches "-al" "\
@@ -16926,7 +16926,7 @@
 
 ;;;***
 
-;;;### (autoloads (log-edit) "log-edit" "log-edit.el" (17843 45610))
+;;;### (autoloads (log-edit) "log-edit" "log-edit.el" (18010 5298))
 ;;; Generated autoloads from log-edit.el
 
 (autoload (quote log-edit) "log-edit" "\
@@ -16947,8 +16947,8 @@
 
 ;;;***
 
-;;;### (autoloads (log-view-mode) "log-view" "log-view.el" (17843
-;;;;;;  45610))
+;;;### (autoloads (log-view-mode) "log-view" "log-view.el" (17842
+;;;;;;  58279))
 ;;; Generated autoloads from log-view.el
 
 (autoload (quote log-view-mode) "log-view" "\
@@ -16958,8 +16958,8 @@
 
 ;;;***
 
-;;;### (autoloads (longlines-mode) "longlines" "longlines.el" (17843
-;;;;;;  45610))
+;;;### (autoloads (longlines-mode) "longlines" "longlines.el" (17992
+;;;;;;  30877))
 ;;; Generated autoloads from longlines.el
 
 (autoload (quote longlines-mode) "longlines" "\
@@ -16980,8 +16980,8 @@
 ;;;***
 
 ;;;### (autoloads (print-region lpr-region print-buffer lpr-buffer
-;;;;;;  lpr-command lpr-switches printer-name) "lpr" "lpr.el" (17843
-;;;;;;  45610))
+;;;;;;  lpr-command lpr-switches printer-name) "lpr" "lpr.el" (17842
+;;;;;;  58279))
 ;;; Generated autoloads from lpr.el
 
 (defvar lpr-windows-system (memq system-type (quote (emx win32 w32 mswindows ms-dos windows-nt))))
@@ -17075,7 +17075,7 @@
 ;;;***
 
 ;;;### (autoloads (ls-lisp-support-shell-wildcards) "ls-lisp" "ls-lisp.el"
-;;;;;;  (17995 6542))
+;;;;;;  (18006 55796))
 ;;; Generated autoloads from ls-lisp.el
 
 (defvar ls-lisp-support-shell-wildcards t "\
@@ -17087,7 +17087,7 @@
 ;;;***
 
 ;;;### (autoloads (phases-of-moon) "lunar" "calendar/lunar.el" (17956
-;;;;;;  60684))
+;;;;;;  13479))
 ;;; Generated autoloads from calendar/lunar.el
 
 (autoload (quote phases-of-moon) "lunar" "\
@@ -17100,8 +17100,8 @@
 
 ;;;***
 
-;;;### (autoloads (m4-mode) "m4-mode" "progmodes/m4-mode.el" (17939
-;;;;;;  56023))
+;;;### (autoloads (m4-mode) "m4-mode" "progmodes/m4-mode.el" (17923
+;;;;;;  63540))
 ;;; Generated autoloads from progmodes/m4-mode.el
 
 (autoload (quote m4-mode) "m4-mode" "\
@@ -17113,7 +17113,7 @@
 ;;;***
 
 ;;;### (autoloads (macroexpand-all) "macroexp" "emacs-lisp/macroexp.el"
-;;;;;;  (17843 45615))
+;;;;;;  (17842 54152))
 ;;; Generated autoloads from emacs-lisp/macroexp.el
 
 (autoload (quote macroexpand-all) "macroexp" "\
@@ -17127,7 +17127,7 @@
 ;;;***
 
 ;;;### (autoloads (apply-macro-to-region-lines kbd-macro-query insert-kbd-macro
-;;;;;;  name-last-kbd-macro) "macros" "macros.el" (17843 45611))
+;;;;;;  name-last-kbd-macro) "macros" "macros.el" (17842 58279))
 ;;; Generated autoloads from macros.el
 
 (autoload (quote name-last-kbd-macro) "macros" "\
@@ -17216,7 +17216,7 @@
 ;;;***
 
 ;;;### (autoloads (what-domain mail-extract-address-components) "mail-extr"
-;;;;;;  "mail/mail-extr.el" (17843 45621))
+;;;;;;  "mail/mail-extr.el" (17842 55035))
 ;;; Generated autoloads from mail/mail-extr.el
 
 (autoload (quote mail-extract-address-components) "mail-extr" "\
@@ -17248,7 +17248,7 @@
 
 ;;;### (autoloads (mail-hist-put-headers-into-history mail-hist-keep-history
 ;;;;;;  mail-hist-enable mail-hist-define-keys) "mail-hist" "mail/mail-hist.el"
-;;;;;;  (17843 45621))
+;;;;;;  (17842 55035))
 ;;; Generated autoloads from mail/mail-hist.el
 
 (autoload (quote mail-hist-define-keys) "mail-hist" "\
@@ -17279,8 +17279,8 @@
 
 ;;;### (autoloads (mail-fetch-field mail-unquote-printable-region
 ;;;;;;  mail-unquote-printable mail-quote-printable mail-file-babyl-p
-;;;;;;  mail-use-rfc822) "mail-utils" "mail/mail-utils.el" (17843
-;;;;;;  45621))
+;;;;;;  mail-use-rfc822) "mail-utils" "mail/mail-utils.el" (17842
+;;;;;;  55035))
 ;;; Generated autoloads from mail/mail-utils.el
 
 (defvar mail-use-rfc822 nil "\
@@ -17332,7 +17332,7 @@
 ;;;***
 
 ;;;### (autoloads (define-mail-abbrev build-mail-abbrevs mail-abbrevs-setup)
-;;;;;;  "mailabbrev" "mail/mailabbrev.el" (17988 52353))
+;;;;;;  "mailabbrev" "mail/mailabbrev.el" (17992 30878))
 ;;; Generated autoloads from mail/mailabbrev.el
 
 (autoload (quote mail-abbrevs-setup) "mailabbrev" "\
@@ -17355,8 +17355,8 @@
 ;;;***
 
 ;;;### (autoloads (mail-complete define-mail-alias expand-mail-aliases
-;;;;;;  mail-complete-style) "mailalias" "mail/mailalias.el" (17843
-;;;;;;  45621))
+;;;;;;  mail-complete-style) "mailalias" "mail/mailalias.el" (17842
+;;;;;;  55035))
 ;;; Generated autoloads from mail/mailalias.el
 
 (defvar mail-complete-style (quote angles) "\
@@ -17402,7 +17402,7 @@
 ;;;***
 
 ;;;### (autoloads (mailclient-send-it) "mailclient" "mail/mailclient.el"
-;;;;;;  (17843 45621))
+;;;;;;  (17842 55035))
 ;;; Generated autoloads from mail/mailclient.el
 
 (autoload (quote mailclient-send-it) "mailclient" "\
@@ -17416,7 +17416,7 @@
 
 ;;;### (autoloads (makefile-imake-mode makefile-bsdmake-mode makefile-makepp-mode
 ;;;;;;  makefile-gmake-mode makefile-automake-mode makefile-mode)
-;;;;;;  "make-mode" "progmodes/make-mode.el" (17843 45628))
+;;;;;;  "make-mode" "progmodes/make-mode.el" (17842 56332))
 ;;; Generated autoloads from progmodes/make-mode.el
 
 (autoload (quote makefile-mode) "make-mode" "\
@@ -17533,8 +17533,8 @@
 
 ;;;***
 
-;;;### (autoloads (make-command-summary) "makesum" "makesum.el" (17843
-;;;;;;  45611))
+;;;### (autoloads (make-command-summary) "makesum" "makesum.el" (17842
+;;;;;;  58279))
 ;;; Generated autoloads from makesum.el
 
 (autoload (quote make-command-summary) "makesum" "\
@@ -17545,7 +17545,7 @@
 
 ;;;***
 
-;;;### (autoloads (man-follow man) "man" "man.el" (17939 56017))
+;;;### (autoloads (man-follow man) "man" "man.el" (17992 30877))
 ;;; Generated autoloads from man.el
 
 (defalias (quote manual-entry) (quote man))
@@ -17572,7 +17572,7 @@
 
 ;;;***
 
-;;;### (autoloads (master-mode) "master" "master.el" (17843 45611))
+;;;### (autoloads (master-mode) "master" "master.el" (17842 58279))
 ;;; Generated autoloads from master.el
 
 (autoload (quote master-mode) "master" "\
@@ -17595,14 +17595,14 @@
 ;;;***
 
 ;;;### (autoloads (menu-bar-mode) "menu-bar" "menu-bar.el" (17942
-;;;;;;  37801))
+;;;;;;  63381))
 ;;; Generated autoloads from menu-bar.el
 
 (put (quote menu-bar-mode) (quote standard-value) (quote (t)))
 
 (defvar menu-bar-mode nil "\
 Non-nil if Menu-Bar mode is enabled.
-See the command `menu-bar-mode' for a description of this minor-mode.
+See the command `menu-bar-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `menu-bar-mode'.")
@@ -17630,7 +17630,7 @@
 ;;;;;;  message-cite-function message-yank-prefix message-citation-line-function
 ;;;;;;  message-send-mail-function message-user-organization-file
 ;;;;;;  message-signature-separator message-from-style) "message"
-;;;;;;  "gnus/message.el" (17949 5807))
+;;;;;;  "gnus/message.el" (18010 19867))
 ;;; Generated autoloads from gnus/message.el
 
 (defvar message-from-style (quote default) "\
@@ -17886,7 +17886,7 @@
 ;;;***
 
 ;;;### (autoloads (metapost-mode metafont-mode) "meta-mode" "progmodes/meta-mode.el"
-;;;;;;  (17843 45629))
+;;;;;;  (17842 56332))
 ;;; Generated autoloads from progmodes/meta-mode.el
 
 (autoload (quote metafont-mode) "meta-mode" "\
@@ -17913,7 +17913,7 @@
 
 ;;;### (autoloads (metamail-region metamail-buffer metamail-interpret-body
 ;;;;;;  metamail-interpret-header) "metamail" "mail/metamail.el"
-;;;;;;  (17843 45621))
+;;;;;;  (17842 55035))
 ;;; Generated autoloads from mail/metamail.el
 
 (autoload (quote metamail-interpret-header) "metamail" "\
@@ -17958,7 +17958,7 @@
 
 ;;;### (autoloads (mh-fully-kill-draft mh-send-letter mh-user-agent-compose
 ;;;;;;  mh-smail-batch mh-smail-other-window mh-smail) "mh-comp"
-;;;;;;  "mh-e/mh-comp.el" (17843 45622))
+;;;;;;  "mh-e/mh-comp.el" (17842 55144))
 ;;; Generated autoloads from mh-e/mh-comp.el
 
 (autoload (quote mh-smail) "mh-comp" "\
@@ -18045,7 +18045,7 @@
 
 ;;;***
 
-;;;### (autoloads (mh-version) "mh-e" "mh-e/mh-e.el" (17843 45622))
+;;;### (autoloads (mh-version) "mh-e" "mh-e/mh-e.el" (17842 55144))
 ;;; Generated autoloads from mh-e/mh-e.el
 
 (put (quote mh-progs) (quote risky-local-variable) t)
@@ -18062,7 +18062,7 @@
 ;;;***
 
 ;;;### (autoloads (mh-folder-mode mh-nmail mh-rmail) "mh-folder"
-;;;;;;  "mh-e/mh-folder.el" (17843 45622))
+;;;;;;  "mh-e/mh-folder.el" (17842 55144))
 ;;; Generated autoloads from mh-e/mh-folder.el
 
 (autoload (quote mh-rmail) "mh-folder" "\
@@ -18144,7 +18144,7 @@
 ;;;***
 
 ;;;### (autoloads (midnight-delay-set clean-buffer-list) "midnight"
-;;;;;;  "midnight.el" (17843 45611))
+;;;;;;  "midnight.el" (17842 58279))
 ;;; Generated autoloads from midnight.el
 
 (autoload (quote clean-buffer-list) "midnight" "\
@@ -18171,12 +18171,12 @@
 ;;;***
 
 ;;;### (autoloads (minibuffer-electric-default-mode) "minibuf-eldef"
-;;;;;;  "minibuf-eldef.el" (17843 45611))
+;;;;;;  "minibuf-eldef.el" (17842 58279))
 ;;; Generated autoloads from minibuf-eldef.el
 
 (defvar minibuffer-electric-default-mode nil "\
 Non-nil if Minibuffer-Electric-Default mode is enabled.
-See the command `minibuffer-electric-default-mode' for a description of this minor-mode.
+See the command `minibuffer-electric-default-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `minibuffer-electric-default-mode'.")
@@ -18199,7 +18199,7 @@
 ;;;***
 
 ;;;### (autoloads (mixal-mode) "mixal-mode" "progmodes/mixal-mode.el"
-;;;;;;  (17843 45629))
+;;;;;;  (17842 56332))
 ;;; Generated autoloads from progmodes/mixal-mode.el
 
 (autoload (quote mixal-mode) "mixal-mode" "\
@@ -18214,7 +18214,7 @@
 
 ;;;### (autoloads (malayalam-composition-function malayalam-post-read-conversion
 ;;;;;;  malayalam-compose-region) "mlm-util" "language/mlm-util.el"
-;;;;;;  (17843 45620))
+;;;;;;  (17842 58278))
 ;;; Generated autoloads from language/mlm-util.el
 
 (autoload (quote malayalam-compose-region) "mlm-util" "\
@@ -18237,7 +18237,7 @@
 ;;;***
 
 ;;;### (autoloads (mm-inline-external-body mm-extern-cache-contents)
-;;;;;;  "mm-extern" "gnus/mm-extern.el" (17843 45617))
+;;;;;;  "mm-extern" "gnus/mm-extern.el" (17842 54741))
 ;;; Generated autoloads from gnus/mm-extern.el
 
 (autoload (quote mm-extern-cache-contents) "mm-extern" "\
@@ -18256,7 +18256,7 @@
 ;;;***
 
 ;;;### (autoloads (mm-inline-partial) "mm-partial" "gnus/mm-partial.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/mm-partial.el
 
 (autoload (quote mm-inline-partial) "mm-partial" "\
@@ -18270,7 +18270,7 @@
 ;;;***
 
 ;;;### (autoloads (mm-url-insert-file-contents-external mm-url-insert-file-contents)
-;;;;;;  "mm-url" "gnus/mm-url.el" (17843 45617))
+;;;;;;  "mm-url" "gnus/mm-url.el" (17842 54741))
 ;;; Generated autoloads from gnus/mm-url.el
 
 (autoload (quote mm-url-insert-file-contents) "mm-url" "\
@@ -18287,7 +18287,7 @@
 ;;;***
 
 ;;;### (autoloads (mm-uu-dissect-text-parts mm-uu-dissect) "mm-uu"
-;;;;;;  "gnus/mm-uu.el" (17843 45617))
+;;;;;;  "gnus/mm-uu.el" (17842 54741))
 ;;; Generated autoloads from gnus/mm-uu.el
 
 (autoload (quote mm-uu-dissect) "mm-uu" "\
@@ -18307,7 +18307,7 @@
 ;;;***
 
 ;;;### (autoloads (mml1991-sign mml1991-encrypt) "mml1991" "gnus/mml1991.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/mml1991.el
 
 (autoload (quote mml1991-encrypt) "mml1991" "\
@@ -18324,7 +18324,7 @@
 
 ;;;### (autoloads (mml2015-self-encrypt mml2015-sign mml2015-encrypt
 ;;;;;;  mml2015-verify-test mml2015-verify mml2015-decrypt-test mml2015-decrypt)
-;;;;;;  "mml2015" "gnus/mml2015.el" (17843 45617))
+;;;;;;  "mml2015" "gnus/mml2015.el" (17842 54741))
 ;;; Generated autoloads from gnus/mml2015.el
 
 (autoload (quote mml2015-decrypt) "mml2015" "\
@@ -18365,7 +18365,7 @@
 ;;;***
 
 ;;;### (autoloads (modula-2-mode) "modula2" "progmodes/modula2.el"
-;;;;;;  (17276 54295))
+;;;;;;  (17276 13069))
 ;;; Generated autoloads from progmodes/modula2.el
 
 (autoload (quote modula-2-mode) "modula2" "\
@@ -18397,7 +18397,7 @@
 ;;;***
 
 ;;;### (autoloads (unmorse-region morse-region) "morse" "play/morse.el"
-;;;;;;  (17843 45626))
+;;;;;;  (17842 55395))
 ;;; Generated autoloads from play/morse.el
 
 (autoload (quote morse-region) "morse" "\
@@ -18412,13 +18412,13 @@
 
 ;;;***
 
-;;;### (autoloads (mouse-sel-mode) "mouse-sel" "mouse-sel.el" (17843
-;;;;;;  45611))
+;;;### (autoloads (mouse-sel-mode) "mouse-sel" "mouse-sel.el" (17842
+;;;;;;  58279))
 ;;; Generated autoloads from mouse-sel.el
 
 (defvar mouse-sel-mode nil "\
 Non-nil if Mouse-Sel mode is enabled.
-See the command `mouse-sel-mode' for a description of this minor-mode.
+See the command `mouse-sel-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `mouse-sel-mode'.")
@@ -18465,7 +18465,7 @@
 
 ;;;***
 
-;;;### (autoloads (mpuz) "mpuz" "play/mpuz.el" (17939 56022))
+;;;### (autoloads (mpuz) "mpuz" "play/mpuz.el" (17862 6157))
 ;;; Generated autoloads from play/mpuz.el
 
 (autoload (quote mpuz) "mpuz" "\
@@ -18475,7 +18475,7 @@
 
 ;;;***
 
-;;;### (autoloads (msb-mode) "msb" "msb.el" (17995 6542))
+;;;### (autoloads (msb-mode) "msb" "msb.el" (18006 55796))
 ;;; Generated autoloads from msb.el
 
 (defvar msb-mode nil "\
@@ -18502,7 +18502,7 @@
 ;;;;;;  describe-current-coding-system describe-current-coding-system-briefly
 ;;;;;;  describe-coding-system describe-character-set list-charset-chars
 ;;;;;;  read-charset list-character-sets) "mule-diag" "international/mule-diag.el"
-;;;;;;  (17843 45619))
+;;;;;;  (17842 54888))
 ;;; Generated autoloads from international/mule-diag.el
 
 (defvar non-iso-charset-alist (\` ((mac-roman (ascii latin-iso8859-1 mule-unicode-2500-33ff mule-unicode-0100-24ff mule-unicode-e000-ffff) mac-roman-decoder ((0 255))) (viscii (ascii vietnamese-viscii-lower vietnamese-viscii-upper) viet-viscii-nonascii-translation-table ((0 255))) (vietnamese-tcvn (ascii vietnamese-viscii-lower vietnamese-viscii-upper) viet-tcvn-nonascii-translation-table ((0 255))) (koi8-r (ascii cyrillic-iso8859-5) cyrillic-koi8-r-nonascii-translation-table ((32 255))) (alternativnyj (ascii cyrillic-iso8859-5) cyrillic-alternativnyj-nonascii-translation-table ((32 255))) (koi8-u (ascii cyrillic-iso8859-5 mule-unicode-0100-24ff) cyrillic-koi8-u-nonascii-translation-table ((32 255))) (big5 (ascii chinese-big5-1 chinese-big5-2) decode-big5-char ((32 127) ((161 254) 64 126 161 254))) (sjis (ascii katakana-jisx0201 japanese-jisx0208) decode-sjis-char ((32 127 161 223) ((129 159 224 239) 64 126 128 252))))) "\
@@ -18676,7 +18676,7 @@
 ;;;;;;  coding-system-translation-table-for-decode coding-system-pre-write-conversion
 ;;;;;;  coding-system-post-read-conversion lookup-nested-alist set-nested-alist
 ;;;;;;  truncate-string-to-width store-substring string-to-sequence)
-;;;;;;  "mule-util" "international/mule-util.el" (17843 45619))
+;;;;;;  "mule-util" "international/mule-util.el" (17842 54888))
 ;;; Generated autoloads from international/mule-util.el
 
 (autoload (quote string-to-sequence) "mule-util" "\
@@ -18805,12 +18805,12 @@
 ;;;***
 
 ;;;### (autoloads (mwheel-install mouse-wheel-mode) "mwheel" "mwheel.el"
-;;;;;;  (17843 45611))
+;;;;;;  (17842 58279))
 ;;; Generated autoloads from mwheel.el
 
 (defvar mouse-wheel-mode nil "\
 Non-nil if Mouse-Wheel mode is enabled.
-See the command `mouse-wheel-mode' for a description of this minor-mode.
+See the command `mouse-wheel-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `mouse-wheel-mode'.")
@@ -18834,7 +18834,7 @@
 ;;;### (autoloads (network-connection network-connection-to-service
 ;;;;;;  whois-reverse-lookup whois finger ftp run-dig dns-lookup-host
 ;;;;;;  nslookup nslookup-host route arp netstat ipconfig ping traceroute)
-;;;;;;  "net-utils" "net/net-utils.el" (17939 56022))
+;;;;;;  "net-utils" "net/net-utils.el" (17891 7215))
 ;;; Generated autoloads from net/net-utils.el
 
 (autoload (quote traceroute) "net-utils" "\
@@ -18930,7 +18930,7 @@
 ;;;;;;  uncomment-region comment-kill comment-set-column comment-indent
 ;;;;;;  comment-indent-default comment-normalize-vars comment-multi-line
 ;;;;;;  comment-padding comment-style comment-column) "newcomment"
-;;;;;;  "newcomment.el" (17939 56017))
+;;;;;;  "newcomment.el" (17992 30877))
 ;;; Generated autoloads from newcomment.el
 
 (defalias (quote indent-for-comment) (quote comment-indent))
@@ -19126,7 +19126,7 @@
 
 ;;;### (autoloads (newsticker-show-news newsticker-start-ticker newsticker-start
 ;;;;;;  newsticker-ticker-running-p newsticker-running-p) "newsticker"
-;;;;;;  "net/newsticker.el" (17939 56022))
+;;;;;;  "net/newsticker.el" (17873 44590))
 ;;; Generated autoloads from net/newsticker.el
 
 (autoload (quote newsticker-running-p) "newsticker" "\
@@ -19168,7 +19168,7 @@
 ;;;***
 
 ;;;### (autoloads (nndiary-generate-nov-databases) "nndiary" "gnus/nndiary.el"
-;;;;;;  (17988 52353))
+;;;;;;  (17992 30878))
 ;;; Generated autoloads from gnus/nndiary.el
 
 (autoload (quote nndiary-generate-nov-databases) "nndiary" "\
@@ -19178,8 +19178,8 @@
 
 ;;;***
 
-;;;### (autoloads (nndoc-add-type) "nndoc" "gnus/nndoc.el" (17843
-;;;;;;  45617))
+;;;### (autoloads (nndoc-add-type) "nndoc" "gnus/nndoc.el" (17842
+;;;;;;  54741))
 ;;; Generated autoloads from gnus/nndoc.el
 
 (autoload (quote nndoc-add-type) "nndoc" "\
@@ -19194,7 +19194,7 @@
 ;;;***
 
 ;;;### (autoloads (nnfolder-generate-active-file) "nnfolder" "gnus/nnfolder.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/nnfolder.el
 
 (autoload (quote nnfolder-generate-active-file) "nnfolder" "\
@@ -19206,7 +19206,7 @@
 ;;;***
 
 ;;;### (autoloads (nnkiboze-generate-groups) "nnkiboze" "gnus/nnkiboze.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/nnkiboze.el
 
 (autoload (quote nnkiboze-generate-groups) "nnkiboze" "\
@@ -19218,7 +19218,7 @@
 ;;;***
 
 ;;;### (autoloads (nnml-generate-nov-databases) "nnml" "gnus/nnml.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/nnml.el
 
 (autoload (quote nnml-generate-nov-databases) "nnml" "\
@@ -19229,7 +19229,7 @@
 ;;;***
 
 ;;;### (autoloads (nnsoup-revert-variables nnsoup-set-variables nnsoup-pack-replies)
-;;;;;;  "nnsoup" "gnus/nnsoup.el" (17843 45617))
+;;;;;;  "nnsoup" "gnus/nnsoup.el" (17842 54741))
 ;;; Generated autoloads from gnus/nnsoup.el
 
 (autoload (quote nnsoup-pack-replies) "nnsoup" "\
@@ -19250,7 +19250,7 @@
 ;;;***
 
 ;;;### (autoloads (disable-command enable-command disabled-command-function)
-;;;;;;  "novice" "novice.el" (17843 45611))
+;;;;;;  "novice" "novice.el" (17842 58279))
 ;;; Generated autoloads from novice.el
 
 (defvar disabled-command-function (quote disabled-command-function) "\
@@ -19283,7 +19283,7 @@
 ;;;***
 
 ;;;### (autoloads (nroff-mode) "nroff-mode" "textmodes/nroff-mode.el"
-;;;;;;  (17843 45630))
+;;;;;;  (17842 58277))
 ;;; Generated autoloads from textmodes/nroff-mode.el
 
 (autoload (quote nroff-mode) "nroff-mode" "\
@@ -19298,7 +19298,7 @@
 ;;;***
 
 ;;;### (autoloads (octave-help) "octave-hlp" "progmodes/octave-hlp.el"
-;;;;;;  (17843 45629))
+;;;;;;  (17842 56332))
 ;;; Generated autoloads from progmodes/octave-hlp.el
 
 (autoload (quote octave-help) "octave-hlp" "\
@@ -19312,7 +19312,7 @@
 ;;;***
 
 ;;;### (autoloads (inferior-octave) "octave-inf" "progmodes/octave-inf.el"
-;;;;;;  (17843 45629))
+;;;;;;  (17842 56332))
 ;;; Generated autoloads from progmodes/octave-inf.el
 
 (autoload (quote inferior-octave) "octave-inf" "\
@@ -19335,7 +19335,7 @@
 ;;;***
 
 ;;;### (autoloads (octave-mode) "octave-mod" "progmodes/octave-mod.el"
-;;;;;;  (17843 45629))
+;;;;;;  (17842 56332))
 ;;; Generated autoloads from progmodes/octave-mod.el
 
 (autoload (quote octave-mode) "octave-mod" "\
@@ -19439,7 +19439,7 @@
 ;;;;;;  org-remember-handler org-remember org-remember-apply-template
 ;;;;;;  org-remember-annotation org-store-link orgtbl-mode turn-on-orgtbl
 ;;;;;;  org-global-cycle org-cycle org-mode) "org" "textmodes/org.el"
-;;;;;;  (17939 56024))
+;;;;;;  (17922 37459))
 ;;; Generated autoloads from textmodes/org.el
 
 (autoload (quote org-mode) "org" "\
@@ -19714,7 +19714,7 @@
 ;;;***
 
 ;;;### (autoloads (outline-minor-mode outline-mode) "outline" "outline.el"
-;;;;;;  (17950 55946))
+;;;;;;  (17952 11093))
 ;;; Generated autoloads from outline.el
 (put 'outline-regexp 'safe-local-variable 'string-or-null-p)
 
@@ -19770,8 +19770,8 @@
 
 ;;;***
 
-;;;### (autoloads nil "paragraphs" "textmodes/paragraphs.el" (17843
-;;;;;;  45630))
+;;;### (autoloads nil "paragraphs" "textmodes/paragraphs.el" (17842
+;;;;;;  58277))
 ;;; Generated autoloads from textmodes/paragraphs.el
 (put 'paragraph-start 'safe-local-variable 'stringp)
 (put 'paragraph-separate 'safe-local-variable 'stringp)
@@ -19785,7 +19785,7 @@
 
 ;;;***
 
-;;;### (autoloads (show-paren-mode) "paren" "paren.el" (17960 56195))
+;;;### (autoloads (show-paren-mode) "paren" "paren.el" (18016 8765))
 ;;; Generated autoloads from paren.el
 
 (defvar show-paren-mode nil "\
@@ -19810,7 +19810,7 @@
 ;;;***
 
 ;;;### (autoloads (parse-time-string) "parse-time" "calendar/parse-time.el"
-;;;;;;  (17958 15315))
+;;;;;;  (17957 43164))
 ;;; Generated autoloads from calendar/parse-time.el
 
 (autoload (quote parse-time-string) "parse-time" "\
@@ -19822,8 +19822,8 @@
 
 ;;;***
 
-;;;### (autoloads (pascal-mode) "pascal" "progmodes/pascal.el" (17843
-;;;;;;  45629))
+;;;### (autoloads (pascal-mode) "pascal" "progmodes/pascal.el" (17842
+;;;;;;  56332))
 ;;; Generated autoloads from progmodes/pascal.el
 
 (autoload (quote pascal-mode) "pascal" "\
@@ -19876,7 +19876,7 @@
 ;;;***
 
 ;;;### (autoloads (pc-bindings-mode) "pc-mode" "emulation/pc-mode.el"
-;;;;;;  (17843 45615))
+;;;;;;  (17842 54264))
 ;;; Generated autoloads from emulation/pc-mode.el
 
 (autoload (quote pc-bindings-mode) "pc-mode" "\
@@ -19894,12 +19894,12 @@
 ;;;***
 
 ;;;### (autoloads (pc-selection-mode pc-selection-mode) "pc-select"
-;;;;;;  "emulation/pc-select.el" (17843 45615))
+;;;;;;  "emulation/pc-select.el" (17842 54264))
 ;;; Generated autoloads from emulation/pc-select.el
 
 (defvar pc-selection-mode nil "\
 Non-nil if Pc-Selection mode is enabled.
-See the command `pc-selection-mode' for a description of this minor-mode.
+See the command `pc-selection-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `pc-selection-mode'.")
@@ -19970,8 +19970,8 @@
 
 ;;;***
 
-;;;### (autoloads (pcomplete/cvs) "pcmpl-cvs" "pcmpl-cvs.el" (17843
-;;;;;;  45611))
+;;;### (autoloads (pcomplete/cvs) "pcmpl-cvs" "pcmpl-cvs.el" (17842
+;;;;;;  58279))
 ;;; Generated autoloads from pcmpl-cvs.el
 
 (autoload (quote pcomplete/cvs) "pcmpl-cvs" "\
@@ -19982,7 +19982,7 @@
 ;;;***
 
 ;;;### (autoloads (pcomplete/tar pcomplete/make pcomplete/bzip2 pcomplete/gzip)
-;;;;;;  "pcmpl-gnu" "pcmpl-gnu.el" (17843 45611))
+;;;;;;  "pcmpl-gnu" "pcmpl-gnu.el" (17842 58279))
 ;;; Generated autoloads from pcmpl-gnu.el
 
 (autoload (quote pcomplete/gzip) "pcmpl-gnu" "\
@@ -20010,7 +20010,7 @@
 ;;;***
 
 ;;;### (autoloads (pcomplete/mount pcomplete/umount pcomplete/kill)
-;;;;;;  "pcmpl-linux" "pcmpl-linux.el" (17843 45611))
+;;;;;;  "pcmpl-linux" "pcmpl-linux.el" (17842 58279))
 ;;; Generated autoloads from pcmpl-linux.el
 
 (autoload (quote pcomplete/kill) "pcmpl-linux" "\
@@ -20030,8 +20030,8 @@
 
 ;;;***
 
-;;;### (autoloads (pcomplete/rpm) "pcmpl-rpm" "pcmpl-rpm.el" (17843
-;;;;;;  45611))
+;;;### (autoloads (pcomplete/rpm) "pcmpl-rpm" "pcmpl-rpm.el" (17842
+;;;;;;  58279))
 ;;; Generated autoloads from pcmpl-rpm.el
 
 (autoload (quote pcomplete/rpm) "pcmpl-rpm" "\
@@ -20047,7 +20047,7 @@
 
 ;;;### (autoloads (pcomplete/chgrp pcomplete/chown pcomplete/which
 ;;;;;;  pcomplete/xargs pcomplete/rm pcomplete/rmdir pcomplete/cd)
-;;;;;;  "pcmpl-unix" "pcmpl-unix.el" (17843 45611))
+;;;;;;  "pcmpl-unix" "pcmpl-unix.el" (17842 58279))
 ;;; Generated autoloads from pcmpl-unix.el
 
 (autoload (quote pcomplete/cd) "pcmpl-unix" "\
@@ -20093,8 +20093,8 @@
 
 ;;;### (autoloads (pcomplete-shell-setup pcomplete-comint-setup pcomplete-list
 ;;;;;;  pcomplete-help pcomplete-expand pcomplete-continue pcomplete-expand-and-complete
-;;;;;;  pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (17946
-;;;;;;  23918))
+;;;;;;  pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (17944
+;;;;;;  62194))
 ;;; Generated autoloads from pcomplete.el
 
 (autoload (quote pcomplete) "pcomplete" "\
@@ -20153,7 +20153,7 @@
 
 ;;;### (autoloads (cvs-dired-use-hook cvs-dired-action cvs-status
 ;;;;;;  cvs-update cvs-examine cvs-quickdir cvs-checkout) "pcvs"
-;;;;;;  "pcvs.el" (17995 6542))
+;;;;;;  "pcvs.el" (18006 55796))
 ;;; Generated autoloads from pcvs.el
 
 (autoload (quote cvs-checkout) "pcvs" "\
@@ -20230,7 +20230,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "pcvs-defs" "pcvs-defs.el" (17843 45611))
+;;;### (autoloads nil "pcvs-defs" "pcvs-defs.el" (17842 58279))
 ;;; Generated autoloads from pcvs-defs.el
 
 (defvar cvs-global-menu (let ((m (make-sparse-keymap "PCL-CVS"))) (define-key m [status] (quote (menu-item "Directory Status" cvs-status :help "A more verbose status of a workarea"))) (define-key m [checkout] (quote (menu-item "Checkout Module" cvs-checkout :help "Check out a module from the repository"))) (define-key m [update] (quote (menu-item "Update Directory" cvs-update :help "Fetch updates from the repository"))) (define-key m [examine] (quote (menu-item "Examine Directory" cvs-examine :help "Examine the current state of a workarea"))) (fset (quote cvs-global-menu) m)))
@@ -20238,7 +20238,7 @@
 ;;;***
 
 ;;;### (autoloads (perl-mode) "perl-mode" "progmodes/perl-mode.el"
-;;;;;;  (17966 9916))
+;;;;;;  (17962 28280))
 ;;; Generated autoloads from progmodes/perl-mode.el
 
 (autoload (quote perl-mode) "perl-mode" "\
@@ -20296,7 +20296,7 @@
 ;;;### (autoloads (pgg-snarf-keys pgg-snarf-keys-region pgg-insert-key
 ;;;;;;  pgg-verify pgg-verify-region pgg-sign pgg-sign-region pgg-decrypt
 ;;;;;;  pgg-decrypt-region pgg-encrypt pgg-encrypt-symmetric pgg-encrypt-symmetric-region
-;;;;;;  pgg-encrypt-region) "pgg" "pgg.el" (17843 45612))
+;;;;;;  pgg-encrypt-region) "pgg" "pgg.el" (17842 58279))
 ;;; Generated autoloads from pgg.el
 
 (autoload (quote pgg-encrypt-region) "pgg" "\
@@ -20430,7 +20430,7 @@
 ;;;***
 
 ;;;### (autoloads (pgg-gpg-symmetric-key-p) "pgg-gpg" "pgg-gpg.el"
-;;;;;;  (17939 56017))
+;;;;;;  (17887 33207))
 ;;; Generated autoloads from pgg-gpg.el
 
 (autoload (quote pgg-gpg-symmetric-key-p) "pgg-gpg" "\
@@ -20441,7 +20441,7 @@
 ;;;***
 
 ;;;### (autoloads (picture-mode) "picture" "textmodes/picture.el"
-;;;;;;  (17843 45630))
+;;;;;;  (17842 58277))
 ;;; Generated autoloads from textmodes/picture.el
 
 (autoload (quote picture-mode) "picture" "\
@@ -20522,7 +20522,7 @@
 ;;;***
 
 ;;;### (autoloads (po-find-file-coding-system) "po" "textmodes/po.el"
-;;;;;;  (17843 45630))
+;;;;;;  (17842 58277))
 ;;; Generated autoloads from textmodes/po.el
 
 (autoload (quote po-find-file-coding-system) "po" "\
@@ -20533,7 +20533,7 @@
 
 ;;;***
 
-;;;### (autoloads (pong) "pong" "play/pong.el" (17843 45626))
+;;;### (autoloads (pong) "pong" "play/pong.el" (17842 55395))
 ;;; Generated autoloads from play/pong.el
 
 (autoload (quote pong) "pong" "\
@@ -20550,7 +20550,7 @@
 ;;;***
 
 ;;;### (autoloads (pp-eval-last-sexp pp-eval-expression pp pp-buffer
-;;;;;;  pp-to-string) "pp" "emacs-lisp/pp.el" (17939 56021))
+;;;;;;  pp-to-string) "pp" "emacs-lisp/pp.el" (17852 19612))
 ;;; Generated autoloads from emacs-lisp/pp.el
 
 (autoload (quote pp-to-string) "pp" "\
@@ -20606,7 +20606,7 @@
 ;;;;;;  pr-ps-buffer-print pr-ps-buffer-using-ghostscript pr-ps-buffer-preview
 ;;;;;;  pr-ps-directory-ps-print pr-ps-directory-print pr-ps-directory-using-ghostscript
 ;;;;;;  pr-ps-directory-preview pr-interface) "printing" "printing.el"
-;;;;;;  (17995 6542))
+;;;;;;  (18006 55796))
 ;;; Generated autoloads from printing.el
 
 (autoload (quote pr-interface) "printing" "\
@@ -21194,7 +21194,7 @@
 ;;;***
 
 ;;;### (autoloads (switch-to-prolog prolog-mode) "prolog" "progmodes/prolog.el"
-;;;;;;  (17843 45629))
+;;;;;;  (17842 56332))
 ;;; Generated autoloads from progmodes/prolog.el
 
 (autoload (quote prolog-mode) "prolog" "\
@@ -21217,7 +21217,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "ps-bdf" "ps-bdf.el" (17843 45612))
+;;;### (autoloads nil "ps-bdf" "ps-bdf.el" (17842 58279))
 ;;; Generated autoloads from ps-bdf.el
 
 (defvar bdf-directory-list (if (memq system-type (quote (ms-dos windows-nt))) (list (expand-file-name "fonts/bdf" installation-directory)) (quote ("/usr/local/share/emacs/fonts/bdf"))) "\
@@ -21226,8 +21226,8 @@
 
 ;;;***
 
-;;;### (autoloads (ps-mode) "ps-mode" "progmodes/ps-mode.el" (17843
-;;;;;;  45629))
+;;;### (autoloads (ps-mode) "ps-mode" "progmodes/ps-mode.el" (17842
+;;;;;;  56332))
 ;;; Generated autoloads from progmodes/ps-mode.el
 
 (autoload (quote ps-mode) "ps-mode" "\
@@ -21276,7 +21276,7 @@
 ;;;### (autoloads (ps-mule-begin-page ps-mule-begin-job ps-mule-encode-header-string
 ;;;;;;  ps-mule-initialize ps-mule-plot-composition ps-mule-plot-string
 ;;;;;;  ps-mule-set-ascii-font ps-mule-prepare-ascii-font ps-multibyte-buffer)
-;;;;;;  "ps-mule" "ps-mule.el" (17843 45612))
+;;;;;;  "ps-mule" "ps-mule.el" (17842 58279))
 ;;; Generated autoloads from ps-mule.el
 
 (defvar ps-multibyte-buffer nil "\
@@ -21397,8 +21397,8 @@
 ;;;;;;  ps-spool-region ps-spool-buffer-with-faces ps-spool-buffer
 ;;;;;;  ps-print-region-with-faces ps-print-region ps-print-buffer-with-faces
 ;;;;;;  ps-print-buffer ps-print-customize ps-print-color-p ps-paper-type
-;;;;;;  ps-page-dimensions-database) "ps-print" "ps-print.el" (17939
-;;;;;;  56017))
+;;;;;;  ps-page-dimensions-database) "ps-print" "ps-print.el" (18006
+;;;;;;  55796))
 ;;; Generated autoloads from ps-print.el
 
 (defvar ps-page-dimensions-database (list (list (quote a4) (/ (* 72 21.0) 2.54) (/ (* 72 29.7) 2.54) "A4") (list (quote a3) (/ (* 72 29.7) 2.54) (/ (* 72 42.0) 2.54) "A3") (list (quote letter) (* 72 8.5) (* 72 11.0) "Letter") (list (quote legal) (* 72 8.5) (* 72 14.0) "Legal") (list (quote letter-small) (* 72 7.68) (* 72 10.16) "LetterSmall") (list (quote tabloid) (* 72 11.0) (* 72 17.0) "Tabloid") (list (quote ledger) (* 72 17.0) (* 72 11.0) "Ledger") (list (quote statement) (* 72 5.5) (* 72 8.5) "Statement") (list (quote executive) (* 72 7.5) (* 72 10.0) "Executive") (list (quote a4small) (* 72 7.47) (* 72 10.85) "A4Small") (list (quote b4) (* 72 10.125) (* 72 14.33) "B4") (list (quote b5) (* 72 7.16) (* 72 10.125) "B5")) "\
@@ -21595,7 +21595,7 @@
 ;;;***
 
 ;;;### (autoloads (jython-mode python-mode run-python) "python" "progmodes/python.el"
-;;;;;;  (17988 52600))
+;;;;;;  (17992 30878))
 ;;; Generated autoloads from progmodes/python.el
 
 (add-to-list (quote interpreter-mode-alist) (quote ("jython" . jython-mode)))
@@ -21670,7 +21670,7 @@
 ;;;***
 
 ;;;### (autoloads (quoted-printable-decode-region) "qp" "gnus/qp.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/qp.el
 
 (autoload (quote quoted-printable-decode-region) "qp" "\
@@ -21693,7 +21693,7 @@
 ;;;;;;  quail-defrule quail-install-decode-map quail-install-map
 ;;;;;;  quail-define-rules quail-show-keyboard-layout quail-set-keyboard-layout
 ;;;;;;  quail-define-package quail-use-package quail-title) "quail"
-;;;;;;  "international/quail.el" (17939 56022))
+;;;;;;  "international/quail.el" (17921 16827))
 ;;; Generated autoloads from international/quail.el
 
 (autoload (quote quail-title) "quail" "\
@@ -21924,8 +21924,8 @@
 
 ;;;### (autoloads (quickurl-list quickurl-list-mode quickurl-edit-urls
 ;;;;;;  quickurl-browse-url-ask quickurl-browse-url quickurl-add-url
-;;;;;;  quickurl-ask quickurl) "quickurl" "net/quickurl.el" (17843
-;;;;;;  45624))
+;;;;;;  quickurl-ask quickurl) "quickurl" "net/quickurl.el" (17842
+;;;;;;  55218))
 ;;; Generated autoloads from net/quickurl.el
 
 (defconst quickurl-reread-hook-postfix "\n;; Local Variables:\n;; eval: (progn (require 'quickurl) (add-hook 'local-write-file-hooks (lambda () (quickurl-read) nil)))\n;; End:\n" "\
@@ -21997,7 +21997,7 @@
 ;;;***
 
 ;;;### (autoloads (rcirc-track-minor-mode rcirc-connect rcirc) "rcirc"
-;;;;;;  "net/rcirc.el" (17988 52353))
+;;;;;;  "net/rcirc.el" (18006 55797))
 ;;; Generated autoloads from net/rcirc.el
 
 (autoload (quote rcirc) "rcirc" "\
@@ -22029,8 +22029,8 @@
 
 ;;;***
 
-;;;### (autoloads (remote-compile) "rcompile" "net/rcompile.el" (17843
-;;;;;;  45624))
+;;;### (autoloads (remote-compile) "rcompile" "net/rcompile.el" (17842
+;;;;;;  55218))
 ;;; Generated autoloads from net/rcompile.el
 
 (autoload (quote remote-compile) "rcompile" "\
@@ -22042,7 +22042,7 @@
 ;;;***
 
 ;;;### (autoloads (re-builder) "re-builder" "emacs-lisp/re-builder.el"
-;;;;;;  (17939 56021))
+;;;;;;  (17917 37732))
 ;;; Generated autoloads from emacs-lisp/re-builder.el
 
 (defalias (quote regexp-builder) (quote re-builder))
@@ -22054,12 +22054,12 @@
 
 ;;;***
 
-;;;### (autoloads (recentf-mode) "recentf" "recentf.el" (17939 56017))
+;;;### (autoloads (recentf-mode) "recentf" "recentf.el" (17930 34071))
 ;;; Generated autoloads from recentf.el
 
 (defvar recentf-mode nil "\
 Non-nil if Recentf mode is enabled.
-See the command `recentf-mode' for a description of this minor-mode.
+See the command `recentf-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `recentf-mode'.")
@@ -22081,8 +22081,8 @@
 ;;;### (autoloads (clear-rectangle string-insert-rectangle string-rectangle
 ;;;;;;  delete-whitespace-rectangle open-rectangle insert-rectangle
 ;;;;;;  yank-rectangle kill-rectangle extract-rectangle delete-extract-rectangle
-;;;;;;  delete-rectangle move-to-column-force) "rect" "rect.el" (17843
-;;;;;;  45612))
+;;;;;;  delete-rectangle move-to-column-force) "rect" "rect.el" (17842
+;;;;;;  58279))
 ;;; Generated autoloads from rect.el
 
 (autoload (quote move-to-column-force) "rect" "\
@@ -22210,8 +22210,8 @@
 
 ;;;***
 
-;;;### (autoloads (refill-mode) "refill" "textmodes/refill.el" (17843
-;;;;;;  45630))
+;;;### (autoloads (refill-mode) "refill" "textmodes/refill.el" (17842
+;;;;;;  58277))
 ;;; Generated autoloads from textmodes/refill.el
 
 (autoload (quote refill-mode) "refill" "\
@@ -22227,7 +22227,7 @@
 ;;;***
 
 ;;;### (autoloads (reftex-reset-scanning-information reftex-mode
-;;;;;;  turn-on-reftex) "reftex" "textmodes/reftex.el" (17939 56024))
+;;;;;;  turn-on-reftex) "reftex" "textmodes/reftex.el" (17923 8784))
 ;;; Generated autoloads from textmodes/reftex.el
 
 (autoload (quote turn-on-reftex) "reftex" "\
@@ -22277,7 +22277,7 @@
 ;;;***
 
 ;;;### (autoloads (reftex-citation) "reftex-cite" "textmodes/reftex-cite.el"
-;;;;;;  (17939 56024))
+;;;;;;  (17923 8784))
 ;;; Generated autoloads from textmodes/reftex-cite.el
 
 (autoload (quote reftex-citation) "reftex-cite" "\
@@ -22307,7 +22307,7 @@
 ;;;***
 
 ;;;### (autoloads (reftex-isearch-minor-mode) "reftex-global" "textmodes/reftex-global.el"
-;;;;;;  (17939 56024))
+;;;;;;  (17923 8784))
 ;;; Generated autoloads from textmodes/reftex-global.el
 
 (autoload (quote reftex-isearch-minor-mode) "reftex-global" "\
@@ -22324,7 +22324,7 @@
 ;;;***
 
 ;;;### (autoloads (reftex-index-phrases-mode) "reftex-index" "textmodes/reftex-index.el"
-;;;;;;  (17939 56024))
+;;;;;;  (17923 8784))
 ;;; Generated autoloads from textmodes/reftex-index.el
 
 (autoload (quote reftex-index-phrases-mode) "reftex-index" "\
@@ -22357,7 +22357,7 @@
 ;;;***
 
 ;;;### (autoloads (reftex-all-document-files) "reftex-parse" "textmodes/reftex-parse.el"
-;;;;;;  (17939 56024))
+;;;;;;  (17923 8784))
 ;;; Generated autoloads from textmodes/reftex-parse.el
 
 (autoload (quote reftex-all-document-files) "reftex-parse" "\
@@ -22369,8 +22369,8 @@
 
 ;;;***
 
-;;;### (autoloads nil "reftex-vars" "textmodes/reftex-vars.el" (17939
-;;;;;;  56024))
+;;;### (autoloads nil "reftex-vars" "textmodes/reftex-vars.el" (17923
+;;;;;;  8784))
 ;;; Generated autoloads from textmodes/reftex-vars.el
 (put 'reftex-vref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x))))
 (put 'reftex-fref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x))))
@@ -22380,7 +22380,7 @@
 ;;;***
 
 ;;;### (autoloads (regexp-opt-depth regexp-opt) "regexp-opt" "emacs-lisp/regexp-opt.el"
-;;;;;;  (17843 45615))
+;;;;;;  (17842 54152))
 ;;; Generated autoloads from emacs-lisp/regexp-opt.el
 
 (autoload (quote regexp-opt) "regexp-opt" "\
@@ -22407,7 +22407,7 @@
 
 ;;;***
 
-;;;### (autoloads (repeat) "repeat" "repeat.el" (17843 45612))
+;;;### (autoloads (repeat) "repeat" "repeat.el" (17842 58279))
 ;;; Generated autoloads from repeat.el
 
 (autoload (quote repeat) "repeat" "\
@@ -22425,7 +22425,7 @@
 ;;;***
 
 ;;;### (autoloads (reporter-submit-bug-report) "reporter" "mail/reporter.el"
-;;;;;;  (17843 45622))
+;;;;;;  (17842 55035))
 ;;; Generated autoloads from mail/reporter.el
 
 (autoload (quote reporter-submit-bug-report) "reporter" "\
@@ -22457,7 +22457,7 @@
 ;;;***
 
 ;;;### (autoloads (reposition-window) "reposition" "reposition.el"
-;;;;;;  (17843 45612))
+;;;;;;  (17842 58279))
 ;;; Generated autoloads from reposition.el
 
 (autoload (quote reposition-window) "reposition" "\
@@ -22484,8 +22484,8 @@
 
 ;;;***
 
-;;;### (autoloads (resume-suspend-hook) "resume" "resume.el" (17843
-;;;;;;  45612))
+;;;### (autoloads (resume-suspend-hook) "resume" "resume.el" (17842
+;;;;;;  58279))
 ;;; Generated autoloads from resume.el
 
 (autoload (quote resume-suspend-hook) "resume" "\
@@ -22496,7 +22496,7 @@
 ;;;***
 
 ;;;### (autoloads (global-reveal-mode reveal-mode) "reveal" "reveal.el"
-;;;;;;  (17843 45612))
+;;;;;;  (17842 58279))
 ;;; Generated autoloads from reveal.el
 
 (autoload (quote reveal-mode) "reveal" "\
@@ -22511,7 +22511,7 @@
 
 (defvar global-reveal-mode nil "\
 Non-nil if Global-Reveal mode is enabled.
-See the command `global-reveal-mode' for a description of this minor-mode.
+See the command `global-reveal-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `global-reveal-mode'.")
@@ -22531,7 +22531,7 @@
 ;;;***
 
 ;;;### (autoloads (make-ring ring-p) "ring" "emacs-lisp/ring.el"
-;;;;;;  (17843 45615))
+;;;;;;  (17842 54152))
 ;;; Generated autoloads from emacs-lisp/ring.el
 
 (autoload (quote ring-p) "ring" "\
@@ -22546,7 +22546,7 @@
 
 ;;;***
 
-;;;### (autoloads (rlogin) "rlogin" "net/rlogin.el" (17843 45624))
+;;;### (autoloads (rlogin) "rlogin" "net/rlogin.el" (17842 55218))
 ;;; Generated autoloads from net/rlogin.el
  (add-hook 'same-window-regexps "^\\*rlogin-.*\\*\\(\\|<[0-9]+>\\)")
 
@@ -22597,8 +22597,8 @@
 ;;;;;;  rmail-mail-new-frame rmail-primary-inbox-list rmail-delete-after-output
 ;;;;;;  rmail-highlight-face rmail-highlighted-headers rmail-retry-ignored-headers
 ;;;;;;  rmail-displayed-headers rmail-ignored-headers rmail-dont-reply-to-names
-;;;;;;  rmail-movemail-variant-p) "rmail" "mail/rmail.el" (17995
-;;;;;;  6542))
+;;;;;;  rmail-movemail-variant-p) "rmail" "mail/rmail.el" (18006
+;;;;;;  55797))
 ;;; Generated autoloads from mail/rmail.el
 
 (autoload (quote rmail-movemail-variant-p) "rmail" "\
@@ -22863,7 +22863,7 @@
 ;;;***
 
 ;;;### (autoloads (rmail-edit-current-message) "rmailedit" "mail/rmailedit.el"
-;;;;;;  (17939 56022))
+;;;;;;  (17887 18399))
 ;;; Generated autoloads from mail/rmailedit.el
 
 (autoload (quote rmail-edit-current-message) "rmailedit" "\
@@ -22875,7 +22875,7 @@
 
 ;;;### (autoloads (rmail-next-labeled-message rmail-previous-labeled-message
 ;;;;;;  rmail-read-label rmail-kill-label rmail-add-label) "rmailkwd"
-;;;;;;  "mail/rmailkwd.el" (17843 45622))
+;;;;;;  "mail/rmailkwd.el" (17842 55035))
 ;;; Generated autoloads from mail/rmailkwd.el
 
 (autoload (quote rmail-add-label) "rmailkwd" "\
@@ -22914,7 +22914,7 @@
 ;;;***
 
 ;;;### (autoloads (set-rmail-inbox-list) "rmailmsc" "mail/rmailmsc.el"
-;;;;;;  (17843 45622))
+;;;;;;  (17842 55035))
 ;;; Generated autoloads from mail/rmailmsc.el
 
 (autoload (quote set-rmail-inbox-list) "rmailmsc" "\
@@ -22928,7 +22928,7 @@
 
 ;;;### (autoloads (rmail-output-body-to-file rmail-output rmail-fields-not-to-output
 ;;;;;;  rmail-output-to-rmail-file rmail-output-file-alist) "rmailout"
-;;;;;;  "mail/rmailout.el" (17843 45622))
+;;;;;;  "mail/rmailout.el" (17842 55035))
 ;;; Generated autoloads from mail/rmailout.el
 
 (defvar rmail-output-file-alist nil "\
@@ -22995,8 +22995,8 @@
 
 ;;;### (autoloads (rmail-sort-by-labels rmail-sort-by-lines rmail-sort-by-correspondent
 ;;;;;;  rmail-sort-by-recipient rmail-sort-by-author rmail-sort-by-subject
-;;;;;;  rmail-sort-by-date) "rmailsort" "mail/rmailsort.el" (17843
-;;;;;;  45622))
+;;;;;;  rmail-sort-by-date) "rmailsort" "mail/rmailsort.el" (17842
+;;;;;;  55035))
 ;;; Generated autoloads from mail/rmailsort.el
 
 (autoload (quote rmail-sort-by-date) "rmailsort" "\
@@ -23048,7 +23048,7 @@
 ;;;;;;  rmail-summary-by-senders rmail-summary-by-topic rmail-summary-by-regexp
 ;;;;;;  rmail-summary-by-recipients rmail-summary-by-labels rmail-summary
 ;;;;;;  rmail-summary-line-count-flag rmail-summary-scroll-between-messages)
-;;;;;;  "rmailsum" "mail/rmailsum.el" (17843 45622))
+;;;;;;  "rmailsum" "mail/rmailsum.el" (17842 55035))
 ;;; Generated autoloads from mail/rmailsum.el
 
 (defvar rmail-summary-scroll-between-messages t "\
@@ -23130,7 +23130,7 @@
 ;;;***
 
 ;;;### (autoloads (toggle-rot13-mode rot13-other-window rot13-region
-;;;;;;  rot13-string rot13) "rot13" "rot13.el" (17843 45612))
+;;;;;;  rot13-string rot13) "rot13" "rot13.el" (17842 58279))
 ;;; Generated autoloads from rot13.el
 
 (autoload (quote rot13) "rot13" "\
@@ -23167,8 +23167,8 @@
 
 ;;;***
 
-;;;### (autoloads (ruler-mode) "ruler-mode" "ruler-mode.el" (17838
-;;;;;;  18033))
+;;;### (autoloads (ruler-mode) "ruler-mode" "ruler-mode.el" (17833
+;;;;;;  43069))
 ;;; Generated autoloads from ruler-mode.el
 
 (autoload (quote ruler-mode) "ruler-mode" "\
@@ -23178,8 +23178,8 @@
 
 ;;;***
 
-;;;### (autoloads (rx rx-to-string) "rx" "emacs-lisp/rx.el" (17843
-;;;;;;  45615))
+;;;### (autoloads (rx rx-to-string) "rx" "emacs-lisp/rx.el" (18011
+;;;;;;  44080))
 ;;; Generated autoloads from emacs-lisp/rx.el
 
 (autoload (quote rx-to-string) "rx" "\
@@ -23251,8 +23251,7 @@
      matches the empty string, but only at point.
 
 `word-start', `bow'
-     matches the empty string, but only at the beginning or end of a
-     word.
+     matches the empty string, but only at the beginning of a word.
 
 `word-end', `eow'
      matches the empty string, but only at the end of a word.
@@ -23266,6 +23265,12 @@
      matches the empty string, but not at the beginning or end of a
      word.
 
+`symbol-start'
+     matches the empty string, but only at the beginning of a symbol.
+
+`symbol-end'
+     matches the empty string, but only at the end of a symbol.
+
 `digit', `numeric', `num'
      matches 0 through 9.
 
@@ -23487,7 +23492,7 @@
 ;;;***
 
 ;;;### (autoloads (savehist-mode savehist-mode) "savehist" "savehist.el"
-;;;;;;  (17843 45612))
+;;;;;;  (17842 58279))
 ;;; Generated autoloads from savehist.el
 
 (defvar savehist-mode nil "\
@@ -23513,7 +23518,7 @@
 ;;;***
 
 ;;;### (autoloads (dsssl-mode scheme-mode) "scheme" "progmodes/scheme.el"
-;;;;;;  (17843 45629))
+;;;;;;  (17842 56332))
 ;;; Generated autoloads from progmodes/scheme.el
 
 (autoload (quote scheme-mode) "scheme" "\
@@ -23555,7 +23560,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-score-mode) "score-mode" "gnus/score-mode.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/score-mode.el
 
 (autoload (quote gnus-score-mode) "score-mode" "\
@@ -23569,12 +23574,12 @@
 ;;;***
 
 ;;;### (autoloads (scroll-all-mode) "scroll-all" "scroll-all.el"
-;;;;;;  (17843 45612))
+;;;;;;  (17842 58278))
 ;;; Generated autoloads from scroll-all.el
 
 (defvar scroll-all-mode nil "\
 Non-nil if Scroll-All mode is enabled.
-See the command `scroll-all-mode' for a description of this minor-mode.
+See the command `scroll-all-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `scroll-all-mode'.")
@@ -23592,7 +23597,7 @@
 ;;;***
 
 ;;;### (autoloads (scroll-lock-mode) "scroll-lock" "scroll-lock.el"
-;;;;;;  (17843 45612))
+;;;;;;  (17842 58278))
 ;;; Generated autoloads from scroll-lock.el
 
 (autoload (quote scroll-lock-mode) "scroll-lock" "\
@@ -23614,7 +23619,7 @@
 ;;;;;;  mail-alias-file mail-default-reply-to mail-archive-file-name
 ;;;;;;  mail-header-separator send-mail-function mail-interactive
 ;;;;;;  mail-self-blind mail-specify-envelope-from mail-from-style)
-;;;;;;  "sendmail" "mail/sendmail.el" (17942 35726))
+;;;;;;  "sendmail" "mail/sendmail.el" (17942 63381))
 ;;; Generated autoloads from mail/sendmail.el
 
 (defvar mail-from-style (quote angles) "\
@@ -23915,7 +23920,7 @@
 ;;;***
 
 ;;;### (autoloads (server-mode server-start) "server" "server.el"
-;;;;;;  (17939 56017))
+;;;;;;  (17921 16827))
 ;;; Generated autoloads from server.el
 
 (autoload (quote server-start) "server" "\
@@ -23932,7 +23937,7 @@
 
 (defvar server-mode nil "\
 Non-nil if Server mode is enabled.
-See the command `server-mode' for a description of this minor-mode.
+See the command `server-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `server-mode'.")
@@ -23949,7 +23954,7 @@
 
 ;;;***
 
-;;;### (autoloads (ses-mode) "ses" "ses.el" (17939 56017))
+;;;### (autoloads (ses-mode) "ses" "ses.el" (17902 31690))
 ;;; Generated autoloads from ses.el
 
 (autoload (quote ses-mode) "ses" "\
@@ -23968,7 +23973,7 @@
 ;;;***
 
 ;;;### (autoloads (html-mode sgml-mode) "sgml-mode" "textmodes/sgml-mode.el"
-;;;;;;  (17939 56024))
+;;;;;;  (18010 58080))
 ;;; Generated autoloads from textmodes/sgml-mode.el
 
 (autoload (quote sgml-mode) "sgml-mode" "\
@@ -24036,7 +24041,7 @@
 ;;;***
 
 ;;;### (autoloads (sh-mode) "sh-script" "progmodes/sh-script.el"
-;;;;;;  (17988 52354))
+;;;;;;  (17992 30878))
 ;;; Generated autoloads from progmodes/sh-script.el
 (put 'sh-shell 'safe-local-variable 'symbolp)
 
@@ -24100,7 +24105,7 @@
 
 ;;;***
 
-;;;### (autoloads (sha1) "sha1" "gnus/sha1.el" (17843 45617))
+;;;### (autoloads (sha1) "sha1" "gnus/sha1.el" (17842 54741))
 ;;; Generated autoloads from gnus/sha1.el
 
 (autoload (quote sha1) "sha1" "\
@@ -24115,7 +24120,7 @@
 ;;;***
 
 ;;;### (autoloads (list-load-path-shadows) "shadow" "emacs-lisp/shadow.el"
-;;;;;;  (17939 56021))
+;;;;;;  (17853 57352))
 ;;; Generated autoloads from emacs-lisp/shadow.el
 
 (autoload (quote list-load-path-shadows) "shadow" "\
@@ -24162,8 +24167,8 @@
 ;;;***
 
 ;;;### (autoloads (shadow-initialize shadow-define-regexp-group shadow-define-literal-group
-;;;;;;  shadow-define-cluster) "shadowfile" "shadowfile.el" (17843
-;;;;;;  45612))
+;;;;;;  shadow-define-cluster) "shadowfile" "shadowfile.el" (17842
+;;;;;;  58278))
 ;;; Generated autoloads from shadowfile.el
 
 (autoload (quote shadow-define-cluster) "shadowfile" "\
@@ -24202,7 +24207,7 @@
 ;;;***
 
 ;;;### (autoloads (shell shell-dumb-shell-regexp) "shell" "shell.el"
-;;;;;;  (17939 56017))
+;;;;;;  (17899 1575))
 ;;; Generated autoloads from shell.el
 
 (defvar shell-dumb-shell-regexp "cmd\\(proxy\\)?\\.exe" "\
@@ -24249,7 +24254,7 @@
 ;;;***
 
 ;;;### (autoloads (sieve-upload-and-bury sieve-upload sieve-manage)
-;;;;;;  "sieve" "gnus/sieve.el" (17843 45617))
+;;;;;;  "sieve" "gnus/sieve.el" (17842 54741))
 ;;; Generated autoloads from gnus/sieve.el
 
 (autoload (quote sieve-manage) "sieve" "\
@@ -24270,7 +24275,7 @@
 ;;;***
 
 ;;;### (autoloads (sieve-mode) "sieve-mode" "gnus/sieve-mode.el"
-;;;;;;  (17843 45617))
+;;;;;;  (17842 54741))
 ;;; Generated autoloads from gnus/sieve-mode.el
 
 (autoload (quote sieve-mode) "sieve-mode" "\
@@ -24285,14 +24290,14 @@
 
 ;;;***
 
-;;;### (autoloads nil "simple" "simple.el" (17995 6542))
+;;;### (autoloads nil "simple" "simple.el" (18009 38727))
 ;;; Generated autoloads from simple.el
 (put 'fill-prefix 'safe-local-variable 'string-or-null-p)
 
 ;;;***
 
-;;;### (autoloads (simula-mode) "simula" "progmodes/simula.el" (17843
-;;;;;;  45629))
+;;;### (autoloads (simula-mode) "simula" "progmodes/simula.el" (17842
+;;;;;;  56332))
 ;;; Generated autoloads from progmodes/simula.el
 
 (autoload (quote simula-mode) "simula" "\
@@ -24341,7 +24346,7 @@
 ;;;***
 
 ;;;### (autoloads (skeleton-pair-insert-maybe skeleton-insert skeleton-proxy-new
-;;;;;;  define-skeleton) "skeleton" "skeleton.el" (17843 45612))
+;;;;;;  define-skeleton) "skeleton" "skeleton.el" (17842 58278))
 ;;; Generated autoloads from skeleton.el
 
 (defvar skeleton-filter-function (quote identity) "\
@@ -24451,7 +24456,7 @@
 ;;;***
 
 ;;;### (autoloads (smerge-mode smerge-ediff) "smerge-mode" "smerge-mode.el"
-;;;;;;  (17939 56017))
+;;;;;;  (17904 28230))
 ;;; Generated autoloads from smerge-mode.el
 
 (autoload (quote smerge-ediff) "smerge-mode" "\
@@ -24470,7 +24475,7 @@
 ;;;***
 
 ;;;### (autoloads (smiley-buffer smiley-region) "smiley" "gnus/smiley.el"
-;;;;;;  (17939 56021))
+;;;;;;  (17875 18370))
 ;;; Generated autoloads from gnus/smiley.el
 
 (autoload (quote smiley-region) "smiley" "\
@@ -24488,7 +24493,7 @@
 ;;;***
 
 ;;;### (autoloads (smtpmail-send-queued-mail smtpmail-send-it) "smtpmail"
-;;;;;;  "mail/smtpmail.el" (17939 56022))
+;;;;;;  "mail/smtpmail.el" (17939 50716))
 ;;; Generated autoloads from mail/smtpmail.el
 
 (autoload (quote smtpmail-send-it) "smtpmail" "\
@@ -24503,7 +24508,7 @@
 
 ;;;***
 
-;;;### (autoloads (snake) "snake" "play/snake.el" (17843 45626))
+;;;### (autoloads (snake) "snake" "play/snake.el" (17842 55395))
 ;;; Generated autoloads from play/snake.el
 
 (autoload (quote snake) "snake" "\
@@ -24527,7 +24532,7 @@
 ;;;***
 
 ;;;### (autoloads (snmpv2-mode snmp-mode) "snmp-mode" "net/snmp-mode.el"
-;;;;;;  (17843 45624))
+;;;;;;  (17842 55218))
 ;;; Generated autoloads from net/snmp-mode.el
 
 (autoload (quote snmp-mode) "snmp-mode" "\
@@ -24558,7 +24563,7 @@
 
 ;;;### (autoloads (solar-equinoxes-solstices sunrise-sunset calendar-location-name
 ;;;;;;  calendar-longitude calendar-latitude calendar-time-display-form)
-;;;;;;  "solar" "calendar/solar.el" (17956 60684))
+;;;;;;  "solar" "calendar/solar.el" (17956 13479))
 ;;; Generated autoloads from calendar/solar.el
 
 (defvar calendar-time-display-form (quote (12-hours ":" minutes am-pm (if time-zone " (") time-zone (if time-zone ")"))) "\
@@ -24629,8 +24634,8 @@
 
 ;;;***
 
-;;;### (autoloads (solitaire) "solitaire" "play/solitaire.el" (17843
-;;;;;;  45626))
+;;;### (autoloads (solitaire) "solitaire" "play/solitaire.el" (17842
+;;;;;;  55395))
 ;;; Generated autoloads from play/solitaire.el
 
 (autoload (quote solitaire) "solitaire" "\
@@ -24707,7 +24712,7 @@
 
 ;;;### (autoloads (reverse-region sort-columns sort-regexp-fields
 ;;;;;;  sort-fields sort-numeric-fields sort-pages sort-paragraphs
-;;;;;;  sort-lines sort-subr) "sort" "sort.el" (17843 45612))
+;;;;;;  sort-lines sort-subr) "sort" "sort.el" (17842 58278))
 ;;; Generated autoloads from sort.el
 
 (autoload (quote sort-subr) "sort" "\
@@ -24849,8 +24854,8 @@
 
 ;;;***
 
-;;;### (autoloads (spam-initialize) "spam" "gnus/spam.el" (17843
-;;;;;;  45617))
+;;;### (autoloads (spam-initialize) "spam" "gnus/spam.el" (17842
+;;;;;;  54741))
 ;;; Generated autoloads from gnus/spam.el
 
 (autoload (quote spam-initialize) "spam" "\
@@ -24862,7 +24867,7 @@
 
 ;;;### (autoloads (spam-report-deagentize spam-report-agentize spam-report-url-to-file
 ;;;;;;  spam-report-url-ping-mm-url spam-report-process-queue) "spam-report"
-;;;;;;  "gnus/spam-report.el" (17843 45617))
+;;;;;;  "gnus/spam-report.el" (17842 54741))
 ;;; Generated autoloads from gnus/spam-report.el
 
 (autoload (quote spam-report-process-queue) "spam-report" "\
@@ -24905,7 +24910,7 @@
 ;;;***
 
 ;;;### (autoloads (speedbar-get-focus speedbar-frame-mode) "speedbar"
-;;;;;;  "speedbar.el" (17939 56017))
+;;;;;;  "speedbar.el" (17881 43027))
 ;;; Generated autoloads from speedbar.el
 
 (defalias (quote speedbar) (quote speedbar-frame-mode))
@@ -24930,7 +24935,7 @@
 ;;;***
 
 ;;;### (autoloads (spell-string spell-region spell-word spell-buffer)
-;;;;;;  "spell" "textmodes/spell.el" (17843 45630))
+;;;;;;  "spell" "textmodes/spell.el" (17842 58276))
 ;;; Generated autoloads from textmodes/spell.el
 
 (put (quote spell-filter) (quote risky-local-variable) t)
@@ -24966,8 +24971,8 @@
 
 ;;;***
 
-;;;### (autoloads (snarf-spooks spook) "spook" "play/spook.el" (17843
-;;;;;;  45626))
+;;;### (autoloads (snarf-spooks spook) "spook" "play/spook.el" (17842
+;;;;;;  55395))
 ;;; Generated autoloads from play/spook.el
 
 (autoload (quote spook) "spook" "\
@@ -24985,8 +24990,8 @@
 ;;;### (autoloads (sql-linter sql-db2 sql-interbase sql-postgres
 ;;;;;;  sql-ms sql-ingres sql-solid sql-mysql sql-sqlite sql-informix
 ;;;;;;  sql-sybase sql-oracle sql-product-interactive sql-mode sql-help
-;;;;;;  sql-add-product-keywords) "sql" "progmodes/sql.el" (17843
-;;;;;;  45629))
+;;;;;;  sql-add-product-keywords) "sql" "progmodes/sql.el" (17842
+;;;;;;  56332))
 ;;; Generated autoloads from progmodes/sql.el
 
 (autoload (quote sql-add-product-keywords) "sql" "\
@@ -25417,8 +25422,8 @@
 ;;;;;;  strokes-mode strokes-list-strokes strokes-load-user-strokes
 ;;;;;;  strokes-help strokes-describe-stroke strokes-do-complex-stroke
 ;;;;;;  strokes-do-stroke strokes-read-complex-stroke strokes-read-stroke
-;;;;;;  strokes-global-set-stroke) "strokes" "strokes.el" (17843
-;;;;;;  45612))
+;;;;;;  strokes-global-set-stroke) "strokes" "strokes.el" (17842
+;;;;;;  58278))
 ;;; Generated autoloads from strokes.el
 
 (autoload (quote strokes-global-set-stroke) "strokes" "\
@@ -25489,7 +25494,7 @@
 
 (defvar strokes-mode nil "\
 Non-nil if Strokes mode is enabled.
-See the command `strokes-mode' for a description of this minor-mode.
+See the command `strokes-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `strokes-mode'.")
@@ -25548,7 +25553,7 @@
 
 ;;;***
 
-;;;### (autoloads (locate-library) "subr" "subr.el" (17966 9915))
+;;;### (autoloads (locate-library) "subr" "subr.el" (17964 48351))
 ;;; Generated autoloads from subr.el
 
 (autoload (quote locate-library) "subr" "\
@@ -25570,7 +25575,7 @@
 ;;;***
 
 ;;;### (autoloads (sc-cite-original) "supercite" "mail/supercite.el"
-;;;;;;  (17939 56022))
+;;;;;;  (17854 7564))
 ;;; Generated autoloads from mail/supercite.el
 
 (autoload (quote sc-cite-original) "supercite" "\
@@ -25602,7 +25607,7 @@
 
 ;;;***
 
-;;;### (autoloads (t-mouse-mode) "t-mouse" "t-mouse.el" (17966 9915))
+;;;### (autoloads (t-mouse-mode) "t-mouse" "t-mouse.el" (18006 55796))
 ;;; Generated autoloads from t-mouse.el
 
 (defvar t-mouse-mode nil "\
@@ -25615,16 +25620,18 @@
 (custom-autoload (quote t-mouse-mode) "t-mouse" nil)
 
 (autoload (quote t-mouse-mode) "t-mouse" "\
-Toggle t-mouse mode.
+Toggle t-mouse mode to use the mouse in Linux consoles.
 With prefix arg, turn t-mouse mode on iff arg is positive.
 
-Turn it on to use Emacs mouse commands, and off to use t-mouse commands.
-
-\(fn &optional ARG)" t nil)
-
-;;;***
-
-;;;### (autoloads (tabify untabify) "tabify" "tabify.el" (17843 45612))
+This allows the use of the mouse when operating on a Linux console, in the
+same way as you can use the mouse under X11.
+It requires the `mev' program, part of the `gpm' utilities.
+
+\(fn &optional ARG)" t nil)
+
+;;;***
+
+;;;### (autoloads (tabify untabify) "tabify" "tabify.el" (17842 58278))
 ;;; Generated autoloads from tabify.el
 
 (autoload (quote untabify) "tabify" "\
@@ -25659,7 +25666,7 @@
 ;;;;;;  table-recognize table-insert-row-column table-insert-column
 ;;;;;;  table-insert-row table-insert table-point-left-cell-hook
 ;;;;;;  table-point-entered-cell-hook table-load-hook table-cell-map-hook)
-;;;;;;  "table" "textmodes/table.el" (17843 45630))
+;;;;;;  "table" "textmodes/table.el" (18012 17784))
 ;;; Generated autoloads from textmodes/table.el
 
 (defvar table-cell-map-hook nil "\
@@ -26247,7 +26254,7 @@
 
 ;;;***
 
-;;;### (autoloads (talk-connect) "talk" "talk.el" (17843 45612))
+;;;### (autoloads (talk-connect) "talk" "talk.el" (17842 58278))
 ;;; Generated autoloads from talk.el
 
 (autoload (quote talk-connect) "talk" "\
@@ -26257,7 +26264,7 @@
 
 ;;;***
 
-;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (17843 45612))
+;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (18010 5426))
 ;;; Generated autoloads from tar-mode.el
 
 (autoload (quote tar-mode) "tar-mode" "\
@@ -26281,7 +26288,7 @@
 ;;;***
 
 ;;;### (autoloads (tcl-help-on-word inferior-tcl tcl-mode) "tcl"
-;;;;;;  "progmodes/tcl.el" (17843 45629))
+;;;;;;  "progmodes/tcl.el" (17842 56332))
 ;;; Generated autoloads from progmodes/tcl.el
 
 (autoload (quote tcl-mode) "tcl" "\
@@ -26332,7 +26339,7 @@
 
 ;;;***
 
-;;;### (autoloads (rsh telnet) "telnet" "net/telnet.el" (17843 45624))
+;;;### (autoloads (rsh telnet) "telnet" "net/telnet.el" (17842 55218))
 ;;; Generated autoloads from net/telnet.el
  (add-hook 'same-window-regexps "\\*telnet-.*\\*\\(\\|<[0-9]+>\\)")
 
@@ -26359,8 +26366,8 @@
 
 ;;;***
 
-;;;### (autoloads (ansi-term term make-term) "term" "term.el" (17951
-;;;;;;  39252))
+;;;### (autoloads (ansi-term term make-term) "term" "term.el" (17952
+;;;;;;  11093))
 ;;; Generated autoloads from term.el
 
 (autoload (quote make-term) "term" "\
@@ -26388,8 +26395,8 @@
 
 ;;;***
 
-;;;### (autoloads (terminal-emulator) "terminal" "terminal.el" (17843
-;;;;;;  45612))
+;;;### (autoloads (terminal-emulator) "terminal" "terminal.el" (17842
+;;;;;;  58278))
 ;;; Generated autoloads from terminal.el
 
 (autoload (quote terminal-emulator) "terminal" "\
@@ -26426,7 +26433,7 @@
 ;;;***
 
 ;;;### (autoloads (testcover-this-defun) "testcover" "emacs-lisp/testcover.el"
-;;;;;;  (17939 56021))
+;;;;;;  (17925 52793))
 ;;; Generated autoloads from emacs-lisp/testcover.el
 
 (autoload (quote testcover-this-defun) "testcover" "\
@@ -26436,7 +26443,7 @@
 
 ;;;***
 
-;;;### (autoloads (tetris) "tetris" "play/tetris.el" (17941 5494))
+;;;### (autoloads (tetris) "tetris" "play/tetris.el" (17941 38806))
 ;;; Generated autoloads from play/tetris.el
 
 (autoload (quote tetris) "tetris" "\
@@ -26467,7 +26474,7 @@
 ;;;;;;  tex-start-commands tex-start-options slitex-run-command latex-run-command
 ;;;;;;  tex-run-command tex-offer-save tex-main-file tex-first-line-header-regexp
 ;;;;;;  tex-directory tex-shell-file-name) "tex-mode" "textmodes/tex-mode.el"
-;;;;;;  (17843 45630))
+;;;;;;  (17992 30878))
 ;;; Generated autoloads from textmodes/tex-mode.el
 
 (defvar tex-shell-file-name nil "\
@@ -26769,7 +26776,7 @@
 ;;;***
 
 ;;;### (autoloads (texi2info texinfo-format-region texinfo-format-buffer)
-;;;;;;  "texinfmt" "textmodes/texinfmt.el" (17843 45630))
+;;;;;;  "texinfmt" "textmodes/texinfmt.el" (17842 58276))
 ;;; Generated autoloads from textmodes/texinfmt.el
 
 (autoload (quote texinfo-format-buffer) "texinfmt" "\
@@ -26809,7 +26816,7 @@
 ;;;***
 
 ;;;### (autoloads (texinfo-mode texinfo-close-quote texinfo-open-quote)
-;;;;;;  "texinfo" "textmodes/texinfo.el" (17843 45630))
+;;;;;;  "texinfo" "textmodes/texinfo.el" (17842 58276))
 ;;; Generated autoloads from textmodes/texinfo.el
 
 (defvar texinfo-open-quote "``" "\
@@ -26896,7 +26903,7 @@
 ;;;### (autoloads (thai-auto-composition-mode thai-composition-function
 ;;;;;;  thai-post-read-conversion thai-compose-buffer thai-compose-string
 ;;;;;;  thai-compose-region) "thai-util" "language/thai-util.el"
-;;;;;;  (17843 45621))
+;;;;;;  (17842 58278))
 ;;; Generated autoloads from language/thai-util.el
 
 (autoload (quote thai-compose-region) "thai-util" "\
@@ -26940,7 +26947,7 @@
 
 ;;;### (autoloads (list-at-point number-at-point symbol-at-point
 ;;;;;;  sexp-at-point thing-at-point bounds-of-thing-at-point forward-thing)
-;;;;;;  "thingatpt" "thingatpt.el" (17843 45612))
+;;;;;;  "thingatpt" "thingatpt.el" (17842 58278))
 ;;; Generated autoloads from thingatpt.el
 
 (autoload (quote forward-thing) "thingatpt" "\
@@ -26997,7 +27004,7 @@
 
 ;;;### (autoloads (thumbs-dired-setroot thumbs-dired-show thumbs-dired-show-marked
 ;;;;;;  thumbs-show-from-dir thumbs-find-thumb) "thumbs" "thumbs.el"
-;;;;;;  (17966 9916))
+;;;;;;  (17963 26308))
 ;;; Generated autoloads from thumbs.el
 
 (autoload (quote thumbs-find-thumb) "thumbs" "\
@@ -27036,7 +27043,7 @@
 ;;;;;;  tibetan-composition-function tibetan-decompose-string tibetan-decompose-region
 ;;;;;;  tibetan-compose-region tibetan-compose-string tibetan-transcription-to-tibetan
 ;;;;;;  tibetan-tibetan-to-transcription tibetan-char-p) "tibet-util"
-;;;;;;  "language/tibet-util.el" (17843 45621))
+;;;;;;  "language/tibet-util.el" (17842 58278))
 ;;; Generated autoloads from language/tibet-util.el
 
 (autoload (quote tibetan-char-p) "tibet-util" "\
@@ -27115,7 +27122,7 @@
 ;;;***
 
 ;;;### (autoloads (tildify-buffer tildify-region) "tildify" "textmodes/tildify.el"
-;;;;;;  (17843 45630))
+;;;;;;  (17842 58276))
 ;;; Generated autoloads from textmodes/tildify.el
 
 (autoload (quote tildify-region) "tildify" "\
@@ -27139,7 +27146,7 @@
 ;;;***
 
 ;;;### (autoloads (display-time-mode display-time display-time-day-and-date)
-;;;;;;  "time" "time.el" (17995 6542))
+;;;;;;  "time" "time.el" (18006 55796))
 ;;; Generated autoloads from time.el
 
 (defvar display-time-day-and-date nil "\
@@ -27181,8 +27188,8 @@
 ;;;### (autoloads (safe-date-to-time time-to-days time-to-day-in-year
 ;;;;;;  date-leap-year-p days-between date-to-day time-add time-subtract
 ;;;;;;  time-since days-to-time time-less-p seconds-to-time time-to-seconds
-;;;;;;  date-to-time) "time-date" "calendar/time-date.el" (17843
-;;;;;;  45615))
+;;;;;;  date-to-time) "time-date" "calendar/time-date.el" (17842
+;;;;;;  53792))
 ;;; Generated autoloads from calendar/time-date.el
 
 (autoload (quote date-to-time) "time-date" "\
@@ -27268,7 +27275,7 @@
 ;;;***
 
 ;;;### (autoloads (time-stamp-toggle-active time-stamp) "time-stamp"
-;;;;;;  "time-stamp.el" (17843 45612))
+;;;;;;  "time-stamp.el" (17842 58278))
 ;;; Generated autoloads from time-stamp.el
 (put 'time-stamp-format 'safe-local-variable 'stringp)
 (put 'time-stamp-line-limit 'safe-local-variable 'integerp)
@@ -27311,7 +27318,7 @@
 ;;;;;;  timeclock-workday-remaining-string timeclock-reread-log timeclock-query-out
 ;;;;;;  timeclock-change timeclock-status-string timeclock-out timeclock-in
 ;;;;;;  timeclock-modeline-display) "timeclock" "calendar/timeclock.el"
-;;;;;;  (17988 52353))
+;;;;;;  (17992 30878))
 ;;; Generated autoloads from calendar/timeclock.el
 
 (autoload (quote timeclock-modeline-display) "timeclock" "\
@@ -27412,7 +27419,7 @@
 
 ;;;### (autoloads (with-timeout run-with-idle-timer add-timeout run-with-timer
 ;;;;;;  run-at-time cancel-function-timers cancel-timer) "timer"
-;;;;;;  "emacs-lisp/timer.el" (17939 56021))
+;;;;;;  "emacs-lisp/timer.el" (17935 13348))
 ;;; Generated autoloads from emacs-lisp/timer.el
 
 (defalias (quote disable-timeout) (quote cancel-timer))
@@ -27493,7 +27500,7 @@
 ;;;***
 
 ;;;### (autoloads (batch-titdic-convert titdic-convert) "titdic-cnv"
-;;;;;;  "international/titdic-cnv.el" (17939 56022))
+;;;;;;  "international/titdic-cnv.el" (17870 32853))
 ;;; Generated autoloads from international/titdic-cnv.el
 
 (autoload (quote titdic-convert) "titdic-cnv" "\
@@ -27516,8 +27523,8 @@
 ;;;***
 
 ;;;### (autoloads (tamil-composition-function tamil-post-read-conversion
-;;;;;;  tamil-compose-region) "tml-util" "language/tml-util.el" (17843
-;;;;;;  45621))
+;;;;;;  tamil-compose-region) "tml-util" "language/tml-util.el" (17842
+;;;;;;  58278))
 ;;; Generated autoloads from language/tml-util.el
 
 (autoload (quote tamil-compose-region) "tml-util" "\
@@ -27540,7 +27547,7 @@
 ;;;***
 
 ;;;### (autoloads (tmm-prompt tmm-menubar-mouse tmm-menubar) "tmm"
-;;;;;;  "tmm.el" (17953 11485))
+;;;;;;  "tmm.el" (17952 58711))
 ;;; Generated autoloads from tmm.el
  (define-key global-map "\M-`" 'tmm-menubar)
  (define-key global-map [f10] 'tmm-menubar)
@@ -27581,7 +27588,7 @@
 
 ;;;### (autoloads (todo-show todo-cp todo-mode todo-print todo-top-priorities
 ;;;;;;  todo-insert-item todo-add-item-non-interactively todo-add-category)
-;;;;;;  "todo-mode" "calendar/todo-mode.el" (17966 9916))
+;;;;;;  "todo-mode" "calendar/todo-mode.el" (17962 52848))
 ;;; Generated autoloads from calendar/todo-mode.el
 
 (autoload (quote todo-add-category) "todo-mode" "\
@@ -27642,7 +27649,7 @@
 
 ;;;### (autoloads (tool-bar-local-item-from-menu tool-bar-add-item-from-menu
 ;;;;;;  tool-bar-local-item tool-bar-add-item) "tool-bar" "tool-bar.el"
-;;;;;;  (17843 45612))
+;;;;;;  (17842 58278))
 ;;; Generated autoloads from tool-bar.el
 
 (put (quote tool-bar-mode) (quote standard-value) (quote (t)))
@@ -27709,12 +27716,12 @@
 ;;;***
 
 ;;;### (autoloads (tpu-edt-on tpu-edt-mode) "tpu-edt" "emulation/tpu-edt.el"
-;;;;;;  (17843 45615))
+;;;;;;  (18006 55796))
 ;;; Generated autoloads from emulation/tpu-edt.el
 
 (defvar tpu-edt-mode nil "\
 Non-nil if Tpu-Edt mode is enabled.
-See the command `tpu-edt-mode' for a description of this minor-mode.
+See the command `tpu-edt-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `tpu-edt-mode'.")
@@ -27736,7 +27743,7 @@
 ;;;***
 
 ;;;### (autoloads (tpu-set-cursor-bound tpu-set-cursor-free tpu-set-scroll-margins)
-;;;;;;  "tpu-extras" "emulation/tpu-extras.el" (17843 45615))
+;;;;;;  "tpu-extras" "emulation/tpu-extras.el" (17842 54264))
 ;;; Generated autoloads from emulation/tpu-extras.el
 
 (autoload (quote tpu-set-scroll-margins) "tpu-extras" "\
@@ -27756,7 +27763,7 @@
 
 ;;;***
 
-;;;### (autoloads (tq-create) "tq" "emacs-lisp/tq.el" (17843 45615))
+;;;### (autoloads (tq-create) "tq" "emacs-lisp/tq.el" (17842 54152))
 ;;; Generated autoloads from emacs-lisp/tq.el
 
 (autoload (quote tq-create) "tq" "\
@@ -27770,7 +27777,7 @@
 ;;;***
 
 ;;;### (autoloads (trace-function-background trace-function trace-buffer)
-;;;;;;  "trace" "emacs-lisp/trace.el" (17843 45615))
+;;;;;;  "trace" "emacs-lisp/trace.el" (17842 54152))
 ;;; Generated autoloads from emacs-lisp/trace.el
 
 (defvar trace-buffer "*trace-output*" "\
@@ -27807,7 +27814,7 @@
 ;;;### (autoloads (tramp-unload-tramp tramp-completion-handle-file-name-completion
 ;;;;;;  tramp-completion-handle-file-name-all-completions tramp-unload-file-name-handlers
 ;;;;;;  tramp-file-name-handler tramp-completion-file-name-regexp
-;;;;;;  tramp-file-name-regexp) "tramp" "net/tramp.el" (17939 56022))
+;;;;;;  tramp-file-name-regexp) "tramp" "net/tramp.el" (17934 45069))
 ;;; Generated autoloads from net/tramp.el
 
 (defvar tramp-unified-filenames (not (featurep (quote xemacs))) "\
@@ -27924,7 +27931,7 @@
 ;;;***
 
 ;;;### (autoloads (tramp-ftp-enable-ange-ftp) "tramp-ftp" "net/tramp-ftp.el"
-;;;;;;  (17843 45624))
+;;;;;;  (17842 55218))
 ;;; Generated autoloads from net/tramp-ftp.el
 
 (autoload (quote tramp-ftp-enable-ange-ftp) "tramp-ftp" "\
@@ -27934,8 +27941,8 @@
 
 ;;;***
 
-;;;### (autoloads (help-with-tutorial) "tutorial" "tutorial.el" (17995
-;;;;;;  6542))
+;;;### (autoloads (help-with-tutorial) "tutorial" "tutorial.el" (18006
+;;;;;;  55796))
 ;;; Generated autoloads from tutorial.el
 
 (autoload (quote help-with-tutorial) "tutorial" "\
@@ -27960,7 +27967,7 @@
 ;;;***
 
 ;;;### (autoloads (2C-split 2C-associate-buffer 2C-two-columns) "two-column"
-;;;;;;  "textmodes/two-column.el" (17843 45630))
+;;;;;;  "textmodes/two-column.el" (17842 58276))
 ;;; Generated autoloads from textmodes/two-column.el
  (autoload '2C-command "two-column" () t 'keymap)
  (global-set-key "\C-x6" '2C-command)
@@ -28011,7 +28018,7 @@
 ;;;;;;  type-break type-break-mode type-break-keystroke-threshold
 ;;;;;;  type-break-good-break-interval type-break-good-rest-interval
 ;;;;;;  type-break-interval type-break-mode) "type-break" "type-break.el"
-;;;;;;  (17939 56017))
+;;;;;;  (17908 29123))
 ;;; Generated autoloads from type-break.el
 
 (defvar type-break-mode nil "\
@@ -28194,7 +28201,7 @@
 ;;;***
 
 ;;;### (autoloads (ununderline-region underline-region) "underline"
-;;;;;;  "textmodes/underline.el" (17843 45630))
+;;;;;;  "textmodes/underline.el" (17842 58276))
 ;;; Generated autoloads from textmodes/underline.el
 
 (autoload (quote underline-region) "underline" "\
@@ -28215,7 +28222,7 @@
 ;;;***
 
 ;;;### (autoloads (unforward-rmail-message undigestify-rmail-message)
-;;;;;;  "undigest" "mail/undigest.el" (17843 45622))
+;;;;;;  "undigest" "mail/undigest.el" (17842 55035))
 ;;; Generated autoloads from mail/undigest.el
 
 (autoload (quote undigestify-rmail-message) "undigest" "\
@@ -28234,7 +28241,7 @@
 ;;;***
 
 ;;;### (autoloads (unrmail batch-unrmail) "unrmail" "mail/unrmail.el"
-;;;;;;  (17843 45622))
+;;;;;;  (17842 55035))
 ;;; Generated autoloads from mail/unrmail.el
 
 (autoload (quote batch-unrmail) "unrmail" "\
@@ -28253,8 +28260,8 @@
 
 ;;;***
 
-;;;### (autoloads (unsafep) "unsafep" "emacs-lisp/unsafep.el" (17843
-;;;;;;  45615))
+;;;### (autoloads (unsafep) "unsafep" "emacs-lisp/unsafep.el" (17842
+;;;;;;  54152))
 ;;; Generated autoloads from emacs-lisp/unsafep.el
 
 (autoload (quote unsafep) "unsafep" "\
@@ -28267,7 +28274,7 @@
 ;;;***
 
 ;;;### (autoloads (url-retrieve-synchronously url-retrieve) "url"
-;;;;;;  "url/url.el" (17843 45630))
+;;;;;;  "url/url.el" (17842 56569))
 ;;; Generated autoloads from url/url.el
 
 (autoload (quote url-retrieve) "url" "\
@@ -28307,7 +28314,7 @@
 ;;;***
 
 ;;;### (autoloads (url-register-auth-scheme url-get-authentication)
-;;;;;;  "url-auth" "url/url-auth.el" (17939 56024))
+;;;;;;  "url-auth" "url/url-auth.el" (17854 10173))
 ;;; Generated autoloads from url/url-auth.el
 
 (autoload (quote url-get-authentication) "url-auth" "\
@@ -28349,8 +28356,8 @@
 ;;;***
 
 ;;;### (autoloads (url-cache-expired url-cache-extract url-is-cached
-;;;;;;  url-store-in-cache) "url-cache" "url/url-cache.el" (17843
-;;;;;;  45630))
+;;;;;;  url-store-in-cache) "url-cache" "url/url-cache.el" (17842
+;;;;;;  56569))
 ;;; Generated autoloads from url/url-cache.el
 
 (autoload (quote url-store-in-cache) "url-cache" "\
@@ -28375,7 +28382,7 @@
 
 ;;;***
 
-;;;### (autoloads (url-cid) "url-cid" "url/url-cid.el" (17843 45630))
+;;;### (autoloads (url-cid) "url-cid" "url/url-cid.el" (17842 56569))
 ;;; Generated autoloads from url/url-cid.el
 
 (autoload (quote url-cid) "url-cid" "\
@@ -28386,7 +28393,7 @@
 ;;;***
 
 ;;;### (autoloads (url-dav-vc-registered url-dav-supported-p) "url-dav"
-;;;;;;  "url/url-dav.el" (17843 45630))
+;;;;;;  "url/url-dav.el" (17842 56569))
 ;;; Generated autoloads from url/url-dav.el
 
 (autoload (quote url-dav-supported-p) "url-dav" "\
@@ -28401,8 +28408,8 @@
 
 ;;;***
 
-;;;### (autoloads (url-file) "url-file" "url/url-file.el" (17843
-;;;;;;  45630))
+;;;### (autoloads (url-file) "url-file" "url/url-file.el" (17842
+;;;;;;  56569))
 ;;; Generated autoloads from url/url-file.el
 
 (autoload (quote url-file) "url-file" "\
@@ -28413,7 +28420,7 @@
 ;;;***
 
 ;;;### (autoloads (url-open-stream url-gateway-nslookup-host) "url-gw"
-;;;;;;  "url/url-gw.el" (17843 45630))
+;;;;;;  "url/url-gw.el" (17842 56569))
 ;;; Generated autoloads from url/url-gw.el
 
 (autoload (quote url-gateway-nslookup-host) "url-gw" "\
@@ -28432,13 +28439,13 @@
 ;;;***
 
 ;;;### (autoloads (url-insert-file-contents url-file-local-copy url-copy-file
-;;;;;;  url-handler-mode) "url-handlers" "url/url-handlers.el" (17843
-;;;;;;  45630))
+;;;;;;  url-handler-mode) "url-handlers" "url/url-handlers.el" (17842
+;;;;;;  56569))
 ;;; Generated autoloads from url/url-handlers.el
 
 (defvar url-handler-mode nil "\
 Non-nil if Url-Handler mode is enabled.
-See the command `url-handler-mode' for a description of this minor-mode.
+See the command `url-handler-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `url-handler-mode'.")
@@ -28477,7 +28484,7 @@
 ;;;***
 
 ;;;### (autoloads (url-http-options url-http-file-attributes url-http-file-exists-p
-;;;;;;  url-http) "url-http" "url/url-http.el" (17951 39666))
+;;;;;;  url-http) "url-http" "url/url-http.el" (17952 11683))
 ;;; Generated autoloads from url/url-http.el
 
 (autoload (quote url-http) "url-http" "\
@@ -28542,7 +28549,7 @@
 
 ;;;***
 
-;;;### (autoloads (url-irc) "url-irc" "url/url-irc.el" (17843 45630))
+;;;### (autoloads (url-irc) "url-irc" "url/url-irc.el" (17842 56569))
 ;;; Generated autoloads from url/url-irc.el
 
 (autoload (quote url-irc) "url-irc" "\
@@ -28552,8 +28559,8 @@
 
 ;;;***
 
-;;;### (autoloads (url-ldap) "url-ldap" "url/url-ldap.el" (17843
-;;;;;;  45630))
+;;;### (autoloads (url-ldap) "url-ldap" "url/url-ldap.el" (17842
+;;;;;;  56569))
 ;;; Generated autoloads from url/url-ldap.el
 
 (autoload (quote url-ldap) "url-ldap" "\
@@ -28567,7 +28574,7 @@
 ;;;***
 
 ;;;### (autoloads (url-mailto url-mail) "url-mailto" "url/url-mailto.el"
-;;;;;;  (17843 45630))
+;;;;;;  (18012 18089))
 ;;; Generated autoloads from url/url-mailto.el
 
 (autoload (quote url-mail) "url-mailto" "\
@@ -28583,7 +28590,7 @@
 ;;;***
 
 ;;;### (autoloads (url-data url-generic-emulator-loader url-info
-;;;;;;  url-man) "url-misc" "url/url-misc.el" (17843 45630))
+;;;;;;  url-man) "url-misc" "url/url-misc.el" (17842 56569))
 ;;; Generated autoloads from url/url-misc.el
 
 (autoload (quote url-man) "url-misc" "\
@@ -28615,7 +28622,7 @@
 ;;;***
 
 ;;;### (autoloads (url-snews url-news) "url-news" "url/url-news.el"
-;;;;;;  (17843 45630))
+;;;;;;  (17842 56569))
 ;;; Generated autoloads from url/url-news.el
 
 (autoload (quote url-news) "url-news" "\
@@ -28632,7 +28639,7 @@
 
 ;;;### (autoloads (url-ns-user-pref url-ns-prefs isInNet isResolvable
 ;;;;;;  dnsResolve dnsDomainIs isPlainHostName) "url-ns" "url/url-ns.el"
-;;;;;;  (17843 45630))
+;;;;;;  (17842 56569))
 ;;; Generated autoloads from url/url-ns.el
 
 (autoload (quote isPlainHostName) "url-ns" "\
@@ -28673,7 +28680,7 @@
 ;;;***
 
 ;;;### (autoloads (url-generic-parse-url url-recreate-url) "url-parse"
-;;;;;;  "url/url-parse.el" (17955 48758))
+;;;;;;  "url/url-parse.el" (17954 22157))
 ;;; Generated autoloads from url/url-parse.el
 
 (autoload (quote url-recreate-url) "url-parse" "\
@@ -28691,7 +28698,7 @@
 ;;;***
 
 ;;;### (autoloads (url-setup-privacy-info) "url-privacy" "url/url-privacy.el"
-;;;;;;  (17843 45630))
+;;;;;;  (17842 56569))
 ;;; Generated autoloads from url/url-privacy.el
 
 (autoload (quote url-setup-privacy-info) "url-privacy" "\
@@ -28707,7 +28714,7 @@
 ;;;;;;  url-strip-leading-spaces url-eat-trailing-space url-get-normalized-date
 ;;;;;;  url-lazy-message url-normalize-url url-insert-entities-in-string
 ;;;;;;  url-parse-args url-debug url-debug) "url-util" "url/url-util.el"
-;;;;;;  (17843 45630))
+;;;;;;  (17842 56569))
 ;;; Generated autoloads from url/url-util.el
 
 (defvar url-debug nil "\
@@ -28836,7 +28843,7 @@
 ;;;***
 
 ;;;### (autoloads (ask-user-about-supersession-threat ask-user-about-lock)
-;;;;;;  "userlock" "userlock.el" (17843 45612))
+;;;;;;  "userlock" "userlock.el" (17842 58278))
 ;;; Generated autoloads from userlock.el
 
 (autoload (quote ask-user-about-lock) "userlock" "\
@@ -28866,7 +28873,7 @@
 
 ;;;### (autoloads (uudecode-decode-region uudecode-decode-region-internal
 ;;;;;;  uudecode-decode-region-external) "uudecode" "gnus/uudecode.el"
-;;;;;;  (17939 56022))
+;;;;;;  (17855 50203))
 ;;; Generated autoloads from gnus/uudecode.el
 
 (autoload (quote uudecode-decode-region-external) "uudecode" "\
@@ -28896,7 +28903,7 @@
 ;;;;;;  vc-directory vc-merge vc-insert-headers vc-version-other-window
 ;;;;;;  vc-diff vc-register vc-next-action vc-do-command edit-vc-file
 ;;;;;;  with-vc-file vc-branch-part vc-trunk-p vc-before-checkin-hook
-;;;;;;  vc-checkin-hook vc-checkout-hook) "vc" "vc.el" (17843 45612))
+;;;;;;  vc-checkin-hook vc-checkout-hook) "vc" "vc.el" (17992 30877))
 ;;; Generated autoloads from vc.el
 
 (defvar vc-checkout-hook nil "\
@@ -29184,7 +29191,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "vc-arch" "vc-arch.el" (17939 56017))
+;;;### (autoloads nil "vc-arch" "vc-arch.el" (17930 34221))
 ;;; Generated autoloads from vc-arch.el
  (defun vc-arch-registered (file)
   (if (vc-find-root file "{arch}/=tagging-method")
@@ -29194,7 +29201,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "vc-cvs" "vc-cvs.el" (17843 45612))
+;;;### (autoloads nil "vc-cvs" "vc-cvs.el" (17842 58278))
 ;;; Generated autoloads from vc-cvs.el
  (defun vc-cvs-registered (f)
   (when (file-readable-p (expand-file-name
@@ -29204,7 +29211,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "vc-mcvs" "vc-mcvs.el" (17843 45612))
+;;;### (autoloads nil "vc-mcvs" "vc-mcvs.el" (17842 58278))
 ;;; Generated autoloads from vc-mcvs.el
  (defun vc-mcvs-registered (file)
   (if (vc-find-root file "MCVS/CVS")
@@ -29215,7 +29222,7 @@
 ;;;***
 
 ;;;### (autoloads (vc-rcs-master-templates) "vc-rcs" "vc-rcs.el"
-;;;;;;  (17939 56017))
+;;;;;;  (17925 15266))
 ;;; Generated autoloads from vc-rcs.el
 
 (defvar vc-rcs-master-templates (quote ("%sRCS/%s,v" "%s%s,v" "%sRCS/%s")) "\
@@ -29228,7 +29235,7 @@
 ;;;***
 
 ;;;### (autoloads (vc-sccs-master-templates) "vc-sccs" "vc-sccs.el"
-;;;;;;  (17843 45612))
+;;;;;;  (17842 58278))
 ;;; Generated autoloads from vc-sccs.el
 
 (defvar vc-sccs-master-templates (quote ("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir)) "\
@@ -29245,7 +29252,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "vc-svn" "vc-svn.el" (17939 56018))
+;;;### (autoloads nil "vc-svn" "vc-svn.el" (17881 64914))
 ;;; Generated autoloads from vc-svn.el
  (defun vc-svn-registered (f)
   (let ((admin-dir (cond ((and (eq system-type 'windows-nt)
@@ -29263,7 +29270,7 @@
 ;;;***
 
 ;;;### (autoloads (vhdl-mode) "vhdl-mode" "progmodes/vhdl-mode.el"
-;;;;;;  (17966 9917))
+;;;;;;  (17962 27361))
 ;;; Generated autoloads from progmodes/vhdl-mode.el
 
 (autoload (quote vhdl-mode) "vhdl-mode" "\
@@ -29804,7 +29811,7 @@
 
 ;;;***
 
-;;;### (autoloads (vi-mode) "vi" "emulation/vi.el" (17789 35159))
+;;;### (autoloads (vi-mode) "vi" "emulation/vi.el" (17788 40208))
 ;;; Generated autoloads from emulation/vi.el
 
 (autoload (quote vi-mode) "vi" "\
@@ -29859,7 +29866,7 @@
 ;;;### (autoloads (viqr-pre-write-conversion viqr-post-read-conversion
 ;;;;;;  viet-encode-viqr-buffer viet-encode-viqr-region viet-decode-viqr-buffer
 ;;;;;;  viet-decode-viqr-region viet-encode-viscii-char) "viet-util"
-;;;;;;  "language/viet-util.el" (17843 45621))
+;;;;;;  "language/viet-util.el" (17842 58278))
 ;;; Generated autoloads from language/viet-util.el
 
 (autoload (quote viet-encode-viscii-char) "viet-util" "\
@@ -29905,8 +29912,8 @@
 
 ;;;### (autoloads (View-exit-and-edit view-mode-enter view-mode view-buffer-other-frame
 ;;;;;;  view-buffer-other-window view-buffer view-file-other-frame
-;;;;;;  view-file-other-window view-file) "view" "view.el" (17995
-;;;;;;  6542))
+;;;;;;  view-file-other-window view-file) "view" "view.el" (18006
+;;;;;;  55796))
 ;;; Generated autoloads from view.el
 
 (defvar view-mode nil "\
@@ -30115,8 +30122,8 @@
 
 ;;;***
 
-;;;### (autoloads (vip-mode vip-setup) "vip" "emulation/vip.el" (17843
-;;;;;;  45615))
+;;;### (autoloads (vip-mode vip-setup) "vip" "emulation/vip.el" (17842
+;;;;;;  54264))
 ;;; Generated autoloads from emulation/vip.el
 
 (autoload (quote vip-setup) "vip" "\
@@ -30132,7 +30139,7 @@
 ;;;***
 
 ;;;### (autoloads (viper-mode toggle-viper-mode) "viper" "emulation/viper.el"
-;;;;;;  (17939 56021))
+;;;;;;  (17921 23052))
 ;;; Generated autoloads from emulation/viper.el
 
 (autoload (quote toggle-viper-mode) "viper" "\
@@ -30149,7 +30156,7 @@
 ;;;***
 
 ;;;### (autoloads (warn lwarn display-warning) "warnings" "emacs-lisp/warnings.el"
-;;;;;;  (17939 56021))
+;;;;;;  (17935 13348))
 ;;; Generated autoloads from emacs-lisp/warnings.el
 
 (defvar warning-prefix-function nil "\
@@ -30239,7 +30246,7 @@
 ;;;***
 
 ;;;### (autoloads (wdired-change-to-wdired-mode) "wdired" "wdired.el"
-;;;;;;  (17843 45612))
+;;;;;;  (17842 58278))
 ;;; Generated autoloads from wdired.el
 
 (autoload (quote wdired-change-to-wdired-mode) "wdired" "\
@@ -30255,7 +30262,7 @@
 
 ;;;***
 
-;;;### (autoloads (webjump) "webjump" "net/webjump.el" (17843 45625))
+;;;### (autoloads (webjump) "webjump" "net/webjump.el" (17842 55218))
 ;;; Generated autoloads from net/webjump.el
 
 (autoload (quote webjump) "webjump" "\
@@ -30272,7 +30279,7 @@
 ;;;***
 
 ;;;### (autoloads (which-function-mode) "which-func" "progmodes/which-func.el"
-;;;;;;  (17843 45629))
+;;;;;;  (17842 56332))
 ;;; Generated autoloads from progmodes/which-func.el
  (put 'which-func-format 'risky-local-variable t)
  (put 'which-func-current 'risky-local-variable t)
@@ -30281,7 +30288,7 @@
 
 (defvar which-function-mode nil "\
 Non-nil if Which-Function mode is enabled.
-See the command `which-function-mode' for a description of this minor-mode.
+See the command `which-function-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `which-function-mode'.")
@@ -30305,7 +30312,7 @@
 ;;;;;;  whitespace-buffer whitespace-toggle-ateol-check whitespace-toggle-spacetab-check
 ;;;;;;  whitespace-toggle-indent-check whitespace-toggle-trailing-check
 ;;;;;;  whitespace-toggle-leading-check) "whitespace" "whitespace.el"
-;;;;;;  (17939 56018))
+;;;;;;  (17925 15266))
 ;;; Generated autoloads from whitespace.el
 
 (autoload (quote whitespace-toggle-leading-check) "whitespace" "\
@@ -30371,7 +30378,7 @@
 
 (defvar whitespace-global-mode nil "\
 Non-nil if Whitespace-Global mode is enabled.
-See the command `whitespace-global-mode' for a description of this minor-mode.
+See the command `whitespace-global-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `whitespace-global-mode'.")
@@ -30396,7 +30403,7 @@
 ;;;***
 
 ;;;### (autoloads (widget-minor-mode widget-browse-other-window widget-browse
-;;;;;;  widget-browse-at) "wid-browse" "wid-browse.el" (17843 45612))
+;;;;;;  widget-browse-at) "wid-browse" "wid-browse.el" (17842 58278))
 ;;; Generated autoloads from wid-browse.el
 
 (autoload (quote widget-browse-at) "wid-browse" "\
@@ -30423,8 +30430,8 @@
 ;;;***
 
 ;;;### (autoloads (widget-setup widget-insert widget-delete widget-create
-;;;;;;  widget-prompt-value widgetp) "wid-edit" "wid-edit.el" (17951
-;;;;;;  39252))
+;;;;;;  widget-prompt-value widgetp) "wid-edit" "wid-edit.el" (17952
+;;;;;;  11093))
 ;;; Generated autoloads from wid-edit.el
 
 (autoload (quote widgetp) "wid-edit" "\
@@ -30468,8 +30475,8 @@
 ;;;***
 
 ;;;### (autoloads (windmove-default-keybindings windmove-down windmove-right
-;;;;;;  windmove-up windmove-left) "windmove" "windmove.el" (17843
-;;;;;;  45612))
+;;;;;;  windmove-up windmove-left) "windmove" "windmove.el" (17842
+;;;;;;  58278))
 ;;; Generated autoloads from windmove.el
 
 (autoload (quote windmove-left) "windmove" "\
@@ -30522,7 +30529,7 @@
 ;;;***
 
 ;;;### (autoloads (winner-mode winner-mode) "winner" "winner.el"
-;;;;;;  (17843 45613))
+;;;;;;  (17842 58278))
 ;;; Generated autoloads from winner.el
 
 (defvar winner-mode nil "\
@@ -30541,7 +30548,7 @@
 ;;;***
 
 ;;;### (autoloads (woman-find-file woman-dired-find-file woman) "woman"
-;;;;;;  "woman.el" (17947 59257))
+;;;;;;  "woman.el" (17949 41467))
 ;;; Generated autoloads from woman.el
 
 (autoload (quote woman) "woman" "\
@@ -30577,7 +30584,7 @@
 ;;;***
 
 ;;;### (autoloads (wordstar-mode) "ws-mode" "emulation/ws-mode.el"
-;;;;;;  (17843 45616))
+;;;;;;  (17842 54264))
 ;;; Generated autoloads from emulation/ws-mode.el
 
 (autoload (quote wordstar-mode) "ws-mode" "\
@@ -30690,7 +30697,7 @@
 ;;;***
 
 ;;;### (autoloads (xml-parse-region xml-parse-file) "xml" "xml.el"
-;;;;;;  (17939 56018))
+;;;;;;  (17916 14776))
 ;;; Generated autoloads from xml.el
 
 (autoload (quote xml-parse-file) "xml" "\
@@ -30715,13 +30722,13 @@
 
 ;;;***
 
-;;;### (autoloads (xterm-mouse-mode) "xt-mouse" "xt-mouse.el" (17939
-;;;;;;  56019))
+;;;### (autoloads (xterm-mouse-mode) "xt-mouse" "xt-mouse.el" (18007
+;;;;;;  39657))
 ;;; Generated autoloads from xt-mouse.el
 
 (defvar xterm-mouse-mode nil "\
 Non-nil if Xterm-Mouse mode is enabled.
-See the command `xterm-mouse-mode' for a description of this minor-mode.
+See the command `xterm-mouse-mode' for a description of this minor mode.
 Setting this variable directly does not take effect;
 either customize it (see the info node `Easy Customization')
 or call the function `xterm-mouse-mode'.")
@@ -30744,7 +30751,7 @@
 ;;;***
 
 ;;;### (autoloads (yenc-extract-filename yenc-decode-region) "yenc"
-;;;;;;  "gnus/yenc.el" (17843 45618))
+;;;;;;  "gnus/yenc.el" (17842 54741))
 ;;; Generated autoloads from gnus/yenc.el
 
 (autoload (quote yenc-decode-region) "yenc" "\
@@ -30760,7 +30767,7 @@
 ;;;***
 
 ;;;### (autoloads (psychoanalyze-pinhead apropos-zippy insert-zippyism
-;;;;;;  yow) "yow" "play/yow.el" (17843 45626))
+;;;;;;  yow) "yow" "play/yow.el" (17842 55395))
 ;;; Generated autoloads from play/yow.el
 
 (autoload (quote yow) "yow" "\
@@ -30786,7 +30793,7 @@
 
 ;;;***
 
-;;;### (autoloads (zone) "zone" "play/zone.el" (17941 5494))
+;;;### (autoloads (zone) "zone" "play/zone.el" (17941 38806))
 ;;; Generated autoloads from play/zone.el
 
 (autoload (quote zone) "zone" "\
@@ -30926,7 +30933,7 @@
 ;;;;;;  "url/url-vars.el" "url/vc-dav.el" "vc-hooks.el" "vcursor.el"
 ;;;;;;  "version.el" "vms-patch.el" "vmsproc.el" "vt-control.el"
 ;;;;;;  "vt100-led.el" "w32-fns.el" "w32-vars.el" "widget.el" "window.el"
-;;;;;;  "x-dnd.el") (17996 40125 700465))
+;;;;;;  "x-dnd.el") (18016 62249 573562))
 
 ;;;***
 
--- a/lisp/longlines.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/longlines.el	Mon Jun 11 00:58:11 2007 +0000
@@ -368,10 +368,10 @@
 With optional argument ARG, turn on line wrapping if and only if ARG is positive.
 If automatic line wrapping is turned on, wrap the entire buffer."
   (interactive "P")
-  (and (null arg)
-       (null longlines-auto-wrap)
-       (setq arg 1))
-  (if (> (prefix-numeric-value arg) 0)
+  (setq arg (if arg
+		(> (prefix-numeric-value arg) 0)
+	      (not longlines-auto-wrap)))
+  (if arg
       (let ((mod (buffer-modified-p)))
 	(setq longlines-auto-wrap t)
 	(longlines-wrap-region (point-min) (point-max))
--- a/lisp/mail/rmail.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/mail/rmail.el	Mon Jun 11 00:58:11 2007 +0000
@@ -228,7 +228,7 @@
   `emacs'     Means any implementation, compatible with the native Emacs one.
               This is the default;
   `mailutils' Means GNU mailutils implementation, capable of handling full
-mail URLs as the source mailbox;")
+mail URLs as the source mailbox.")
 
 ;;;###autoload
 (defun rmail-movemail-variant-p (&rest variants)
--- a/lisp/mail/rmailsum.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/mail/rmailsum.el	Mon Jun 11 00:58:11 2007 +0000
@@ -854,6 +854,15 @@
 		      (set-buffer rmail-buffer)
 		      (rmail-show-message msg-num t))))))
 	(rmail-summary-update-highlight nil)))))
+
+(defun rmail-summary-save-buffer ()
+  "Save the buffer associated with this RMAIL summary."
+  (interactive)
+  (save-window-excursion
+    (save-excursion
+      (switch-to-buffer rmail-buffer)
+      (save-buffer))))
+
 
 (if rmail-summary-mode-map
     nil
@@ -923,6 +932,7 @@
     'rmail-summary-sort-by-lines)
   (define-key rmail-summary-mode-map "\C-c\C-s\C-k"
     'rmail-summary-sort-by-labels)
+  (define-key rmail-summary-mode-map "\C-x\C-s" 'rmail-summary-save-buffer)
   )
 
 ;;; Menu bar bindings.
--- a/lisp/mh-e/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/mh-e/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,8 @@
+2007-06-06  Juanma Barranquero  <lekktu@gmail.com>
+
+	* mh-mime.el (mh-mh-directive-present-p):
+	* mh-search.el (mh-index-group-by-folder): Fix typos in docstrings.
+
 2006-11-14  Bill Wohler  <wohler@newt.com>
 
 	* mh-xface.el (mh-x-image-url-cache-canonicalize): Add `*' to
@@ -10,7 +15,7 @@
 	* mh-e.el (Version, mh-version): Update for release 8.0.3.
 
 	* mh-e.el (mh-alias-local-users): Boolean docstrings should start
-	with "Non-nil means". Perhaps this option should have a -flag
+	with "Non-nil means".  Perhaps this option should have a -flag
 	appended.
 	(mh-junk-background): Sync docstring with manual.
 
@@ -62,7 +67,7 @@
 	* mh-tool-bar.el (mh-tool-bar-define): Fix XEmacs' vector-list so
 	it refers to the icons in mh-xemacs-icon-map instead of trying to
 	declare the icons in situ.  This allows mh-tool-bar.el to be
-	compiled under XEmacs. Remove initial value for
+	compiled under XEmacs.  Remove initial value for
 	mh-tool-bar-folder-buttons, mh-tool-bar-show-buttons,
 	mh-tool-bar-letter-buttons.  The MH-E icons now appear in XEmacs.
 	In mh-tool-bar-init, check for mh-xemacs-use-tool-bar-flag sooner.
@@ -133,7 +138,7 @@
 2006-04-26  Eric Ding  <ericding@alum.mit.edu>
 
 	* mh-e.el (mh-invisible-header-fields-internal): Add entry
-	"X-Provags-ID:"
+	"X-Provags-ID:".
 
 2006-04-25  Bill Wohler  <wohler@newt.com>
 
@@ -155,9 +160,9 @@
 
 	* mh-letter.el (mh-insert-letter): If a message number isn't
 	given, throw an error rather than using a potentially incorrect
-	message number (closes SF #1473729). In addition, use the cur
+	message number (closes SF #1473729).  In addition, use the cur
 	message if mh-sent-from-msg is nil (when sending a message, in
-	contrast to replying). Move conversion of int to string into
+	contrast to replying).  Move conversion of int to string into
 	interactive stanza so body can assume variables are of proper
 	type.
 
@@ -177,15 +182,15 @@
 	(mh-tool-bar-folder-buttons-set, mh-tool-bar-letter-buttons-set):
 	Call it (closes SF #1452718).
 
-	* mh-folder.el (mh-folder-buttons-init-flag): Delete. Use
+	* mh-folder.el (mh-folder-buttons-init-flag): Delete.  Use
 	mh-folder-tool-bar-map instead.
-	(image-load-path): Delete. No longer used.
+	(image-load-path): Delete.  No longer used.
 	(mh-folder-mode): Moved setting of image-load-path into
 	mh-tool-bar-folder-buttons-init.
 
-	* mh-letter.el (mh-letter-buttons-init-flag): Delete. Use
+	* mh-letter.el (mh-letter-buttons-init-flag): Delete.  Use
 	mh-letter-tool-bar-map instead.
-	(image-load-path): Delete. No longer used.
+	(image-load-path): Delete.  No longer used.
 	(mh-letter-mode): Moved setting of image-load-path into
 	mh-tool-bar-letter-buttons-init.
 
@@ -202,10 +207,10 @@
 	* mh-e.el (defcustom-mh, defface-mh, defgroup-mh, mh-face-data)
 	(mh-strip-package-version, mh-face-data, mh-inherit-face-flag)
 	(mh-min-colors-defined-flag): Do not unbind these macros and
-	variables. Nice idea, but too many nasty side-effects. These
+	variables.  Nice idea, but too many nasty side-effects.  These
 	macros are needed by [Cc]ustom-make-dependencies when creating the
-	MH-E customization groups in mh-cus-load.el. These disappeared
-	when the macros above were introduced. Besides, if a developer
+	MH-E customization groups in mh-cus-load.el.  These disappeared
+	when the macros above were introduced.  Besides, if a developer
 	were to try to show the help for a macro or variable they were
 	looking at and got [No match] when they did so, that would be bad.
 
@@ -218,11 +223,11 @@
 	variables and functions with the same name are found correctly by
 	find-func (invoked by clicking on the filename link in the *Help*
 	buffer).
-	(mh-defmacro-compat): Rename to defmacro-mh. Ditto.
-
-	* mh-e.el: (mh-defgroup): Rename to defgroup-mh. Ditto.
-	(mh-defcustom): Rename to defcustom-mh. Ditto.
-	(mh-defface): Rename to defface-mh. Ditto.
+	(mh-defmacro-compat): Rename to defmacro-mh.  Ditto.
+
+	* mh-e.el (mh-defgroup): Rename to defgroup-mh.  Ditto.
+	(mh-defcustom): Rename to defcustom-mh.  Ditto.
+	(mh-defface): Rename to defface-mh.  Ditto.
 	(mh-font-lock-add-keywords): Make changes according to these
 	renamings.
 
@@ -232,11 +237,11 @@
 	* mh-utils.el (mh-sub-folders-actual): Mention that folder must
 	have been processed by mh-normalize-folder-name.
 	(mh-folder-completion-function): Handle completion of folders with
-	absolute names. Also, when flag is t, display complete folder name
+	absolute names.  Also, when flag is t, display complete folder name
 	to provide proper highlighting in Emacs 22 now that
 	minibuffer-completing-file-name is nil (closes SF #1470518).
 	(mh-folder-completing-read): No longer set
-	minibuffer-completing-file-name to t. This was causing "Can't set
+	minibuffer-completing-file-name to t.  This was causing "Can't set
 	current directory errors" when browsing absolute file names.
 	Another benefit of this change is that SPC can be used for
 	completion again (closes SF #1470518).
@@ -256,9 +261,9 @@
 
 	* mh-show.el (font-lock-auto-fontify): Ditto.
 
-	* mh-utils.el (mh-speed-flists-cache): Ditto
-
-	* mh-acros.el (struct, x, y):  No need to wrap defvar with
+	* mh-utils.el (mh-speed-flists-cache): Ditto.
+
+	* mh-acros.el (struct, x, y): No need to wrap defvar with
 	eval-when-compile when shushing compiler, even when
 	mh-do-in-xemacs or another construct is used.
 
@@ -287,7 +292,7 @@
 	* mh-xface.el (default-enable-multibyte-characters): Ditto.
 
 	* mh-compat.el (mh-font-lock-add-keywords): New alias for
-	font-lock-add-keywords. Returns nil on XEmacs.
+	font-lock-add-keywords.  Returns nil on XEmacs.
 
 	* mh-e.el: Add MH-E function and variable keywords such as
 	mh-defun-compat and mh-defcustom to font-lock-keywords.
@@ -297,7 +302,7 @@
 	* mh-e.el (customize-package-emacs-version-alist)
 	(mh-e, mh-alias, mh-folder, mh-folder-selection)
 	(mh-identity, mh-inc, mh-junk, mh-letter, mh-ranges)
-	(mh-scan-line-formats, mh-search, mh-sending-mail, )
+	(mh-scan-line-formats, mh-search, mh-sending-mail)
 	(mh-sequences, mh-show, mh-speedbar, mh-thread, mh-tool-bar)
 	(mh-hooks, mh-faces, mh-alias-completion-ignore-case-flag)
 	(mh-alias-expand-aliases-flag, mh-alias-flash-on-comma)
@@ -307,7 +312,7 @@
 	(mh-new-messages-folders, mh-ticked-messages-folders)
 	(mh-large-folder, mh-recenter-summary-flag)
 	(mh-recursive-folders-flag, mh-sortm-args)
-	(mh-default-folder-for-message-function, )
+	(mh-default-folder-for-message-function)
 	(mh-default-folder-list, mh-default-folder-must-exist-flag)
 	(mh-default-folder-prefix, mh-identity-list)
 	(mh-auto-fields-list, mh-auto-fields-prompt-flag)
@@ -320,18 +325,18 @@
 	(mh-extract-from-attribution-verb, mh-ins-buf-prefix)
 	(mh-letter-complete-function, mh-letter-fill-column)
 	(mh-mml-method-default, mh-signature-file-name)
-	(mh-signature-separator-flag, mh-x-face-file, )
+	(mh-signature-separator-flag, mh-x-face-file)
 	(mh-yank-behavior, mh-interpret-number-as-range-flag)
 	(mh-adaptive-cmd-note-flag, mh-scan-format-file, mh-scan-prog)
 	(mh-search-program, mh-compose-forward-as-mime-flag)
 	(mh-compose-letter-function, mh-compose-prompt-flag)
 	(mh-forward-subject-format, mh-insert-x-mailer-flag)
 	(mh-redist-full-contents-flag, mh-reply-default-reply-to)
-	(mh-reply-show-message-flag, )
+	(mh-reply-show-message-flag)
 	(mh-refile-preserves-sequences-flag, mh-tick-seq)
 	(mh-update-sequences-after-mh-show-flag)
 	(mh-bury-show-buffer-flag, mh-clean-message-header-flag)
-	(mh-decode-mime-flag, )
+	(mh-decode-mime-flag)
 	(mh-display-buttons-for-alternatives-flag)
 	(mh-display-buttons-for-inline-parts-flag)
 	(mh-do-not-confirm-flag, mh-fetch-x-image-url)
@@ -348,8 +353,7 @@
 	(mh-alias-reloaded-hook, mh-before-commands-processed-hook)
 	(mh-before-quit-hook, mh-before-send-letter-hook)
 	(mh-delete-msg-hook, mh-find-path-hook, mh-folder-mode-hook)
-	(mh-forward-hook, mh-inc-folder-hook, )
-	(mh-insert-signature-hook, )
+	(mh-forward-hook, mh-inc-folder-hook, mh-insert-signature-hook)
 	(mh-kill-folder-suppress-prompt-hooks, mh-letter-mode-hook)
 	(mh-mh-to-mime-hook, mh-search-mode-hook, mh-quit-hook)
 	(mh-refile-msg-hook, mh-show-hook, mh-show-mode-hook)
@@ -361,7 +365,7 @@
 	(mh-letter-header-field, mh-search-folder, mh-show-cc)
 	(mh-show-date, mh-show-from, mh-show-header, mh-show-pgg-bad)
 	(mh-show-pgg-good, mh-show-pgg-unknown, mh-show-signature)
-	(mh-show-subject, mh-show-to, mh-show-xface, )
+	(mh-show-subject, mh-show-to, mh-show-xface)
 	(mh-speedbar-folder, mh-speedbar-folder-with-unseen-messages)
 	(mh-speedbar-selected-folder)
 	(mh-speedbar-selected-folder-with-unseen-messages): Use dotted
@@ -375,7 +379,7 @@
 2006-03-31  Bill Wohler  <wohler@newt.com>
 
 	* mh-e.el (mh-strip-package-version): Move before use to avoid
-	compiler error. Make macro, also to avoid compiler error.
+	compiler error.  Make macro, also to avoid compiler error.
 	(mh-defface-compat): Incorporate body into mh-face-data and
 	delete.
 
@@ -474,7 +478,7 @@
 	MH-Letter mode, move save-buffer and mh-fully-kill-draft icons in
 	front of mh-compose-insertion to be consistent with other mailers,
 	such as Evolution.  In MH-Folder mode, move vanilla reply icon to
-	the left of the other reply icons. Use mail/inbox icon instead of
+	the left of the other reply icons.  Use mail/inbox icon instead of
 	mail, next-page instead of page-down, delete instead of close,
 	mail/move instead of mail/refile, data-save instead of execute,
 	mail/flag-for-followup instead of highlight, contact instead of
@@ -513,7 +517,7 @@
 2006-03-15  Bill Wohler  <wohler@newt.com>
 
 	* mh-compat.el (mh-image-load-path-for-library): Fix example by
-	not recommending that one binds image-load-path. Just defvar it to
+	not recommending that one binds image-load-path.  Just defvar it to
 	placate compiler and only use it if previously defined.
 
 	* mh-e.el (image-load-path): Don't bind!
@@ -551,11 +555,11 @@
 2006-03-10  Bill Wohler  <wohler@newt.com>
 
 	* mh-compat.el (mh-replace-regexp-in-string): Pass the literal
-	flag to replace-in-string. This was badly needed by
+	flag to replace-in-string.  This was badly needed by
 	mh-quote-pick-expr in order to properly quote subjects when using
 	/ s on XEmacs (closes SF #1447598).
-	(mh-image-load-path-for-library): Merged changes from Reiner. Add
-	no-error argument. If path t, just return directory.
+	(mh-image-load-path-for-library): Merged changes from Reiner.  Add
+	no-error argument.  If path t, just return directory.
 
 	* mh-e.el (mh-profile-component): Drop `s' from mhparam
 	-components for Mailutils compatibility (closes SF #1446985).
@@ -598,11 +602,11 @@
 	(mh-sub-folders): Use new flag to mh-normalize-folder-name to make
 	this function more robust.  It could too easily list the folders in /.
 	(mh-folder-list): Fix a couple of problems pointed out by Thomas
-	Baumann.  Set folder to nil if empty. Don't append "/" if folder nil.
+	Baumann.  Set folder to nil if empty.  Don't append "/" if folder nil.
 
 2006-03-03  Bill Wohler  <wohler@newt.com>
 
-	* mh-folder.el (mh-folder-mode):  Rename mh-image-load-path to
+	* mh-folder.el (mh-folder-mode): Rename mh-image-load-path to
 	mh-image-load-path-for-library.
 
 	* mh-letter.el (mh-letter-mode): Rename mh-image-load-path to
@@ -689,7 +693,7 @@
 2006-02-21  Eric Ding  <ericding@alum.mit.edu>
 
 	* mh-e.el (mh-invisible-header-fields-internal): Add entry
-	"X-Sasl-enc:"
+	"X-Sasl-enc:".
 
 2006-02-20  Eric Ding  <ericding@alum.mit.edu>
 
@@ -958,7 +962,7 @@
 
 	* mh-comp.el (mh-send-sub): Don't find components file in current
 	directory--this seems to have been a side-effect of commenting out
-	the use of an old mh-etc variable. Improve error message.
+	the use of an old mh-etc variable.  Improve error message.
 
 2006-01-31  Bill Wohler  <wohler@newt.com>
 
@@ -979,7 +983,7 @@
 	(mh-display-completion-list): Move here from mh-comp.el.
 	(mh-face-foreground, mh-face-background): Move here from
 	mh-xface.el.
-	(mh-write-file-functions): Move here from mh-folder.el
+	(mh-write-file-functions): Move here from mh-folder.el.
 
 	* mh-folder.el (mh-write-file-functions-compat): Move to
 	mh-compat.el and rename to mh-write-file-functions.
@@ -1042,7 +1046,7 @@
 	mh-adaptive-cmd-note-flag.
 
 	* mh-comp.el (sc-cite-original): Remove autoload of "sc" with old
-	docstring. sc-cite-original is autoloaded via loaddefs.el for all
+	docstring.  sc-cite-original is autoloaded via loaddefs.el for all
 	supported versions.  In addition, the package name "sc" has been
 	made obsolete by "supercite since at least Emacs 21.
 
@@ -1323,7 +1327,7 @@
 
 	* mh-exec.el: Move content into mh-e.el and remove.
 
-	* mh-folder.el: New file. Contains mh-folder-mode from mh-e.el.
+	* mh-folder.el: New file.  Contains mh-folder-mode from mh-e.el.
 
 	* mh-funcs.el (mh-note-copied, mh-note-printed): Move to new file
 	mh-scan.el.
@@ -1368,7 +1372,7 @@
 
 	* mh-print.el: Rearrange for consistency with other files.
 
-	* mh-scan.el: New file. Contains scan line constants and utilities
+	* mh-scan.el: New file.  Contains scan line constants and utilities
 	from XXX, mh-funcs, mh-utils.el.
 
 	* mh-search.el: Rearrange for consistency with other files.
@@ -1565,7 +1569,7 @@
 	* mh-comp.el (mh-pgp-support-flag): Move here from mh-utils.el;
 	needed to help remove dependency on mh-utils.
 
-	* mh-exec.el: New file. Move process support routines here from
+	* mh-exec.el: New file.  Move process support routines here from
 	mh-utils.el.
 
 	* mh-init.el (mh-utils): Remove require.
@@ -1612,7 +1616,7 @@
 	(mh-kill-folder-suppress-prompt-hooks): Rename mh-index-p to
 	mh-search-p.
 	(mh-search-mode-hook): Change group from mh-index to mh-search.
-	(mh-index-folder): Rename to mh-search-folder. Change group from
+	(mh-index-folder): Rename to mh-search-folder.  Change group from
 	mh-index to mh-search.
 
 	* mh-e.el (mh-folder-font-lock-keywords): Rename mh-index-folder
@@ -1667,7 +1671,7 @@
 2006-01-12  Bill Wohler  <wohler@newt.com>
 
 	* mh-search.el: New file containing contents of mh-index.el and
-	mh-pick.el. C-c C-c launches your mh-index-program; C-c C-p runs
+	mh-pick.el.  C-c C-c launches your mh-index-program; C-c C-p runs
 	pick.  Pick no longer sets the "search" sequence.  Instead, it
 	brings up a folder view that we're accustomed to.  (Closes SF
 	#829207.)
@@ -1722,13 +1726,13 @@
 
 	* mh-utils.el (mh-x-image-url-cache-canonicalize): Use
 	url-hexify-string to remove special characters from filenames
-	(closes SF #1396499). Note that this invalidates the existing
+	(closes SF #1396499).  Note that this invalidates the existing
 	names in your cache so you might as well remove
 	~/Mail/.mhe-x-image-cache/* now.
 	(url-unreserved-chars, url-hexify-string): Define if not defined.
 	Copied from url-util.el in Emacs22 for Emacs 21.
 
-	* mh-buffers.el: New file. Contains constants and code from
+	* mh-buffers.el: New file.  Contains constants and code from
 	mh-index.el and mh-utils.el.
 
 	* mh-alias.el:
@@ -1758,7 +1762,7 @@
 2006-01-10  Bill Wohler  <wohler@newt.com>
 
 	* mh-comp.el (mh-insert-letter): If you choose a different folder,
-	the cur message is used. Sync docstring with manual (closes SF
+	the cur message is used.  Sync docstring with manual (closes SF
 	#1205890).
 
 	* mh-mime.el (mh-compose-forward): Use standard range argument
@@ -1776,7 +1780,7 @@
 	use function mh-variants instead.
 	(mh-variant-info, mh-variant-mh-info, mh-variant-mu-mh-info)
 	(mh-variant-nmh-info): Co-locate next to mh-variants, which uses
-	them. Updated to use mh-file-command-p which is more accurrate
+	them.  Updated to use mh-file-command-p which is more accurrate
 	than file-executable-p which returns t for directories.
 	(mh-file-command-p): Move here from mh-utils, since
 	mh-variant-*-info are the only functions to use it.
@@ -1962,8 +1966,8 @@
 
 	* mh-customize.el (mh-folder-msg-number): Snow is actually
 	off-white on low color displays which turns to white when bold.
-	This is unreadable on white backgrounds. Use snow with min-colors
-	requirement. Use cyan on low-color displays.
+	This is unreadable on white backgrounds.  Use snow with min-colors
+	requirement.  Use cyan on low-color displays.
 
 	* mh-init.el (mh-defface-compat): On low-color displays, delete
 	the high-color display rather than simply strip the min-colors
@@ -1976,13 +1980,13 @@
 2006-01-02  Bill Wohler  <wohler@newt.com>
 
 	* mh-alias.el (mh-alias-grab-from-field): Remove leading * from
-	docstring. Does this mean something in a defun?
+	docstring.  Does this mean something in a defun?
 
 	* mh-customize.el (bw-new-face-to-old, bw-old-face-to-new):
 	Checkdoc fix.
 
 	* mh-e.el (mh-inc-folder): Rename maildrop-name argument to file
-	so it reads better in docstring and manual. Sync docstring with
+	so it reads better in docstring and manual.  Sync docstring with
 	manual.
 
 	* mh-init.el (mh-defface-compat): Remove trailing space (checkdoc).
@@ -2004,7 +2008,7 @@
 	* mh-e.el (mh-refile-or-write-again, mh-toggle-showing): Ditto.
 
 	* mh-funcs.el (mh-pipe-msg, mh-sort-folder, mh-undo-folder)
-	(mh-store-msg, mh-store-buffer): Ditto
+	(mh-store-msg, mh-store-buffer): Ditto.
 
 	* mh-index.el (mh-index-search, mh-index-do-search)
 	(mh-index-next-folder, mh-index-sequenced-messages): Ditto.
@@ -2014,7 +2018,7 @@
 	* mh-mime.el (mh-mh-compose-external-compressed-tar)
 	(mh-mh-compose-external-type, mh-mh-to-mime, mh-mh-to-mime-undo)
 	(mh-mml-secure-message-sign, mh-mml-secure-message-encrypt)
-	(mh-mml-secure-message-signencrypt): Ditto
+	(mh-mml-secure-message-signencrypt): Ditto.
 
 	* mh-pick.el (mh-search-folder): Ditto.
 
@@ -2068,7 +2072,7 @@
 	(mh-scan-date-regexp, mh-scan-rcpt-regexp, mh-scan-body-regexp)
 	(mh-scan-subject-regexp): Sync docstrings with manual
 	(mh-scan-format-regexp): Rename to
-	mh-scan-sent-to-me-sender-regexp. Drop date parenthesized
+	mh-scan-sent-to-me-sender-regexp.  Drop date parenthesized
 	expression.  Make expression more like the others (anchored at the
 	beginning of line).  Sync docstrings with manual.
 	(mh-folder-font-lock-keywords): Use faces directly rather than
@@ -2228,7 +2232,7 @@
 	(mh-tool-bar-define): Replace toolbar with tool-bar or tool bar
 	depending on context.
 	(mh-toolbar-init): Rename to mh-tool-bar-init.  Simplify condition
-	for calling set-specifier. Only look at the value of
+	for calling set-specifier.  Only look at the value of
 	mh-xemacs-use-tool-bar-flag.
 	(mh-tool-bar-folder-buttons, mh-tool-bar-letter-buttons):
 	Sync docstrings with manual.
@@ -2501,7 +2505,7 @@
 	msg argument to message (to make for a better docstring).
 
 	* mh-customize.el (mh-redist-full-contents-flag): Convert defvar
-	to defcustom. Rename by adding -flag.
+	to defcustom.  Rename by adding -flag.
 	(mh-compose-forward-as-mime-flag)
 	(mh-compose-letter-function, mh-forward-subject-format)
 	(mh-insert-x-mailer-flag, mh-reply-default-reply-to)
@@ -2623,10 +2627,10 @@
 	Sync docstring with manual.
 
 	* mh-identity.el (mh-assoc-ignore-case): Merge with version in
-	mh-alias.el and move to mh-acros.el
+	mh-alias.el and move to mh-acros.el.
 
 	* mh-alias.el (mh-assoc-ignore-case): Merge with version in
-	mh-identity.el and move to mh-acros.el
+	mh-identity.el and move to mh-acros.el.
 
 	* mh-acros.el (mh-assoc-ignore-case): Merge of function from
 	mh-identity.el and mh-alias.el.
@@ -2667,15 +2671,15 @@
 	mh-mhn-compose-external-compressed-tar to
 	mh-mh-compose-external-compressed-tar.  Rename
 	mh-mhn-compose-anon-ftp to mh-mh-compose-anon-ftp.  Rename
-	mh-edit-mhn to mh-mh-to-mime. Rename mh-mhn-directive-present-p to
-	mh-mh-directive-present-p. Rename mh-revert-mhn-edit to
+	mh-edit-mhn to mh-mh-to-mime.  Rename mh-mhn-directive-present-p to
+	mh-mh-directive-present-p.  Rename mh-revert-mhn-edit to
 	mh-mh-to-mime-undo.  Rename mh-gnus-pgp-support-flag to
 	mh-pgp-support-flag.  Rename mh-compose-insertion value from 'mhn
 	to 'mh.
 	(mh-insert-signature): Rename mh-mhn-directive-present-p to
 	mh-mh-directive-present-p.
 	(mh-send-letter): Rename mh-mhn-directive-present-p to
-	mh-mh-directive-present-p. Rename mh-edit-mhn to mh-mh-to-mime.
+	mh-mh-directive-present-p.  Rename mh-edit-mhn to mh-mh-to-mime.
 	(mh-letter-mode-map): Rename mh-edit-mhn to mh-mh-to-mime.  Rename
 	mh-mhn-compose-anon-ftp to mh-mh-compose-anon-ftp.  Rename
 	mh-mhn-compose-external-compressed-tar to
@@ -2829,7 +2833,7 @@
 
 	* mh-e.el (Version, mh-version): Add +cvs to version.
 
-2005-10-14  Bill Wohler	 <wohler@newt.com>
+2005-10-14  Bill Wohler  <wohler@newt.com>
 
 	Released MH-E version 7.85.
 
--- a/lisp/mh-e/mh-mime.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/mh-e/mh-mime.el	Mon Jun 11 00:58:11 2007 +0000
@@ -1667,7 +1667,7 @@
 (defun mh-mh-directive-present-p (&optional begin end)
   "Check if the text between BEGIN and END might be a MH-style directive.
 The optional argument BEGIN defaults to the beginning of the
-buffer, while END defaults to the the end of the buffer."
+buffer, while END defaults to the end of the buffer."
   (unless begin (setq begin (point-min)))
   (unless end (setq end (point-max)))
   (save-excursion
--- a/lisp/mh-e/mh-search.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/mh-e/mh-search.el	Mon Jun 11 00:58:11 2007 +0000
@@ -1357,7 +1357,7 @@
 ;;;###mh-autoload
 (defun mh-index-group-by-folder ()
   "Partition the messages based on source folder.
-Returns an alist with the the folder names in the car and the cdr
+Returns an alist with the folder names in the car and the cdr
 being the list of messages originally from that folder."
   (save-excursion
     (goto-char (point-min))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/net/socks.el	Mon Jun 11 00:58:11 2007 +0000
@@ -0,0 +1,650 @@
+;;; socks.el --- A Socks v5 Client for Emacs
+
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002,
+;;   2007 Free Software Foundation, Inc.
+
+;; Author: William M. Perry <wmperry@gnu.org>
+;;         Dave Love <fx@gnu.org>
+;; Keywords: comm, firewalls
+
+;; 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:
+
+;; This is an implementation of the SOCKS v5 protocol as defined in
+;; RFC 1928.
+
+;; TODO
+;; - Finish the redirection rules stuff
+;; - Implement composition of servers.  Recursively evaluate the
+;;   redirection rules and do SOCKS-over-HTTP and SOCKS-in-SOCKS
+
+(eval-when-compile
+  (require 'wid-edit))
+(require 'custom)
+
+(if (not (fboundp 'split-string))
+    (defun split-string (string &optional pattern)
+      "Return a list of substrings of STRING which are separated by PATTERN.
+If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
+      (or pattern
+	  (setq pattern "[ \f\t\n\r\v]+"))
+      (let (parts (start 0))
+	(while (string-match pattern string start)
+	  (setq parts (cons (substring string start (match-beginning 0)) parts)
+		start (match-end 0)))
+	(nreverse (cons (substring string start) parts)))))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Custom widgets
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(define-widget 'dynamic-choice 'menu-choice
+  "A pretty simple dynamic dropdown list"
+  :format "%[%t%]: %v"
+  :tag "Network"
+  :case-fold t
+  :void '(item :format "invalid (%t)\n")
+  :value-create 's5-widget-value-create
+  :value-delete 'widget-children-value-delete
+  :value-get 'widget-choice-value-get
+  :value-inline 'widget-choice-value-inline
+  :mouse-down-action 'widget-choice-mouse-down-action
+  :action 'widget-choice-action
+  :error "Make a choice"
+  :validate 'widget-choice-validate
+  :match 's5-dynamic-choice-match
+  :match-inline 's5-dynamic-choice-match-inline)
+
+(defun s5-dynamic-choice-match (widget value)
+  (let ((choices (funcall (widget-get widget :choice-function)))
+	current found)
+    (while (and choices (not found))
+      (setq current (car choices)
+	    choices (cdr choices)
+	    found (widget-apply current :match value)))
+    found))
+
+(defun s5-dynamic-choice-match-inline (widget value)
+  (let ((choices (funcall (widget-get widget :choice-function)))
+	current found)
+    (while (and choices (not found))
+      (setq current (car choices)
+	    choices (cdr choices)
+	    found (widget-match-inline current value)))
+    found))
+
+(defun s5-widget-value-create (widget)
+  (let ((choices (funcall (widget-get widget :choice-function)))
+	(value (widget-get widget :value)))
+    (if (not value)
+	(widget-put widget :value (widget-value (car choices))))
+    (widget-put widget :args choices)
+    (widget-choice-value-create widget)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Customization support
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defgroup socks nil
+  "SOCKS Support"
+  :prefix "socks-"
+  :group 'processes)
+
+'(defcustom socks-server-aliases nil
+  "A list of server aliases for use in access control and filtering rules."
+  :group 'socks
+  :type '(repeat (list :format "%v"
+		       :value ("" "" 1080 5)
+		       (string :tag "Alias")
+		       (string :tag "Hostname/IP Address")
+		       (integer :tag "Port #")
+		       (choice :tag "SOCKS Version"
+			       (integer :tag "SOCKS v4" :value 4)
+			       (integer :tag "SOCKS v5" :value 5)))))
+
+'(defcustom socks-network-aliases
+  '(("Anywhere" (netmask "0.0.0.0" "0.0.0.0")))
+  "A list of network aliases for use in subsequent rules."
+  :group 'socks
+  :type '(repeat (list :format "%v"
+		       :value (netmask "" "255.255.255.0")
+		       (string :tag "Alias")
+		       (radio-button-choice
+			:format "%v"
+			(list :tag  "IP address range"
+			      (const :format "" :value range)
+			      (string :tag "From")
+			      (string :tag "To"))
+			(list :tag  "IP address/netmask"
+			      (const :format "" :value netmask)
+			      (string :tag "IP Address")
+			      (string :tag "Netmask"))
+			(list :tag  "Domain Name"
+			      (const :format "" :value domain)
+			      (string :tag "Domain name"))
+			(list :tag  "Unique hostname/IP address"
+			      (const :format "" :value exact)
+			      (string :tag "Hostname/IP Address"))))))
+
+'(defun s5-servers-filter ()
+  (if socks-server-aliases
+      (mapcar (lambda (x) (list 'const :tag (car x) :value (car x))) s5-server-aliases)
+    '((const :tag "No aliases defined" :value nil))))
+
+'(defun s5-network-aliases-filter ()
+  (mapcar (lambda (x) (list 'const :tag (car x) :value (car x)))
+	  socks-network-aliases))
+
+'(defcustom socks-redirection-rules
+   nil
+   "A list of redirection rules."
+   :group 'socks
+   :type '(repeat (list :format "%v"
+			:value ("Anywhere" nil)
+			(dynamic-choice :choice-function s5-network-aliases-filter
+					:tag "Destination network")
+			(radio-button-choice
+			 :tag "Connection type"
+			 (const :tag "Direct connection" :value nil)
+			 (dynamic-choice :format "%t: %[%v%]"
+					 :choice-function s5-servers-filter
+					 :tag "Proxy chain via")))))
+
+(defcustom socks-server
+  (list "Default server" "socks" 1080 5)
+  ""
+  :group 'socks
+  :type '(list
+	  (string :format "" :value "Default server")
+	  (string :tag "Server")
+	  (integer :tag "Port")
+	  (radio-button-choice :tag "SOCKS Version"
+			       :format "%t: %v"
+			       (const :tag "SOCKS v4  " :format "%t" :value 4)
+			       (const :tag "SOCKS v5"   :format "%t" :value 5))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Get down to the nitty gritty
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defconst socks-version 5)
+(defvar socks-debug nil)
+
+;; Common socks v5 commands
+(defconst socks-connect-command 1)
+(defconst socks-bind-command 2)
+(defconst socks-udp-associate-command 3)
+
+;; Miscellaneous other socks constants
+(defconst socks-authentication-null 0)
+(defconst socks-authentication-failure 255)
+
+;; Response codes
+(defconst socks-response-success               0)
+(defconst socks-response-general-failure       1)
+(defconst socks-response-access-denied         2)
+(defconst socks-response-network-unreachable   3)
+(defconst socks-response-host-unreachable      4)
+(defconst socks-response-connection-refused    5)
+(defconst socks-response-ttl-expired           6)
+(defconst socks-response-cmd-not-supported     7)
+(defconst socks-response-address-not-supported 8)
+
+(defvar socks-errors
+  '("Succeeded"
+    "General SOCKS server failure"
+    "Connection not allowed by ruleset"
+    "Network unreachable"
+    "Host unreachable"
+    "Connection refused"
+    "Time-to-live expired"
+    "Command not supported"
+    "Address type not supported"))
+
+;; The socks v5 address types
+(defconst socks-address-type-v4   1)
+(defconst socks-address-type-name 3)
+(defconst socks-address-type-v6   4)
+
+;; Base variables
+(defvar socks-timeout 5)
+(defvar socks-connections (make-hash-table :size 13))
+
+;; Miscellaneous stuff for authentication
+(defvar socks-authentication-methods nil)
+(defvar socks-username (user-login-name))
+(defvar socks-password nil)
+
+(defun socks-register-authentication-method (id desc callback)
+  (let ((old (assq id socks-authentication-methods)))
+    (if old
+	(setcdr old (cons desc callback))
+      (setq socks-authentication-methods
+	    (cons (cons id (cons desc callback))
+		  socks-authentication-methods)))))
+
+(defun socks-unregister-authentication-method (id)
+  (let ((old (assq id socks-authentication-methods)))
+    (if old
+	(setq socks-authentication-methods
+	      (delq old socks-authentication-methods)))))
+
+(socks-register-authentication-method 0 "No authentication" 'identity)
+
+(defun socks-build-auth-list ()
+  (let ((num 0)
+	(retval ""))
+    (mapcar
+     (function
+      (lambda (x)
+	(if (fboundp (cdr (cdr x)))
+	    (setq retval (format "%s%c" retval (car x))
+		  num (1+ num)))))
+     (reverse socks-authentication-methods))
+    (format "%c%s" num retval)))
+
+(defconst socks-state-waiting-for-auth 0)
+(defconst socks-state-submethod-negotiation 1)
+(defconst socks-state-authenticated 2)
+(defconst socks-state-waiting 3)
+(defconst socks-state-connected 4)
+
+(defmacro socks-wait-for-state-change (proc htable cur-state)
+  (`
+   (while (and (= (gethash 'state (, htable)) (, cur-state))
+	       (memq (process-status (, proc)) '(run open)))
+     (accept-process-output (, proc) socks-timeout))))
+
+(defun socks-filter (proc string)
+  (let ((info (gethash proc socks-connections))
+	state version desired-len)
+    (or info (error "socks-filter called on non-SOCKS connection %S" proc))
+    (setq state (gethash 'state info))
+    (cond
+     ((= state socks-state-waiting-for-auth)
+      (puthash 'scratch (concat string (gethash 'scratch info)) info)
+      (setq string (gethash 'scratch info))
+      (if (< (length string) 2)
+	  nil				; We need to spin some more
+	(puthash 'authtype (aref string 1) info)
+	(puthash 'scratch (substring string 2 nil) info)
+	(puthash 'state socks-state-submethod-negotiation info)))
+     ((= state socks-state-submethod-negotiation)
+      )
+     ((= state socks-state-authenticated)
+      )
+     ((= state socks-state-waiting)
+      (puthash 'scratch (concat string (gethash 'scratch info)) info)
+      (setq string (gethash 'scratch info))
+      (setq version (gethash 'server-protocol info))
+      (cond
+       ((equal version 'http)
+	(if (not (string-match "\r\n\r\n" string))
+	    nil			; Need to spin some more
+	  (puthash 'state socks-state-connected info)
+	  (puthash 'reply 0 info)
+	  (puthash 'response string info)))
+       ((equal version 4)
+	(if (< (length string) 2)
+	    nil			; Can't know how much to read yet
+	  (setq desired-len
+		(+ 4 ; address length
+		   2 ; port
+		   2 ; initial data
+		   ))
+	  (if (< (length string) desired-len)
+	      nil			; need to spin some more
+	    (let ((response (aref string 1)))
+	      (if (= response 90)
+		  (setq response 0))
+	      (puthash 'state socks-state-connected info)
+	      (puthash 'reply response info)
+	      (puthash 'response string info)))))
+       ((equal version 5)
+	(if (< (length string) 4)
+	    nil
+	  (setq desired-len
+		(+ 6			; Standard socks header
+		   (cond
+		    ((= (aref string 3) socks-address-type-v4) 4)
+		    ((= (aref string 3) socks-address-type-v6) 16)
+		    ((= (aref string 3) socks-address-type-name)
+		     (if (< (length string) 5)
+			 255
+		       (+ 1 (aref string 4)))))))
+	  (if (< (length string) desired-len)
+	      nil			; Need to spin some more
+	    (puthash 'state socks-state-connected info)
+	    (puthash 'reply (aref string 1) info)
+	    (puthash 'response string info))))))
+     ((= state socks-state-connected)
+      )
+     )
+    )
+  )
+
+(defun socks-open-connection (server-info)
+  (interactive)
+  (save-excursion
+    (let ((proc (socks-original-open-network-stream "socks"
+						    nil
+						    (nth 1 server-info)
+						    (nth 2 server-info)))
+	  (info (make-hash-table :size 13))
+	  (authtype nil)
+	  version)
+
+      ;; Initialize process and info about the process
+      (set-process-filter proc 'socks-filter)
+      (set-process-query-on-exit-flag proc nil)
+      (puthash proc info socks-connections)
+      (puthash 'state socks-state-waiting-for-auth info)
+      (puthash 'authtype socks-authentication-failure info)
+      (puthash 'server-protocol (nth 3 server-info) info)
+      (puthash 'server-name (nth 1 server-info) info)
+      (setq version (nth 3 server-info))
+      (cond
+       ((equal version 'http)
+	;; Don't really have to do any connection setup under http
+	nil)
+       ((equal version 4)
+	;; Don't really have to do any connection setup under v4
+	nil)
+       ((equal version 5)
+	;; Need to handle all the authentication crap under v5
+	;; Send what we think we can handle for authentication types
+	(process-send-string proc (format "%c%s" socks-version
+					  (socks-build-auth-list)))
+
+	;; Basically just do a select() until we change states.
+	(socks-wait-for-state-change proc info socks-state-waiting-for-auth)
+	(setq authtype (gethash 'authtype info))
+	(cond
+	 ((= authtype socks-authentication-null)
+	  (and socks-debug (message "No authentication necessary")))
+	 ((= authtype socks-authentication-failure)
+	  (error "No acceptable authentication methods found."))
+	 (t
+	  (let* ((auth-type (gethash 'authtype info))
+		 (auth-handler (assoc auth-type socks-authentication-methods))
+		 (auth-func (and auth-handler (cdr (cdr auth-handler))))
+		 (auth-desc (and auth-handler (car (cdr auth-handler)))))
+	    (set-process-filter proc nil)
+	    (if (and auth-func (fboundp auth-func)
+		     (funcall auth-func proc))
+		nil			; We succeeded!
+	      (delete-process proc)
+	      (error "Failed to use auth method: %s (%d)"
+		     (or auth-desc "Unknown") auth-type))
+	    )
+	  )
+	 )
+	(puthash 'state socks-state-authenticated info)
+	(set-process-filter proc 'socks-filter)))
+      proc)))
+
+(defun socks-send-command (proc command atype address port)
+  (let ((addr (cond
+	       ((or (= atype socks-address-type-v4)
+		    (= atype socks-address-type-v6))
+		address)
+	       ((= atype socks-address-type-name)
+		(format "%c%s" (length address) address))
+	       (t
+		(error "Unkown address type: %d" atype))))
+	(info (gethash proc socks-connections))
+	request version)
+    (or info (error "socks-send-command called on non-SOCKS connection %S"
+		    proc))
+    (puthash 'state socks-state-waiting info)
+    (setq version (gethash 'server-protocol info))
+    (cond
+     ((equal version 'http)
+      (setq request (format (eval-when-compile
+			      (concat
+			       "CONNECT %s:%d HTTP/1.0\r\n"
+			       "User-Agent: Emacs/SOCKS v1.0\r\n"
+			       "\r\n"))
+			    (cond
+			     ((equal atype socks-address-type-name) address)
+			     (t
+			      (error "Unsupported address type for HTTP: %d" atype)))
+			    port)))
+     ((equal version 4)
+      (setq request (format
+		     "%c%c%c%c%s%s%c"
+		     version		; version
+		     command		; command
+		     (lsh port -8)	; port, high byte
+		     (- port (lsh (lsh port -8) 8)) ; port, low byte
+		     addr		; address
+		     (user-full-name)	; username
+		     0			; terminate username
+		     )))
+     ((equal version 5)
+      (setq request (format
+		     "%c%c%c%c%s%c%c"
+		     version		; version
+		     command		; command
+		     0			; reserved
+		     atype		; address type
+		     addr		; address
+		     (lsh port -8)	; port, high byte
+		     (- port (lsh (lsh port -8) 8)) ; port, low byte
+		     )))
+     (t
+      (error "Unknown protocol version: %d" version)))
+    (process-send-string proc request)
+    (socks-wait-for-state-change proc info socks-state-waiting)
+    (process-status proc)
+    (if (= (or (gethash 'reply info) 1) socks-response-success)
+	nil				; Sweet sweet success!
+      (delete-process proc)
+      (error "SOCKS: %s" (nth (or (gethash 'reply info) 1) socks-errors)))
+    proc))
+
+
+;; Replacement functions for open-network-stream, etc.
+(defvar socks-noproxy nil
+  "*List of regexps matching hosts that we should not socksify connections to")
+
+(defun socks-find-route (host service)
+  (let ((route socks-server)
+	(noproxy socks-noproxy))
+    (while noproxy
+      (if (eq ?! (aref (car noproxy) 0))
+	  (if (string-match (substring (car noproxy) 1) host)
+	      (setq noproxy nil))
+	(if (string-match (car noproxy) host)
+	    (setq route nil
+		  noproxy nil)))
+      (setq noproxy (cdr noproxy)))
+    route))
+
+(defvar socks-override-functions nil
+  "*Whether to overwrite the open-network-stream function with the SOCKSified
+version.")
+
+(if (fboundp 'socks-original-open-network-stream)
+    nil				; Do nothing, we've been here already
+  (defalias 'socks-original-open-network-stream
+    (symbol-function 'open-network-stream))
+  (if socks-override-functions
+      (defalias 'open-network-stream 'socks-open-network-stream)))
+
+(defvar socks-services-file "/etc/services")
+(defvar socks-tcp-services (make-hash-table :size 13 :test 'equal))
+(defvar socks-udp-services (make-hash-table :size 13 :test 'equal))
+
+(defun socks-parse-services ()
+  (if (not (and (file-exists-p socks-services-file)
+		(file-readable-p socks-services-file)))
+      (error "Could not find services file: %s" socks-services-file))
+  (save-excursion
+    (clrhash socks-tcp-services)
+    (clrhash socks-udp-services)
+    (set-buffer (get-buffer-create " *socks-tmp*"))
+    (erase-buffer)
+    (insert-file-contents socks-services-file)
+    ;; Nuke comments
+    (goto-char (point-min))
+    (while (re-search-forward "#.*" nil t)
+      (replace-match ""))
+    ;; Nuke empty lines
+    (goto-char (point-min))
+    (while (re-search-forward "^[ \t\n]+" nil t)
+      (replace-match ""))
+    ;; Now find all the lines
+    (goto-char (point-min))
+    (let (name port type)
+      (while (re-search-forward "^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)/\\([a-z]+\\)"
+				nil t)
+	(setq name (downcase (match-string 1))
+	      port (string-to-number (match-string 2))
+	      type (downcase (match-string 3)))
+	(puthash name port (if (equal type "udp")
+			       socks-udp-services
+			     socks-tcp-services))))))
+
+(defun socks-find-services-entry (service &optional udp)
+  "Return the port # associated with SERVICE"
+  (if (= (hash-table-count socks-tcp-services) 0)
+      (socks-parse-services))
+  (gethash (downcase service)
+	      (if udp socks-udp-services socks-tcp-services)))
+
+(defun socks-open-network-stream (name buffer host service)
+  (let* ((route (socks-find-route host service))
+	 proc info version atype)
+    (if (not route)
+	(socks-original-open-network-stream name buffer host service)
+      (setq proc (socks-open-connection route)
+	    info (gethash proc socks-connections)
+	    version (gethash 'server-protocol info))
+      (cond
+       ((equal version 4)
+	(setq host (socks-nslookup-host host))
+	(if (not (listp host))
+	    (error "Could not get IP address for: %s" host))
+	(setq host (apply 'format "%c%c%c%c" host))
+	(setq atype socks-address-type-v4))
+       (t
+	(setq atype socks-address-type-name)))
+      (socks-send-command proc
+			  socks-connect-command
+			  atype
+			  host
+			  (if (stringp service)
+			      (socks-find-services-entry service)
+			    service))
+      (puthash 'buffer buffer info)
+      (puthash 'host host info)
+      (puthash 'service host info)
+      (set-process-filter proc nil)
+      (set-process-buffer proc (if buffer (get-buffer-create buffer)))
+      proc)))
+
+;; Authentication modules go here
+
+;; Basic username/password authentication, ala RFC 1929
+(socks-register-authentication-method 2 "Username/Password"
+				      'socks-username/password-auth)
+
+(defconst socks-username/password-auth-version 1)
+
+(defun socks-username/password-auth-filter (proc str)
+  (let ((info (gethash proc socks-connections))
+	state desired-len)
+    (or info (error "socks-filter called on non-SOCKS connection %S" proc))
+    (setq state (gethash 'state info))
+    (puthash 'scratch (concat (gethash 'scratch info) str) info)
+    (if (< (length (gethash 'scratch info)) 2)
+	nil
+      (puthash 'password-auth-status (aref (gethash 'scratch info) 1) info)
+      (puthash 'state socks-state-authenticated info))))
+
+(defun socks-username/password-auth (proc)
+  (let* ((info (gethash proc socks-connections))
+	 (state (gethash 'state info)))
+    (if (not socks-password)
+	(setq socks-password (read-passwd
+			      (format "Password for %s@%s: "
+				      socks-username
+				      (gethash 'server-name info)))))
+    (puthash 'scratch "" info)
+    (set-process-filter proc 'socks-username/password-auth-filter)
+    (process-send-string proc
+			 (format "%c%c%s%c%s"
+				 socks-username/password-auth-version
+				 (length socks-username)
+				 socks-username
+				 (length socks-password)
+				 socks-password))
+    (socks-wait-for-state-change proc info state)
+    (= (gethash 'password-auth-status info) 0)))
+
+
+;; More advanced GSS/API stuff, not yet implemented - volunteers?
+;; (socks-register-authentication-method 1 "GSS/API" 'socks-gssapi-auth)
+
+(defun socks-gssapi-auth (proc)
+  nil)
+
+
+;; CHAP stuff
+;; (socks-register-authentication-method 3 "CHAP" 'socks-chap-auth)
+(defun socks-chap-auth (proc)
+  nil)
+
+
+;; CRAM stuff
+;; (socks-register-authentication-method 5 "CRAM" 'socks-cram-auth)
+(defun socks-cram-auth (proc)
+  nil)
+
+
+(defcustom socks-nslookup-program "nslookup"
+  "*If non-NIL then a string naming the nslookup program."
+  :type '(choice (const :tag "None" :value nil) string)
+  :group 'socks)
+
+(defun socks-nslookup-host (host)
+  "Attempt to resolve the given HOSTNAME using nslookup if possible."
+  (interactive "sHost:  ")
+  (if socks-nslookup-program
+      (let ((proc (start-process " *nslookup*" " *nslookup*"
+				 socks-nslookup-program host))
+	    (res host))
+	(set-process-query-on-exit-flag proc nil)
+	(save-excursion
+	  (set-buffer (process-buffer proc))
+	  (while (progn
+		   (accept-process-output proc)
+		   (memq (process-status proc) '(run open))))
+	  (goto-char (point-min))
+	  (if (re-search-forward "Name:.*\nAddress\\(es\\)?: *\\([0-9.]+\\)$" nil t)
+	      (progn
+		(setq res (buffer-substring (match-beginning 2)
+					    (match-end 2))
+		      res (mapcar 'string-to-int (split-string res "\\.")))))
+	  (kill-buffer (current-buffer)))
+	res)
+    host))
+
+(provide 'socks)
+
+;; arch-tag: 67aef0d9-f4f7-4056-89c3-b4c9bf93ce7f
+;;; socks.el ends here
--- a/lisp/pgg.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/pgg.el	Mon Jun 11 00:58:11 2007 +0000
@@ -332,7 +332,7 @@
   (interactive "r")
   (let ((status
 	 (pgg-save-coding-system start end
-	   (pgg-invoke "encrypt-symmetric-region" 
+	   (pgg-invoke "encrypt-symmetric-region"
 		       (or pgg-scheme pgg-default-scheme)
 		       (point-min) (point-max) passphrase))))
     (when (interactive-p)
@@ -416,7 +416,7 @@
 a detached signature.
 
 If this function is called interactively, CLEARTEXT is enabled
-and the the output is displayed.
+and the output is displayed.
 
 If optional PASSPHRASE is not specified, it will be obtained from the
 passphrase cache or user."
@@ -441,7 +441,7 @@
 within the region.
 
 If this function is called interactively, CLEARTEXT is enabled
-and the the output is displayed.
+and the output is displayed.
 
 If optional PASSPHRASE is not specified, it will be obtained from the
 passphrase cache or user."
@@ -485,7 +485,7 @@
 	       (or (cdr (assq 'preferred-key-server packet))
 		   pgg-default-keyserver-address))
 	 (pgg-fetch-key keyserver key))
-    (setq status 
+    (setq status
 	  (pgg-save-coding-system start end
 	    (pgg-invoke "verify-region" (or pgg-scheme pgg-default-scheme)
 			(point-min) (point-max) signature)))
--- a/lisp/progmodes/compile.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/progmodes/compile.el	Mon Jun 11 00:58:11 2007 +0000
@@ -38,11 +38,14 @@
 ;; LINE will be nil for a message that doesn't contain them.  Then the
 ;; location refers to a indented beginning of line or beginning of file.
 ;; Once any location in some file has been jumped to, the list is extended to
-;; (COLUMN LINE FILE-STRUCTURE MARKER . VISITED) for all LOCs pertaining to
-;; that file.
+;; (COLUMN LINE FILE-STRUCTURE MARKER TIMESTAMP . VISITED)
+;; for all LOCs pertaining to that file.
 ;; MARKER initially points to LINE and COLUMN in a buffer visiting that file.
 ;; Being a marker it sticks to some text, when the buffer grows or shrinks
 ;; before that point.  VISITED is t if we have jumped there, else nil.
+;; TIMESTAMP is necessary because of "incremental compilation": `omake -P'
+;; polls filesystem for changes and recompiles when a file is modified
+;; using the same *compilation* buffer. this necessitates re-parsing markers.
 
 ;;   FILE-STRUCTURE is a list of
 ;;   ((FILENAME . DIRECTORY) FORMATS (LINE LOC ...) ...)
@@ -117,7 +120,7 @@
   "Function to compute the name of a compilation buffer.
 The function receives one argument, the name of the major mode of the
 compilation buffer.  It should return a string.
-nil means compute the name with `(concat \"*\" (downcase major-mode) \"*\")'.")
+If nil, compute the name with `(concat \"*\" (downcase major-mode) \"*\")'.")
 
 ;;;###autoload
 (defvar compilation-finish-function nil
@@ -126,7 +129,7 @@
 describing how the process finished.")
 
 (make-obsolete-variable 'compilation-finish-function
-  "Use `compilation-finish-functions', but it works a little differently."
+  "use `compilation-finish-functions', but it works a little differently."
   "22.1")
 
 ;;;###autoload
@@ -466,7 +469,7 @@
 (defcustom compilation-search-path '(nil)
   "*List of directories to search for source files named in error messages.
 Elements should be directory names, not file names of directories.
-nil as an element means to try the default directory."
+The value nil as an element means to try the default directory."
   :type '(repeat (choice (const :tag "Default" nil)
 			 (string :tag "Directory")))
   :group 'compilation)
@@ -1419,7 +1422,7 @@
     (font-lock-fontify-buffer)))
 
 (defun compilation-handle-exit (process-status exit-status msg)
-  "Write MSG in the current buffer and hack its mode-line-process."
+  "Write MSG in the current buffer and hack its `mode-line-process'."
   (let ((inhibit-read-only t)
 	(status (if compilation-exit-message-function
 		    (funcall compilation-exit-message-function
@@ -1516,7 +1519,7 @@
 	       (eq (prog1 last (setq last (nth 2 (car msg))))
 		   last))
 	   (if compilation-skip-visited
-	       (nthcdr 4 (car msg)))
+	       (nthcdr 5 (car msg)))
 	   (if compilation-skip-to-next-location
 	       (eq (car msg) loc))
 	   ;; count this message only if none of the above are true
@@ -1619,7 +1622,7 @@
   (when reset
     (setq compilation-current-error nil))
   (let* ((columns compilation-error-screen-columns) ; buffer's local value
-	 (last 1)
+	 (last 1) timestamp
 	 (loc (compilation-next-error (or n 1) nil
 				      (or compilation-current-error
 					  compilation-messages-start
@@ -1632,10 +1635,17 @@
 		compilation-current-error
 	      (copy-marker (line-beginning-position)))
 	  loc (car loc))
-    ;; If loc contains no marker, no error in that file has been visited.  If
-    ;; the marker is invalid the buffer has been killed.  So, recalculate all
-    ;; markers for that file.
-    (unless (and (nth 3 loc) (marker-buffer (nth 3 loc)))
+    ;; If loc contains no marker, no error in that file has been visited.
+    ;; If the marker is invalid the buffer has been killed.
+    ;; If the file is newer than the timestamp, it has been modified
+    ;; (`omake -P' polls filesystem for changes and recompiles when needed
+    ;;  in the same process and buffer).
+    ;; So, recalculate all markers for that file.
+    (unless (and (nth 3 loc) (marker-buffer (nth 3 loc))
+                 (equal (nth 4 loc)
+                        (setq timestamp
+                              (with-current-buffer (marker-buffer (nth 3 loc))
+                                (visited-file-modtime)))))
       (with-current-buffer (compilation-find-file marker (caar (nth 2 loc))
 						  (cadr (car (nth 2 loc))))
 	(save-restriction
@@ -1658,7 +1668,8 @@
 		  (set-marker (nth 3 col) (point))
 		(setcdr (nthcdr 2 col) `(,(point-marker)))))))))
     (compilation-goto-locus marker (nth 3 loc) (nth 3 end-loc))
-    (setcdr (nthcdr 3 loc) t)))		; Set this one as visited.
+    (setcdr (nthcdr 3 loc) (list timestamp))
+    (setcdr (nthcdr 4 loc) t)))		; Set this one as visited.
 
 (defvar compilation-gcpro nil
   "Internal variable used to keep some values from being GC'd.")
@@ -1825,8 +1836,8 @@
 Search the directories in `compilation-search-path'.
 A nil in `compilation-search-path' means to try the
 \"current\" directory, which is passed in DIRECTORY.
-If DIRECTORY. is relative, it is combined with `default-directory'.
-If DIRECTORY. is nil, that means use `default-directory'.
+If DIRECTORY is relative, it is combined with `default-directory'.
+If DIRECTORY is nil, that means use `default-directory'.
 If FILENAME is not found at all, ask the user where to find it.
 Pop up the buffer containing MARKER and scroll to MARKER if we ask the user."
   (or formats (setq formats '("%s")))
@@ -1867,7 +1878,7 @@
                         ;; restrictive otherwise, since it also prevents the
                         ;; user from completing "fo" to "foo/" when she
                         ;; wants to enter "foo/bar".
-                        ;; 
+                        ;;
                         ;; Try to make sure the user can only select
                         ;; a valid answer.  This predicate may be ignored,
                         ;; tho, so we still have to double-check afterwards.
--- a/lisp/progmodes/ebrowse.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/progmodes/ebrowse.el	Mon Jun 11 00:58:11 2007 +0000
@@ -1003,7 +1003,7 @@
 
 
 (defun ebrowse-member-table (header)
-  "Return the member obarray.  Build it it hasn't been set up yet.
+  "Return the member obarray.  Build it if it hasn't been set up yet.
 HEADER is the tree header structure of the class tree."
   (when (null (ebrowse-hs-member-table header))
     (loop for buffer in (ebrowse-browser-buffer-list)
@@ -3598,7 +3598,7 @@
 
 
 (defun* ebrowse-draw-file-member-info (info &optional (kind ""))
-  "Display a line in an the members per file info buffer.
+  "Display a line in the members info buffer.
 INFO describes the member.  It has the form (TREE ACCESSOR MEMBER).
 TREE is the class of the member to display.
 ACCESSOR is the accessor symbol of its member list.
--- a/lisp/progmodes/idlwave.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/progmodes/idlwave.el	Mon Jun 11 00:58:11 2007 +0000
@@ -7095,7 +7095,7 @@
   "Make the user select an element from the alist in the variable SYM.
 The keys of the alist are expected to be strings.  The function returns the
 car of the selected association.
-To do this, PROMPT is displayed and and the user must hit a letter key to
+To do this, PROMPT is displayed and the user must hit a letter key to
 select an entry.  If the user does not reply within DELAY seconds, a help
 window with the options is displayed automatically.
 The key which is associated with each option is generated automatically.
--- a/lisp/progmodes/mixal-mode.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/progmodes/mixal-mode.el	Mon Jun 11 00:58:11 2007 +0000
@@ -1017,7 +1017,7 @@
   "Alist that contains all the possible operation codes for mix.
 Each elt has the form
   (OP-CODE GROUP FULL-NAME C-BYTE F-BYTE DESCRIPTION EXECUTION-TIME)
-Where OP-CODE is the text of the opcode as an symbol,
+Where OP-CODE is the text of the opcode as a symbol,
 FULL-NAME is the human readable name as a string,
 C-BYTE is the operation code telling what operation is to be performed,
 F-BYTE holds a modification of the operation code which can be a symbol
--- a/lisp/ses.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/ses.el	Mon Jun 11 00:58:11 2007 +0000
@@ -878,9 +878,9 @@
 
 (defun ses-call-printer (printer &optional value)
   "Invokes PRINTER (a string or parenthesized string or function-symbol or
-lambda of one argument) on VALUE.  Result is the the printed cell as a
-string.  The variable `ses-call-printer-return' is set to t if the printer
-used parenthesis to request left-justification, or the error-signal if the
+lambda of one argument) on VALUE.  Result is the printed cell as a string.
+The variable `ses-call-printer-return' is set to t if the printer used
+parenthesis to request left-justification, or the error-signal if the
 printer signaled one (and \"%s\" is used as the default printer), else nil."
   (setq ses-call-printer-return nil)
   (unless value
--- a/lisp/startup.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/startup.el	Mon Jun 11 00:58:11 2007 +0000
@@ -1315,7 +1315,7 @@
 			 (emacs-version)
 			 "\n"
 			 :face '(variable-pitch :height 0.5)
-			 "Copyright (C) 2007 Free Software Foundation, Inc.")
+			 emacs-copyright)
     (and auto-save-list-file-prefix
 	 ;; Don't signal an error if the
 	 ;; directory for auto-save-list files
--- a/lisp/tar-mode.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/tar-mode.el	Mon Jun 11 00:58:11 2007 +0000
@@ -663,15 +663,15 @@
 	 (size (tar-header-size tokens))
 	 (link-p (tar-header-link-type tokens)))
     (if link-p
-	(error "This is a%s, not a real file"
-	       (cond ((eq link-p 5) " directory")
-		     ((eq link-p 20) " tar directory header")
-		     ((eq link-p 28) " next has longname")
-		     ((eq link-p 29) " multivolume-continuation")
-		     ((eq link-p 35) " sparse entry")
-		     ((eq link-p 38) " volume header")
-		     ((eq link-p 55) "n extended pax header")
-		     (t "link"))))
+	(error "This is %s, not a real file"
+	       (cond ((eq link-p 5) "a directory")
+		     ((eq link-p 20) "a tar directory header")
+		     ((eq link-p 28) "a next has longname")
+		     ((eq link-p 29) "a multivolume-continuation")
+		     ((eq link-p 35) "a sparse entry")
+		     ((eq link-p 38) "a volume header")
+		     ((eq link-p 55) "an extended pax header")
+		     (t "a link"))))
     (if (zerop size) (error "This is a zero-length file"))
     descriptor))
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/textmodes/css-mode.el	Mon Jun 11 00:58:11 2007 +0000
@@ -0,0 +1,469 @@
+;;; css-mode.el --- Major mode to edit CSS files
+
+;; Copyright (C) 2006, 2007  Free Software Foundation, Inc.
+
+;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
+;; Keywords: hypermedia
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; Yet another CSS mode.
+
+;;; Todo:
+
+;; - electric ; and }
+;; - filling code with auto-fill-mode
+;; - completion
+;; - fix font-lock errors with multi-line selectors
+
+;;; Code:
+
+(defun css-extract-keyword-list (res)
+  (with-temp-buffer
+    (url-insert-file-contents "http://www.w3.org/TR/REC-CSS2/css2.txt")
+    (goto-char (point-max))
+    (search-backward "Appendix H. Index")
+    (forward-line)
+    (delete-region (point-min) (point))
+    (let ((result nil)
+          keys)
+      (dolist (re res)
+        (goto-char (point-min))
+        (setq keys nil)
+        (while (re-search-forward (cdr re) nil t)
+          (push (match-string 1) keys))
+        (push (cons (car re) (sort keys 'string-lessp)) result))
+      (nreverse result))))
+
+(defun css-extract-parse-val-grammar (string env)
+  (let ((start 0)
+        (elems ())
+        name)
+    (while (string-match
+            (concat "\\(?:"
+                    (concat "<a [^>]+><span [^>]+>\\(?:"
+                            "&lt;\\([^&]+\\)&gt;\\|'\\([^']+\\)'"
+                            "\\)</span></a>")
+                    "\\|" "\\(\\[\\)"
+                    "\\|" "\\(]\\)"
+                    "\\|" "\\(||\\)"
+                    "\\|" "\\(|\\)"
+                    "\\|" "\\([*+?]\\)"
+                    "\\|" "\\({[^}]+}\\)"
+                    "\\|" "\\(\\w+\\(?:-\\w+\\)*\\)"
+                    "\\)[ \t\n]*")
+            string start)
+      ;; (assert (eq start (match-beginning 0)))
+      (setq start (match-end 0))
+      (cond
+       ;; Reference to a type of value.
+       ((setq name (match-string-no-properties 1 string))
+        (push (intern name) elems))
+       ;; Reference to another property's values.
+       ((setq name (match-string-no-properties 2 string))
+        (setq elems (delete-dups (append (cdr (assoc name env)) elems))))
+       ;; A literal
+       ((setq name (match-string-no-properties 9 string))
+        (push name elems))
+       ;; We just ignore the rest.  I.e. we ignore the structure because
+       ;; it's too difficult to exploit anyway (it would allow us to only
+       ;; complete top/center/bottom after one of left/center/right and
+       ;; vice-versa).
+       (t nil)))
+    elems))
+        
+
+(defun css-extract-props-and-vals ()
+  (with-temp-buffer
+    (url-insert-file-contents "http://www.w3.org/TR/CSS21/propidx.html")
+    (goto-char (point-min))
+    (let ((props ()))
+      (while (re-search-forward "#propdef-\\([^\"]+\\)\"><span class=\"propinst-\\1 xref\">'\\1'</span></a>" nil t)
+        (let ((prop (match-string-no-properties 1)))
+          (save-excursion
+            (goto-char (match-end 0))
+            (search-forward "<td>")
+            (let ((vals-string (buffer-substring (point)
+                                                 (progn
+                                                   (re-search-forward "[ \t\n]+|[ \t\n]+<a href=\"cascade.html#value-def-inherit\" class=\"noxref\"><span class=\"value-inst-inherit\">inherit</span></a>")
+                                                   (match-beginning 0)))))
+              ;; 
+              (push (cons prop (css-extract-parse-val-grammar vals-string props))
+                    props)))))
+      props)))
+
+;; Extraction was done with:
+;; (css-extract-keyword-list
+;;  '((pseudo . "^ +\\* :\\([^ \n,]+\\)")
+;;    (at . "^ +\\* @\\([^ \n,]+\\)")
+;;    (descriptor . "^ +\\* '\\([^ '\n]+\\)' (descriptor)")
+;;    (media . "^ +\\* '\\([^ '\n]+\\)' media group")
+;;    (property . "^ +\\* '\\([^ '\n]+\\)',")))
+
+(defconst css-pseudo-ids
+  '("active" "after" "before" "first" "first-child" "first-letter" "first-line"
+    "focus" "hover" "lang" "left" "link" "right" "visited")
+  "Identifiers for pseudo-elements and pseudo-classes.")
+
+(defconst css-at-ids
+  '("charset" "font-face" "import" "media" "page")
+  "Identifiers that appear in the form @foo.")
+
+(defconst css-descriptor-ids
+  '("ascent" "baseline" "bbox" "cap-height" "centerline" "definition-src"
+    "descent" "font-family" "font-size" "font-stretch" "font-style"
+    "font-variant" "font-weight" "mathline" "panose-1" "slope" "src" "stemh"
+    "stemv" "topline" "unicode-range" "units-per-em" "widths" "x-height")
+  "Identifiers for font descriptors.")
+
+(defconst css-media-ids
+  '("all" "aural" "bitmap" "continuous" "grid" "paged" "static" "tactile"
+    "visual")
+  "Identifiers for types of media.")
+
+(defconst css-property-ids
+  '("azimuth" "background" "background-attachment" "background-color"
+    "background-image" "background-position" "background-repeat" "block"
+    "border" "border-bottom" "border-bottom-color" "border-bottom-style"
+    "border-bottom-width" "border-collapse" "border-color" "border-left"
+    "border-left-color" "border-left-style" "border-left-width" "border-right"
+    "border-right-color" "border-right-style" "border-right-width"
+    "border-spacing" "border-style" "border-top" "border-top-color"
+    "border-top-style" "border-top-width" "border-width" "bottom"
+    "caption-side" "clear" "clip" "color" "compact" "content"
+    "counter-increment" "counter-reset" "cue" "cue-after" "cue-before"
+    "cursor" "dashed" "direction" "display" "dotted" "double" "elevation"
+    "empty-cells" "float" "font" "font-family" "font-size" "font-size-adjust"
+    "font-stretch" "font-style" "font-variant" "font-weight" "groove" "height"
+    "hidden" "inline" "inline-table" "inset" "left" "letter-spacing"
+    "line-height" "list-item" "list-style" "list-style-image"
+    "list-style-position" "list-style-type" "margin" "margin-bottom"
+    "margin-left" "margin-right" "margin-top" "marker-offset" "marks"
+    "max-height" "max-width" "min-height" "min-width" "orphans" "outline"
+    "outline-color" "outline-style" "outline-width" "outset" "overflow"
+    "padding" "padding-bottom" "padding-left" "padding-right" "padding-top"
+    "page" "page-break-after" "page-break-before" "page-break-inside" "pause"
+    "pause-after" "pause-before" "pitch" "pitch-range" "play-during" "position"
+    "quotes" "richness" "ridge" "right" "run-in" "size" "solid" "speak"
+    "speak-header" "speak-numeral" "speak-punctuation" "speech-rate" "stress"
+    "table" "table-caption" "table-cell" "table-column" "table-column-group"
+    "table-footer-group" "table-header-group" "table-layout" "table-row"
+    "table-row-group" "text-align" "text-decoration" "text-indent"
+    "text-shadow" "text-transform" "top" "unicode-bidi" "vertical-align"
+    "visibility" "voice-family" "volume" "white-space" "widows" "width"
+    "word-spacing" "z-index")
+  "Identifiers for properties.")
+
+(defcustom css-electrick-keys '(?\} ?\;) ;; '()
+  "Self inserting keys which should trigger re-indentation."
+  :type '(repeat character)
+  :options '((?\} ?\;)))
+
+(defvar css-mode-syntax-table
+  (let ((st (make-syntax-table)))
+    ;; C-style comments.
+    (modify-syntax-entry ?/ ". 14" st)
+    (modify-syntax-entry ?* ". 23" st)
+    ;; Strings.
+    (modify-syntax-entry ?\" "\"" st)
+    (modify-syntax-entry ?\' "\"" st)
+    ;; Blocks.
+    (modify-syntax-entry ?\{ "(}" st)
+    (modify-syntax-entry ?\} "){" st)
+    ;; Args in url(...) thingies and other "function calls".
+    (modify-syntax-entry ?\( "()" st)
+    (modify-syntax-entry ?\) ")(" st)
+    ;; To match attributes in selectors.
+    (modify-syntax-entry ?\[ "(]" st)
+    (modify-syntax-entry ?\] ")[" st)
+    ;; Special chars that sometimes come at the beginning of words.
+    (modify-syntax-entry ?@ "'" st)
+    ;; (modify-syntax-entry ?: "'" st)
+    (modify-syntax-entry ?# "'" st)
+    ;; Distinction between words and symbols.
+    (modify-syntax-entry ?- "_" st)
+    st))
+
+(defconst css-escapes-re
+  "\\\\\\(?:[^\000-\037\177]\\|[0-9a-fA-F]+[ \n\t\r\f]?\\)")
+(defconst css-nmchar-re (concat "\\(?:[-[:alnum:]]\\|" css-escapes-re "\\)"))
+(defconst css-nmstart-re (concat "\\(?:[[:alpha:]]\\|" css-escapes-re "\\)"))
+(defconst css-ident-re (concat css-nmstart-re css-nmchar-re "*"))
+(defconst css-name-re (concat css-nmchar-re "+"))
+
+(defface css-selector '((t :inherit font-lock-function-name-face))
+  "Face to use for selectors.")
+(defface css-property '((t :inherit font-lock-variable-name-face))
+  "Face to use for properties.")
+
+(defvar css-font-lock-keywords
+  `(("!\\s-*important" . font-lock-builtin-face)
+    ;; Atrules keywords.  IDs not in css-at-ids are valid (ignored).
+    ;; In fact the regexp should probably be
+    ;; (,(concat "\\(@" css-ident-re "\\)\\([ \t\n][^;{]*\\)[;{]")
+    ;;  (1 font-lock-builtin-face))
+    ;; Since "An at-rule consists of everything up to and including the next
+    ;; semicolon (;) or the next block, whichever comes first."
+    (,(concat "@" css-ident-re) . font-lock-builtin-face)
+    ;; Selectors.
+    ;; FIXME: attribute selectors don't work well because they may contain
+    ;; strings which have already been highlighted as f-l-string-face and
+    ;; thus prevent this highlighting from being applied (actually now that
+    ;; I use `append' this should work better).  But really the part of hte
+    ;; selector between [...] should simply not be highlighted.
+    (,(concat "^\\([ \t]*[^@:{\n][^:{\n]+\\(?::" (regexp-opt css-pseudo-ids t)
+              "\\(?:([^)]+)\\)?[^:{\n]*\\)*\\)\\(?:\n[ \t]*\\)*{")
+     (1 'css-selector append))
+    ;; In the above rule, we allow the open-brace to be on some subsequent
+    ;; line.  This will only work if we properly mark the intervening text
+    ;; as being part of a multiline element (and even then, this only
+    ;; ensures proper refontification, but not proper discovery).
+    ("^[ \t]*{" (0 (save-excursion
+                     (goto-char (match-beginning 0))
+                     (skip-chars-backward " \n\t")
+                     (put-text-property (point) (match-end 0)
+                                        'font-lock-multiline t)
+                     ;; No face.
+                     nil)))
+    ;; Properties.  Again, we don't limit ourselves to css-property-ids.
+    (,(concat "\\(?:[{;]\\|^\\)[ \t]*\\(" css-ident-re "\\)\\s-*:")
+     (1 'css-property))))
+
+(defvar css-font-lock-defaults
+  '(css-font-lock-keywords nil t))
+
+(unless (fboundp 'prog-mode) (defalias 'prog-mode 'fundamental-mode))
+
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.css\\'" . css-mode))
+;;;###autoload
+(define-derived-mode css-mode prog-mode "CSS"
+  "Major mode to edit Cascading Style Sheets."
+  (set (make-local-variable 'font-lock-defaults) css-font-lock-defaults)
+  (set (make-local-variable 'comment-start) "/*")
+  (set (make-local-variable 'comment-start-skip) "/\\*+[ \t]*")
+  (set (make-local-variable 'comment-end) "*/")
+  (set (make-local-variable 'comment-end-skip) "[ \t]*\\*+/")
+  (set (make-local-variable 'forward-sexp-function) 'css-forward-sexp)
+  (set (make-local-variable 'parse-sexp-ignore-comments) t)
+  (set (make-local-variable 'indent-line-function) 'css-indent-line)
+  (set (make-local-variable 'fill-paragraph-function)
+       'css-fill-paragraph)
+  (when css-electrick-keys
+    (let ((fc (make-char-table 'auto-fill-chars)))
+      (set-char-table-parent fc auto-fill-chars)
+      (dolist (c css-electrick-keys)
+        (aset fc c 'indent-according-to-mode))
+      (set (make-local-variable 'auto-fill-chars) fc))))
+
+(defun css-fill-paragraph (&optional justify)
+  (save-excursion
+    (let ((ppss (syntax-ppss))
+          (eol (line-end-position)))
+      (cond
+       ((and (nth 4 ppss)
+             (save-excursion
+               (goto-char (nth 8 ppss))
+               (forward-comment 1)
+               (prog1 (not (bolp))
+                 (setq eol (point)))))
+        ;; Filling inside a comment whose comment-end marker is not \n.
+        ;; This code is meant to be generic, so that it works not only for
+        ;; css-mode but for all modes.
+        (save-restriction
+          (narrow-to-region (nth 8 ppss) eol)
+          (comment-normalize-vars)
+          (let ((fill-paragraph-function nil)
+                (paragraph-separate
+                 (if (and comment-continue
+                          (string-match "[^ \t]" comment-continue))
+                     (concat "\\(?:[ \t]*" (regexp-quote comment-continue)
+                             "\\)?\\(?:" paragraph-separate "\\)")
+                   paragraph-separate))
+                (paragraph-start
+                 (if (and comment-continue
+                          (string-match "[^ \t]" comment-continue))
+                     (concat "\\(?:[ \t]*" (regexp-quote comment-continue)
+                             "\\)?\\(?:" paragraph-start "\\)")
+                   paragraph-start)))
+            (fill-paragraph justify)
+            ;; Don't try filling again.
+            t)))
+        
+       ((and (null (nth 8 ppss))
+             (or (nth 1 ppss)
+                 (and (ignore-errors
+                        (down-list 1)
+                        (when (<= (point) eol)
+                          (setq ppss (syntax-ppss)))))))
+        (goto-char (nth 1 ppss))
+        (let ((end (save-excursion
+                     (ignore-errors (forward-sexp 1) (copy-marker (point) t)))))
+          (when end
+            (while (re-search-forward "[{;}]" end t)
+              (cond
+               ;; This is a false positive inside a string or comment.
+               ((nth 8 (syntax-ppss)) nil)
+               ((eq (char-before) ?\})
+                (save-excursion
+                  (forward-char -1)
+                  (skip-chars-backward " \t")
+                  (unless (bolp) (newline))))
+               (t
+                (while
+                    (progn
+                      (setq eol (line-end-position))
+                      (and (forward-comment 1)
+                           (> (point) eol)
+                           ;; A multi-line comment should be on its own line.
+                           (save-excursion (forward-comment -1)
+                                           (when (< (point) eol)
+                                             (newline)
+                                             t)))))
+                (if (< (point) eol) (newline)))))
+            (goto-char (nth 1 ppss))
+            (indent-region (line-beginning-position 2) end)
+            ;; Don't use the default filling code.
+            t)))))))
+
+;;; Navigation and indentation.
+
+(defconst css-navigation-syntax-table
+  (let ((st (make-syntax-table css-mode-syntax-table)))
+    (map-char-table (lambda (c v)
+                      ;; Turn punctuation (code = 1) into symbol (code = 1).
+                      (if (eq (car-safe v) 1)
+                          (set-char-table-range st c (cons 3 (cdr v)))))
+                    st)
+    st))
+
+(defun css-backward-sexp (n)
+  (let ((forward-sexp-function nil))
+    (if (< n 0) (css-forward-sexp (- n))
+      (while (> n 0)
+        (setq n (1- n))
+        (forward-comment (- (point-max)))
+        (if (not (eq (char-before) ?\;))
+            (backward-sexp 1)
+          (while (progn (backward-sexp 1)
+                        (save-excursion
+                          (forward-comment (- (point-max)))
+                          ;; FIXME: We should also skip punctuation.
+                          (not (memq (char-before) '(?\; ?\{)))))))))))
+
+(defun css-forward-sexp (n)
+  (let ((forward-sexp-function nil))
+    (if (< n 0) (css-backward-sexp (- n))
+      (while (> n 0)
+        (setq n (1- n))
+        (forward-comment (point-max))
+        (if (not (eq (char-after) ?\;))
+            (forward-sexp 1)
+          (while (progn (forward-sexp 1)
+                        (save-excursion
+                          (forward-comment (point-max))
+                          ;; FIXME: We should also skip punctuation.
+                          (not (memq (char-after) '(?\; ?\})))))))))))
+
+(defun css-indent-calculate-virtual ()
+  (if (or (save-excursion (skip-chars-backward " \t") (bolp))
+          (if (looking-at "\\s(")
+              (save-excursion
+                (forward-char 1) (skip-chars-forward " \t")
+                (not (or (eolp) (looking-at comment-start-skip))))))
+      (current-column)
+    (css-indent-calculate)))
+
+(defcustom css-indent-offset 4
+  "Basic size of one indentation step."
+  :type 'integer)
+
+(defun css-indent-calculate ()
+  (let ((ppss (syntax-ppss))
+        pos)
+    (with-syntax-table css-navigation-syntax-table
+      (save-excursion
+        (cond
+         ;; Inside a string.
+         ((nth 3 ppss) 'noindent)
+         ;; Inside a comment.
+         ((nth 4 ppss)
+          (setq pos (point))
+          (forward-line -1)
+          (skip-chars-forward " \t")
+          (if (>= (nth 8 ppss) (point))
+              (progn
+                (goto-char (nth 8 ppss))
+                (if (eq (char-after pos) ?*)
+                    (forward-char 1)
+                  (if (not (looking-at comment-start-skip))
+                      (error "Internal css-mode error")
+                    (goto-char (match-end 0))))
+                (current-column))
+            (if (and (eq (char-after pos) ?*) (eq (char-after) ?*))
+                (current-column)
+              ;; 'noindent
+              (current-column)
+              )))
+         ;; In normal code.
+         (t
+          (or
+           (when (looking-at "\\s)")
+             (forward-char 1)
+             (backward-sexp 1)
+             (css-indent-calculate-virtual))
+           (when (looking-at comment-start-skip)
+             (forward-comment (point-max))
+             (css-indent-calculate))
+           (when (save-excursion (forward-comment (- (point-max)))
+                                 (setq pos (point))
+                                 (eq (char-syntax (preceding-char)) ?\())
+             (goto-char (1- pos))
+             (if (not (looking-at "\\s([ \t]*"))
+                 (error "Internal css-mode error")
+               (if (or (memq (char-after (match-end 0)) '(?\n nil))
+                       (save-excursion (goto-char (match-end 0))
+                                       (looking-at comment-start-skip)))
+                   (+ (css-indent-calculate-virtual) css-indent-offset)
+                 (progn (goto-char (match-end 0)) (current-column)))))
+           (progn
+             (css-backward-sexp 1)
+             (if (looking-at "\\s(")
+                 (css-indent-calculate)
+               (css-indent-calculate-virtual))))))))))
+     
+
+(defun css-indent-line ()
+  "Indent current line according to CSS indentation rules."
+  (interactive)
+  (let* ((savep (point))
+         (forward-sexp-function nil)
+	 (indent (condition-case nil
+		     (save-excursion
+		       (forward-line 0)
+		       (skip-chars-forward " \t")
+		       (if (>= (point) savep) (setq savep nil))
+		       (css-indent-calculate))
+		   (error nil))))
+    (if (not (numberp indent)) 'noindent
+      (if savep
+          (save-excursion (indent-line-to indent))
+        (indent-line-to indent)))))
+
+(provide 'css-mode)
+;; arch-tag: b4d8b8e2-b130-4e74-b3aa-cd8f1ab659d0
+;;; css-mode.el ends here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/textmodes/org-publish.el	Mon Jun 11 00:58:11 2007 +0000
@@ -0,0 +1,603 @@
+;;; org-publish.el --- publish related org-mode files as a website
+
+;; Copyright (C) 2006, 2007  Free Software Foundation, Inc.
+
+;; Author: David O'Toole <dto@gnu.org>
+;; Keywords: hypermedia, outlines
+;; Version: 1.80
+
+;; $Id: org-publish.el,v 1.2 2007/06/07 02:04:17 miles Exp $
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;; This file is part of GNU Emacs.
+
+;;; Commentary:
+
+;; Requires at least version 4.27 of org.el
+;;
+;; The official org-mode website:
+;; http://staff.science.uva.nl/~dominik/Tools/org/
+;;
+;; Home page for org-publish.el:
+;; http://dto.freeshell.org/notebook/OrgMode.html
+
+;; This program extends the HTML publishing support of Emacs Org-mode
+;; to allow configurable publishing of related sets of files as a
+;; complete website.
+;;
+;; org-publish.el can do the following:
+;;
+;; + Publish all one's org-files to html
+;; + Upload html, images, attachments and other files to a web server
+;; + Exclude selected private pages from publishing
+;; + Publish a clickable index of pages
+;; + Manage local timestamps, for publishing only changed files
+;; + Accept plugin functions to extend range of publishable content
+;;
+;; Special thanks to the org-mode maintainer Carsten Dominik for his
+;; ideas, enthusiasm, and cooperation.
+
+;;; Installation:
+
+;; Put org-publish.el in your load path, byte-compile it, and then add
+;; the following lines to your emacs initialization file:
+
+;; (autoload 'org-publish "org-publish" nil t)
+;; (autoload 'org-publish "org-publish-all" nil t)
+;; (autoload 'org-publish "org-publish-current-file" nil t)
+;; (autoload 'org-publish "org-publish-current-project" nil t)
+
+;; NOTE: When org-publish.el is included with org.el, those forms are
+;; already in the file org-install.el, and hence don't need to be put
+;; in your emacs initialization file in this case.
+
+;;; Usage:
+;;
+;; The program's main configuration variable is
+;; `org-publish-project-alist'. See below for example configurations
+;; with commentary.
+
+;; The main interactive functions are:
+;;
+;; M-x org-publish
+;; M-x org-publish-all
+;; M-x org-publish-current-file
+;; M-x org-publish-current-project
+
+;;;; Simple example configuration:
+
+;; (setq org-publish-project-alist
+;;       (list
+;;        '("org" . (:base-directory "~/org/"
+;; 		     :base-extension "org"
+;; 		     :publishing-directory "~/public_html"
+;;                   :with-section-numbers nil
+;; 		     :table-of-contents nil
+;; 		     :style "<link rel=stylesheet href=\"../other/mystyle.css\" type=\"text/css\">")))
+
+;;;; More complex example configuration:
+
+;; Imagine your *.org files are kept in ~/org, your images in
+;; ~/images, and stylesheets in ~/other. Now imagine you want to
+;; publish the files through an ssh connection to a remote host, via
+;; Tramp-mode. To maintain relative links from *.org files to /images
+;; and /other, we should replicate the same directory structure in
+;; your web server account's designated html root (in this case,
+;; assumed to be ~/html)
+
+;; Once you've done created the proper directories, you can adapt the
+;; following example configuration to your specific paths, run M-x
+;; org-publish-all, and it should publish the files to the correct
+;; directories on the web server, transforming the *.org files into
+;; HTML, and leaving other files alone.
+
+;; (setq org-publish-project-alist
+;;       (list
+;;        '("orgfiles" :base-directory "~/org/"
+;; 		       :base-extension "org"
+;; 		       :publishing-directory "/ssh:user@host:~/html/notebook/"
+;; 		       :publishing-function org-publish-org-to-html
+;; 		       :exclude "PrivatePage.org"   ;; regexp
+;; 		       :headline-levels 3
+;;                     :with-section-numbers nil
+;; 		       :table-of-contents nil
+;; 		       :style "<link rel=stylesheet href=\"../other/mystyle.css\" type=\"text/css\">"
+;; 		       :auto-preamble t
+;; 		       :auto-postamble nil)
+;;
+;;         ("images" :base-directory "~/images/"
+;; 	             :base-extension "jpg\\|gif\\|png"
+;; 		     :publishing-directory "/ssh:user@host:~/html/images/"
+;; 		     :publishing-function org-publish-attachment)
+;;
+;;         ("other"  :base-directory "~/other/"
+;; 	   	     :base-extension "css"
+;; 		     :publishing-directory "/ssh:user@host:~/html/other/"
+;; 		     :publishing-function org-publish-attachment)
+;;         ("website" :components ("orgfiles" "images" "other"))))
+
+;; For more information, see the documentation for the variable
+;; `org-publish-project-alist'.
+
+;; Of course, you don't have to publish to remote directories from
+;; within emacs. You can always just publish to local folders, and
+;; then use the synchronization/upload tool of your choice.
+
+
+;;; List of user-visible changes since version 1.27
+
+;; 1.78: Allow list-valued :publishing-function
+;; 1.77: Added :preparation-function, this allows you to use GNU Make etc.
+;; 1.65: Remove old "composite projects". They're redundant.
+;; 1.64: Allow meta-projects with :components
+;; 1.57: Timestamps flag is now called "org-publish-use-timestamps-flag"
+;; 1.52: Properly set default for :index-filename
+;; 1.48: Composite projects allowed.
+;;       :include keyword allowed.
+;; 1.43: Index no longer includes itself in the index.
+;; 1.42: Fix "function definition is void" error
+;;       when :publishing-function not set in org-publish-current-file.
+;; 1.41: Fixed bug where index isn't published on first try.
+;; 1.37: Added interactive function "org-publish". Prompts for particular
+;;       project name to publish.
+;; 1.34: Added force-publish option to all interactive functions.
+;; 1.32: Fixed "index.org has changed on disk" error during index publishing.
+;; 1.30: Fixed startup error caused by (require 'em-unix)
+
+;;; Code:
+
+
+(eval-when-compile
+  (require 'cl))
+
+
+(defgroup org-publish nil
+	"Options for publishing a set of Org-mode and related files."
+   :tag "Org Publishing"
+   :group 'org)
+
+
+(defcustom org-publish-project-alist nil
+  "Association list to control publishing behavior.
+Each element of the alist is a publishing 'project.'  The CAR of
+each element is a string, uniquely identifying the project. The
+CDR of each element is in one of the following forms:
+
+  (:property value :property value ... )
+
+OR,
+
+  (:components (\"project-1\" \"project-2\" ...))
+
+When the CDR of an element of org-publish-project-alist is in
+this second form, the elements of the list after :components are
+taken to be components of the project, which group together files
+requiring different publishing options. When you publish such a
+project with M-x org-publish, the components all publish.
+
+When a property is given a value in org-publish-project-alist, its
+setting overrides the value of the corresponding user variable
+ (if any) during publishing. However, options set within a file
+override everything.
+
+Most properties are optional, but some should always be set:
+
+    :base-directory        Directory containing publishing source files
+    :base-extension        Extension (without the dot!) of source files.
+                             This can be a regular expression.
+    :publishing-directory  Directory (possibly remote) where output
+                             files will be published
+
+The :exclude property may be used to prevent certain files from
+being published. Its value may be a string or regexp matching
+file names you don't want to be published.
+
+The :include property may be used to include extra files. Its
+value may be a list of filenames to include. The filenames are
+considered relative to the publishing directory.
+
+When both :include and :exclude properties are given values, the
+exclusion step happens first.
+
+One special property controls which back-end function to use for
+publishing files in the project. This can be used to extend the
+set of file types publishable by org-publish, as well as the set
+of output formats.
+
+    :publishing-function     Function to publish file. The default is
+                             org-publish-org-to-html, but other
+                             values are possible. May also be a
+                             list of functions, in which case 
+                             each function in the list is invoked
+                             in turn.
+
+Another property allows you to insert code that prepares a
+project for publishing. For example, you could call GNU Make on a
+certain makefile, to ensure published files are built up to date. 
+
+    :preparation-function   Function to be called before publishing
+                              this project.
+
+Some properties control details of the Org publishing process,
+and are equivalent to the corresponding user variables listed in
+the right column. See the documentation for those variables to
+learn more about their use and default values.
+
+    :language              org-export-default-language
+    :headline-levels       org-export-headline-levels
+    :section-numbers       org-export-with-section-numbers
+    :table-of-contents     org-export-with-toc
+    :emphasize             org-export-with-emphasize
+    :sub-superscript       org-export-with-sub-superscripts
+    :TeX-macros            org-export-with-TeX-macros
+    :fixed-width           org-export-with-fixed-width
+    :tables                org-export-with-tables
+    :table-auto-headline   org-export-highlight-first-table-line
+    :style                 org-export-html-style
+    :convert-org-links     org-export-html-link-org-files-as-html
+    :inline-images         org-export-html-inline-images
+    :expand-quoted-html    org-export-html-expand
+    :timestamp             org-export-html-with-timestamp
+    :publishing-directory  org-export-publishing-directory
+    :preamble              org-export-html-preamble
+    :postamble             org-export-html-postamble
+    :auto-preamble         org-export-html-auto-preamble
+    :auto-postamble        org-export-html-auto-postamble
+    :author                user-full-name
+    :email                 user-mail-address
+
+The following properties may be used to control publishing of an
+index of files or summary page for a given project.
+
+    :auto-index            Whether to publish an index during
+                           org-publish-current-project or org-publish-all.
+    :index-filename        Filename for output of index. Defaults
+                           to 'index.org' (which becomes 'index.html')
+    :index-title           Title of index page. Defaults to name of file.
+    :index-function        Plugin function to use for generation of index.
+                           Defaults to 'org-publish-org-index', which
+                           generates a plain list of links to all files
+                           in the project.
+"
+  :group 'org-publish
+  :type 'alist)
+
+
+(defcustom org-publish-use-timestamps-flag t
+  "When non-nil, use timestamp checking to publish only changed files.
+When nil, do no timestamp checking and always publish all
+files."
+  :group 'org-publish
+  :type 'boolean)
+
+
+(defcustom org-publish-timestamp-directory "~/.org-timestamps/"
+  "Name of directory in which to store publishing timestamps."
+  :group 'org-publish
+  :type 'string)
+
+
+;;;; Timestamp-related functions
+
+
+(defun org-publish-timestamp-filename (filename)
+  "Return path to timestamp file for filename FILENAME."
+  (while (string-match "~\\|/" filename)
+    (setq filename (replace-match "_" nil t filename)))
+  (concat org-publish-timestamp-directory filename ".timestamp"))
+
+
+(defun org-publish-needed-p (filename)
+  "Check whether file should be published.
+If org-publish-use-timestamps-flag is set to nil, this function always
+returns t. Otherwise, check the timestamps folder to determine
+whether file should be published."
+  (if org-publish-use-timestamps-flag
+      (progn
+	;;
+	;; create folder if needed
+	(if (not (file-exists-p org-publish-timestamp-directory))
+	    (make-directory org-publish-timestamp-directory)
+	  (if (not (file-directory-p org-publish-timestamp-directory))
+	      (error "org-publish-timestamp-directory must be a directory.")))
+	;;
+	;; check timestamp. ok if timestamp file doesn't exist
+	(let* ((timestamp (org-publish-timestamp-filename filename))
+	       (rtn (file-newer-than-file-p filename timestamp)))
+	  (if rtn
+	      ;; handle new timestamps
+	      (if (not (file-exists-p timestamp))
+		  ;; create file
+		  (with-temp-buffer
+		    (make-directory (file-name-directory timestamp) :parents)
+		    (write-file timestamp)
+		    (kill-buffer (current-buffer)))))
+	  rtn))
+    t))
+
+
+(defun org-publish-update-timestamp (filename)
+  "Update publishing timestamp for file FILENAME."
+  (let ((timestamp (org-publish-timestamp-filename filename)))
+    ;; Emacs 21 doesn't have set-file-times
+    (if (fboundp 'set-file-times)
+        (set-file-times timestamp)
+      (call-process "touch" nil 0 nil timestamp))))
+
+
+;;;; A hash mapping files to project names
+
+
+(defvar org-publish-files (make-hash-table :test 'equal) "Hash
+table mapping file names to project names.")
+
+
+;;;; Checking filenames against this hash
+
+
+(defun org-publish-validate-link (link &optional directory)
+  (gethash (file-truename (expand-file-name link directory))
+	   org-publish-files))
+
+
+;;;; Getting project information out of org-publish-project-alist
+
+
+(defun org-publish-get-plists (&optional project-name)
+ "Return a list of property lists for project PROJECT-NAME.
+When argument is not given, return all property lists for all projects."
+ (let ((alist (if project-name
+		   (list (assoc project-name org-publish-project-alist))
+		 org-publish-project-alist))
+	(project nil)
+	(plists nil)
+	(single nil)
+	(components nil))
+
+   ;;
+   ;;
+   (while (setq project (pop alist))
+     ;; what kind of project is it?
+     (if (setq components (plist-get (cdr project) :components))
+	  ;; meta project. annotate each plist with name of enclosing project
+	  (setq single
+		(apply 'append
+		       (mapcar 'org-publish-get-plists components)))
+	;; normal project
+	(setq single (list (cdr project))))
+     ;;
+     (setq plists (append plists single))
+     (dolist (p single)
+	(let* ((exclude (plist-get p :exclude))
+	       (files (org-publish-get-base-files p exclude)))
+	  (dolist (f files)
+	    (puthash (file-truename f) (car project) org-publish-files)))))
+   plists))
+
+
+
+(defun org-publish-get-base-files (plist &optional exclude-regexp)
+  "Return a list of all files in project defined by PLIST.
+If EXCLUDE-REGEXP is set, this will be used to filter out
+matching filenames."
+  (let* ((dir (file-name-as-directory (plist-get plist :base-directory)))
+	 (include-list (plist-get plist :include))
+	 (extension (or (plist-get plist :base-extension) "org"))
+	 (regexp (concat "^[^\\.].*\\.\\(" extension "\\)$"))
+	 (allfiles (directory-files dir t regexp)))
+    ;;
+    ;; exclude files
+    (setq allfiles
+	  (if (not exclude-regexp)
+	      allfiles
+	    (delq nil
+		  (mapcar (lambda (x)
+			    (if (string-match exclude-regexp x) nil x))
+			  allfiles))))
+    ;;
+    ;; include extra files
+    (let ((inc nil))
+      (while (setq inc (pop include-list))
+	(setq allfiles (cons (expand-file-name inc dir) allfiles))))
+
+    allfiles))
+
+
+(defun org-publish-get-project-from-filename (filename)
+  "Figure out which project a given FILENAME belongs to, if any.
+Filename should contain full path. Returns name of project, or
+nil if not found."
+  (org-publish-get-plists)
+  (gethash (file-truename filename) org-publish-files))
+
+
+(defun org-publish-get-plist-from-filename (filename)
+  "Return publishing configuration plist for file FILENAME."
+  (let ((found nil))
+    (mapcar
+     (lambda (plist)
+       (let ((files (org-publish-get-base-files plist)))
+ 	 (if (member (expand-file-name filename) files)
+	     (setq found plist))))
+     (org-publish-get-plists))
+    found))
+
+
+
+;;;; Pluggable publishing back-end functions
+
+
+(defun org-publish-org-to-html (plist filename)
+  "Publish an org file to HTML.
+PLIST is the property list for the given project.
+FILENAME is the filename of the org file to be published."
+  (require 'org)
+  (let* ((arg (plist-get plist :headline-levels)))
+    (progn
+      (find-file filename)
+      (org-export-as-html arg nil plist)
+      ;; get rid of HTML buffer
+      (kill-buffer (current-buffer)))))
+
+
+(defun org-publish-attachment (plist filename)
+  "Publish a file with no transformation of any kind.
+PLIST is the property list for the given project.
+FILENAME is the filename of the file to be published."
+  ;; make sure eshell/cp code is loaded
+  (require 'eshell)
+  (require 'esh-maint)
+  (require 'em-unix)
+  (let ((destination (file-name-as-directory (plist-get plist :publishing-directory))))
+    (eshell/cp filename destination)))
+
+
+;;;; Publishing files, sets of files, and indices
+
+
+(defun org-publish-file (filename)
+  "Publish file FILENAME."
+  (let* ((project-name (org-publish-get-project-from-filename filename))
+	 (plist (org-publish-get-plist-from-filename filename))
+	 (publishing-function (or (plist-get plist :publishing-function) 'org-publish-org-to-html)))
+    (if (not project-name)
+	(error (format "File %s is not part of any known project." filename)))
+    (when (org-publish-needed-p filename)
+      (if (listp publishing-function)
+	  ;; allow chain of publishing functions
+	  (mapc (lambda (f)
+		  (funcall f plist filename)) 
+		publishing-function)
+	(funcall publishing-function plist filename))
+      (org-publish-update-timestamp filename))))
+
+
+(defun org-publish-plist (plist)
+  "Publish all files in set defined by PLIST.
+ If :auto-index is set, publish the index too."
+  (let* ((exclude-regexp (plist-get plist :exclude))
+	 (publishing-function (or (plist-get plist :publishing-function) 'org-publish-org-to-html))
+	 (index-p (plist-get plist :auto-index))
+         (index-filename (or (plist-get plist :index-filename) "index.org"))
+	 (index-function (or (plist-get plist :index-function) 'org-publish-org-index))
+	 (preparation-function (plist-get plist :preparation-function))
+	 (f nil))
+    ;;
+    (when preparation-function
+      (funcall preparation-function))
+    (if index-p
+	(funcall index-function plist index-filename))
+    (let ((files (org-publish-get-base-files plist exclude-regexp)))
+      (while (setq f (pop files))
+	;; check timestamps
+	(when (org-publish-needed-p f)
+	  (if (listp publishing-function)
+	      ;; allow chain of publishing functions
+	      (mapc (lambda (func)
+		      (funcall func plist f)) 
+		    publishing-function)
+	    (funcall publishing-function plist f))
+	  (org-publish-update-timestamp f))))))
+
+
+(defun org-publish-org-index (plist &optional index-filename)
+  "Create an index of pages in set defined by PLIST.
+Optionally set the filename of the index with INDEX-FILENAME;
+default is 'index.org'."
+  (let* ((dir (file-name-as-directory (plist-get plist :base-directory)))
+	 (exclude-regexp (plist-get plist :exclude))
+	 (files (org-publish-get-base-files plist exclude-regexp))
+	 (index-filename (concat dir (or index-filename "index.org")))
+	 (index-buffer (find-buffer-visiting index-filename))
+	 (ifn (file-name-nondirectory index-filename))
+	 (f nil))
+    ;;
+    ;; if buffer is already open, kill it to prevent error message
+    (if index-buffer
+	(kill-buffer index-buffer))
+    (with-temp-buffer
+      (while (setq f (pop files))
+	(let ((fn (file-name-nondirectory f)))
+	  (unless (string= fn ifn) ;; index shouldn't index itself
+	    (insert (concat " + [[file:" fn "]["
+			    (file-name-sans-extension fn)
+			    "]]\n")))))
+      (write-file index-filename)
+      (kill-buffer (current-buffer)))))
+
+
+;(defun org-publish-meta-index (meta-plist &optional index-filename)
+;  "Create an index for a metaproject."
+;  (let* ((plists (
+
+
+;;;; Interactive publishing functions
+
+
+;;;###autoload
+(defun org-publish (project-name &optional force)
+  "Publish the project PROJECT-NAME."
+  (interactive (list (completing-read "Project name: " org-publish-project-alist
+				      nil t)
+		     current-prefix-arg))
+  (save-window-excursion
+    (let ((org-publish-use-timestamps-flag (if force nil t))
+	  (plists (org-publish-get-plists project-name)))
+      (mapcar 'org-publish-plist plists))))
+
+
+;;;###autoload
+(defun org-publish-current-project (&optional force)
+  "Publish the project associated with the current file.
+With prefix argument, force publishing all files in project."
+  (interactive "P")
+  (save-window-excursion
+    (let* ((project-name (org-publish-get-project-from-filename (buffer-file-name)))
+	   (org-publish-use-timestamps-flag (if force nil t)))
+      (if (not project-name)
+	  (error (format "File %s is not part of any known project." (buffer-file-name))))
+      (org-publish project-name))))
+
+
+;;;###autoload
+(defun org-publish-current-file (&optional force)
+  "Publish the current file.
+With prefix argument, force publish the file."
+  (interactive "P")
+  (save-window-excursion
+    (let ((org-publish-use-timestamps-flag
+	   (if force nil t)))
+      (org-publish-file (buffer-file-name)))))
+
+
+;;;###autoload
+(defun org-publish-all (&optional force)
+  "Publish all projects.
+With prefix argument, force publish all files."
+  (interactive "P")
+  (save-window-excursion
+    (let ((org-publish-use-timestamps-flag
+	   (if force nil t))
+	  (plists (org-publish-get-plists)))
+      (mapcar 'org-publish-plist plists))))
+
+
+
+(provide 'org-publish)
+
+;; arch-tag: 72807f3c-8af0-4a6b-8dca-c3376eb25adb
+;;; org-publish.el ends here
--- a/lisp/textmodes/org.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/textmodes/org.el	Mon Jun 11 00:58:11 2007 +0000
@@ -1,11 +1,11 @@
-;;;; org.el --- Outline-based notes management and organize
+;;; org.el --- Outline-based notes management and organizer
 ;; Carstens outline-mode for keeping track of everything.
 ;; Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 ;;
 ;; 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.67d
+;; Version: 4.77
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -83,7 +83,7 @@
 
 ;;; Version
 
-(defvar org-version "4.67c"
+(defconst org-version "4.77"
   "The version number of the file org.el.")
 (defun org-version ()
   (interactive)
@@ -153,21 +153,13 @@
   :group 'org-startup
   :type 'boolean)
 
-(defcustom org-CUA-compatible nil
-  "Non-nil means use alternative key bindings for S-<cursor movement>.
-Org-mode used S-<cursor movement> for changing timestamps and priorities.
-S-<cursor movement> is also used for example by `CUA-mode' to select text.
-If you want to use Org-mode together with `CUA-mode', Org-mode needs to use
-alternative bindings.  Setting this variable to t will replace the following
-keys both in Org-mode and in the Org-agenda buffer.
-
-S-RET   -> C-S-RET
-S-up    -> M-p
-S-down  -> M-n
-S-left  -> M--
-S-right -> M-+
-
-If you do not like the alternative keys, take a look at the variable
+(defcustom org-replace-disputed-keys nil
+  "Non-nil means use alternative key bindings for some keys.
+Org-mode uses S-<cursor> keys for changing timestamps and priorities.
+These keys are also used by other packages like `CUA-mode' or `windmove.el'.
+If you want to use Org-mode together with one of these other modes,
+or more generally if you would like to move some Org-mode commands to
+other keys, set this variable and configure the keys with the variable
 `org-disputed-keys'.
 
 This option is only relevant at load-time of Org-mode, and must be set
@@ -176,21 +168,47 @@
   :group 'org-startup
   :type 'boolean)
 
-(defvar org-disputed-keys
-  '((S-up     [(shift up)]      [(meta ?p)])
-    (S-down   [(shift down)]    [(meta ?n)])
-    (S-left   [(shift left)]    [(meta ?-)])
-    (S-right  [(shift right)]   [(meta ?+)])
-    (S-return [(shift return)]  [(control shift return)]))
+(if (fboundp 'defvaralias)
+    (defvaralias 'org-CUA-compatible 'org-replace-disputed-keys))
+
+(defcustom org-disputed-keys
+  '(([(shift up)]		. [(meta p)])
+    ([(shift down)]		. [(meta n)])
+    ([(shift left)]		. [(meta -)])
+    ([(shift right)]		. [(meta +)])
+    ([(control shift right)] 	. [(meta shift +)])
+    ([(control shift left)]	. [(meta shift -)]))
   "Keys for which Org-mode and other modes compete.
-This is an alist, cars are symbols for lookup, 1st element is the default key,
-second element will be used when `org-CUA-compatible' is t.")
+This is an alist, cars are the default keys, second element specifies
+the alternative to use when `org-replace-disputed-keys' is t.
+
+Keys can be specified in any syntax supported by `define-key'.
+The value of this option takes effect only at Org-mode's startup,
+therefore you'll have to restart Emacs to apply it after changing."
+  :group 'org-startup
+  :type 'alist)
 
 (defun org-key (key)
-  "Select a key according to `org-CUA-compatible'."
-  (nth (if org-CUA-compatible 2 1)
-       (or (assq key org-disputed-keys)
-	   (error "Invalid Key %s in `org-key'" key))))
+  "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'.
+Or return the original if not disputed."
+  (if org-replace-disputed-keys
+      (let* ((nkey (key-description key))
+	     (x (org-find-if (lambda (x)
+			       (equal (key-description (car x)) nkey))
+			     org-disputed-keys)))
+	(if x (cdr x) key))
+    key))
+
+(defun org-find-if (predicate seq)
+  (catch 'exit
+    (while seq
+      (if (funcall predicate (car seq))
+	  (throw 'exit (car seq))
+	(pop seq)))))
+
+(defun org-defkey (keymap key def)
+  "Define a key, possibly translated, as returned by `org-key'."
+  (define-key keymap (org-key key) def))
 
 (defcustom org-ellipsis nil
   "The ellipsis to use in the Org-mode outline.
@@ -255,7 +273,9 @@
   :group 'org-keywords
   :type 'string)
 
-(defvar org-repeat-re "\\<REPEAT(\\([-+ 0-9dwmy]+\\))"
+(defconst org-repeat-re
+  (concat "\\(?:\\<\\(?:" org-scheduled-string "\\|" org-deadline-string "\\)"
+	  " +<[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^>\n]*\\)\\(\\+[0-9]+[dwmy]\\)")
   "Regular expression for specifying repeated events.
 After a match, group 1 contains the repeat expression.")
 
@@ -304,7 +324,7 @@
 		    (const default))
 		   (boolean)))))
 
-(defcustom org-show-following-heading '((default . t))
+(defcustom org-show-following-heading '((default . nil))
   "Non-nil means, show following heading when revealing a location.
 Org-mode often shows locations in an org-mode file which might have
 been invisible before.  When this is set, the heading following the
@@ -386,6 +406,7 @@
 white       Only in completely white lines
 whitestart  Only at the beginning of lines, before the first non-white char.
 t           Everywhere except in headlines
+exc-hl-bol  Everywhere except at the start of a headline
 If TAB is used in a place where it does not emulate TAB, the current subtree
 visibility is cycled."
   :group 'org-cycle
@@ -393,9 +414,25 @@
 		 (const :tag "Only in completely white lines" white)
 		 (const :tag "Before first char in a line" whitestart)
 		 (const :tag "Everywhere except in headlines" t)
+		 (const :tag "Everywhere except at bol in headlines" exc-hl-bol)
 		 ))
 
+(defcustom org-cycle-separator-lines 2
+  "Number of empty lines needed to keep an empty line between collapsed trees.
+If you leave an empty line between the end of a subtree and the following
+headline, this empty line is hidden when the subtree is folded.
+Org-mode will leave (exactly) one empty line visible if the number of
+empty lines is equal or larger to the number given in this variable.
+So the default 2 means, at least 2 empty lines after the end of a subtree
+are needed to produce free space between a collapsed subtree and the
+following headline.
+
+Special case: when 0, never leave empty lines in collapsed view."
+  :group 'org-cycle
+  :type 'integer)
+
 (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
+			    org-cycle-show-empty-lines
 			    org-optimize-window-after-visibility-change)
   "Hook that is run after `org-cycle' has changed the buffer visibility.
 The function(s) in this hook must accept a single argument which indicates
@@ -406,12 +443,20 @@
   :group 'org-cycle
   :type 'hook)
 
-
 (defgroup org-edit-structure nil
   "Options concerning structure editing in Org-mode."
   :tag "Org Edit Structure"
   :group 'org-structure)
 
+(defcustom org-special-ctrl-a nil
+  "Non-nil means `C-a' behaves specially in headlines.
+When set, `C-a' will bring back the cursor to the beginning of the
+headline text, i.e. after the stars and after a possible TODO keyword.
+When the cursor is already at that position, another `C-a' will bring
+it to the beginning of the line."
+  :group 'org-edit-structure
+  :type 'boolean)
+
 (defcustom org-odd-levels-only nil
   "Non-nil means, skip even levels and only use odd levels for the outline.
 This has the effect that two stars are being added/taken away in
@@ -783,6 +828,18 @@
   :tag "Org Table Calculation"
   :group 'org-table)
 
+(defcustom org-table-use-standard-references t
+  "Should org-mode work with table refrences like B3 instead of @3$2?
+Possible values are:
+nil     never use them
+from    accept as input, do not present for editing
+t:      accept as input and present for editing"
+  :group 'org-table-calculation
+  :type '(choice
+	  (const :tag "Never, don't even check unser input for them" nil)
+	  (const :tag "Always, both as user input, and when editing" t)
+	  (const :tag "Convert user input, don't offer during editing" 'from)))
+
 (defcustom org-table-copy-increment t
   "Non-nil means, increment when copying current field with \\[org-table-copy-down]."
   :group 'org-table-calculation
@@ -815,9 +872,6 @@
   :group 'org-table-calculation
   :type 'boolean)
 
-;; FIXME this is also a variable that makes Org-mode files non-portable
-;; Maybe I should have a #+ options for constants?
-;; How about the SI/cgs issue?
 (defcustom org-table-formula-use-constants t
   "Non-nil means, interpret constants in formulas in tables.
 A constant looks like `$c' or `$Grav' and will be replaced before evaluation
@@ -826,6 +880,8 @@
   :group 'org-table-calculation
   :type 'boolean)
 
+;; FIXME this is also a variable that makes Org-mode files non-portable
+;; Maybe I should have a #+ options for constants?
 (defcustom org-table-formula-constants nil
   "Alist with constant names and values, for use in table formulas.
 The car of each element is a name of a constant, without the `$' before it.
@@ -852,7 +908,7 @@
   :group 'org)
 
 (defvar org-link-abbrev-alist-local nil
-  "buffer-local version of `org-link-abbrev-alist', which see.
+  "Buffer-local version of `org-link-abbrev-alist', which see.
 The value of this is taken from the #+LINK lines.")
 (make-variable-buffer-local 'org-link-abbrev-alist-local)
 
@@ -1318,30 +1374,64 @@
   :tag "Org Progress"
   :group 'org-time)
 
-(defcustom org-todo-keywords '("TODO" "DONE")
-  "List of TODO entry keywords.
-\\<org-mode-map>By default, this is '(\"TODO\" \"DONE\").  The last entry in the list is
-considered to mean that the entry is \"done\".  All the other mean that
-action is required, and will make the entry show up in todo lists, diaries
-etc.
-The command \\[org-todo] cycles an entry through these states, and an
+(defcustom org-todo-keywords '((sequence "TODO" "DONE"))
+  "List of TODO entry keyword sequences and their interpretation.
+\\<org-mode-map>This is a list of sequences.
+
+Each sequence starts with a symbol, either `sequence' or `type',
+indicating if the keywords should be interpreted as a sequence of
+action steps, or as different types of TODO items.  The first
+keywords are states requiring action - these states will select a headline
+for inclusion into the global TODO list Org-mode produces.  If one of
+the \"keywords\" is the vertical bat \"|\" the remaining keywords
+signify that no further action is necessary.  If \"|\" is not found,
+the last keyword is treated as the only DONE state of the sequence.
+
+The command \\[org-todo] cycles an entry through these states, and one
 additional state where no keyword is present.  For details about this
-cycling, see also the variable `org-todo-interpretation'
-Changes become only effective after restarting Emacs."
+cycling, see the manual.
+
+TODO keywords and interpretation can also be set on a per-file basis with
+the special #+SEQ_TODO and #+TYP_TODO lines.
+
+For backward compatibility, this variable may also be just a list
+of keywords - in this case the interptetation (sequence or type) will be
+taken from the (otherwise obsolete) variable `org-todo-interpretation'."
   :group 'org-todo
   :group 'org-keywords
-  :type '(repeat (string :tag "Keyword")))
+  :type '(choice
+	  (repeat :tag "Old syntax, just keywords"
+		  (string :tag "Keyword"))
+	  (repeat :tag "New syntax"
+		  (cons
+		   (choice
+		    :tag "Interpretation"
+		    (const :tag "Sequence (cycling hits every state)" sequence)
+		    (const :tag "Type     (cycling directly to DONE)" type))
+		   (repeat
+		    (string :tag "Keyword"))))))
+
+(defvar org-todo-keywords-1 nil)
+(make-variable-buffer-local 'org-todo-keywords-1)
+(defvar org-todo-keywords-for-agenda nil)
+(defvar org-done-keywords-for-agenda nil)
+(defvar org-not-done-keywords nil)
+(make-variable-buffer-local 'org-not-done-keywords)
+(defvar org-done-keywords nil)
+(make-variable-buffer-local 'org-done-keywords)
+(defvar org-todo-heads nil)
+(make-variable-buffer-local 'org-todo-heads)
+(defvar org-todo-sets nil)
+(make-variable-buffer-local 'org-todo-sets)
+(defvar org-todo-kwd-alist nil)
+(make-variable-buffer-local 'org-todo-kwd-alist)
 
 (defcustom org-todo-interpretation 'sequence
   "Controls how TODO keywords are interpreted.
-This variable is only relevant if `org-todo-keywords' contains more than two
-states.  \\<org-mode-map>Possible values are `sequence' and `type'.
-
-When `sequence', \\[org-todo] will always switch to the next state in the
-`org-todo-keywords' list. When `type', \\[org-todo] only cycles from state
-to state when executed several times in direct succession.  Otherwise, it
-switches directly to DONE from any state.
-See the manual for more information."
+This variable is in principle obsolete and is only used for
+backward compatibility, if the interpretation of todo keywords is
+not given already in `org-todo-keywords'.  See that variable for
+more information."
   :group 'org-todo
   :group 'org-keywords
   :type '(choice (const sequence)
@@ -1393,6 +1483,12 @@
 	       (const :tag "when TODO state changes" state)
 	       (const :tag "when clocking out" clock-out))))
 
+(defcustom org-log-done-with-time t
+  "Non-nil means, the CLOSED time stamp will contain date and time.
+When nil, only the date will be recorded."
+  :group 'org-progress
+  :type 'boolean)
+
 (defcustom org-log-note-headings
   '((done . "CLOSING NOTE %t")
     (state . "State %-12s %t")
@@ -1414,11 +1510,9 @@
 		       state) string)
 	  (cons (const :tag "Heading when clocking out" clock-out) string)))
 
-(defcustom org-allow-auto-repeat t
-  "Non-nil means, find REPEAT cookies in entries and apply them.
-A repeat cookie looks like REPEAT(+1m) and causes deadlines and schedules
-to repeat themselves shifted by a certain amount of time, each time an
-entry is marked DONE."
+(defcustom org-log-repeat t
+  "Non-nil means, prompt for a note when REPEAT is resetting a TODO entry.
+When nil, no note will be taken."
   :group 'org-todo
   :group 'org-progress
   :type 'boolean)
@@ -1428,14 +1522,21 @@
   :tag "Org Priorities"
   :group 'org-todo)
 
-(defcustom org-default-priority ?B
-  "The default priority of TODO items.
-This is the priority an item get if no explicit priority is given."
+(defcustom org-highest-priority ?A
+  "The highest priority of TODO items.  A character like ?A, ?B etc.
+Must have a smaller ASCII number than `org-lowest-priority'."
   :group 'org-priorities
   :type 'character)
 
 (defcustom org-lowest-priority ?C
-  "The lowest priority of TODO items.  A character like ?A, ?B etc."
+  "The lowest priority of TODO items.  A character like ?A, ?B etc.
+Must have a larger ASCII number than `org-highest-priority'."
+  :group 'org-priorities
+  :type 'character)
+
+(defcustom org-default-priority ?B
+  "The default priority of TODO items.
+This is the priority an item get if no explicit priority is given."
   :group 'org-priorities
   :type 'character)
 
@@ -1612,7 +1713,7 @@
   "Variable used by org files to set a category for agenda display.
 Such files should use a file variable to set it, for example
 
-   -*- mode: org; org-category: \"ELisp\"
+#   -*- mode: org; org-category: \"ELisp\"
 
 or contain a special line
 
@@ -1654,17 +1755,75 @@
   :group 'org-agenda
   :type 'sexp)
 
+(defgroup org-agenda-export nil
+ "Options concerning exporting agenda views in Org-mode."
+ :tag "Org Agenda Export"
+ :group 'org-agenda)
+
+(defcustom org-agenda-with-colors t
+  "Non-nil means, use colors in agenda views."
+  :group 'org-agenda-export
+  :type 'boolean)
+
+(defcustom org-agenda-exporter-settings nil
+  "Alist of variable/value pairs that should be active during agenda export.
+This is a good place to set uptions for ps-print and for htmlize."
+  :group 'org-agenda-export
+  :type '(repeat
+	  (list
+	   (variable)
+	   (sexp :tag "Value"))))
+
+(defcustom org-agenda-export-html-style ""
+  "The style specification for exported HTML Agenda files.
+If this variable contains a string, it will replace the default <style>
+section as produced by `htmlize'.
+Since there are different ways of setting style information, this variable
+needs to contain the full HTML structure to provide a style, including the
+surrounding HTML tags.  The style specifications should include definitions
+the fonts used by the agenda, here is an example:
+
+   <style type=\"text/css\">
+       p { font-weight: normal; color: gray; }
+       .org-agenda-structure {
+          font-size: 110%;
+          color: #003399;
+          font-weight: 600;
+       }
+       .org-todo {
+          color: #cc6666;Week-agenda:
+          font-weight: bold;
+       }
+       .org-done {
+          color: #339933;
+       }
+       .title { text-align: center; }
+       .todo, .deadline { color: red; }
+       .done { color: green; }
+    </style>
+
+or, if you want to keep the style in a file,
+
+   <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">
+
+As the value of this option simply gets inserted into the HTML <head> header,
+you can \"misuse\" it to also add other text to the header.  However,
+<style>...</style> is required, if not present the variable will be ignored."
+  :group 'org-agenda-export
+  :group 'org-export-html
+  :type 'string)
+
 (defgroup org-agenda-custom-commands nil
  "Options concerning agenda views in Org-mode."
  :tag "Org Agenda Custom Commands"
  :group 'org-agenda)
 
-(defcustom org-agenda-custom-commands '(("w" todo "WAITING"))
+(defcustom org-agenda-custom-commands nil
   "Custom commands for the agenda.
 These commands will be offered on the splash screen displayed by the
 agenda dispatcher \\[org-agenda].  Each entry is a list like this:
 
-   (key type match options)
+   (key type match options files)
 
 key     The key (a single char as a string) to be associated with the command.
 type    The command type, any of the following symbols:
@@ -1680,11 +1839,16 @@
          - a regular expression for occur searches
 options  A list of option setttings, similar to that in a let form, so like
          this: ((opt1 val1) (opt2 val2) ...)
+files    A list of files file to write the produced agenda buffer to
+         with the command `org-store-agenda-views'.
+         If a file name ends in \".html\", an HTML version of the buffer
+         is written out.  If it ends in \".ps\", a postscript version is
+         produced.  Otherwide, only the plain text is written to the file.
 
 You can also define a set of commands, to create a composite agenda buffer.
 In this case, an entry looks like this:
 
-  (key desc (cmd1 cmd2 ...) general-options)
+  (key desc (cmd1 cmd2 ...) general-options file)
 
 where
 
@@ -1695,19 +1859,22 @@
        (agenda)
        (alltodo)
        (stuck)
-       (todo \"match\" options)
-       (tags \"match\" options )
-       (tags-todo \"match\" options)
+       (todo \"match\" options files)
+       (tags \"match\" options files)
+       (tags-todo \"match\" options files)
 
 Each command can carry a list of options, and another set of options can be
 given for the whole set of commands.  Individual command options take
 precedence over the general options."
   :group 'org-agenda-custom-commands
   :type '(repeat
-	  (choice
+	  (choice :value ("a" tags "" nil)
 	   (list :tag "Single command"
 		 (string :tag "Key")
 		 (choice
+		  (const :tag "Agenda" agenda)
+		  (const :tag "TODO list" alltodo)
+		  (const :tag "Stuck projects" stuck)
 		  (const :tag "Tags search (all agenda files)" tags)
 		  (const :tag "Tags search of TODO entries (all agenda files)" tags-todo)
 		  (const :tag "TODO keyword search (all agenda files)" todo)
@@ -1717,7 +1884,8 @@
 		  (symbol :tag "Other, user-defined function"))
 		 (string :tag "Match")
 		 (repeat :tag "Local options"
-			 (list (variable :tag "Option") (sexp :tag "Value"))))
+			 (list (variable :tag "Option") (sexp :tag "Value")))
+		 (option (repeat :tag "Export" (file :tag "Export to"))))
 	   (list :tag "Command series, all agenda files"
 		 (string :tag "Key")
 		 (string :tag "Description")
@@ -1756,20 +1924,24 @@
 
 		 (repeat :tag "General options"
 			 (list (variable :tag "Option")
-			       (sexp :tag "Value")))))))
+			       (sexp :tag "Value")))
+		 (option (repeat :tag "Export" (file :tag "Export to")))))))
 
 (defcustom org-stuck-projects
-  '("+LEVEL=2/-DONE" ("TODO" "NEXT" "NEXTACTION") nil)
+  '("+LEVEL=2/-DONE" ("TODO" "NEXT" "NEXTACTION") nil "")
   "How to identify stuck projects.
-This is a list of three items:
+This is a list of four items:
 1. A tags/todo matcher string that is used to identify a project.
-   The entire tree below a headline matched by this is considered a project.
-2. A list of TODO keywords itentifying non-stuck projects.
+   The entire tree below a headline matched by this is considered one project.
+2. A list of TODO keywords identifying non-stuck projects.
    If the project subtree contains any headline with one of these todo
-   keywords, the project is consitered to be not stuck.
+   keywords, the project is considered to be not stuck.  If you specify
+   \"*\" as a keyword, any TODO keyword will mark the project unstuck.
 3. A list of tags identifying non-stuck projects.
    If the project subtree contains any headline with one of these tags,
-   the project is consitered to be not stuck.
+   the project is considered to be not stuck.  If you specify \"*\" as
+   a tag, any tag will mark the project unstuck.
+4. An arbitrary regular expression matching non-stuck projects.
 
 After defining this variable, you may use \\[org-agenda-list-stuck-projects]
 or `C-c a #' to produce the list."
@@ -1777,7 +1949,8 @@
   :type '(list
 	  (string :tag "Tags/TODO match to identify a project")
 	  (repeat :tag "Projects are *not* stuck if they have an entry with TODO keyword any of" (string))
-	  (repeat :tag "Projects are *not* stuck if they have an entry with TAG being any of" (string))))
+	  (repeat :tag "Projects are *not* stuck if they have an entry with TAG being any of" (string))
+	  (regexp :tag "Projects are *not* stuck if this regexp matches\ninside the subtree")))
 
 
 (defgroup org-agenda-skip nil
@@ -1815,6 +1988,14 @@
   :group 'org-agenda-skip
   :type 'boolean)
 
+(defcustom org-agenda-skip-deadline-if-done nil
+  "Non-nil means don't show deadines when the corresponding item is done.
+When nil, the deadline is still shown and should give you a happy feeling.
+
+This is relevant for the daily/weekly agenda."
+  :group 'org-agenda-skip
+  :type 'boolean)
+
 (defcustom org-timeline-show-empty-dates 3
   "Non-nil means, `org-timeline' also shows dates without an entry.
 When nil, only the days which actually have entries are shown.
@@ -1846,7 +2027,7 @@
   :type 'boolean)
 
 (defcustom org-agenda-start-with-follow-mode nil
-  "The initial value of follwo-mode in a newly created agenda window."
+  "The initial value of follow-mode in a newly created agenda window."
   :group 'org-agenda-startup
   :type 'boolean)
 
@@ -1931,7 +2112,7 @@
 FIXME: Not used currently, because of timezone problem."
   :group 'org-agenda-daily/weekly
   :type 'string)
-  
+
 (defcustom org-agenda-include-diary nil
   "If non-nil, include in the agenda entries from the Emacs Calendar's diary."
   :group 'org-agenda-daily/weekly
@@ -2006,7 +2187,7 @@
   (defcustom org-agenda-sorting-strategy
     '((agenda time-up category-keep priority-down)
       (todo category-keep priority-down)
-      (tags category-keep))
+      (tags category-keep priority-down))
     "Sorting structure for the agenda items of a single day.
 This is a list of symbols which will be used in sequence to determine
 if an entry should be listed before another entry.  The following
@@ -2113,7 +2294,7 @@
   (setq org-agenda-prefix-format \"  %-11:c% s\")
 
 See also the variables `org-agenda-remove-times-when-in-prefix' and
-`org-agenda-remove-tags-when-in-prefix'."
+`org-agenda-remove-tags'."
   :type '(choice
 	  (string :tag "General format")
 	  (list :greedy t :tag "View dependent"
@@ -2144,7 +2325,7 @@
 	  (const :tag "Never" nil)
 	  (const :tag "When at beginning of entry" beg)))
 
-(defcustom org-agenda-remove-tags-when-in-prefix nil
+(defcustom org-agenda-remove-tags nil
   "Non-nil means, remove the tags from the headline copy in the agenda.
 When this is the symbol `prefix', only remove tags when
 `org-agenda-prefix-format' contains a `%T' specifier."
@@ -2154,6 +2335,10 @@
 	  (const :tag "Never" nil)
 	  (const :tag "When prefix format contains %T" prefix)))
 
+(if (fboundp 'defvaralias)
+    (defvaralias 'org-agenda-remove-tags-when-in-prefix
+      'org-agenda-remove-tags))
+
 (defcustom org-agenda-align-tags-to-column 65
   "Shift tags in agenda items to this column."
   :group 'org-agenda-prefix
@@ -2165,13 +2350,18 @@
   :group 'org)
 
 (defcustom org-format-latex-options
-  '(:foreground "Black" :background "Transparent" :scale 1.0
-		:matchers ("begin" "$" "$$" "\\(" "\\["))
+  '(:foreground default :background default :scale 1.0
+    :html-foreground "Black" :html-background "Transparent" :html-scale 1.0
+    :matchers ("begin" "$" "$$" "\\(" "\\["))
   "Options for creating images from LaTeX fragments.
 This is a property list with the following properties:
-:foreground  the foreground color, for example \"Black\".
+:foreground  the foreground color for images embedded in emacs, e.g. \"Black\".
+             `default' means use the forground of the default face.
 :background  the background color, or \"Transparent\".
+             `default' means use the background of the default face.
 :scale       a scaling factor for the size of the images
+:html-foreground, :html-background, :html-scale
+             The same numbers for HTML export.
 :matchers    a list indicating which matchers should be used to
              find LaTeX fragments.  Valid members of this list are:
              \"begin\"  find environments
@@ -2182,6 +2372,18 @@
   :group 'org-latex
   :type 'plist)
 
+(defcustom org-format-latex-header "\\documentclass{article}
+\\usepackage{fullpage}         % do not remove
+\\usepackage{amssymb}
+\\usepackage[usenames]{color}
+\\usepackage{amsmath}
+\\usepackage{latexsym}
+\\usepackage[mathscr]{eucal}
+\\pagestyle{empty}             % do not remove"
+  "The document header used for processing LaTeX fragments."
+  :group 'org-latex
+  :type 'string)
+
 (defgroup org-export nil
   "Options for exporting org-listings."
   :tag "Org Export"
@@ -2237,6 +2439,12 @@
   :group 'org-export-general
   :type 'string)
 
+(defcustom org-export-skip-text-before-1st-heading t
+  "Non-nil means, skip all text before the first headline when exporting.
+When nil, that text is exported as well."
+  :group 'org-export-general
+  :type 'boolean)
+
 (defcustom org-export-headline-levels 3
   "The last level which is still exported as a headline.
 Inferior levels will produce itemize lists when exported.
@@ -2354,12 +2562,19 @@
  x_{i^2} or   x^(2-i)    braces or parenthesis do grouping.
 
 Still, ambiguity is possible - so when in doubt use {} to enclose the
-sub/superscript.
+sub/superscript.  If you set this variable to the symbol `{}',
+the braces are *required* in order to trigger interpretations as
+sub/superscript.  This can be helpful in documents that need \"_\"
+frequently in plain text.
+
 Not all export backends support this, but HTML does.
 
 This option can also be set with the +OPTIONS line, e.g. \"^:nil\"."
   :group 'org-export-translation
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "Always interpret" t)
+	  (const :tag "Only with braces" {})
+	  (const :tag "Never interpret" nil)))
 
 (defcustom org-export-with-TeX-macros t
   "Non-nil means, interpret simple TeX-like macros when exporting.
@@ -2467,7 +2682,7 @@
 
 (defcustom org-export-ascii-bullets '(?* ?+ ?-)
   "Bullet characters for headlines converted to lists in ASCII export.
-The first character is is used for the first lest level generated in this
+The first character is used for the first lest level generated in this
 way, and so on.  If there are more levels than characters given here,
 the list will be repeated.
 Note that plain lists will keep the same bullets as the have in the
@@ -2534,6 +2749,7 @@
   :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
@@ -2567,7 +2783,7 @@
 		 (const :tag "Always" t)
 		 (const :tag "When there is no description" maybe)))
 
-;; FIXME: rename 
+;; FIXME: rename
 (defcustom org-export-html-expand t
   "Non-nil means, for HTML export, treat @<...> as HTML tag.
 When nil, these tags will be exported as plain text and therefore
@@ -2579,12 +2795,24 @@
 
 (defcustom org-export-html-table-tag
   "<table border=\"2\" cellspacing=\"0\" cellpadding=\"6\" rules=\"groups\" frame=\"hsides\">"
-  "The HTML tag used to start a table.
+  "The HTML tag that is used to start a table.
 This must be a <table> tag, but you may change the options like
 borders and spacing."
   :group 'org-export-html
   :type 'string)
 
+(defcustom org-export-table-header-tags '("<th>" . "</th>")
+  "The opening tag for table header fields.
+This is customizable so that alignment options can be specified."
+  :group 'org-export-tables
+  :type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
+
+(defcustom org-export-table-data-tags '("<td>" . "</td>")
+  "The opening tag for table data fields.
+This is customizable so that alignment options can be specified."
+  :group 'org-export-tables
+  :type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
+
 (defcustom org-export-html-with-timestamp nil
   "If non-nil, write `org-export-html-html-helper-timestamp'
 into the exported HTML text.  Otherwise, the buffer will just be saved
@@ -2618,6 +2846,12 @@
 	  (const :tag "Unfinished" t)
 	  (const :tag "All" all)))
 
+(defcustom org-icalendar-include-sexps t
+  "Non-nil means, export to iCalendar files should also cover sexp entries.
+These are entries like in the diary, but directly in an Org-mode file."
+  :group 'org-export-icalendar
+  :type 'boolean)
+
 (defcustom org-icalendar-combined-name "OrgMode"
   "Calendar name for the combined iCalendar representing all agenda files."
   :group 'org-export-icalendar
@@ -2690,8 +2924,6 @@
 	  (setq markers (concat (replace-match "" t t markers) "^")))
       (if (string-match "-" markers)
 	  (setq markers (concat (replace-match "" t t markers) "-")))
-;      (while (>= (setq nl (1- nl)) 0) (setq body1 (concat body1 "\n?" body "*?")))
-;      (while (>= (setq nl (1- nl)) 0) (setq body1 (concat body1 "\\(?:\n?" body "*?\\)?")))
       (if (> nl 0)
           (setq body1 (concat body1 "\\(?:\n" body "*?\\)\\{0,"
                               (int-to-string nl) "\\}")))
@@ -2701,15 +2933,15 @@
 		    "\\("
 		    "\\([" markers "]\\)"
 		    "\\("
-		    "[^" border markers "]"
+		    "[^" border (if (and nil stacked) markers) "]"
 		    body1
-		    "[^" border markers "]"
+		    "[^" border (if (and nil stacked) markers) "]"
 		    "\\)"
 		    "\\3\\)"
 		    "\\([" post (if stacked markers) "]\\|$\\)")))))
 
 (defcustom org-emphasis-regexp-components
-  '(" \t('\"" " \t.,?;'\")" " \t\r\n," "." 1 nil)
+  '(" \t('\"" "- \t.,:?;'\")" " \t\r\n,\"'" "." 1 nil)
   "Components used to build the reqular expression for emphasis.
 This is a list with 6 entries.  Terminology:  In an emphasis string
 like \" *strong word* \", we call the initial space PREMATCH, the final
@@ -2719,8 +2951,7 @@
 
 pre          Chars allowed as prematch.  Beginning of line will be allowed too.
 post         Chars allowed as postmatch.  End of line will be allowed too.
-border       The chars *forbidden* as border characters.  In addition to the
-             characters given here, all marker characters are forbidden too.
+border       The chars *forbidden* as border characters.
 body-regexp  A regexp like \".\" to match a body character.  Don't use
              non-shy groups here, and don't allow newline here.
 newline      The maximum number of newlines allowed in an emphasis exp.
@@ -2745,11 +2976,11 @@
     ("_" underline "<u>" "</u>")
     ("=" shadow "<code>" "</code>")
     ("+" (:strike-through t) "<del>" "</del>")
-)
+    )
 "Special syntax for emphasized text.
 Text starting and ending with a special character will be emphasized, for
 example *bold*, _underlined_ and /italic/.  This variable sets the marker
-characters, the face to bbe used by font-lock for highlighting in Org-mode
+characters, the face to be used by font-lock for highlighting in Org-mode
 Emacs buffers, and the HTML tags to be used for this.
 Use customize to modify this, or restart Emacs after changing it."
   :group 'org-font-lock
@@ -2894,15 +3125,6 @@
   "Face for deadlines and TODO keywords."
   :group 'org-faces)
 
-(defface org-headline-done ;; font-lock-string-face
-  (org-compatible-face
-   '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
-     (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
-     (((class color) (min-colors 8)  (background light)) (:bold nil))))
-  "Face used to indicate that a headline is DONE.
-This face is only used if `org-fontify-done-headline' is set."
-  :group 'org-faces)
-
 (defface org-archived    ; similar to shadow
   (org-compatible-face
    '((((class color grayscale) (min-colors 88) (background light))
@@ -2930,6 +3152,13 @@
   "Face for links."
   :group 'org-faces)
 
+(defface org-sexp-date
+  '((((class color) (background light)) (:foreground "Purple"))
+    (((class color) (background dark)) (:foreground "Cyan"))
+    (t (:underline t)))
+  "Face for links."
+  :group 'org-faces)
+
 (defface org-tag
   '((t (:bold t)))
   "Face for tags."
@@ -2951,7 +3180,17 @@
      (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen" :bold t))
      (((class color) (min-colors 8)) (:foreground "green"))
      (t (:bold t))))
-  "Face used for DONE."
+  "Face used for todo keywords that indicate DONE items."
+  :group 'org-faces)
+
+(defface org-headline-done ;; font-lock-string-face
+  (org-compatible-face
+   '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
+     (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
+     (((class color) (min-colors 8)  (background light)) (:bold nil))))
+  "Face used to indicate that a headline is DONE.
+This face is only used if `org-fontify-done-headline' is set.  If applies
+to the part of the headline after the DONE keyword."
   :group 'org-faces)
 
 (defface org-table ;; font-lock-function-name-face
@@ -2975,6 +3214,17 @@
   "Face for formulas."
   :group 'org-faces)
 
+(defface org-agenda-structure ;; font-lock-function-name-face
+  (org-compatible-face
+   '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
+     (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
+     (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
+     (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
+     (((class color) (min-colors 8)) (:foreground "blue" :bold t))
+     (t (:bold t))))
+  "Face used in agenda for captions and dates."
+  :group 'org-faces)
+
 (defface org-scheduled-today
   (org-compatible-face
    '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
@@ -3021,9 +3271,6 @@
 
 ;;; Variables for pre-computed regular expressions, all buffer local
 
-(defvar org-done-string nil
-  "The last string in `org-todo-keywords', indicating an item is DONE.")
-(make-variable-buffer-local 'org-done-string)
 (defvar org-todo-regexp nil
   "Matches any of the TODO state keywords.")
 (make-variable-buffer-local 'org-todo-regexp)
@@ -3043,12 +3290,6 @@
 (defvar org-looking-at-done-regexp nil
   "Matches the DONE keyword a point.")
 (make-variable-buffer-local 'org-looking-at-done-regexp)
-(defvar org-todo-kwd-priority-p nil
-  "Do TODO items have priorities?")
-(make-variable-buffer-local 'org-todo-kwd-priority-p)
-(defvar org-todo-kwd-max-priority nil
-  "Maximum priority of TODO items.")
-(make-variable-buffer-local 'org-todo-kwd-max-priority)
 (defvar org-ds-keyword-length 12
   "Maximum length of the Deadline and SCHEDULED keywords.")
 (make-variable-buffer-local 'org-ds-keyword-length)
@@ -3080,6 +3321,9 @@
 (defvar org-maybe-keyword-time-regexp nil
   "Matches a timestamp, possibly preceeded by a keyword.")
 (make-variable-buffer-local 'org-maybe-keyword-time-regexp)
+(defvar org-planning-or-clock-line-re nil
+  "Matches a line with planning or clock info.")
+(make-variable-buffer-local 'org-planning-or-clock-line-re)
 
 (defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t
 				   rear-nonsticky t mouse-map t fontified t)
@@ -3102,6 +3346,12 @@
 	((assoc key option) (cdr (assoc key option)))
 	(t (cdr (assq 'default option)))))
 
+(defsubst org-inhibit-invisibility ()
+  "Modified `buffer-invisibility-spec' for Emacs 21.
+Some ops with invisible text do not work correctly on Emacs 21.  For these
+we turn off invisibility temporarily.  Use this in a `let' form."
+  (if (< emacs-major-version 22) nil buffer-invisibility-spec))
+
 (defsubst org-set-local (var value)
   "Make VAR local in current buffer and set it to VALUE."
   (set (make-variable-buffer-local var) value))
@@ -3139,7 +3389,11 @@
     ("nologging" org-log-done nil)
     ("lognotedone" org-log-done done push)
     ("lognotestate" org-log-done state push)
-    ("lognoteclock-out" org-log-done clock-out push))
+    ("lognoteclock-out" org-log-done clock-out push)
+    ("logrepeat" org-log-repeat t)
+    ("nologrepeat" org-log-repeat nil)
+    ("constcgs" constants-unit-system cgs)
+    ("constSI" constants-unit-system SI))
   "Variable associated with STARTUP options for org-mode.
 Each element is a list of three items: The startup options as written
 in the #+STARTUP line, the corresponding variable, and the value to
@@ -3149,11 +3403,16 @@
 (defun org-set-regexps-and-options ()
   "Precompute regular expressions for current buffer."
   (when (org-mode-p)
+    (org-set-local 'org-todo-kwd-alist nil)
+    (org-set-local 'org-todo-keywords-1 nil)
+    (org-set-local 'org-done-keywords nil)
+    (org-set-local 'org-todo-heads nil)
+    (org-set-local 'org-todo-sets nil)
     (let ((re (org-make-options-regexp
 	       '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
-		 "STARTUP" "ARCHIVE" "TAGS" "LINK")))
+		 "STARTUP" "ARCHIVE" "TAGS" "LINK" "PRIORITIES")))
 	  (splitre "[ \t]+")
-	  kwds int key value cat arch tags links)
+	  kwds key value cat arch tags links hw dws tail sep kws1 prio)
       (save-excursion
 	(save-restriction
 	  (widen)
@@ -3166,14 +3425,9 @@
 		  (setq value (replace-match "" t t value)))
 	      (setq cat (intern value)))
 	     ((equal key "SEQ_TODO")
-	      (setq int 'sequence
-		    kwds (append kwds (org-split-string value splitre))))
-	     ((equal key "PRI_TODO")
-	      (setq int 'priority
-		    kwds (append kwds (org-split-string value splitre))))
+	      (push (cons 'sequence (org-split-string value splitre)) kwds))
 	     ((equal key "TYP_TODO")
-	      (setq int 'type
-		    kwds (append kwds (org-split-string value splitre))))
+	      (push (cons 'type (org-split-string value splitre)) kwds))
 	     ((equal key "TAGS")
 	      (setq tags (append tags (org-split-string value splitre))))
 	     ((equal key "LINK")
@@ -3181,17 +3435,20 @@
 		(push (cons (match-string 1 value)
 			    (org-trim (match-string 2 value)))
 		      links)))
+	     ((equal key "PRIORITIES")
+	      (setq prio (org-split-string value " +")))
 	     ((equal key "STARTUP")
 	      (let ((opts (org-split-string value splitre))
 		    l var val)
-		(while (setq l (assoc (pop opts) org-startup-options))
-		  (setq var (nth 1 l) val (nth 2 l))
-		  (if (not (nth 3 l))
-		      (set (make-local-variable var) val)
-		    (if (not (listp (symbol-value var)))
-			(set (make-local-variable var) nil))
-		    (set (make-local-variable var) (symbol-value var))
-		    (add-to-list var val)))))
+		(while (setq l (pop opts))
+		  (when (setq l (assoc l org-startup-options))
+		    (setq var (nth 1 l) val (nth 2 l))
+		    (if (not (nth 3 l))
+			(set (make-local-variable var) val)
+		      (if (not (listp (symbol-value var)))
+			  (set (make-local-variable var) nil))
+		      (set (make-local-variable var) (symbol-value var))
+		      (add-to-list var val))))))
 	     ((equal key "ARCHIVE")
 	      (string-match " *$" value)
 	      (setq arch (replace-match "" t t value))
@@ -3199,10 +3456,38 @@
 				      '(face t fontified t) arch)))
 	    )))
       (and cat (org-set-local 'org-category cat))
-      (and kwds (org-set-local 'org-todo-keywords kwds))
+      (when prio
+	(if (< (length prio) 3) (setq prio '("A" "C" "B")))
+	(setq prio (mapcar 'string-to-char prio))
+	(org-set-local 'org-highest-priority (nth 0 prio))
+	(org-set-local 'org-lowest-priority  (nth 1 prio))
+	(org-set-local 'org-default-priority (nth 2 prio)))
       (and arch (org-set-local 'org-archive-location arch))
-      (and int (org-set-local 'org-todo-interpretation int))
       (and links (setq org-link-abbrev-alist-local (nreverse links)))
+      ;; Process the TODO keywords
+      (unless kwds
+	;; Use the global values as if they had been given locally.
+	(setq kwds (default-value 'org-todo-keywords))
+	(if (stringp (car kwds))
+	    (setq kwds (list (cons org-todo-interpretation
+				   (default-value 'org-todo-keywords)))))
+	(setq kwds (reverse kwds)))
+      (setq kwds (nreverse kwds))
+      (let (inter kws)
+	(while (setq kws (pop kwds))
+	  (setq inter (pop kws) sep (member "|" kws)
+		kws1 (delete "|" (copy-sequence kws))
+		hw (car kws1)
+		dws (if sep (cdr sep) (last kws1))
+		tail (list inter hw (car dws) (org-last dws)))
+	  (add-to-list 'org-todo-heads hw 'append)
+	  (push kws1 org-todo-sets)
+	  (setq org-done-keywords (append org-done-keywords dws nil))
+	  (mapc (lambda (x) (push (cons x tail) org-todo-kwd-alist)) kws1)
+	  (setq org-todo-keywords-1 (append org-todo-keywords-1 kws1 nil)))
+	(setq org-todo-sets (nreverse org-todo-sets)
+	      org-todo-kwd-alist (nreverse org-todo-kwd-alist)))
+      ;; Process the tags.
       (when tags
 	(let (e tgs)
 	  (while (setq e (pop tags))
@@ -3221,32 +3506,35 @@
 		(push e org-tag-alist))))))
 
     ;; Compute the regular expressions and other local variables
-    (setq org-todo-kwd-priority-p (equal org-todo-interpretation 'priority)
-	  org-todo-kwd-max-priority (1- (length org-todo-keywords))
-	  org-ds-keyword-length (+ 2 (max (length org-deadline-string)
+    (if (not org-done-keywords)
+	(setq org-done-keywords (list (org-last org-todo-keywords-1))))
+    (setq org-ds-keyword-length (+ 2 (max (length org-deadline-string)
 					  (length org-scheduled-string)))
-	  org-done-string
-	  (nth (1- (length org-todo-keywords)) org-todo-keywords)
+	  org-not-done-keywords
+	  (org-delete-all org-done-keywords (copy-sequence org-todo-keywords-1))
 	  org-todo-regexp
-	  (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords
+	  (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords-1
 				      "\\|") "\\)\\>")
 	  org-not-done-regexp
 	  (concat "\\<\\("
-		  (mapconcat 'regexp-quote
-			     (nreverse (cdr (reverse org-todo-keywords)))
-			     "\\|")
+		  (mapconcat 'regexp-quote org-not-done-keywords "\\|")
 		  "\\)\\>")
 	  org-todo-line-regexp
 	  (concat "^\\(\\*+\\)[ \t]*\\(?:\\("
-		  (mapconcat 'regexp-quote org-todo-keywords "\\|")
+		  (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
 		  "\\)\\>\\)? *\\(.*\\)")
 	  org-nl-done-regexp
-	  (concat "[\r\n]\\*+[ \t]+" org-done-string "\\>")
+	  (concat "[\r\n]\\*+[ \t]+"
+		  "\\(?:" (mapconcat 'regexp-quote org-done-keywords "\\|")
+		  "\\)" "\\>")
 	  org-todo-line-tags-regexp
 	  (concat "^\\(\\*+\\)[ \t]*\\(?:\\("
-		  (mapconcat 'regexp-quote org-todo-keywords "\\|")
+		  (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
 		  "\\)\\>\\)? *\\(.*?\\([ \t]:[a-zA-Z0-9:_@]+:[ \t]*\\)?$\\)")
-	  org-looking-at-done-regexp (concat "^" org-done-string "\\>")
+	  org-looking-at-done-regexp
+	  (concat "^" "\\(?:"
+		  (mapconcat 'regexp-quote org-done-keywords "\\|") "\\)"
+		  "\\>")
 	  org-deadline-regexp (concat "\\<" org-deadline-string)
 	  org-deadline-time-regexp
 	  (concat "\\<" org-deadline-string " *<\\([^>]+\\)>")
@@ -3274,7 +3562,12 @@
 		  "\\|" org-deadline-string
 		  "\\|" org-closed-string
 		  "\\|" org-clock-string "\\)\\)?"
-		  " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^]\r\n>]*?[]>]\\)"))
+		  " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^]\r\n>]*?[]>]\\|<%%([^\r\n>]*>\\)")
+	  org-planning-or-clock-line-re
+	  (concat "\\(?:^[ \t]*\\(" org-scheduled-string
+		  "\\|" org-deadline-string
+		  "\\|" org-closed-string "\\|" org-clock-string "\\)\\>\\)")
+	  )
 
     (org-set-font-lock-defaults)))
 
@@ -3325,6 +3618,7 @@
 (defvar annotation) ; from remember.el, dynamically scoped in `remember-mode'
 (defvar initial)    ; from remember.el, dynamically scoped in `remember-mode'
 (defvar org-latex-regexps)
+(defvar constants-unit-system)
 
 (defvar original-date) ; dynamically scoped in calendar.el does scope this
 
@@ -3394,6 +3688,7 @@
     (overlay-get ovl prop)))
 (defun org-overlays-at (pos)
   (if (featurep 'xemacs) (extents-at pos) (overlays-at pos)))
+;; FIXME: this is currently not used
 (defun org-overlays-in (&optional start end)
   (if (featurep 'xemacs)
       (extent-list nil start end)
@@ -3402,6 +3697,7 @@
   (if (featurep 'xemacs) (extent-start-position o) (overlay-start o)))
 (defun org-overlay-end (o)
   (if (featurep 'xemacs) (extent-end-position o) (overlay-end o)))
+;; FIXME: this is currently not used
 (defun org-find-overlays (prop &optional pos delete)
   "Find all overlays specifying PROP at POS or point.
 If DELETE is non-nil, delete all those overlays."
@@ -3455,6 +3751,7 @@
 	(setq buffer-invisibility-spec
 	      (delete arg buffer-invisibility-spec)))))
 
+;; FIXME: this is currently not used
 (defun org-in-invisibility-spec-p (arg)
   "Is ARG a member of `buffer-invisibility-spec'?"
   (if (consp buffer-invisibility-spec)
@@ -3477,6 +3774,7 @@
 (defvar org-mode-hook nil)
 (defvar org-inhibit-startup nil)        ; Dynamically-scoped param.
 (defvar org-agenda-keep-modes nil)      ; Dynamically-scoped param.
+(defvar org-table-buffer-is-an nil)
 
 
 ;;;###autoload
@@ -3521,7 +3819,6 @@
   (when (featurep 'xemacs)
     (org-set-local 'line-move-ignore-invisible t))
   (setq outline-regexp "\\*+")
-  ;;(setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)")
   (setq outline-level 'org-outline-level)
   (when (and org-ellipsis (stringp org-ellipsis)
              (fboundp 'set-display-table-slot) (boundp 'buffer-display-table))
@@ -3534,6 +3831,7 @@
   ;; Calc embedded
   (org-set-local 'calc-embedded-open-mode "# ")
   (modify-syntax-entry ?# "<")
+  (modify-syntax-entry ?@ "w")
   (if org-startup-truncated (setq truncate-lines t))
   (org-set-local 'font-lock-unfontify-region-function
 		 'org-unfontify-region)
@@ -3545,6 +3843,7 @@
   (org-add-hook 'kill-buffer-hook 'org-check-running-clock nil 'local)
   ;; Paragraphs and auto-filling
   (org-set-autofill-regexps)
+  (setq indent-line-function 'org-indent-line-function)
   (org-update-radio-target-regexp)
 
   ;; Comment characters
@@ -3564,7 +3863,7 @@
   (if (and org-insert-mode-line-in-empty-file
 	   (interactive-p)
 	   (= (point-min) (point-max)))
-      (insert "    -*- mode: org -*-\n\n"))
+      (insert "#    -*- mode: org -*-\n\n"))
 
   (unless org-inhibit-startup
     (when org-startup-align-all-tables
@@ -3578,6 +3877,8 @@
       (let ((this-command 'org-cycle) (last-command 'org-cycle))
 	(org-cycle '(4)) (org-cycle '(4)))))))
 
+(put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify)
+
 (defsubst org-call-with-arg (command arg)
   "Call COMMAND interactively, but pretend prefix are was ARG."
   (let ((current-prefix-arg arg)) (call-interactively command)))
@@ -3610,23 +3911,23 @@
 ;;;; Font-Lock stuff, including the activators
 
 (defvar org-mouse-map (make-sparse-keymap))
-(define-key org-mouse-map
+(org-defkey org-mouse-map
   (if (featurep 'xemacs) [button2] [mouse-2]) 'org-open-at-mouse)
-(define-key org-mouse-map
+(org-defkey org-mouse-map
   (if (featurep 'xemacs) [button3] [mouse-3]) 'org-find-file-at-mouse)
 (when org-mouse-1-follows-link
-  (define-key org-mouse-map [follow-link] 'mouse-face))
+  (org-defkey org-mouse-map [follow-link] 'mouse-face))
 (when org-tab-follows-link
-  (define-key org-mouse-map [(tab)] 'org-open-at-point)
-  (define-key org-mouse-map "\C-i" 'org-open-at-point))
+  (org-defkey org-mouse-map [(tab)] 'org-open-at-point)
+  (org-defkey org-mouse-map "\C-i" 'org-open-at-point))
 (when org-return-follows-link
-  (define-key org-mouse-map [(return)] 'org-open-at-point)
-  (define-key org-mouse-map "\C-m" 'org-open-at-point))
+  (org-defkey org-mouse-map [(return)] 'org-open-at-point)
+  (org-defkey org-mouse-map "\C-m" 'org-open-at-point))
 
 (require 'font-lock)
 
 (defconst org-non-link-chars "]\t\n\r<>")
-(defconst org-link-types '("https?" "ftp" "mailto" "file" "news" "bbdb" "vm"
+(defconst org-link-types '("http" "https" "ftp" "mailto" "file" "news" "bbdb" "vm"
 			   "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp"))
 (defconst org-link-re-with-space
   (concat
@@ -3679,21 +3980,17 @@
   (concat "\\(" org-bracket-link-regexp "\\)\\|\\("
 	  org-angle-link-re "\\)\\|\\("
 	  org-plain-link-re "\\)")
-  "Regular expression matching any link.")	  
-
-(defconst org-ts-lengths
-  (cons (length (format-time-string (car org-time-stamp-formats)))
-	(length (format-time-string (cdr org-time-stamp-formats))))
-  "This holds the lengths of the two different time formats.")
-(defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*?\\)>"
+  "Regular expression matching any link.")
+
+(defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)>"
+  "Regular expression for fast time stamp matching.")
+(defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)[]>]"
   "Regular expression for fast time stamp matching.")
-(defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*?\\)[]>]"
-  "Regular expression for fast time stamp matching.")
-(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\([^]0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
+(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) \\([^]0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
   "Regular expression matching time strings for analysis.")
-(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 ">")
+(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,6\\}>")
   "Regular expression matching time stamps, with groups.")
-(defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[]>]")
+(defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[^]>\n]\\{0,6\\}[]>]")
   "Regular expression matching time stamps (also [..]), with groups.")
 (defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp)
   "Regular expression matching a time stamp range.")
@@ -3712,27 +4009,87 @@
 
 (defun org-do-emphasis-faces (limit)
   "Run through the buffer and add overlays to links."
-  (if (re-search-forward org-emph-re limit t)
-      (progn
-	(font-lock-prepend-text-property (match-beginning 2) (match-end 2)
-					 'face
-					 (nth 1 (assoc (match-string 3)
-						       org-emphasis-alist)))
-	(add-text-properties (match-beginning 2) (match-end 2)
-			     '(font-lock-multiline t))
-	(backward-char 1)
-	t)))
+  (let (rtn)
+    (while (and (not rtn) (re-search-forward org-emph-re limit t))
+      (if (not (= (char-after (match-beginning 3))
+		  (char-after (match-beginning 4))))
+	  (progn
+	    (setq rtn t)
+	    (font-lock-prepend-text-property (match-beginning 2) (match-end 2)
+					     'face
+					     (nth 1 (assoc (match-string 3)
+							   org-emphasis-alist)))
+	    (add-text-properties (match-beginning 2) (match-end 2)
+				 '(font-lock-multiline t))
+	    (backward-char 1))))
+    rtn))
+
+(defun org-emphasize (&optional char)
+  "Insert or change an emphasis, i.e. a font like bold or italic.
+If there is an active region, change that region to a new emphasis.
+If there is no region, just insert the marker characters and position
+the cursor between them.
+CHAR should be either the marker character, or the first character of the
+HTML tag associated with that emphasis.  If CHAR is a space, the means
+to remove the emphasis of the selected region.
+If char is not given (for example in an interactive call) it
+will be prompted for."
+  (interactive)
+  (let ((eal org-emphasis-alist) e det
+	(erc org-emphasis-regexp-components)
+	(prompt "")
+	(string "") beg end move tag c s)
+    (if (org-region-active-p)
+	(setq beg (region-beginning) end (region-end)
+	      string (buffer-substring beg end))
+      (setq move t))
+
+    (while (setq e (pop eal))
+      (setq tag (car (org-split-string (nth 2 e) "[ <>/]+"))
+	    c (aref tag 0))
+      (push (cons c (string-to-char (car e))) det)
+      (setq prompt (concat prompt (format " [%s%c]%s" (car e) c
+					  (substring tag 1)))))
+    (unless char
+      (message "%s" (concat "Emphasis marker or tag:" prompt))
+      (setq char (read-char-exclusive)))
+    (setq char (or (cdr (assoc char det)) char))
+    (if (equal char ?\ )
+	(setq s "" move nil)
+      (unless (assoc (char-to-string char) org-emphasis-alist)
+	(error "No such emphasis marker: \"%c\"" char))
+      (setq s (char-to-string char)))
+    (while (and (> (length string) 1)
+		(equal (substring string 0 1) (substring string -1))
+		(assoc (substring string 0 1) org-emphasis-alist))
+      (setq string (substring string 1 -1)))
+    (setq string (concat s string s))
+    (if beg (delete-region beg end))
+    (unless (or (bolp)
+		(string-match (concat "[" (nth 0 erc) "\n]")
+			      (char-to-string (char-before (point)))))
+      (insert " "))
+    (unless (string-match (concat "[" (nth 1 erc) "\n]")
+			  (char-to-string (char-after (point))))
+      (insert " ") (backward-char 1))
+    (insert string)
+    (and move (backward-char 1))))
 
 (defun org-activate-plain-links (limit)
   "Run through the buffer and add overlays to links."
-  (if (re-search-forward org-plain-link-re limit t)
-      (progn
-	(add-text-properties (match-beginning 0) (match-end 0)
-			     (list 'mouse-face 'highlight
-				   'rear-nonsticky t
-				   'keymap org-mouse-map
-				   ))
-	t)))
+  (catch 'exit
+    (let (f)
+      (while (re-search-forward org-plain-link-re limit t)
+	(setq f (get-text-property (match-beginning 0) 'face))
+	(if (or (eq f 'org-tag)
+		(and (listp f) (memq 'org-tag f)))
+	    nil
+	  (add-text-properties (match-beginning 0) (match-end 0)
+			       (list 'mouse-face 'highlight
+				     'rear-nonsticky t
+				     'keymap org-mouse-map
+				     ))
+	  (throw 'exit t))))))
 
 (defun org-activate-angle-links (limit)
   "Run through the buffer and add overlays to links."
@@ -3881,11 +4238,6 @@
 				   'keymap org-mouse-map))
 	t)))
 
-(defun org-font-lock-level ()
-  (save-excursion
-    (org-back-to-heading t)
-    (- (match-end 0) (match-beginning 0))))
-
 (defun org-outline-level ()
   (save-excursion
     (looking-at outline-regexp)
@@ -3906,20 +4258,20 @@
 	   '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
 	     (1 'org-table))
 	   ;; Links
+	   (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend)))
 	   (if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t)))
 	   (if (memq 'plain lk) '(org-activate-plain-links (0 'org-link t)))
 	   (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t)))
 	   (if (memq 'radio lk) '(org-activate-target-links (0 'org-link t)))
 	   (if (memq 'date lk) '(org-activate-dates (0 'org-date t)))
-	   (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend)))
+	   '("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t))
 	   '(org-hide-wide-columns (0 nil append))
 	   ;; TODO lines
 	   (list (concat "^\\*+[ \t]*" org-not-done-regexp)
 		 '(1 'org-todo t))
 	   ;; Priorities
-	   (list (concat "\\[#[A-Z]\\]") '(0 'org-special-keyword t))
+	   (list (concat "\\[#[A-Z0-9]\\]") '(0 'org-special-keyword t))
 	   ;; Special keywords
-	   (list org-repeat-re  '(0 'org-special-keyword t))
 	   (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t))
 	   (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t))
 	   (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t))
@@ -3942,9 +4294,13 @@
 	   '("^#.*" (0 'font-lock-comment-face t))
 	   ;; DONE
 	   (if org-fontify-done-headline
-	       (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>")
+	       (list (concat "^[*]+ +\\<\\("
+			     (mapconcat 'regexp-quote org-done-keywords "\\|")
+			     "\\)\\(.*\\)")
 		     '(1 'org-done t) '(2 'org-headline-done t))
-	     (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>")
+	     (list (concat "^[*]+ +\\<\\("
+			   (mapconcat 'regexp-quote org-done-keywords "\\|")
+			   "\\)\\>")
 		   '(1 'org-done t)))
 	   ;; Table stuff
 	   '("^[ \t]*\\(:.*\\)" (1 'org-table t))
@@ -4022,8 +4378,8 @@
   `indent-relative', like TAB normally does.  See the option
   `org-cycle-emulate-tab' for details.
 
-- Special case: if point is the the beginning of the buffer and there is
-  no headline in line 1, this function will act as if called with prefix arg."
+- Special case: if point is the beginning of the buffer and there is no
+  headline in line 1, this function will act as if called with prefix arg."
   (interactive "P")
   (let* ((outline-regexp
 	  (if (and (org-mode-p) org-cycle-include-plain-lists)
@@ -4088,7 +4444,8 @@
 			      (- (funcall outline-level) arg)))
 	(org-show-subtree)))
 
-     ((save-excursion (beginning-of-line 1) (looking-at outline-regexp))
+     ((and (save-excursion (beginning-of-line 1) (looking-at outline-regexp))
+	   (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol))))
       ;; At a heading: rotate between three different views
       (org-back-to-heading)
       (let ((goal-column 0) eoh eol eos)
@@ -4102,20 +4459,30 @@
 	      (beginning-of-line 2)) (setq eol (point)))
 	  (outline-end-of-heading)   (setq eoh (point))
 	  (org-end-of-subtree t)
-	  (skip-chars-forward " \t\n")
-	  (beginning-of-line 1) ; in case this is an item
+	  (unless (eobp)
+	    (skip-chars-forward " \t\n")
+	    (beginning-of-line 1) ; in case this is an item
+	    )
 	  (setq eos (1- (point))))
 	;; Find out what to do next and set `this-command'
 	(cond
 	 ((= eos eoh)
 	  ;; Nothing is hidden behind this heading
 	  (message "EMPTY ENTRY")
-	  (setq org-cycle-subtree-status nil))
+	  (setq org-cycle-subtree-status nil)
+	  (save-excursion
+	    (goto-char eos)
+	    (outline-next-heading)
+	    (if (org-invisible-p) (org-flag-heading nil))))
 	 ((>= eol eos)
 	  ;; Entire subtree is hidden in one line: open it
 	  (org-show-entry)
 	  (show-children)
 	  (message "CHILDREN")
+	  (save-excursion
+	    (goto-char eos)
+	    (outline-next-heading)
+	    (if (org-invisible-p) (org-flag-heading nil)))
 	  (setq org-cycle-subtree-status 'children)
 	  (run-hook-with-args 'org-cycle-hook 'children))
 	 ((and (eq last-command this-command)
@@ -4137,6 +4504,11 @@
 
      ((org-try-cdlatex-tab))
 
+     ((and (eq org-cycle-emulate-tab 'exc-hl-bol)
+	   (or (not (bolp))
+	       (not (looking-at outline-regexp))))
+      (call-interactively (global-key-binding "\t")))
+
      ((if (and (memq org-cycle-emulate-tab '(white whitestart))
 	       (save-excursion (beginning-of-line 1) (looking-at "[ \t]*"))
 	       (or (and (eq org-cycle-emulate-tab 'white)
@@ -4151,7 +4523,7 @@
 	  (progn
 	    (beginning-of-line 1)
 	    (and (looking-at "[ \t]+") (replace-match ""))))
-      (indent-relative))
+      (call-interactively (global-key-binding "\t")))
 
      (t (save-excursion
 	  (org-back-to-heading)
@@ -4177,13 +4549,13 @@
 first headline is not level one, then (hide-sublevels 1) gives confusing
 results."
   (interactive)
-  (hide-sublevels (save-excursion
-		    (goto-char (point-min))
-		    (if (re-search-forward (concat "^" outline-regexp) nil t)
-			(progn
-			  (goto-char (match-beginning 0))
-			  (funcall outline-level))
-		      1))))
+  (let ((level (save-excursion
+		 (goto-char (point-min))
+		 (if (re-search-forward (concat "^" outline-regexp) nil t)
+		     (progn
+		       (goto-char (match-beginning 0))
+		       (funcall outline-level))))))
+    (and level (hide-sublevels level))))
 
 (defun org-content (&optional arg)
   "Show all headlines in the buffer, like a table of contents.
@@ -4210,13 +4582,53 @@
 This function is the default value of the hook `org-cycle-hook'."
   (when (get-buffer-window (current-buffer))
     (cond
-     ((eq state 'overview) (org-first-headline-recenter 1))
+;     ((eq state 'overview) (org-first-headline-recenter 1))
+;     ((eq state 'overview) (org-beginning-of-line))
      ((eq state 'content)  nil)
      ((eq state 'all)      nil)
      ((eq state 'folded)   nil)
      ((eq state 'children) (or (org-subtree-end-visible-p) (recenter 1)))
      ((eq state 'subtree)  (or (org-subtree-end-visible-p) (recenter 1))))))
 
+
+(defun org-cycle-show-empty-lines (state)
+  "Show empty lines above all visible headlines.
+The region to be covered depends on STATE when called through
+`org-cycle-hook'.  Lisp program can use t for STATE to get the
+entire buffer covered.  Note that an empty line is only shown if there
+are at least `org-cycle-separator-lines' empty lines before the headeline."
+  (when (> org-cycle-separator-lines 0)
+    (save-excursion
+      (let* ((n org-cycle-separator-lines)
+	     (re (cond
+		  ((= n 1) "\\(\n[ \t]*\n\\*+\\) ")
+		  ((= n 2) "^[ \t]*\\(\n[ \t]*\n\\*+\\) ")
+		  (t (let ((ns (number-to-string (- n 2))))
+		       (concat "^\\(?:[ \t]*\n\\)\\{" ns "," ns "\\}"
+			       "[ \t]*\\(\n[ \t]*\n\\*+\\) ")))))
+	     beg end)
+	(cond
+	 ((memq state '(overview contents t))
+	  (setq beg (point-min) end (point-max)))
+	 ((memq state '(children folded))
+	  (setq beg (point) end (progn (org-end-of-subtree t t)
+				       (beginning-of-line 2)
+				       (point)))))
+	(when beg
+	  (goto-char beg)
+	  (while (re-search-forward re end t)
+	    (if (not (get-char-property (match-end 1) 'invisible))
+		(outline-flag-region
+		 (match-beginning 1) (match-end 1) nil)))))))
+  ;; Never hide empty lines at the end of the file.
+  (save-excursion
+    (goto-char (point-max))
+    (outline-previous-heading)
+    (outline-end-of-heading)
+    (if (and (looking-at "[ \t\n]+")
+	     (= (match-end 0) (point-max)))
+	(outline-flag-region (point) (match-end 0) nil))))
+
 (defun org-subtree-end-visible-p ()
   "Is the end of the current subtree visible?"
   (pos-visible-in-window-p
@@ -4238,27 +4650,27 @@
 (let ((cmds '(isearch-forward isearch-backward)) cmd)
   (while (setq cmd (pop cmds))
     (substitute-key-definition cmd cmd org-goto-map global-map)))
-(define-key org-goto-map "\C-m"     'org-goto-ret)
-(define-key org-goto-map [(left)]   'org-goto-left)
-(define-key org-goto-map [(right)]  'org-goto-right)
-(define-key org-goto-map [(?q)]     'org-goto-quit)
-(define-key org-goto-map [(control ?g)] 'org-goto-quit)
-(define-key org-goto-map "\C-i" 'org-cycle)
-(define-key org-goto-map [(tab)] 'org-cycle)
-(define-key org-goto-map [(down)] 'outline-next-visible-heading)
-(define-key org-goto-map [(up)] 'outline-previous-visible-heading)
-(define-key org-goto-map "n" 'outline-next-visible-heading)
-(define-key org-goto-map "p" 'outline-previous-visible-heading)
-(define-key org-goto-map "f" 'outline-forward-same-level)
-(define-key org-goto-map "b" 'outline-backward-same-level)
-(define-key org-goto-map "u" 'outline-up-heading)
-(define-key org-goto-map "\C-c\C-n" 'outline-next-visible-heading)
-(define-key org-goto-map "\C-c\C-p" 'outline-previous-visible-heading)
-(define-key org-goto-map "\C-c\C-f" 'outline-forward-same-level)
-(define-key org-goto-map "\C-c\C-b" 'outline-backward-same-level)
-(define-key org-goto-map "\C-c\C-u" 'outline-up-heading)
+(org-defkey org-goto-map "\C-m"     'org-goto-ret)
+(org-defkey org-goto-map [(left)]   'org-goto-left)
+(org-defkey org-goto-map [(right)]  'org-goto-right)
+(org-defkey org-goto-map [(?q)]     'org-goto-quit)
+(org-defkey org-goto-map [(control ?g)] 'org-goto-quit)
+(org-defkey org-goto-map "\C-i" 'org-cycle)
+(org-defkey org-goto-map [(tab)] 'org-cycle)
+(org-defkey org-goto-map [(down)] 'outline-next-visible-heading)
+(org-defkey org-goto-map [(up)] 'outline-previous-visible-heading)
+(org-defkey org-goto-map "n" 'outline-next-visible-heading)
+(org-defkey org-goto-map "p" 'outline-previous-visible-heading)
+(org-defkey org-goto-map "f" 'outline-forward-same-level)
+(org-defkey org-goto-map "b" 'outline-backward-same-level)
+(org-defkey org-goto-map "u" 'outline-up-heading)
+(org-defkey org-goto-map "\C-c\C-n" 'outline-next-visible-heading)
+(org-defkey org-goto-map "\C-c\C-p" 'outline-previous-visible-heading)
+(org-defkey org-goto-map "\C-c\C-f" 'outline-forward-same-level)
+(org-defkey org-goto-map "\C-c\C-b" 'outline-backward-same-level)
+(org-defkey org-goto-map "\C-c\C-u" 'outline-up-heading)
 (let ((l '(1 2 3 4 5 6 7 8 9 0)))
-  (while l (define-key org-goto-map (int-to-string (pop l)) 'digit-argument)))
+  (while l (org-defkey org-goto-map (int-to-string (pop l)) 'digit-argument)))
 
 (defconst org-goto-help
 "Select a location to jump to, press RET
@@ -4474,10 +4886,13 @@
 	     pos)
 	(cond
 	 ((and (org-on-heading-p) (bolp)
-	       (save-excursion (backward-char 1) (not (org-invisible-p))))
+	       (or (bobp)
+		   (save-excursion (backward-char 1) (not (org-invisible-p)))))
 	  (open-line (if blank 2 1)))
-	 ((and (bolp) (save-excursion
-			(backward-char 1) (not (org-invisible-p))))
+	 ((and (bolp)
+	       (or (bobp)
+		   (save-excursion
+		     (backward-char 1) (not (org-invisible-p)))))
 	  nil)
 	 (t (newline (if blank 2 1))))
 	(insert head) (just-one-space)
@@ -4500,8 +4915,8 @@
       (looking-at org-todo-line-regexp))
     (if (or arg
 	    (not (match-beginning 2))
-	    (equal (match-string 2) org-done-string))
-	(insert (car org-todo-keywords) " ")
+	    (member (match-string 2) org-done-keywords))
+	(insert (car org-todo-keywords-1) " ")
       (insert (match-string 2) " "))))
 
 ;;; Promotion and Demotion
@@ -4724,6 +5139,7 @@
     (setq txt (buffer-substring beg end))
     (delete-region beg end)
     (insert txt)
+    (or (bolp) (insert "\n"))
     (goto-char ins-point)
     (if folded (hide-subtree))
     (move-marker ins-point nil)))
@@ -4749,7 +5165,9 @@
 If CUT is non-nil, actually cut the subtree."
   (interactive)
   (let (beg end folded)
-    (org-back-to-heading)
+    (if (interactive-p)
+	(org-back-to-heading nil) ; take what looks like a subtree
+      (org-back-to-heading t)) ; take what is really there
     (setq beg (point))
     (save-match-data
       (save-excursion (outline-end-of-heading)
@@ -4888,7 +5306,7 @@
   (save-excursion
     (narrow-to-region
      (progn (org-back-to-heading) (point))
-     (progn (org-end-of-subtree t) (point)))))
+     (progn (org-end-of-subtree t t) (point)))))
 
 
 ;;; Outline Sorting
@@ -5130,7 +5548,7 @@
 the whole buffer."
   (interactive "P")
   (save-excursion
-    (let* ((buffer-invisibility-spec nil) ; Emacs 21 compatibility
+    (let* ((buffer-invisibility-spec (org-inhibit-invisibility)) ; Emacs 21
 	   (beg (progn (outline-back-to-heading) (point)))
 	   (end (move-marker (make-marker)
 			     (progn (outline-next-heading) (point))))
@@ -5214,13 +5632,24 @@
 	(concat (make-string i1 ?\ ) l)
       l)))
 
+(defcustom org-empty-line-terminates-plain-lists nil
+  "Non-nil means, an empty line ends all plain list levels.
+When nil, empty lines are part of the preceeding item."
+  :group 'org-plain-lists
+  :type 'boolean)
+
 (defun org-beginning-of-item ()
   "Go to the beginning of the current hand-formatted item.
 If the cursor is not in an item, throw an error."
   (interactive)
   (let ((pos (point))
-	(limit (save-excursion (org-back-to-heading)
-			       (beginning-of-line 2) (point)))
+	(limit (save-excursion
+		 (condition-case nil
+		     (progn
+		       (org-back-to-heading)
+		       (beginning-of-line 2) (point))
+		   (error (point-min)))))
+	(ind-empty (if org-empty-line-terminates-plain-lists 0 10000))
 	ind ind1)
     (if (org-at-item-p)
 	(beginning-of-line 1)
@@ -5230,12 +5659,14 @@
       (if (catch 'exit
 	    (while t
 	      (beginning-of-line 0)
-	      (if (< (point) limit) (throw 'exit nil))
-	      (unless (looking-at "[ \t]*$")
+	      (if (or (bobp) (< (point) limit)) (throw 'exit nil))
+
+	      (if (looking-at "[ \t]*$")
+		  (setq ind1 ind-empty)
 		(skip-chars-forward " \t")
-		(setq ind1 (current-column))
-		(if (< ind1 ind)
-		    (throw 'exit (org-at-item-p))))))
+		(setq ind1 (current-column)))
+	      (if (< ind1 ind)
+		  (progn (beginning-of-line 1) (throw 'exit (org-at-item-p))))))
 	  nil
 	(goto-char pos)
 	(error "Not in an item")))))
@@ -5244,22 +5675,27 @@
   "Go to the end of the current hand-formatted item.
 If the cursor is not in an item, throw an error."
   (interactive)
-  (let ((pos (point))
-	(limit (save-excursion (outline-next-heading) (point)))
-	(ind (save-excursion
-	       (org-beginning-of-item)
-	       (skip-chars-forward " \t")
-	       (current-column)))
-	ind1)
-    (if (catch 'exit
-	  (while t
-	    (beginning-of-line 2)
-	    (if (>= (point) limit) (throw 'exit t))
-	    (unless (looking-at "[ \t]*$")
-	      (skip-chars-forward " \t")
-	      (setq ind1 (current-column))
-	      (if (<= ind1 ind) (throw 'exit t)))))
-	(beginning-of-line 1)
+  (let* ((pos (point))
+	 ind1
+	 (ind-empty (if org-empty-line-terminates-plain-lists 0 10000))
+	 (limit (save-excursion (outline-next-heading) (point)))
+	 (ind (save-excursion
+		(org-beginning-of-item)
+		(skip-chars-forward " \t")
+		(current-column)))
+	 (end (catch 'exit
+		(while t
+		  (beginning-of-line 2)
+		  (if (eobp) (throw 'exit (point)))
+		  (if (>= (point) limit) (throw 'exit (point-at-bol)))
+		  (if (looking-at "[ \t]*$")
+		      (setq ind1 ind-empty)
+		    (skip-chars-forward " \t")
+		    (setq ind1 (current-column)))
+		  (if (<= ind1 ind)
+		      (throw 'exit (point-at-bol)))))))
+    (if end
+	(goto-char end)
       (goto-char pos)
       (error "Not in an item"))))
 
@@ -5338,7 +5774,11 @@
       (while t
 	(beginning-of-line 0)
 	(if (looking-at "[ \t]*$")
-	    nil
+	    (if org-empty-line-terminates-plain-lists
+		(progn
+		  (goto-char pos)
+		  (error "Cannot move this item further up"))
+	      nil)
 	  (if (<= (setq ind1 (org-get-indentation)) ind)
 	      (throw 'exit t)))))
     (condition-case nil
@@ -5468,16 +5908,16 @@
 open TODO items and archive them (after getting confirmation from the user).
 If the cursor is not at a headline when this comand is called, try all level
 1 trees.  If the cursor is on a headline, only try the direct children of
-this heading. "
+this heading."
   (interactive "P")
   (if find-done
       (org-archive-all-done)
     ;; Save all relevant TODO keyword-relatex variables
 
     (let ((tr-org-todo-line-regexp org-todo-line-regexp) ; keep despite compiler
-	  (tr-org-todo-keywords org-todo-keywords)
-	  (tr-org-todo-interpretation org-todo-interpretation)
-	  (tr-org-done-string org-done-string)
+	  (tr-org-todo-keywords-1 org-todo-keywords-1)
+	  (tr-org-todo-kwd-alist org-todo-kwd-alist)
+	  (tr-org-done-keywords org-done-keywords)
 	  (tr-org-todo-regexp org-todo-regexp)
 	  (tr-org-todo-line-regexp org-todo-line-regexp)
 	  (tr-org-odd-levels-only org-odd-levels-only)
@@ -5488,8 +5928,10 @@
 
       ;; Try to find a local archive location
       (save-excursion
-	(if (or (re-search-backward re nil t) (re-search-forward re nil t))
-	    (setq org-archive-location (match-string 1))))
+	(save-restriction
+	  (widen)
+	  (if (or (re-search-backward re nil t) (re-search-forward re nil t))
+	      (setq org-archive-location (match-string 1)))))
 
       (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location)
 	  (progn
@@ -5516,7 +5958,8 @@
 	;; Enforce org-mode for the archive buffer
 	(if (not (org-mode-p))
 	    ;; Force the mode for future visits.
-	    (let ((org-insert-mode-line-in-empty-file t))
+	    (let ((org-insert-mode-line-in-empty-file t)
+		  (org-inhibit-startup t))
 	      (call-interactively 'org-mode)))
 	(when newfile-p
 	  (goto-char (point-max))
@@ -5524,13 +5967,13 @@
 			  (buffer-file-name this-buffer))))
 	;; Force the TODO keywords of the original buffer
 	(let ((org-todo-line-regexp tr-org-todo-line-regexp)
-	      (org-todo-keywords tr-org-todo-keywords)
-	      (org-todo-interpretation tr-org-todo-interpretation)
-	      (org-done-string tr-org-done-string)
+	      (org-todo-keywords-1 tr-org-todo-keywords-1)
+	      (org-todo-kwd-alist tr-org-todo-kwd-alist)
+	      (org-done-keywords tr-org-done-keywords)
 	      (org-todo-regexp tr-org-todo-regexp)
 	      (org-todo-line-regexp tr-org-todo-line-regexp)
 	      (org-odd-levels-only
-	       (if (local-variable-p 'org-odd-levels-only)
+	       (if (local-variable-p 'org-odd-levels-only (current-buffer))
 		   org-odd-levels-only
 		 tr-org-odd-levels-only)))
 	  (goto-char (point-min))
@@ -5556,10 +5999,10 @@
 	    (goto-char (point-max)) (insert "\n"))
 	  ;; Paste
 	  (org-paste-subtree (org-get-legal-level level 1))
-	  ;; Mark the entry as done, i.e. set to last work in org-todo-keywords
+	  ;; Mark the entry as done, i.e. set to last word in org-todo-keywords-1 FIXME: not right anymore!!!!!!!
 	  (if org-archive-mark-done
 	      (let (org-log-done)
-		(org-todo (length org-todo-keywords))))
+		(org-todo (length org-todo-keywords-1))))
 	  ;; Move cursor to right after the TODO keyword
 	  (when org-archive-stamp-time
 	    (beginning-of-line 1)
@@ -5653,7 +6096,7 @@
 (defun org-toggle-tag (tag &optional onoff)
   "Toggle the tag TAG for the current line.
 If ONOFF is `on' or `off', don't toggle but set to this state."
-  (unless (org-on-heading-p) (error "Not on headling"))
+  (unless (org-on-heading-p t) (error "Not on headling"))
   (let (res current)
     (save-excursion
       (beginning-of-line)
@@ -5749,6 +6192,8 @@
   "Table row types, non-nil only for the duration of a comand.")
 (defvar org-table-current-begin-line nil
   "Table begin line, non-nil only for the duration of a comand.")
+(defvar org-table-current-begin-pos nil
+  "Table begin position, non-nil only for the duration of a comand.")
 (defvar org-table-dlines nil
   "Vector of data line line numbers in the current table.")
 (defvar org-table-hlines nil
@@ -5760,11 +6205,17 @@
   "Regular expression for matching ranges in formulas.")
 
 (defconst org-table-range-regexp2
-   "@\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[a-zA-Z0-9]+\\)?\\(\\.\\.@?\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[a-zA-Z0-9]+\\)?\\)?\\|\\$[a-zA-Z0-9]+\\.\\.\\$[a-zA-Z0-9]+"
-  "Regular expression to recognize ranges in formulas for highlighting.")
-
-(defvar org-inhibit-highlight-removal nil)
-
+  (concat
+   "\\(" "@[-0-9I$&]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\|" "\\$[a-zA-Z0-9]+" "\\)"
+   "\\.\\."
+   "\\(" "@?[-0-9I$&]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\|" "\\$[a-zA-Z0-9]+" "\\)")
+  "Match a range for reference display.")
+
+(defconst org-table-translate-regexp
+  (concat "\\(" "@[-0-9I$]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\)")
+  "Match a reference that needs translation, for reference display.")
+
+(defvar org-inhibit-highlight-removal nil) ; dynamically scoped param
 
 (defun org-table-create-with-table.el ()
   "Use the table.el package to insert a new table.
@@ -5783,8 +6234,9 @@
 
 (defun org-table-create-or-convert-from-region (arg)
   "Convert region to table, or create an empty table.
-If there is an active region, convert it to a table.  If there is no such
-region, create an empty table."
+If there is an active region, convert it to a table, using the function
+`org-table-convert-region'.
+If there is no such region, create an empty table with `org-table-create'."
   (interactive "P")
   (if (org-region-active-p)
       (org-table-convert-region (region-beginning) (region-end) arg)
@@ -5827,7 +6279,9 @@
 The region goes from BEG0 to END0, but these borders will be moved
 slightly, to make sure a beginning of line in the first line is included.
 When NSPACE is non-nil, it indicates the minimum number of spaces that
-separate columns (default: just one space)."
+separate columns.  By default, the function first checks if every line
+contains at lease one TAB.  If yes, it assumes that the material is TAB
+separated.  If not, it assumes a single space as separator."
   (interactive "rP")
   (let* ((beg (min beg0 end0))
 	 (end (max beg0 end0))
@@ -6249,9 +6703,13 @@
 the cursor is moved with it.  Therefore, repeating this command causes the
 column to be filled row-by-row.
 If the variable `org-table-copy-increment' is non-nil and the field is an
-integer, it will be incremented while copying."
+integer or a timestamp, it will be incremented while copying.  In the case of
+a timestamp, if the cursor is on the year, change the year.  If it is on the
+month or the day, change that.  Point will stay on the current date field
+in order to easily repeat the interval."
   (interactive "p")
   (let* ((colpos (org-table-current-column))
+	 (col (current-column))
 	 (field (org-table-get-field))
 	 (non-empty (string-match "[^ \t]" field))
 	 (beg (org-table-begin))
@@ -6279,8 +6737,12 @@
 		   (string-match "^[0-9]+$" txt))
 	      (setq txt (format "%d" (+ (string-to-number txt) 1))))
 	  (insert txt)
-	  (org-table-maybe-recalculate-line)
-	  (org-table-align))
+	  (move-to-column col)
+	  (if (and org-table-copy-increment (org-at-timestamp-p t))
+	      (org-timestamp-up 1)
+	    (org-table-maybe-recalculate-line))
+	  (org-table-align)
+	  (move-to-column col))
       (error "No non-empty field found"))))
 
 (defun org-table-check-inside-data-field ()
@@ -6333,7 +6795,7 @@
 
 (defun org-table-field-info (arg)
   "Show info about the current field, and highlight any reference at point."
-  (interactive "P") 
+  (interactive "P")
   (org-table-get-specials)
   (save-excursion
     (let* ((pos (point))
@@ -6344,21 +6806,26 @@
 	   (eql (org-table-get-stored-formulas))
 	   (dline (org-table-current-dline))
 	   (ref (format "@%d$%d" dline col))
+	   (ref1 (org-table-convert-refs-to-an ref))
 	   (fequation (or (assoc name eql) (assoc ref eql)))
-	   (cequation (assoc (int-to-string col) eql)))
+	   (cequation (assoc (int-to-string col) eql))
+	   (eqn (or fequation cequation)))
       (goto-char pos)
       (condition-case nil
-	  (org-show-reference 'local)
+	  (org-table-show-reference 'local)
 	(error nil))
-      (message "line @%d, col $%s%s, ref @%d$%d%s%s"
+      (message "line @%d, col $%s%s, ref @%d$%d or %s%s%s"
 	       dline col
 	       (if cname (concat " or $" cname) "")
-	       dline col
+	       dline col ref1
 	       (if name (concat " or $" name) "")
 	       ;; FIXME: formula info not correct if special table line
-	       (if (or fequation cequation)
-		   (concat ", " (if fequation "field" "column")
-			   " formula applies" "")
+	       (if eqn
+		   (concat ", formula: "
+			   (org-table-formula-to-user
+			    (concat
+			     (if (string-match "^[$@]"(car eqn)) "" "$")
+			     (car eqn) "=" (cdr eqn))))
 		 "")))))
 
 (defun org-table-current-column ()
@@ -6573,7 +7040,7 @@
     (goto-line linepos)
     (org-table-goto-column colpos)
     (org-table-align)
-    (org-table-fix-formulas 
+    (org-table-fix-formulas
      "$" (list (cons (number-to-string col) (number-to-string colpos))
 	       (cons (number-to-string colpos) (number-to-string col))))))
 
@@ -6591,7 +7058,7 @@
   (interactive "P")
   (let* ((col (current-column))
 	 (pos (point))
-	 (hline1p (save-excursion (beginning-of-line 1) 
+	 (hline1p (save-excursion (beginning-of-line 1)
 				  (looking-at org-table-hline-regexp)))
 	 (dline1 (org-table-current-dline))
 	 (dline2 (+ dline1 (if up -1 1)))
@@ -6612,7 +7079,7 @@
     (beginning-of-line 0)
     (move-to-column col)
     (unless (or hline1p hline2p)
-      (org-table-fix-formulas 
+      (org-table-fix-formulas
        "@" (list (cons (number-to-string dline1) (number-to-string dline2))
 		 (cons (number-to-string dline2) (number-to-string dline1)))))))
 
@@ -6635,9 +7102,9 @@
 	 (org-table-align))
     (org-table-fix-formulas "@" nil (1- (org-table-current-dline)) 1)))
 
-(defun org-table-insert-hline (&optional arg)
+(defun org-table-insert-hline (&optional above)
   "Insert a horizontal-line below the current line into the table.
-With prefix ARG, insert above the current line."
+With prefix ABOVE, insert above the current line."
   (interactive "P")
   (if (not (org-at-table-p))
       (error "Not at a table"))
@@ -6649,12 +7116,25 @@
 		  (concat "+" (make-string (- (match-end 1) (match-beginning 1))
 					   ?-) "|") t t line)))
     (and (string-match "\\+" line) (setq line (replace-match "|" t t line)))
-    (beginning-of-line (if arg 1 2))
+    (beginning-of-line (if above 1 2))
     (insert line "\n")
-    (beginning-of-line (if arg 1 -1))
+    (beginning-of-line (if above 1 -1))
     (move-to-column col)
     (and org-table-overlay-coordinates (org-table-align))))
 
+(defun org-table-hline-and-move (&optional same-column)
+  "Insert a hline and move to the row below that line."
+  (interactive "P")
+  (let ((col (org-table-current-column)))
+    (org-table-maybe-eval-formula)
+    (org-table-maybe-recalculate-line)
+    (org-table-insert-hline)
+    (end-of-line 2)
+    (if (looking-at "\n[ \t]*|-")
+	(progn (insert "\n|") (org-table-align))
+      (org-table-next-field))
+    (if same-column (org-table-goto-column col))))
+
 (defun org-table-clean-line (s)
   "Convert a table line S into a string with only \"|\" and space.
 In particular, this does handle wide and invisible characters."
@@ -6959,15 +7439,14 @@
       (switch-to-buffer-other-window "*Org tmp*")
       (erase-buffer)
       (insert "#\n# Edit field and finish with C-c C-c\n#\n")
-      (org-mode)
+      (let ((org-inhibit-startup t)) (org-mode))
       (goto-char (setq p (point-max)))
       (insert (org-trim field))
       (remove-text-properties p (point-max)
 			      '(invisible t org-cwidth t display t
 					  intangible t))
       (goto-char p)
-      (org-set-local 'org-finish-function
-		     'org-table-finish-edit-field)
+      (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"))))
@@ -6997,8 +7476,8 @@
 
 (defun org-trim (s)
   "Remove whitespace at beginning and end of string."
-  (if (string-match "^[ \t]+" s) (setq s (replace-match "" t t s)))
-  (if (string-match "[ \t]+$" s) (setq s (replace-match "" t t s)))
+  (if (string-match "^[ \t\n\r]+" s) (setq s (replace-match "" t t s)))
+  (if (string-match "[ \t\n\r]+$" s) (setq s (replace-match "" t t s)))
   s)
 
 (defun org-wrap (string &optional width lines)
@@ -7159,21 +7638,25 @@
      ((equal n 0)                             nil)
      (t n))))
 
-(defun org-table-current-field-formula ()
+(defun org-table-current-field-formula (&optional key noerror)
   "Return the formula active for the current field.
-Assumes that specials are in place."
+Assumes that specials are in place.
+If KEY is given, return the key to this formula.
+Otherwise return the formula preceeded with \"=\" or \":=\"."
   (let* ((name (car (rassoc (list (org-current-line)
 				  (org-table-current-column))
 			    org-table-named-field-locations)))
 	 (col (org-table-current-column))
 	 (scol (int-to-string col))
 	 (ref (format "@%d$%d" (org-table-current-dline) col))
-	 (stored-list (org-table-get-stored-formulas))
+	 (stored-list (org-table-get-stored-formulas noerror))
 	 (ass (or (assoc name stored-list)
 		  (assoc ref stored-list)
 		  (assoc scol stored-list))))
-    (if ass (concat (if (string-match "^[0-9]+$" (car ass)) "=" ":=")
-		    (cdr ass)))))
+    (if key
+	(car ass)
+      (if ass (concat (if (string-match "^[0-9]+$" (car ass)) "=" ":=")
+		      (cdr ass))))))
 
 (defun org-table-get-formula (&optional equation named)
   "Read a formula from the minibuffer, offer stored formula as default.
@@ -7199,11 +7682,16 @@
 	       stored)
 	      ((stringp equation)
 	       equation)
-	      (t (read-string
-		  (format "%s formula $%s=" (if named "Field" "Column") scol)
-		  (or stored "") 'org-table-formula-history
-		  ;stored
-		  ))))
+	      (t (org-table-formula-from-user
+		  (read-string
+		   (org-table-formula-to-user
+		    (format "%s formula %s%s="
+			    (if named "Field" "Column")
+			    (if (member (string-to-char scol) '(?$ ?@)) "" "$")
+			    scol))
+		   (if stored (org-table-formula-to-user stored) "")
+		   'org-table-formula-history
+		   )))))
 	 mustsave)
     (when (not (string-match "\\S-" eq))
       ;; remove formula
@@ -7225,7 +7713,7 @@
 
 (defun org-table-store-formulas (alist)
   "Store the list of formulas below the current table."
-  (setq alist (sort alist (lambda (a b) (string< (car a) (car b)))))
+  (setq alist (sort alist 'org-table-formula-less-p))
   (save-excursion
     (goto-char (org-table-end))
     (if (looking-at "\\([ \t]*\n\\)*#\\+TBLFM:\\(.*\n?\\)")
@@ -7242,7 +7730,20 @@
 		       alist "::")
 	    "\n")))
 
-(defun org-table-get-stored-formulas ()
+(defsubst org-table-formula-make-cmp-string (a)
+  (when (string-match "^\\(@\\([0-9]+\\)\\)?\\(\\$?\\([0-9]+\\)\\)?\\(\\$?[a-zA-Z0-9]+\\)?" a)
+    (concat
+     (if (match-end 2) (format "@%05d" (string-to-number (match-string 2 a))) "")
+     (if (match-end 4) (format "$%05d" (string-to-number (match-string 4 a))) "")
+     (if (match-end 5) (concat "@@" (match-string 5 a))))))
+
+(defun org-table-formula-less-p (a b)
+  "Compare two formulas for sorting."
+  (let ((as (org-table-formula-make-cmp-string (car a)))
+	(bs (org-table-formula-make-cmp-string (car b))))
+    (and as bs (string< as bs))))
+
+(defun org-table-get-stored-formulas (&optional noerror)
   "Return an alist with the stored formulas directly after current table."
   (interactive)
   (let (scol eq eq-alist strings string seen)
@@ -7252,13 +7753,18 @@
 	(setq strings (org-split-string (match-string 2) " *:: *"))
 	(while (setq string (pop strings))
 	  (when (string-match "\\(@[0-9]+\\$[0-9]+\\|\\$\\([a-zA-Z0-9]+\\)\\) *= *\\(.*[^ \t]\\)" string)
-	    (setq scol (if (match-end 2) 
-			   (match-string 2 string) 
+	    (setq scol (if (match-end 2)
+			   (match-string 2 string)
 			 (match-string 1 string))
 		  eq (match-string 3 string)
 		  eq-alist (cons (cons scol eq) eq-alist))
 	    (if (member scol seen)
-		(error "Double definition `$%s=' in TBLFM line, please fix by hand" scol)
+                (if noerror
+                    (progn
+                      (message "Double definition `$%s=' in TBLFM line, please fix by hand" scol)
+                      (ding)
+                      (sit-for 2))
+                  (error "Double definition `$%s=' in TBLFM line, please fix by hand" scol))
 	      (push scol seen))))))
     (nreverse eq-alist)))
 
@@ -7297,7 +7803,8 @@
 	    org-table-local-parameters nil
 	    org-table-named-field-locations nil
 	    org-table-current-begin-line nil
-	    org-table-current-line-types nil)	    
+	    org-table-current-begin-pos nil
+	    org-table-current-line-types nil)
       (goto-char beg)
       (when (re-search-forward "^[ \t]*| *! *\\(|.*\\)" end t)
 	(setq names (org-split-string (match-string 1) " *| *")
@@ -7334,7 +7841,8 @@
       ;; Analyse the line types
       (goto-char beg)
       (setq org-table-current-begin-line (org-current-line)
-	    l org-table-current-begin-line)      
+	    org-table-current-begin-pos (point)
+	    l org-table-current-begin-line)
       (while (looking-at "[ \t]*|\\(-\\)?")
 	(push (if (match-end 1) 'hline 'dline) types)
 	(if (match-end 1) (push l hlines) (push l dlines))
@@ -7344,13 +7852,6 @@
 	    org-table-dlines (apply 'vector (cons nil (nreverse dlines)))
 	    org-table-hlines (apply 'vector (cons nil (nreverse hlines)))))))
 
-(defun org-this-word ()
-  ;; Get the current word
-  (save-excursion
-    (let ((beg (progn (skip-chars-backward "^ \t\n") (point)))
-	  (end (progn (skip-chars-forward "^ \t\n") (point))))
-      (buffer-substring-no-properties beg end))))
-
 (defun org-table-maybe-eval-formula ()
   "Check if the current field starts with \"=\" or \":=\".
 If yes, store the formula and apply it."
@@ -7364,7 +7865,8 @@
 	      eq (match-string 1 field))
 	(if (or (fboundp 'calc-eval)
 		(equal (substring eq 0 (min 2 (length eq))) "'("))
-	    (org-table-eval-formula (if named '(4) nil) eq)
+	    (org-table-eval-formula (if named '(4) nil)
+				    (org-table-formula-from-user eq))
 	  (error "Calc does not seem to be installed, and is needed to evaluate the formula"))))))
 
 (defvar org-recalc-commands nil
@@ -7485,7 +7987,7 @@
 
 When called with two `C-u' prefixes, insert the active equation
 for the field back into the current field, so that it can be
-edited there.  This is useful in order to use \\[org-show-reference]
+edited there.  This is useful in order to use \\[org-table-show-reference]
 to check the referenced fields.
 
 When called, the command first prompts for a formula, which is read in
@@ -7577,7 +8079,7 @@
 	;; Insert complex ranges
 	(while (string-match org-table-range-regexp form)
 	  (setq form
-		(replace-match 
+		(replace-match
 		 (save-match-data
 		   (org-table-make-reference
 		    (org-table-get-range (match-string 0 form) nil n0)
@@ -7585,7 +8087,7 @@
 		 t t form)))
 	;; Insert simple ranges
 	(while (string-match "\\$\\([0-9]+\\)\\.\\.\\$\\([0-9]+\\)"  form)
-	  (setq form 
+	  (setq form
 		(replace-match
 		 (save-match-data
 		   (org-table-make-reference
@@ -7596,17 +8098,16 @@
 		 t t form)))
 	(setq form0 form)
 	;; Insert the references to fields in same row
-	(while (string-match "\\$\\([0-9]+\\)?" form)
-	  (setq n (if (match-beginning 1)
-		      (string-to-number (match-string 1 form))
-		    n0)
-		x (nth (1- n) fields))
+	(while (string-match "\\$\\([0-9]+\\)" form)
+	  (setq n (string-to-number (match-string 1 form))
+		x (nth (1- (if (= n 0) n0 n)) fields))
 	  (unless x (error "Invalid field specifier \"%s\""
 			   (match-string 0 form)))
 	  (setq form (replace-match
 		      (save-match-data
 			(org-table-make-reference x nil numbers lispp))
 		      t t form)))
+
 	(if lispp
 	    (setq ev (condition-case nil
 			 (eval (eval (read form)))
@@ -7616,7 +8117,7 @@
 	      (error "Calc does not seem to be installed, and is needed to evaluate the formula"))
 	  (setq ev (calc-eval (cons form modes)
 			      (if numbers 'num))))
-	
+
 	(when org-table-formula-debug
 	  (with-output-to-temp-buffer "*Substitution History*"
 	    (princ (format "Substitution history of formula
@@ -7738,7 +8239,7 @@
 	    (setq i 0 hdir "+")
 	    (if (eq (aref table 0) 'hline) (setq hn (1- hn)))))
       (if (and (not hn) on (not odir))
-	  (error "should never happen");;(aref org-table-dlines on) FIXME
+	  (error "should never happen");;(aref org-table-dlines on)
 	(if (and hn (> hn 0))
 	    (setq i (org-find-row-type table i 'hline (equal hdir "-") nil hn)))
 	(if on
@@ -7837,7 +8338,7 @@
       (goto-char beg)
       (and all (message "Re-applying formulas to full table..."))
       (while (re-search-forward line-re end t)
-	(unless (string-match "^ *[_^!$] *$" (org-table-get-field 1))
+	(unless (string-match "^ *[_^!$/] *$" (org-table-get-field 1))
 	  ;; Unprotected line, recalculate
 	  (and all (message "Re-applying formulas to full table...(line %d)"
 			    (setq cnt (1+ cnt))))
@@ -7858,7 +8359,7 @@
 	      a (assoc name org-table-named-field-locations))
 	(and (not a)
 	     (string-match "@\\([0-9]+\\)\\$\\([0-9]+\\)" name)
-	     (setq a 
+	     (setq a
 		   (list
 		    name
 		    (aref org-table-dlines
@@ -7876,12 +8377,12 @@
       (org-table-goto-column thiscol)
       (or noalign (and org-table-may-need-update (org-table-align))
 	  (and all (message "Re-applying formulas...done"))))))
-  
+
 (defun org-table-iterate (&optional arg)
   "Recalculate the table until it does not change anymore."
   (interactive "P")
   (let ((imax (if arg (prefix-numeric-value arg) 10))
-	(i 0)	      
+	(i 0)
 	(lasttbl (buffer-substring (org-table-begin) (org-table-end)))
 	thistbl)
     (catch 'exit
@@ -7924,32 +8425,74 @@
       (and (fboundp 'constants-get) (constants-get const))
       "#UNDEFINED_NAME"))
 
-(defvar org-edit-formulas-map (make-sparse-keymap))
-(define-key org-edit-formulas-map "\C-c\C-c"      'org-finish-edit-formulas)
-(define-key org-edit-formulas-map "\C-c\C-q"      'org-abort-edit-formulas)
-(define-key org-edit-formulas-map "\C-c?"         'org-show-reference)
-(define-key org-edit-formulas-map [(shift up)]    'org-table-edit-line-up)
-(define-key org-edit-formulas-map [(shift down)]  'org-table-edit-line-down)
-(define-key org-edit-formulas-map [(shift left)] 'org-table-edit-backward-field)
-(define-key org-edit-formulas-map [(shift right)] 'org-table-edit-next-field)
-(define-key org-edit-formulas-map [(meta up)]     'org-table-edit-scroll-down)
-(define-key org-edit-formulas-map [(meta down)]   'org-table-edit-scroll)
-(define-key org-edit-formulas-map [(meta tab)]    'lisp-complete-symbol)
-(define-key org-edit-formulas-map "\M-\C-i"       'lisp-complete-symbol)
-(define-key org-edit-formulas-map [(tab)]         'org-edit-formula-lisp-indent)
-(define-key org-edit-formulas-map "\C-i"          'org-edit-formula-lisp-indent)
+(defvar org-table-fedit-map (make-sparse-keymap))
+(org-defkey org-table-fedit-map "\C-x\C-s"      'org-table-fedit-finish)
+(org-defkey org-table-fedit-map "\C-c\C-s"      'org-table-fedit-finish)
+(org-defkey org-table-fedit-map "\C-c\C-c"      'org-table-fedit-finish)
+(org-defkey org-table-fedit-map "\C-c\C-q"      'org-table-fedit-abort)
+(org-defkey org-table-fedit-map "\C-c?"         'org-table-show-reference)
+(org-defkey org-table-fedit-map [(meta shift up)]    'org-table-fedit-line-up)
+(org-defkey org-table-fedit-map [(meta shift down)]  'org-table-fedit-line-down)
+(org-defkey org-table-fedit-map [(shift up)]    'org-table-fedit-ref-up)
+(org-defkey org-table-fedit-map [(shift down)]  'org-table-fedit-ref-down)
+(org-defkey org-table-fedit-map [(shift left)]  'org-table-fedit-ref-left)
+(org-defkey org-table-fedit-map [(shift right)] 'org-table-fedit-ref-right)
+(org-defkey org-table-fedit-map [(meta up)]     'org-table-fedit-scroll-down)
+(org-defkey org-table-fedit-map [(meta down)]   'org-table-fedit-scroll)
+(org-defkey org-table-fedit-map [(meta tab)]    'lisp-complete-symbol)
+(org-defkey org-table-fedit-map "\M-\C-i"       'lisp-complete-symbol)
+(org-defkey org-table-fedit-map [(tab)]         'org-table-fedit-lisp-indent)
+(org-defkey org-table-fedit-map "\C-i"          'org-table-fedit-lisp-indent)
+(org-defkey org-table-fedit-map "\C-c\C-r" 'org-table-fedit-toggle-ref-type)
+(org-defkey org-table-fedit-map "\C-c}"    'org-table-fedit-toggle-coordinates)
+
+(easy-menu-define org-table-fedit-menu org-table-fedit-map "Org Edit Formulas Menu"
+  '("Edit-Formulas"
+    ["Finish and Install" org-table-fedit-finish t]
+    ["Finish, Install, and Apply" (org-table-fedit-finish t) :keys "C-u C-c C-c"]
+    ["Abort" org-table-fedit-abort t]
+    "--"
+    ["Pretty-Print Lisp Formula" org-table-fedit-lisp-indent t]
+    ["Complete Lisp Symbol" lisp-complete-symbol t]
+    "--"
+    "Shift Reference at Point"
+    ["Up" org-table-fedit-ref-up t]
+    ["Down" org-table-fedit-ref-down t]
+    ["Left" org-table-fedit-ref-left t]
+    ["Right" org-table-fedit-ref-right t]
+    "-"
+    "Change Test Row for Column Formulas"
+    ["Up" org-table-fedit-line-up t]
+    ["Down" org-table-fedit-line-down t]
+    "--"
+    ["Scroll Table Window" org-table-fedit-scroll t]
+    ["Scroll Table Window down" org-table-fedit-scroll-down t]
+    ["Show Table Grid" org-table-fedit-toggle-coordinates
+     :style toggle :selected (with-current-buffer (marker-buffer org-pos)
+			       org-table-overlay-coordinates)]
+    "--"
+    ["Standard Refs (B3 instead of @3$2)" org-table-fedit-toggle-ref-type
+     :style toggle :selected org-table-buffer-is-an]))
 
 (defvar org-pos)
 
 (defun org-table-edit-formulas ()
   "Edit the formulas of the current table in a separate buffer."
   (interactive)
+  (when (save-excursion (beginning-of-line 1) (looking-at "#\\+TBLFM"))
+    (beginning-of-line 0))
   (unless (org-at-table-p) (error "Not at a table"))
   (org-table-get-specials)
-  (let ((eql (org-table-get-stored-formulas))
+  (let ((key (org-table-current-field-formula 'key 'noerror))
+	(eql (sort (org-table-get-stored-formulas 'noerror)
+                   'org-table-formula-less-p))
 	(pos (move-marker (make-marker) (point)))
+	(startline 1)
 	(wc (current-window-configuration))
-	entry s)
+	(titles '((column . "# Column Formulas\n")
+		  (field . "# Field Formulas\n")
+		  (named . "# Named Field Formulas\n")))
+	entry s type title)
     (switch-to-buffer-other-window "*Edit Formulas*")
     (erase-buffer)
     ;; Keep global-font-lock-mode from turning on font-lock-mode
@@ -7958,38 +8501,226 @@
     (org-set-local 'font-lock-global-modes (list 'not major-mode))
     (org-set-local 'org-pos pos)
     (org-set-local 'org-window-configuration wc)
-    (use-local-map org-edit-formulas-map)
-    (org-add-hook 'post-command-hook 'org-table-edit-formulas-post-command t t)
-    (setq s "# `C-c C-c' to finish, `C-u C-c C-c' to also apply, `C-c C-q' to abort.
-# `TAB' to pretty-print Lisp expressions, `M-TAB' to complete List symbols
-# `M-up/down' to scroll table, `S-up/down' to change line for column formulas\n\n")
-
-    (put-text-property 0 (length s) 'face 'font-lock-comment-face s)
-    (insert s)
+    (use-local-map org-table-fedit-map)
+    (org-add-hook 'post-command-hook 'org-table-fedit-post-command t t)
+    (easy-menu-add org-table-fedit-menu)
+    (setq startline (org-current-line))
     (while (setq entry (pop eql))
+      (setq type (cond
+		  ((equal (string-to-char (car entry)) ?@) 'field)
+		  ((string-match "^[0-9]" (car entry)) 'column)
+		  (t 'named)))
+      (when (setq title (assq type titles))
+	(or (bobp) (insert "\n"))
+	(insert (org-add-props (cdr title) nil 'face font-lock-comment-face))
+	(setq titles (delq title titles)))
+      (if (equal key (car entry)) (setq startline (org-current-line)))
       (setq s (concat (if (equal (string-to-char (car entry)) ?@) "" "$")
 		      (car entry) " = " (cdr entry) "\n"))
       (remove-text-properties 0 (length s) '(face nil) s)
       (insert s))
-    (goto-char (point-min))
-    (message "Edit formulas and finish with `C-c C-c'.")))
-
-(defun org-table-edit-formulas-post-command ()
+    (if (eq org-table-use-standard-references t)
+	(org-table-fedit-toggle-ref-type))
+    (goto-line startline)
+    (message "Edit formulas and finish with `C-c C-c'.  See menu for more commands.")))
+
+(defun org-table-fedit-post-command ()
   (when (not (memq this-command '(lisp-complete-symbol)))
     (let ((win (selected-window)))
       (save-excursion
 	(condition-case nil
-	    (org-show-reference)
+	    (org-table-show-reference)
 	  (error nil))
 	(select-window win)))))
 
-(defun org-finish-edit-formulas (&optional arg)
+(defun org-table-formula-to-user (s)
+  "Convert a formula from internal to user representation."
+  (if (eq org-table-use-standard-references t)
+      (org-table-convert-refs-to-an s)
+    s))
+
+(defun org-table-formula-from-user (s)
+  "Convert a formula from user to internal representation."
+  (if org-table-use-standard-references
+      (org-table-convert-refs-to-rc s)
+    s))
+
+(defun org-table-convert-refs-to-rc (s)
+  "Convert spreadsheet references from AB7 to @7$28.
+Works for single references, but also for entire formulas and even the
+full TBLFM line."
+  (let ((start 0))
+    (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\)" s start)
+      (cond
+       ((match-end 3)
+	;; format match, just advance
+	(setq start (match-end 0)))
+       ((and (> (match-beginning 0) 0)
+	     (equal ?. (aref s (max (1- (match-beginning 0)) 0))))
+	;; 3.e5 or something like this.  FIXME: is this ok????
+	(setq start (match-end 0)))
+       (t
+	(setq start (match-beginning 0)
+	      s (replace-match
+		 (if (equal (match-string 2 s) "&")
+		     (format "$%d" (org-letters-to-number (match-string 1 s)))
+		   (format "@%d$%d"
+			   (string-to-number (match-string 2 s))
+			   (org-letters-to-number (match-string 1 s))))
+		 t t s)))))
+    s))
+
+(defun org-table-convert-refs-to-an (s)
+  "Convert spreadsheet references from to @7$28 to AB7.
+Works for single references, but also for entire formulas and even the
+full TBLFM line."
+  (while (string-match "@\\([0-9]+\\)$\\([0-9]+\\)" s)
+    (setq s (replace-match
+	     (format "%s%d"
+		     (org-number-to-letters
+		      (string-to-number (match-string 2 s)))
+		     (string-to-number (match-string 1 s)))
+	     t t s)))
+  (while (string-match "\\(^\\|[^0-9a-zA-Z]\\)\\$\\([0-9]+\\)" s)
+    (setq s (replace-match (concat "\\1"
+				   (org-number-to-letters
+				    (string-to-number (match-string 2 s))) "&")
+			   t nil s)))
+  s)
+
+(defun org-letters-to-number (s)
+  "Convert a base 26 number represented by letters into an integer.
+For example:  AB -> 28."
+  (let ((n 0))
+    (setq s (upcase s))
+    (while (> (length s) 0)
+	  (setq n (+ (* n 26) (string-to-char s) (- ?A) 1)
+		s (substring s 1)))
+    n))
+
+(defun org-number-to-letters (n)
+  "Convert an integer into a base 26 number represented by letters.
+For example:  28 -> AB."
+  (let ((s ""))
+    (while (> n 0)
+      (setq s (concat (char-to-string (+ (mod (1- n) 26) ?A)) s)
+	    n (/ (1- n) 26)))
+    s))
+
+(defun org-table-fedit-convert-buffer (function)
+  "Convert all references in this buffer, using FUNTION."
+  (let ((line (org-current-line)))
+    (goto-char (point-min))
+    (while (not (eobp))
+      (insert (funcall function (buffer-substring (point) (point-at-eol))))
+      (delete-region (point) (point-at-eol))
+      (or (eobp) (forward-char 1)))
+    (goto-line line)))
+
+(defun org-table-fedit-toggle-ref-type ()
+  "Convert all references in the buffer from B3 to @3$2 and back."
+  (interactive)
+  (org-set-local 'org-table-buffer-is-an (not org-table-buffer-is-an))
+  (org-table-fedit-convert-buffer
+   (if org-table-buffer-is-an
+       'org-table-convert-refs-to-an 'org-table-convert-refs-to-rc))
+  (message "Reference type switched to %s"
+	   (if org-table-buffer-is-an "A1 etc" "@row$column")))
+
+(defun org-table-fedit-ref-up ()
+  "Shift the reference at point one row/hline up."
+  (interactive)
+  (org-table-fedit-shift-reference 'up))
+(defun org-table-fedit-ref-down ()
+  "Shift the reference at point one row/hline down."
+  (interactive)
+  (org-table-fedit-shift-reference 'down))
+(defun org-table-fedit-ref-left ()
+  "Shift the reference at point one field to the left."
+  (interactive)
+  (org-table-fedit-shift-reference 'left))
+(defun org-table-fedit-ref-right ()
+  "Shift the reference at point one field to the right."
+  (interactive)
+  (org-table-fedit-shift-reference 'right))
+
+(defun org-table-fedit-shift-reference (dir)
+  (cond
+   ((org-at-regexp-p "\\(\\<[a-zA-Z]\\)&")
+    (if (memq dir '(left right))
+	(org-rematch-and-replace 1 (eq dir 'left))
+      (error "Cannot shift reference in this direction")))
+   ((org-at-regexp-p "\\(\\<[a-zA-Z]\\{1,2\\}\\)\\([0-9]+\\)")
+    ;; A B3-like reference
+    (if (memq dir '(up down))
+	(org-rematch-and-replace 2 (eq dir 'up))
+      (org-rematch-and-replace 1 (eq dir 'left))))
+   ((org-at-regexp-p
+     "\\(@\\|\\.\\.\\)\\([-+]?\\(I+\\>\\|[0-9]+\\)\\)\\(\\$\\([-+]?[0-9]+\\)\\)?")
+    ;; An internal reference
+    (if (memq dir '(up down))
+	(org-rematch-and-replace 2 (eq dir 'up) (match-end 3))
+      (org-rematch-and-replace 5 (eq dir 'left))))))
+
+(defun org-rematch-and-replace (n &optional decr hline)
+  "Re-match the group N, and replace it with the shifted refrence."
+  (or (match-end n) (error "Cannot shift reference in this direction"))
+  (goto-char (match-beginning n))
+  (and (looking-at (regexp-quote (match-string n)))
+       (replace-match (org-shift-refpart (match-string 0) decr hline)
+		      t t)))
+
+(defun org-shift-refpart (ref &optional decr hline)
+  "Shift a refrence part REF.
+If DECR is set, decrease the references row/column, else increase.
+If HLINE is set, this may be a hline reference, it certainly is not
+a translation reference."
+  (save-match-data
+    (let* ((sign (string-match "^[-+]" ref)) n)
+
+      (if sign (setq sign (substring ref 0 1) ref (substring ref 1)))
+      (cond
+       ((and hline (string-match "^I+" ref))
+	(setq n (string-to-number (concat sign (number-to-string (length ref)))))
+	(setq n (+ n (if decr -1 1)))
+	(if (= n 0) (setq n (+ n (if decr -1 1))))
+	(if sign
+	    (setq sign (if (< n 0) "-" "+") n (abs n))
+	  (setq n (max 1 n)))
+	(concat sign (make-string n ?I)))
+
+       ((string-match "^[0-9]+" ref)
+	(setq n (string-to-number (concat sign ref)))
+	(setq n (+ n (if decr -1 1)))
+	(if sign
+	    (concat (if (< n 0) "-" "+") (number-to-string (abs n)))
+	  (number-to-string (max 1 n))))
+
+       ((string-match "^[a-zA-Z]+" ref)
+	(org-number-to-letters
+	 (max 1 (+ (org-letters-to-number ref) (if decr -1 1)))))
+
+       (t (error "Cannot shift reference"))))))
+
+(defun org-table-fedit-toggle-coordinates ()
+  "Toggle the display of coordinates in the refrenced table."
+  (interactive)
+  (let ((pos (marker-position org-pos)))
+    (with-current-buffer (marker-buffer org-pos)
+      (save-excursion
+	(goto-char pos)
+	(org-table-toggle-coordinate-overlays)))))
+
+(defun org-table-fedit-finish (&optional arg)
   "Parse the buffer for formula definitions and install them.
 With prefix ARG, apply the new formulas to the table."
   (interactive "P")
   (org-table-remove-rectangle-highlight)
+  (if org-table-use-standard-references
+      (progn
+	(org-table-fedit-convert-buffer 'org-table-convert-refs-to-rc)
+	(setq org-table-buffer-is-an nil)))
   (let ((pos org-pos) eql var form)
-    (setq org-pos nil)
     (goto-char (point-min))
     (while (re-search-forward
 	    "^\\(@[0-9]+\\$[0-9]+\\|\\$\\([a-zA-Z0-9]+\\)\\) *= *\\(.*\\(\n[ \t]+.*$\\)*\\)"
@@ -7997,9 +8728,13 @@
       (setq var (if (match-end 2) (match-string 2) (match-string 1))
 	    form (match-string 3))
       (setq form (org-trim form))
-      (while (string-match "[ \t]*\n[ \t]*" form)
-	(setq form (replace-match " " t t form)))
-      (push (cons var form) eql))
+      (when (not (equal form ""))
+	(while (string-match "[ \t]*\n[ \t]*" form)
+	  (setq form (replace-match " " t t form)))
+	(when (assoc var eql)
+	  (error "Double formulas for %s" var))
+	(push (cons var form) eql)))
+    (setq org-pos nil)
     (set-window-configuration org-window-configuration)
     (select-window (get-buffer-window (marker-buffer pos)))
     (goto-char pos)
@@ -8012,7 +8747,7 @@
 	(org-table-recalculate 'all)
       (message "New formulas installed - press C-u C-c C-c to apply."))))
 
-(defun org-abort-edit-formulas ()
+(defun org-table-fedit-abort ()
   "Abort editing formulas, without installing the changes."
   (interactive)
   (org-table-remove-rectangle-highlight)
@@ -8023,7 +8758,7 @@
     (move-marker pos nil)
     (message "Formula editing aborted without installing changes")))
 
-(defun org-edit-formula-lisp-indent ()
+(defun org-table-fedit-lisp-indent ()
   "Pretty-print and re-indent Lisp expressions in the Formula Editor."
   (interactive)
   (let ((pos (point)) beg end ind)
@@ -8064,7 +8799,7 @@
 
 (defvar org-show-positions nil)
 
-(defun org-show-reference (&optional local)
+(defun org-table-show-reference (&optional local)
   "Show the location/value of the $ expression at point."
   (interactive)
   (org-table-remove-rectangle-highlight)
@@ -8077,12 +8812,18 @@
 	  var name e what match dest)
       (if local (org-table-get-specials))
       (setq what (cond
-		  ((org-at-regexp-p org-table-range-regexp2) 'range)
+		  ((or (org-at-regexp-p org-table-range-regexp2)
+		       (org-at-regexp-p org-table-translate-regexp)
+		       (org-at-regexp-p org-table-range-regexp))
+		   (setq match
+			 (save-match-data
+			   (org-table-convert-refs-to-rc (match-string 0))))
+		   'range)
 		  ((org-at-regexp-p "\\$[a-zA-Z][a-zA-Z0-9]*") 'name)
 		  ((org-at-regexp-p "\\$[0-9]+") 'column)
 		  ((not local) nil)
 		  (t (error "No reference at point")))
-	    match (and what (match-string 0)))
+	    match (and what (or match (match-string 0))))
       (when (and  match (not (equal (match-beginning 0) (point-at-bol))))
 	(org-table-add-rectangle-overlay (match-beginning 0) (match-end 0)
 					 'secondary-selection))
@@ -8094,9 +8835,13 @@
 	(setq match (org-table-formula-substitute-names match)))
       (unless local
 	(save-excursion
+	  (end-of-line 1)
+	  (re-search-backward "^\\S-" nil t)
 	  (beginning-of-line 1)
-	  (when (looking-at "\\(\\$[0-9a-zA-Z]+\\|@[0-9]+\\$[0-9]+\\)=")
-	    (setq dest (match-string 1))
+	  (when (looking-at "\\(\\$[0-9a-zA-Z]+\\|@[0-9]+\\$[0-9]+\\|[a-zA-Z]+\\([0-9]+\\|&\\)\\) *=")
+	    (setq dest
+		  (save-match-data
+		    (org-table-convert-refs-to-rc (match-string 1))))
 	    (org-table-add-rectangle-overlay
 	     (match-beginning 1) (match-end 1) face2))))
       (if (and (markerp pos) (marker-buffer pos))
@@ -8165,18 +8910,20 @@
 	  (message "Constant: $%s=%s in `org-table-formula-constants'."
 		   var (cdr e)))
 	 ((setq e (and (fboundp 'constants-get) (constants-get var)))
-	  (message "Constant: $%s=%s, retrieved from `constants.el'." var e))
+	  (message "Constant: $%s=%s, from `constants.el'%s."
+		   var e (format " (%s units)" constants-unit-system)))
 	 (t (error "Undefined name $%s" var)))))
       (goto-char pos)
-      (when org-show-positions
+      (when (and org-show-positions
+                 (not (memq this-command '(org-table-fedit-scroll
+                                           org-table-fedit-scroll-down))))
 	(push pos org-show-positions)
+	(push org-table-current-begin-pos org-show-positions)
 	(let ((min (apply 'min org-show-positions))
 	      (max (apply 'max org-show-positions)))
-	  (when (or (not (pos-visible-in-window-p min))
-		    (not (pos-visible-in-window-p max)))
-	    (goto-char min)
-	    (set-window-start (selected-window) (point-at-bol))
-	    (goto-char pos))))
+          (goto-char min) (recenter 0)
+          (goto-char max)
+          (or (pos-visible-in-window-p max) (recenter -1))))
       (select-window win))))
 
 (defun org-table-force-dataline ()
@@ -8193,27 +8940,17 @@
 	    ((or p1 p2) (goto-char (or p1 p2)))
 	    (t (error "No table dataline around here"))))))
 
-(defun org-table-edit-line-up ()
+(defun org-table-fedit-line-up ()
   "Move cursor one line up in the window showing the table."
   (interactive)
-  (org-table-edit-move 'previous-line))
-
-(defun org-table-edit-line-down ()
+  (org-table-fedit-move 'previous-line))
+
+(defun org-table-fedit-line-down ()
   "Move cursor one line down in the window showing the table."
   (interactive)
- (org-table-edit-move 'next-line))
-
-(defun org-table-edit-backward-field ()
-  "Move cursor one field backward in the window showing the table."
-  (interactive)
-  (org-table-edit-move 'org-table-previous-field))
-
-(defun org-table-edit-next-field ()
-  "Move cursor one field forward in the window showing the table."
-  (interactive)
-  (org-table-edit-move 'org-table-next-field))
-
-(defun org-table-edit-move (command)
+ (org-table-fedit-move 'next-line))
+
+(defun org-table-fedit-move (command)
   "Move the cursor in the window shoinw the table.
 Use COMMAND to do the motion, repeat if necessary to end up in a data line."
   (let ((org-table-allow-automatic-line-recalculation nil)
@@ -8228,17 +8965,17 @@
     (move-marker pos (point))
     (select-window win)))
 
-(defun org-table-edit-scroll (N)
+(defun org-table-fedit-scroll (N)
   (interactive "p")
   (let ((other-window-scroll-buffer (marker-buffer org-pos)))
     (scroll-other-window N)))
 
-(defun org-table-edit-scroll-down (N)
+(defun org-table-fedit-scroll-down (N)
   (interactive "p")
-  (org-table-edit-scroll (- N)))
+  (org-table-fedit-scroll (- N)))
 
 (defvar org-table-rectangle-overlays nil)
-	
+
 (defun org-table-add-rectangle-overlay (beg end &optional face)
   "Add a new overlay."
   (let ((ov (org-make-overlay beg end)))
@@ -8290,7 +9027,7 @@
   (mapc 'org-delete-overlay org-table-coordinate-overlays)
   (setq org-table-coordinate-overlays nil)
   (save-excursion
-    (let ((id 0) (ih 0) hline eol str ic ov beg)
+    (let ((id 0) (ih 0) hline eol s1 s2 str ic ov beg)
       (goto-char (org-table-begin))
       (while (org-at-table-p)
 	(setq eol (point-at-eol))
@@ -8299,15 +9036,18 @@
 	(setq hline (looking-at org-table-hline-regexp))
 	(setq str (if hline (format "I*%-2d" (setq ih (1+ ih)))
 		    (format "%4d" (setq id (1+ id)))))
-	(org-overlay-before-string ov str 'org-formula 'evaporate)
+	(org-overlay-before-string ov str 'org-special-keyword 'evaporate)
 	(when hline
 	  (setq ic 0)
-	  (while (re-search-forward "[+|]-+" eol t)
+	  (while (re-search-forward "[+|]\\(-+\\)" eol t)
 	    (setq beg (1+ (match-beginning 0))
-		  str (concat "$" (int-to-string (setq ic (1+ ic)))))
+		  ic (1+ ic)
+		  s1 (concat "$" (int-to-string ic))
+		  s2 (org-number-to-letters ic)
+		  str (if (eq org-table-use-standard-references t) s2 s1))
 	    (setq ov (org-make-overlay beg (+ beg (length str))))
 	    (push ov org-table-coordinate-overlays)
-	    (org-overlay-display ov str 'org-formula 'evaporate)))
+	    (org-overlay-display ov str 'org-special-keyword 'evaporate)))
 	(beginning-of-line 2)))))
 
 (defun org-table-toggle-coordinate-overlays ()
@@ -8492,7 +9232,7 @@
 	  '("\C-c}"              org-table-toggle-coordinate-overlays)
 	  '("\C-c{"              org-table-toggle-formula-debugger)
 	  '("\C-m"               org-table-next-row)
-	  (list (org-key 'S-return) 'org-table-copy-down)
+	  '([(shift return)]     org-table-copy-down)
 	  '("\C-c\C-q"           org-table-wrap-region)
 	  '("\C-c?"              org-table-field-info)
 	  '("\C-c "              org-table-blank-field)
@@ -8507,34 +9247,34 @@
 	elt key fun cmd)
     (while (setq elt (pop bindings))
       (setq nfunc (1+ nfunc))
-      (setq key (car elt)
+      (setq key (org-key (car elt))
 	    fun (nth 1 elt)
 	    cmd (orgtbl-make-binding fun nfunc key))
-      (define-key orgtbl-mode-map key cmd))
+      (org-defkey orgtbl-mode-map key cmd))
 
     ;; Special treatment needed for TAB and RET
-    (define-key orgtbl-mode-map [(return)]
+    (org-defkey orgtbl-mode-map [(return)]
       (orgtbl-make-binding 'orgtbl-ret 100 [(return)] "\C-m"))
-    (define-key orgtbl-mode-map "\C-m"
+    (org-defkey orgtbl-mode-map "\C-m"
       (orgtbl-make-binding 'orgtbl-ret 101 "\C-m" [(return)]))
 
-    (define-key orgtbl-mode-map [(tab)]
+    (org-defkey orgtbl-mode-map [(tab)]
       (orgtbl-make-binding 'orgtbl-tab 102 [(tab)] "\C-i"))
-    (define-key orgtbl-mode-map "\C-i"
+    (org-defkey orgtbl-mode-map "\C-i"
       (orgtbl-make-binding 'orgtbl-tab 103 "\C-i" [(tab)]))
 
-    (define-key orgtbl-mode-map [(shift tab)]
+    (org-defkey orgtbl-mode-map [(shift tab)]
       (orgtbl-make-binding 'org-table-previous-field 104
 			   [(shift tab)] [(tab)] "\C-i"))
 
-    (define-key orgtbl-mode-map "\M-\C-m"
+    (org-defkey orgtbl-mode-map "\M-\C-m"
       (orgtbl-make-binding 'org-table-wrap-region 105
 			   "\M-\C-m" [(meta return)]))
-    (define-key orgtbl-mode-map [(meta return)]
+    (org-defkey orgtbl-mode-map [(meta return)]
       (orgtbl-make-binding 'org-table-wrap-region 106
 			   [(meta return)] "\M-\C-m"))
 
-    (define-key orgtbl-mode-map "\C-c\C-c" 'orgtbl-ctrl-c-ctrl-c)
+    (org-defkey orgtbl-mode-map "\C-c\C-c" 'orgtbl-ctrl-c-ctrl-c)
     (when orgtbl-optimized
       ;; If the user wants maximum table support, we need to hijack
       ;; some standard editing functions
@@ -8542,7 +9282,7 @@
 		 'self-insert-command 'orgtbl-self-insert-command
 		 'delete-char 'org-delete-char
 		 'delete-backward-char 'org-delete-backward-char)
-      (define-key orgtbl-mode-map "|" 'org-force-self-insert))
+      (org-defkey orgtbl-mode-map "|" 'org-force-self-insert))
     (easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu"
       '("OrgTbl"
 	["Align" org-ctrl-c-ctrl-c :active (org-at-table-p) :keys "C-c C-c"]
@@ -8678,7 +9418,31 @@
 (defvar orgtbl-exp-regexp "^\\([-+]?[0-9][0-9.]*\\)[eE]\\([-+]?[0-9]+\\)$"
   "Regula expression matching exponentials as produced by calc.")
 
-(defvar org-table-clean-did-remove-column-1 nil)
+(defvar org-table-clean-did-remove-column nil)
+
+(defun orgtbl-export (table target)
+  (let ((func (intern (concat "orgtbl-to-" (symbol-name target))))
+	(lines (org-split-string table "[ \t]*\n[ \t]*"))
+	org-table-last-alignment org-table-last-column-widths
+	maxcol column)
+    (if (not (fboundp func))
+	(error "Cannot export orgtbl table to %s" target))
+    (setq lines (org-table-clean-before-export lines))
+    (setq table
+	  (mapcar
+	   (lambda (x)
+	     (if (string-match org-table-hline-regexp x)
+		 'hline
+	       (org-split-string (org-trim x) "\\s-*|\\s-*")))
+	   lines))
+    (setq maxcol (apply 'max (mapcar (lambda (x) (if (listp x) (length x) 0))
+				     table)))
+    (loop for i from (1- maxcol) downto 0 do
+	  (setq column (mapcar (lambda (x) (if (listp x) (nth i x) nil)) table))
+	  (setq column (delq nil column))
+	  (push (apply 'max (mapcar 'string-width column)) org-table-last-column-widths)
+	  (push (> (/ (apply '+ (mapcar (lambda (x) (if (string-match org-table-number-regexp x) 1 0)) column)) maxcol) org-table-number-fraction) org-table-last-alignment))
+    (funcall func table nil)))
 
 (defun orgtbl-send-table (&optional maybe)
   "Send a tranformed version of this table to the receiver position.
@@ -8706,7 +9470,7 @@
 		 (org-table-begin) (org-table-end)))
 	   (lines (nthcdr (or skip 0) (org-split-string txt "[ \t]*\n[ \t]*")))
 	   (lines (org-table-clean-before-export lines))
-	   (i0 (if org-table-clean-did-remove-column-1 2 1))
+	   (i0 (if org-table-clean-did-remove-column 2 1))
 	   (table (mapcar
 		   (lambda (x)
 		     (if (string-match org-table-hline-regexp x)
@@ -8722,7 +9486,7 @@
 	   (org-table-last-column-widths
 	    (org-remove-by-index (funcall fun org-table-last-column-widths)
 				 skipcols i0)))
-      
+
       (unless (fboundp transform)
 	(error "No such transformation function %s" transform))
       (setq txt (funcall transform table params))
@@ -8754,7 +9518,7 @@
 			(setq i0 (1+ i0))
 			(if (memq i0 indices) :rm x))
 		      list))))
-				
+
 (defun orgtbl-toggle-comment ()
   "Comment or uncomment the orgtbl at point."
   (interactive)
@@ -8850,7 +9614,7 @@
 	 (splicep (plist-get p :splice))
 	 (hline (plist-get p :hline))
 	 rtn line i fm efm lfmt h)
-    
+
     ;; Do we have a header?
     (if (and (not splicep) (listp (car table)) (memq 'hline table))
 	(setq h t))
@@ -8858,7 +9622,7 @@
     ;; Put header
     (unless splicep
       (push (or (plist-get p :tstart) "ERROR: no :tstart") rtn))
-    
+
     ;; Now loop over all lines
     (while (setq line (pop table))
       (if (eq line 'hline)
@@ -8886,10 +9650,10 @@
 		 (mapconcat 'identity line (org-get-param p h i :sep :hsep))
 		 (org-get-param p h i :lend :hlend))
 		rtn))))
-    
-    (unless splicep 
+
+    (unless splicep
       (push (or (plist-get p :tend) "ERROR: no :tend") rtn))
-    
+
     (mapconcat 'identity (nreverse rtn) "\n")))
 
 (defun orgtbl-to-latex (table params)
@@ -9041,7 +9805,7 @@
 	(setq cpltxt (concat "bbdb:" (or name company))
 	      link (org-make-link cpltxt))
 	(org-store-link-props :type "bbdb" :name name :company company)))
-     
+
      ((eq major-mode 'Info-mode)
       (setq link (org-make-link "info:"
 				(file-name-nondirectory Info-current-file)
@@ -9219,7 +9983,7 @@
       (if (string-match "::\\'" cpltxt)
 	  (setq cpltxt (substring cpltxt 0 -2)))
       (setq link (org-make-link cpltxt)))
-     
+
      (buffer-file-name
       ;; Just link to this file here.
       (setq cpltxt (concat "file:"
@@ -9430,7 +10194,8 @@
 With three \\[universal-argument] prefixes, negate the meaning of
 `org-keep-stored-link-after-insertion'."
   (interactive "P")
-  (let ((region (if (org-region-active-p)
+  (let ((wcf (current-window-configuration))
+	(region (if (org-region-active-p)
 		    (prog1 (buffer-substring (region-beginning) (region-end))
 		      (delete-region (region-beginning) (region-end)))))
         tmphist ; byte-compile incorrectly complains about this
@@ -9469,13 +10234,31 @@
 	 (t (setq link (org-make-link "file:" file))))))
      (t
       ;; Read link, with completion for stored links.
-      ;; Fake a link history
+      (with-output-to-temp-buffer "*Org Links*"
+	(princ "Insert a link.  Use TAB to complete valid link prefixes.\n")
+	(when org-stored-links
+	  (princ "\nStored links ar available with <up>/<down> (most recent with RET):\n\n")
+	  (princ (mapconcat 'car (reverse org-stored-links) "\n"))))
+      (let ((cw (selected-window)))
+	(select-window (get-buffer-window "*Org Links*"))
+	(shrink-window-if-larger-than-buffer)
+	(setq truncate-lines t)
+	(select-window cw))
+      ;; Fake a link history, containing the stored links.
       (setq tmphist (append (mapcar 'car org-stored-links)
 			    org-insert-link-history))
-      (setq link (org-completing-read
-		  "Link: " org-stored-links nil nil nil
-		  'tmphist
-		  (or (car (car org-stored-links)))))
+      (unwind-protect
+	  (setq link (org-completing-read
+		      "Link: "
+		      (append
+		       (mapcar (lambda (x) (concat (car x) ":"))
+			       (append org-link-abbrev-alist-local org-link-abbrev-alist))
+		       (mapcar (lambda (x) (concat x ":")) org-link-types))
+		      nil nil nil
+		      'tmphist
+		      (or (car (car org-stored-links)))))
+	(set-window-configuration wcf)
+	(kill-buffer "*Org Links*"))
       (setq entry (assoc link org-stored-links))
       (or entry (push link org-insert-link-history))
       (if (funcall (if (equal complete-file '(64)) 'not 'identity)
@@ -9531,7 +10314,7 @@
 (defun org-completing-read (&rest args)
   (let ((minibuffer-local-completion-map
 	 (copy-keymap minibuffer-local-completion-map)))
-    (define-key minibuffer-local-completion-map " " 'self-insert-command)
+    (org-defkey minibuffer-local-completion-map " " 'self-insert-command)
     (apply 'completing-read args)))
 
 ;;; Opening/following a link
@@ -9637,7 +10420,7 @@
 	    (setq type (match-string 1) path (match-string 2))
 	    (throw 'match t)))
 	(save-excursion
-	  (when (org-in-regexp "\\(:[A-Za-z_@0-9:]+\\):[ \t\r\n]")
+	  (when (org-in-regexp "\\(:[A-Za-z_@0-9:]+\\):[ \t]*$")
 	    (setq type "tags"
 		  path (match-string 1))
 	    (while (string-match ":" path)
@@ -9830,6 +10613,10 @@
 in all files.  If AVOID-POS is given, ignore matches near that position."
   (let ((case-fold-search t)
 	(s0 (mapconcat 'identity (org-split-string s "[ \t\r\n]+") " "))
+	(markers (concat "\\(?:" (mapconcat (lambda (x) (regexp-quote (car x)))
+					    (append '((" ") ("\t") ("\n"))
+						    org-emphasis-alist)
+					    "\\|") "\\)"))
 	(pos (point))
 	(pre "") (post "")
 	words re0 re1 re2 re3 re4 re5 re2a reall)
@@ -9866,7 +10653,8 @@
       ;; Make a series of regular expressions to find a match
       (setq words (org-split-string s "[ \n\r\t]+")
 	    re0 (concat "\\(<<" (regexp-quote s0) ">>\\)")
-	    re2 (concat "[ \t\r\n]\\(" (mapconcat 'downcase words "[ \t]+") "\\)[ \t\r\n]")
+	    re2 (concat markers "\\(" (mapconcat 'downcase words "[ \t]+")
+			"\\)" markers)
 	    re2a (concat "[ \t\r\n]\\(" (mapconcat 'downcase words "[ \t\r\n]+") "\\)[ \t\r\n]")
 	    re4 (concat "[^a-zA-Z_]\\(" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\)[^a-zA-Z_]")
 	    re1 (concat pre re2 post)
@@ -9908,16 +10696,18 @@
   (let ((m org-open-link-marker))
     (catch 'exit
       (while (apply 're-search-forward args)
-	(goto-char (match-end group))
-	(if (and (or (not (eq (marker-buffer m) (current-buffer)))
-		     (> (match-beginning 0) (marker-position m))
-		     (< (match-end 0) (marker-position m)))
-		 (save-match-data
-		   (or (not (org-in-regexp org-bracket-link-analytic-regexp 1))
-		       (not (match-end 4))  ; no description
-		       (and (<= (match-beginning 4) (point))
-			    (>= (match-end 4) (point))))))
-		 (throw 'exit (point)))))))
+	(unless (get-text-property (match-end group) 'intangible) ; Emacs 21
+	  (goto-char (match-end group))
+	  (if (and (or (not (eq (marker-buffer m) (current-buffer)))
+		       (> (match-beginning 0) (marker-position m))
+		       (< (match-end 0) (marker-position m)))
+		   (save-match-data
+		     (or (not (org-in-regexp
+			       org-bracket-link-analytic-regexp 1))
+			 (not (match-end 4))  ; no description
+			 (and (<= (match-beginning 4) (point))
+			      (>= (match-end 4) (point))))))
+	      (throw 'exit (point))))))))
 
 (defun org-get-buffer-for-internal-link (buffer)
   "Return a buffer to be used for displaying the link target of internal links."
@@ -10065,7 +10855,7 @@
   (funcall (cdr (assq 'gnus org-link-frame-setup)))
   (if gnus-other-frame-object (select-frame gnus-other-frame-object))
   (cond ((and group article)
-	 (gnus-group-read-group 0 nil group)
+	 (gnus-group-read-group 1 nil group)
 	 (gnus-summary-goto-article (string-to-number article) nil t))
 	(group (gnus-group-jump-to-group group))))
 
@@ -10346,7 +11136,7 @@
 	(if (stringp command)
 	    (setq cmd command)
 	  (setq cmd 'emacs))))
-    (if (and (not (eq cmd 'emacs)) ; Emacs has not problems with non-ex files
+    (if (and (not (eq cmd 'emacs)) ; Emacs has no problems with non-ex files
 	     (not (file-exists-p file))
 	     (not org-open-non-existing-files))
 	(error "No such file: %s" file))
@@ -10380,10 +11170,6 @@
     org-file-apps-defaults-windowsnt)
    (t org-file-apps-defaults-gnu)))
 
-(defun org-expand-file-name (path)
-  "Replace special path abbreviations and expand the file name."
-  (expand-file-name path))
-
 (defvar ange-ftp-name-format) ; to silence the XEmacs compiler.
 (defun org-file-remote-p (file)
   "Test whether FILE specifies a location on a remote system.
@@ -10569,7 +11355,7 @@
     (replace-match ""))
   (catch 'quit
     (let* ((txt (buffer-substring (point-min) (point-max)))
-	   (fastp current-prefix-arg)
+	   (fastp (equal current-prefix-arg '(4)))
 	   (file (if fastp org-default-notes-file (org-get-org-file)))
 	   (heading org-remember-default-headline)
 	   (visiting (org-find-base-buffer-visiting file))
@@ -10577,6 +11363,7 @@
 	   (org-startup-align-all-tables nil)
 	   (org-goto-start-pos 1)
 	   spos level indent reversed)
+      (setq current-prefix-arg nil)
       ;; Modify text so that it becomes a nice subtree which can be inserted
       ;; into an org tree.
       (let* ((lines (split-string txt "\n"))
@@ -10597,13 +11384,13 @@
       ;; Find the file
       (if (not visiting) (find-file-noselect file))
       (with-current-buffer (or visiting (get-file-buffer file))
-	(save-excursion (and (goto-char (point-min))
-			     (not (re-search-forward "^\\* " nil t))
-			     (insert "\n* Notes\n")))
-	(setq reversed (org-notes-order-reversed-p))
 	(save-excursion
 	  (save-restriction
 	    (widen)
+	    (and (goto-char (point-min))
+		 (not (re-search-forward "^\\* " nil t))
+		 (insert "\n* Notes\n"))
+	    (setq reversed (org-notes-order-reversed-p))
 
 	    ;; Find the default location
 	    (when (and heading (stringp heading) (string-match "\\S-" heading))
@@ -10619,7 +11406,7 @@
 			   org-goto-start-pos
 			 (org-get-location (current-buffer) org-remember-help)))
 	    (if (not spos) (throw 'quit nil)) ; return nil to show we did
-					      ; not handle this note
+					; not handle this note
 	    (goto-char spos)
 	    (cond ((and (bobp) (not reversed))
 		   ;; Put it at the end, one level below level 1
@@ -10636,12 +11423,12 @@
 		     (re-search-forward "^\\*" nil t)
 		     (beginning-of-line 1)
 		     (org-paste-subtree 1 txt)))
-		  ((and (org-on-heading-p nil) (not current-prefix-arg))
+		  ((and (org-on-heading-p t) (not current-prefix-arg))
 		   ;; Put it below this entry, at the beg/end of the subtree
 		   (org-back-to-heading t)
 		   (setq level (funcall outline-level))
 		   (if reversed
-		       (outline-end-of-heading)
+		       (outline-next-heading)
 		     (org-end-of-subtree t))
 		   (if (not (bolp)) (newline))
 		   (beginning-of-line 1)
@@ -10649,7 +11436,9 @@
 		  (t
 		   ;; Put it right there, with automatic level determined by
 		   ;; org-paste-subtree or from prefix arg
-		   (org-paste-subtree current-prefix-arg txt)))
+		   (org-paste-subtree
+		    (if (numberp current-prefix-arg) current-prefix-arg)
+		    txt)))
 	    (when remember-save-after-remembering
 	      (save-buffer)
 	      (if (not visiting) (kill-buffer (current-buffer)))))))))
@@ -10838,7 +11627,7 @@
 		   ((string-match "\\`\\*+[ \t]*\\'"
 				  (buffer-substring (point-at-bol) beg))
 		    (setq type :todo)
-		    (mapcar 'list org-todo-keywords))
+		    (mapcar 'list org-todo-keywords-1))
 		   (searchhead
 		    (setq type :searchhead)
 		    (save-excursion
@@ -10926,6 +11715,8 @@
 'none             -> empty state
 \"\"(empty string)  -> switch to empty state
 'done             -> switch to DONE
+'nextset          -> switch to the next set of keywords
+'previousset      -> switch to the previous set of keywords
 \"WAITING\"         -> switch to the specified keyword, but only if it
                      really is a member of `org-todo-keywords'."
   (interactive "P")
@@ -10935,52 +11726,76 @@
     (or (looking-at (concat " +" org-todo-regexp " *"))
 	(looking-at " *"))
     (let* ((this (match-string 1))
+	   (head (org-get-todo-sequence-head this))
+	   (ass (assoc head org-todo-kwd-alist))
+	   (interpret (nth 1 ass))
+	   (done-word (nth 3 ass))
+	   (final-done-word (nth 4 ass))
 	   (last-state (or this ""))
 	   (completion-ignore-case t)
-	   (member (member this org-todo-keywords))
+	   (member (member this org-todo-keywords-1))
 	   (tail (cdr member))
 	   (state (cond
 		   ((equal arg '(4))
 		    ;; Read a state with completion
 		    (completing-read "State: " (mapcar (lambda(x) (list x))
-						       org-todo-keywords)
+						       org-todo-keywords-1)
 				     nil t))
 		   ((eq arg 'right)
 		    (if this
 			(if tail (car tail) nil)
-		      (car org-todo-keywords)))
+		      (car org-todo-keywords-1)))
 		   ((eq arg 'left)
-		    (if (equal member org-todo-keywords)
+		    (if (equal member org-todo-keywords-1)
 			nil
 		      (if this
-			  (nth (- (length org-todo-keywords) (length tail) 2)
-			       org-todo-keywords)
-			org-done-string)))
+			  (nth (- (length org-todo-keywords-1) (length tail) 2)
+			       org-todo-keywords-1)
+			(org-last org-todo-keywords-1))))
 		   (arg
-		    ;; user requests a specific state
+		    ;; user or caller requests a specific state
 		    (cond
 		     ((equal arg "") nil)
 		     ((eq arg 'none) nil)
-		     ((eq arg 'done) (org-last org-todo-keywords))
-		     ((car (member arg org-todo-keywords)))
+		     ((eq arg 'done) (or done-word (car org-done-keywords)))
+		     ((eq arg 'nextset)
+		      (or (car (cdr (member head org-todo-heads)))
+			  (car org-todo-heads)))
+		     ((eq arg 'previousset)
+		      (let ((org-todo-heads (reverse org-todo-heads)))
+			(or (car (cdr (member head org-todo-heads)))
+			    (car org-todo-heads))))
+		     ((car (member arg org-todo-keywords-1)))
 		     ((nth (1- (prefix-numeric-value arg))
-			     org-todo-keywords))))
-		   ((null member) (car org-todo-keywords))
+			     org-todo-keywords-1))))
+		   ((null member) (or head (car org-todo-keywords-1)))
+		   ((equal this final-done-word) nil) ;; -> make empty
 		   ((null tail) nil) ;; -> first entry
-		   ((eq org-todo-interpretation 'sequence)
+		   ((eq interpret 'sequence)
 		    (car tail))
-		   ((memq org-todo-interpretation '(type priority))
+		   ((memq interpret '(type priority))
 		    (if (eq this-command last-command)
 			(car tail)
-		      (if (> (length tail) 0) org-done-string nil)))
+		      (if (> (length tail) 0)
+			  (or done-word (car org-done-keywords))
+			nil)))
 		   (t nil)))
 	   (next (if state (concat " " state " ") " "))
 	   dostates)
       (replace-match next t t)
+      (unless head
+	(setq head (org-get-todo-sequence-head state)
+	      ass (assoc head org-todo-kwd-alist)
+	      interpret (nth 1 ass)
+	      done-word (nth 3 ass)
+	      final-done-word (nth 4 ass)))
+      (when (memq arg '(nextset previousset))
+	(message "Keyword set: %s"
+		 (mapconcat 'identity (assoc state org-todo-sets) " ")))
       (setq org-last-todo-state-is-todo
-	    (not (equal state org-done-string)))
-      (when org-log-done
-	(setq dostates (and (eq org-todo-interpretation 'sequence)
+	    (not (member state org-done-keywords)))
+      (when (and org-log-done (not (memq arg '(nextset previousset))))
+	(setq dostates (and (eq interpret 'sequence)
 			    (listp org-log-done) (memq 'state org-log-done)))
 	(cond
 	 ((and state (not this))
@@ -10988,7 +11803,7 @@
 	  (and dostates (org-add-log-maybe 'state state 'findpos)))
 	 ((and state dostates)
 	  (org-add-log-maybe 'state state 'findpos))
-	 ((equal state org-done-string)
+	 ((member state org-done-keywords)
 	  ;; Planning info calls the note-setting command.
 	  (org-add-planning-info 'closed (org-current-time)
 				 (if (org-get-repeat) nil 'scheduled))
@@ -10996,8 +11811,10 @@
       ;; Fixup tag positioning
       (and org-auto-align-tags (org-set-tags nil t))
       (run-hooks 'org-after-todo-state-change-hook)
-      (and (equal state org-done-string) (org-auto-repeat-maybe))
-      ))
+      (and (member state org-done-keywords) (org-auto-repeat-maybe))
+      (if (and arg (not (member state org-done-keywords)))
+	  (setq head (org-get-todo-sequence-head state)))
+      (put-text-property (point-at-bol) (point-at-eol) 'org-todo-head head)))
   ;; Fixup cursor location if close to the keyword
   (if (and (outline-on-heading-p)
 	   (not (bolp))
@@ -11008,8 +11825,24 @@
 	(goto-char (or (match-end 2) (match-end 1)))
 	(just-one-space))))
 
+(defun org-get-todo-sequence-head (kwd)
+  "Return the head of the TODO sequence to which KWD belongs.
+If KWD is not set, check if there is a text property remembering the
+right sequence."
+  (let (p)
+    (cond
+     ((not kwd)
+      (or (get-text-property (point-at-bol) 'org-todo-head)
+	  (progn
+	    (setq p (next-single-property-change (point-at-bol) 'org-todo-head
+						 nil (point-at-eol)))
+	    (get-text-property p 'org-todo-head))))
+     ((not (member kwd org-todo-keywords-1))
+      (car org-todo-keywords-1))
+     (t (nth 2 (assoc kwd org-todo-kwd-alist))))))
+
 (defun org-get-repeat ()
-  "Return the REPEAT statement of this entry."
+  "Check if tere is a deadline/schedule with repeater in this entry."
   (save-match-data
     (save-excursion
       (org-back-to-heading t)
@@ -11020,24 +11853,29 @@
 (defvar org-last-changed-timestamp)
 (defvar org-log-post-message)
 (defun org-auto-repeat-maybe ()
-  "Check if the current headline contains a REPEAT key.
-If yes, set TODO state back to what it was and change any SCHEDULED
-or DEADLINE times the new date.
+  "Check if the current headline contains a repeated deadline/schedule.
+If yes, set TODO state back to what it was and change the base date
+of repeating deadline/scheduled time stamps to new date.
 This function should be run in the `org-after-todo-state-change-hook'."
   ;; last-state is dynamically scoped into this function
-  (let ((repeat (org-get-repeat))
-	(whata '(("d" . day) ("m" . month) ("y" . year)))
-	(msg "Entry repeats: ")
-	(org-log-done)
-	re type n what start)
+  (let* ((repeat (org-get-repeat))
+	 (aa (assoc last-state org-todo-kwd-alist))
+	 (interpret (nth 1 aa))
+	 (head (nth 2 aa))
+	 (done-word (nth 3 aa))
+	 (whata '(("d" . day) ("m" . month) ("y" . year)))
+	 (msg "Entry repeats: ")
+	 (org-log-done)
+	 re type n what ts)
     (when repeat
-      (org-todo (if (eq 'org-todo-interpretation 'type)
-		    last-state
-		  (car org-todo-keywords)))
-      (unless (memq 'org-add-log-note (default-value 'post-command-hook))
+      (org-todo (if (eq interpret 'type) last-state head))
+      (when (and org-log-repeat
+		 (not (memq 'org-add-log-note
+			    (default-value 'post-command-hook))))
 	;; Make sure a note is taken
 	(let ((org-log-done '(done)))
-	  (org-add-log-maybe 'done org-done-string 'findpos)))
+	  (org-add-log-maybe 'done (or done-word (car org-done-keywords))
+			     'findpos)))
       (org-back-to-heading t)
       (org-add-planning-info nil nil 'closed)
       (setq re (concat "\\(" org-scheduled-time-regexp "\\)\\|\\("
@@ -11045,11 +11883,10 @@
       (while (re-search-forward
 	      re (save-excursion (outline-next-heading) (point)) t)
 	(setq type (if (match-end 1) org-scheduled-string org-deadline-string)
-	      start 0)
-	(while (string-match "\\([-+]?[0-9]+\\)\\([dwmy]\\)" repeat start)
-	  (setq start (match-end 0)
-		n (string-to-number (match-string 1 repeat))
-		what (match-string 2 repeat))
+	      ts (match-string (if (match-end 2) 2 4)))
+	(when (string-match "\\([-+]?[0-9]+\\)\\([dwmy]\\)" ts)
+	  (setq	n (string-to-number (match-string 1 ts))
+		what (match-string 2 ts))
 	  (if (equal what "w") (setq n (* n 7) what "d"))
 	  (org-timestamp-change n (cdr (assoc what whata))))
 	(setq msg (concat msg type org-last-changed-timestamp " ")))
@@ -11062,15 +11899,20 @@
 headlines above the match.
 With \\[universal-argument] prefix, also show the DONE entries.
 With a numeric prefix N, construct a sparse tree for the Nth element
-of `org-todo-keywords'."
+of `org-todo-keywords-1'."
   (interactive "P")
   (let ((case-fold-search nil)
 	(kwd-re
 	 (cond ((null arg) org-not-done-regexp)
-	       ((equal arg '(4)) org-todo-regexp)
-	       ((<= (prefix-numeric-value arg) (length org-todo-keywords))
+	       ((equal arg '(4))
+		(let ((kwd (completing-read "Keyword (or KWD1|KWD2|...): "
+					    (mapcar 'list org-todo-keywords-1))))
+		  (concat "\\("
+			  (mapconcat 'identity (org-split-string kwd "|") "\\|")
+			  "\\)\\>")))
+	       ((<= (prefix-numeric-value arg) (length org-todo-keywords-1))
 		(regexp-quote (nth (1- (prefix-numeric-value arg))
-				   org-todo-keywords)))
+				   org-todo-keywords-1)))
 	       (t (error "Invalid prefix argument: %s" arg)))))
     (message "%d TODO entries found"
 	     (org-occur (concat "^" outline-regexp " +" kwd-re )))))
@@ -11143,9 +11985,11 @@
 		   ((eq what 'deadline) org-deadline-string)
 		   ((eq what 'closed) org-closed-string))
 	     " ")
-	    (org-insert-time-stamp time 
-				   (or org-time-was-given (eq what 'closed))
-				   (eq what 'closed))
+	    (org-insert-time-stamp
+	     time
+	     (or org-time-was-given
+		 (and (eq what 'closed) org-log-done-with-time))
+	     (eq what 'closed))
 	    (end-of-line 1))
 	  (goto-char (point-min))
 	  (widen)
@@ -11163,6 +12007,7 @@
 The auto-repeater uses this.")
 
 (defun org-add-log-maybe (&optional purpose state findpos)
+  "Set up the post command hook to take a note."
   (save-excursion
     (when (and (listp org-log-done)
 	       (memq purpose org-log-done))
@@ -11221,17 +12066,18 @@
 				"")))))
       (if lines (setq note (concat note " \\\\")))
       (push note lines))
-    (save-excursion
-      (set-buffer (marker-buffer org-log-note-marker))
+    (when lines
       (save-excursion
-	(goto-char org-log-note-marker)
-	(move-marker org-log-note-marker nil)
-	(end-of-line 1)
-	(if (not (bolp)) (insert "\n")) (indent-relative nil)
-	(setq ind (concat (buffer-substring (point-at-bol) (point)) "    "))
-	(insert "  - " (pop lines))
-	(while lines
-	  (insert "\n" ind (pop lines))))))
+	(set-buffer (marker-buffer org-log-note-marker))
+	(save-excursion
+	  (goto-char org-log-note-marker)
+	  (move-marker org-log-note-marker nil)
+	  (end-of-line 1)
+	  (if (not (bolp)) (insert "\n")) (indent-relative nil)
+	  (setq ind (concat (buffer-substring (point-at-bol) (point)) "    "))
+	  (insert "  - " (pop lines))
+	  (while lines
+	    (insert "\n" ind (pop lines)))))))
   (set-window-configuration org-log-note-window-configuration)
   (with-current-buffer (marker-buffer org-log-note-return-to)
     (goto-char org-log-note-return-to))
@@ -11264,7 +12110,8 @@
 	(when (or (not callback)
 		  (save-match-data (funcall callback)))
 	  (setq cnt (1+ cnt))
-	  (org-highlight-new-match (match-beginning 0) (match-end 0))
+	  (when org-highlight-sparse-tree-matches
+	    (org-highlight-new-match (match-beginning 0) (match-end 0)))
 	  (org-show-context 'occur-tree))))
     (when org-remove-highlights-with-change
       (org-add-hook 'before-change-functions 'org-remove-occur-highlights
@@ -11342,7 +12189,7 @@
 
 ;;;; Priorities
 
-(defvar org-priority-regexp ".*?\\(\\[#\\([A-Z]\\)\\] ?\\)"
+(defvar org-priority-regexp ".*?\\(\\[#\\([A-Z0-9]\\)\\] ?\\)"
   "Regular expression matching the priority indicator.")
 
 (defvar org-remove-priority-next-time nil)
@@ -11371,18 +12218,18 @@
 	(setq current org-default-priority))
       (cond
        ((eq action 'set)
-	(message "Priority A-%c, SPC to remove: " org-lowest-priority)
+	(message "Priority %c-%c, SPC to remove: " org-highest-priority org-lowest-priority)
 	(setq new (read-char-exclusive))
 	(cond ((equal new ?\ ) (setq remove t))
-	      ((or (< (upcase new) ?A) (> (upcase new) org-lowest-priority))
+	      ((or (< (upcase new) org-highest-priority) (> (upcase new) org-lowest-priority))
 	       (error "Priority must be between `%c' and `%c'"
-		      ?A org-lowest-priority))))
+		      org-highest-priority org-lowest-priority))))
        ((eq action 'up)
 	(setq new (1- current)))
        ((eq action 'down)
 	(setq new (1+ current)))
        (t (error "Invalid action")))
-      (setq new (min (max ?A (upcase new)) org-lowest-priority))
+      (setq new (min (max org-highest-priority (upcase new)) org-lowest-priority))
       (setq news (format "%c" new))
       (if have
 	  (if remove
@@ -11419,15 +12266,14 @@
 inclusion.  When TODO-ONLY is non-nil, only lines with a TODO keyword
 are included in the output."
   (let* ((re (concat "[\n\r]" outline-regexp " *\\(\\<\\("
-		     (mapconcat 'regexp-quote
-				(nreverse (cdr (reverse org-todo-keywords)))
-				"\\|")
+		     (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
 		     "\\>\\)\\)? *\\(.*?\\)\\(:[A-Za-z_@0-9:]+:\\)?[ \t]*$"))
 	 (props (list 'face nil
 		      'done-face 'org-done
 		      'undone-face nil
 		      'mouse-face 'highlight
 		      'org-not-done-regexp org-not-done-regexp
+		      'org-todo-regexp org-todo-regexp
 		      'keymap org-agenda-keymap
 		      'help-echo
 		      (format "mouse-2 or RET jump to org file %s"
@@ -11435,7 +12281,7 @@
 	 (case-fold-search nil)
          lspos
 	 tags tags-list tags-alist (llast 0) rtn level category i txt
-	 todo marker entry)
+	 todo marker entry priority)
     (save-excursion
       (goto-char (point-min))
       (when (eq action 'sparse-tree) (org-overview))
@@ -11462,7 +12308,7 @@
 		(if org-use-tag-inheritance
 		    (apply 'append (mapcar 'cdr tags-alist))
 		  tags))
-	  (when (and (or (not todo-only) todo)
+	  (when (and (or (not todo-only) (member todo org-not-done-keywords))
 		     (eval matcher)
 		     (or (not org-agenda-skip-archived-trees)
 			 (not (member org-archive-tag tags-list))))
@@ -11477,11 +12323,13 @@
 			  (if org-tags-match-list-sublevels
 			      (make-string (1- level) ?.) "")
 			  (org-get-heading))
-			 category tags-list))
+			 category tags-list)
+		    priority (org-get-priority txt))
 	      (goto-char lspos)
 	      (setq marker (org-agenda-new-marker))
 	      (org-add-props txt props
-		'org-marker marker 'org-hd-marker marker 'org-category category)
+		'org-marker marker 'org-hd-marker marker 'org-category category
+		'priority priority 'type "tagsmatch")
 	      (push txt rtn))
 	    ;; if we are to skip sublevels, jump to end of subtree
 	    (or org-tags-match-list-sublevels (org-end-of-subtree t))))))
@@ -11610,7 +12458,7 @@
     (if arg
 	(save-excursion
 	  (goto-char (point-min))
-	  (let (buffer-invisibility-spec)  ; Emacs 21 compatibility
+	  (let ((buffer-invisibility-spec (org-inhibit-invisibility)))
 	    (while (re-search-forward re nil t)
 	      (org-set-tags nil t)
 	      (end-of-line 1)))
@@ -11637,11 +12485,12 @@
 	(while (string-match "[-+&]+" tags)
 	  ;; No boolean logic, just a list
 	  (setq tags (replace-match ":" t t tags))))
+
       (if (string-match "\\`[\t ]*\\'" tags)
           (setq tags "")
 	(unless (string-match ":$" tags) (setq tags (concat tags ":")))
 	(unless (string-match "^:" tags) (setq tags (concat ":" tags))))
-      
+
       ;; Insert new tags at the correct column
       (beginning-of-line 1)
       (if (re-search-forward
@@ -11728,7 +12577,7 @@
 	 (fwidth (+ maxlen 3 1 3))
 	 (ncol (/ (- (window-width) 4) fwidth))
 	 (i-face 'org-done)
-	 (c-face 'org-tag)
+	 (c-face 'org-todo)
 	 tg cnt e c char c1 c2 ntable tbl rtn
 	 ov-start ov-end ov-prefix
 	 (exit-after-next org-fast-tag-selection-single-key)
@@ -12014,9 +12863,9 @@
 	 (timestr (format-time-string
 		   (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time))
 	 (prompt (concat (if prompt (concat prompt " ") "")
-			 (format "YYYY-MM-DD [%s]: " timestr)))
+			 (format "Date and/or time (default [%s]): " timestr)))
 	 ans (org-ans0 "") org-ans1 org-ans2 (deltadays 0)
-	 second minute hour day month year tl wday wday1)
+	 second minute hour day month year tl wday wday1 pm)
 
     (cond
      (from-string (setq ans from-string))
@@ -12027,44 +12876,43 @@
 	  (calendar-forward-day (- (time-to-days default-time)
 				   (calendar-absolute-from-gregorian
 				    (calendar-current-date))))
-	  (org-eval-in-calendar nil)
+	  (org-eval-in-calendar nil t)
 	  (let* ((old-map (current-local-map))
 		 (map (copy-keymap calendar-mode-map))
 		 (minibuffer-local-map (copy-keymap minibuffer-local-map)))
-	    (define-key map (kbd "RET") 'org-calendar-select)
-	    (define-key map (if (featurep 'xemacs) [button1] [mouse-1])
+	    (org-defkey map (kbd "RET") 'org-calendar-select)
+	    (org-defkey map (if (featurep 'xemacs) [button1] [mouse-1])
 	      'org-calendar-select-mouse)
-	    (define-key map (if (featurep 'xemacs) [button2] [mouse-2])
+	    (org-defkey map (if (featurep 'xemacs) [button2] [mouse-2])
 	      'org-calendar-select-mouse)
-	    (define-key minibuffer-local-map [(meta shift left)]
+	    (org-defkey minibuffer-local-map [(meta shift left)]
 	      (lambda () (interactive)
 		(org-eval-in-calendar '(calendar-backward-month 1))))
-	    (define-key minibuffer-local-map [(meta shift right)]
+	    (org-defkey minibuffer-local-map [(meta shift right)]
 	      (lambda () (interactive)
 		(org-eval-in-calendar '(calendar-forward-month 1))))
-	    (define-key minibuffer-local-map [(shift up)]
+	    (org-defkey minibuffer-local-map [(shift up)]
 	      (lambda () (interactive)
 		(org-eval-in-calendar '(calendar-backward-week 1))))
-	    (define-key minibuffer-local-map [(shift down)]
+	    (org-defkey minibuffer-local-map [(shift down)]
 	      (lambda () (interactive)
 		(org-eval-in-calendar '(calendar-forward-week 1))))
-	    (define-key minibuffer-local-map [(shift left)]
+	    (org-defkey minibuffer-local-map [(shift left)]
 	      (lambda () (interactive)
 		(org-eval-in-calendar '(calendar-backward-day 1))))
-	    (define-key minibuffer-local-map [(shift right)]
+	    (org-defkey minibuffer-local-map [(shift right)]
 	      (lambda () (interactive)
 		(org-eval-in-calendar '(calendar-forward-day 1))))
-	    (define-key minibuffer-local-map ">"
+	    (org-defkey minibuffer-local-map ">"
 	      (lambda () (interactive)
 		(org-eval-in-calendar '(scroll-calendar-left 1))))
-	    (define-key minibuffer-local-map "<"
+	    (org-defkey minibuffer-local-map "<"
 	      (lambda () (interactive)
 		(org-eval-in-calendar '(scroll-calendar-right 1))))
 	    (unwind-protect
 		(progn
 		  (use-local-map map)
 		  (setq org-ans0 (read-string prompt "" nil nil))
-;		  (if (not (string-match "\\S-" org-ans0)) (setq org-ans0 nil))
 		  ;; org-ans0: from prompt
 		  ;; org-ans1: from mouse click
 		  ;; org-ans2: from calendar motion
@@ -12077,17 +12925,30 @@
     (if (string-match "^[ \t]*[-+][0-9]+[ \t]*$" org-ans0)
 	(setq deltadays (string-to-number ans) ans ""))
 
-    (if (string-match
-	 "^ *\\(\\([0-9]+\\)-\\)?\\([0-1]?[0-9]\\)-\\([0-3]?[0-9]\\)\\([^-0-9]\\|$\\)" ans)
-	(progn
-	  (setq year (if (match-end 2)
-			 (string-to-number (match-string 2 ans))
-		       (string-to-number (format-time-string "%Y")))
-		month (string-to-number (match-string 3 ans))
-		day (string-to-number (match-string 4 ans)))
-	  (if (< year 100) (setq year (+ 2000 year)))
-	  (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
-				   t nil ans))))
+    ;; Help matching ISO dates with single digit month ot day, like 2006-8-11.
+    (when (string-match
+	   "^ *\\(\\([0-9]+\\)-\\)?\\([0-1]?[0-9]\\)-\\([0-3]?[0-9]\\)\\([^-0-9]\\|$\\)" ans)
+      (setq year (if (match-end 2)
+		     (string-to-number (match-string 2 ans))
+		   (string-to-number (format-time-string "%Y")))
+	    month (string-to-number (match-string 3 ans))
+	    day (string-to-number (match-string 4 ans)))
+      (if (< year 100) (setq year (+ 2000 year)))
+      (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
+			       t nil ans)))
+    ;; Help matching am/pm times, because `parse-time-string' does not do that.
+    ;; If there is a time with am/pm, and *no* time without it, we convert
+    ;; convert so that matching will be successful.
+    (when (and (not (string-match "[012]?[0-9]:[0-9][0-9]\\([ \t\n]\\|$\\)" ans))
+	       (string-match "\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\(am\\|AM\\|pm\\|PM\\)\\>" ans))
+      (setq hour (string-to-number (match-string 1 ans))
+	    minute (if (match-end 3) (string-to-number (match-string 3 ans)) 0)
+	    pm (equal ?p (string-to-char (downcase (match-string 4 ans)))))
+      (if (and (= hour 12) (not pm))
+	  (setq hour 0)
+	(if (and pm (< hour 12)) (setq hour (+ 12 hour))))
+      (setq ans (replace-match (format "%02d:%02d" hour minute) t t ans)))
+
     (setq tl (parse-time-string ans)
 	  year (or (nth 5 tl) (string-to-number (format-time-string "%Y" ct)))
 	  month (or (nth 4 tl) (string-to-number (format-time-string "%m" ct)))
@@ -12113,18 +12974,28 @@
 	  (format "%04d-%02d-%02d %02d:%02d" year month day hour minute)
 	(format "%04d-%02d-%02d" year month day)))))
 
-(defun org-eval-in-calendar (form)
+(defun org-eval-in-calendar (form &optional keepdate)
   "Eval FORM in the calendar window and return to current window.
 Also, store the cursor date in variable org-ans2."
   (let ((sw (selected-window)))
     (select-window (get-buffer-window "*Calendar*"))
     (eval form)
-    (when (calendar-cursor-to-date)
+    (when (and (not keepdate) (calendar-cursor-to-date))
       (let* ((date (calendar-cursor-to-date))
 	     (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
 	(setq org-ans2 (format-time-string "%Y-%m-%d" time))))
     (org-move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
-    (select-window sw)))
+    (select-window sw)
+    ;; Update the prompt to show new default date
+    (save-excursion
+      (goto-char (point-min))
+      (when (and org-ans2
+		 (re-search-forward "\\[[-0-9]+\\]" nil t)
+		 (get-text-property (match-end 0) 'field))
+	(let ((inhibit-read-only t))
+	  (replace-match (concat "[" org-ans2 "]") t t)
+	  (add-text-properties (point-min) (1+ (match-end 0))
+			       (text-properties-at (1+ (point-min)))))))))
 
 (defun org-calendar-select ()
   "Return to `org-read-date' with the date currently selected.
@@ -12136,7 +13007,7 @@
       (setq org-ans1 (format-time-string "%Y-%m-%d" time)))
     (if (active-minibuffer-window) (exit-minibuffer))))
 
-(defun org-insert-time-stamp (time &optional with-hm inactive pre post)
+(defun org-insert-time-stamp (time &optional with-hm inactive pre post extra)
   "Insert a date stamp for the date given by the internal TIME.
 WITH-HM means, use the stamp format that includes the time of the day.
 INACTIVE means use square brackets instead of angular ones, so that the
@@ -12149,6 +13020,10 @@
     (if inactive (setq fmt (concat "[" (substring fmt 1 -1) "]")))
     (insert (or pre ""))
     (insert (setq stamp (format-time-string fmt time)))
+    (when extra
+      (backward-char 1)
+      (insert extra)
+      (forward-char 1))
     (insert (or post ""))
     stamp))
 
@@ -12175,17 +13050,22 @@
 
 (defun org-display-custom-time (beg end)
   "Overlay modified time stamp format over timestamp between BED and END."
-  (let* ((t1 (save-match-data
-	       (org-parse-time-string (buffer-substring beg end) t)))
-	 (w1 (- end beg))
-	 (with-hm (and (nth 1 t1) (nth 2 t1)))
-	 (tf (funcall (if with-hm 'cdr 'car) org-time-stamp-custom-formats))
-	 (time (org-fix-decoded-time t1))
-	 (str (org-add-props
+  (let* ((ts (buffer-substring beg end))
+	 t1 w1 with-hm tf time str w2 (off 0))
+    (save-match-data
+      (setq t1 (org-parse-time-string ts t))
+      (if (string-match " \\+[0-9]+[dwmy]\\'" ts)
+	  (setq off (- (match-end 0) (match-beginning 0)))))
+    (setq end (- end off))
+    (setq w1 (- end beg)
+	  with-hm (and (nth 1 t1) (nth 2 t1))
+	  tf (funcall (if with-hm 'cdr 'car) org-time-stamp-custom-formats)
+	  time (org-fix-decoded-time t1)
+	  str (org-add-props
 		  (format-time-string
 		   (substring tf 1 -1) (apply 'encode-time time))
-		  nil 'mouse-face 'highlight))
-	 (w2 (length str)))
+		  nil 'mouse-face 'highlight)
+	  w2 (length str))
     (if (not (= w2 w1))
 	(add-text-properties (1+ beg) (+ 2 beg)
 			     (list 'org-dwidth t 'org-dwidth-n (- w1 w2))))
@@ -12349,6 +13229,133 @@
 (defun org-time-string-to-time (s)
   (apply 'encode-time (org-parse-time-string s)))
 
+(defun org-time-string-to-absolute (s &optional daynr)
+  "Convert a time stamp to an absolute day number.
+If there is a specifyer for a cyclic time stamp, get the closest date to
+DATE."
+  (cond
+   ((and daynr (string-match "\\`%%\\((.*)\\)" s))
+    (if (org-diary-sexp-entry (match-string 1 s) "" date)
+	daynr
+      (+ daynr 1000)))
+   ((and daynr (string-match "\\+[0-9]+[dwmy]" s))
+    (org-closest-date s (if (and (boundp 'daynr) (integerp daynr)) daynr
+			  (time-to-days (current-time))) (match-string 0 s)))
+   (t (time-to-days (apply 'encode-time (org-parse-time-string s))))))
+
+(defun org-calendar-holiday ()
+  "List of holidays, for Diary display in Org-mode."
+  (let ((hl (check-calendar-holidays date)))
+    (if hl (mapconcat 'identity hl "; "))))
+
+(defun org-diary-sexp-entry (sexp entry date)
+  "Process a SEXP diary ENTRY for DATE."
+  (let ((result (if calendar-debug-sexp
+                    (let ((stack-trace-on-error t))
+                      (eval (car (read-from-string sexp))))
+                  (condition-case nil
+                      (eval (car (read-from-string sexp)))
+                    (error
+                     (beep)
+                     (message "Bad sexp at line %d in %s: %s"
+			      (org-current-line)
+			      (buffer-file-name) sexp)
+                     (sleep-for 2))))))
+    (cond ((stringp result) result)
+	  ((and (consp result)
+		(stringp (cdr result))) (cdr result))
+	  (result entry)
+          (t nil))))
+
+(defun org-diary-to-ical-string (frombuf)
+  "FIXME"
+  (let* ((tmpdir (if (featurep 'xemacs)
+		     (temp-directory)
+		   temporary-file-directory))
+	 (tmpfile (make-temp-name
+		   (expand-file-name "orgics" tmpdir)))
+	 buf rtn b e)
+    (save-excursion
+      (set-buffer frombuf)
+      (icalendar-export-region (point-min) (point-max) tmpfile)
+      (setq buf (find-buffer-visiting tmpfile))
+      (set-buffer buf)
+      (goto-char (point-min))
+      (if (re-search-forward "^BEGIN:VEVENT" nil t)
+	  (setq b (match-beginning 0)))
+      (goto-char (point-max))
+      (if (re-search-backward "^END:VEVENT" nil t)
+	  (setq e (match-end 0)))
+      (setq rtn (if (and b e) (concat (buffer-substring b e) "\n") "")))
+    (kill-buffer buf)
+    (kill-buffer frombuf)
+    (delete-file tmpfile)
+    rtn))
+
+(defun org-closest-date (start current change)
+  "Find the date closest to CURRENT that is consistent with START and CHANGE."
+  ;; Make the proper lists from the dates
+  (catch 'exit
+    (let ((a1 '(("d" . day) ("w" . week) ("m" . month) ("y" . year)))
+	  dn dw sday cday n1 n2
+	  d m y y1 y2 date1 date2 nmonths nm ny m2)
+
+      (setq start (org-date-to-gregorian start)
+	    current (org-date-to-gregorian current)
+	    sday (calendar-absolute-from-gregorian start)
+	    cday  (calendar-absolute-from-gregorian current))
+
+      (if (<= cday sday) (throw 'exit sday))
+
+      (if (string-match "\\(\\+[0-9]+\\)\\([dwmy]\\)" change)
+	  (setq dn (string-to-number (match-string 1 change))
+		dw (cdr (assoc (match-string 2 change) a1)))
+	(error "Invalid change specifyer: %s" change))
+      (if (eq dw 'week) (setq dw 'day dn (* 7 dn)))
+      (cond
+       ((eq dw 'day)
+	(setq n1 (+ sday (* dn (floor (/ (- cday sday) dn))))
+	      n2 (+ n1 dn)))
+       ((eq dw 'year)
+	(setq d (nth 1 start) m (car start) y1 (nth 2 start) y2 (nth 2 current))
+	(setq y1 (+ (* (floor (/ (- y2 y1) dn)) dn) y1))
+	(setq date1 (list m d y1)
+	      n1 (calendar-absolute-from-gregorian date1)
+	      date2 (list m d (+ y1 (* (if (< n1 cday) 1 -1) dn)))
+	      n2 (calendar-absolute-from-gregorian date2)))
+       ((eq dw 'month)
+	;; approx number of month between the tow dates
+	(setq nmonths (floor (/ (- cday sday) 30.436875)))
+	;; How often does dn fit in there?
+	(setq d (nth 1 start) m (car start) y (nth 2 start)
+	      nm (* dn (max 0 (1- (floor (/ nmonths dn)))))
+	      m (+ m nm)
+	      ny (floor (/ m 12))
+	      y (+ y ny)
+	      m (- m (* ny 12)))
+	(while (> m 12) (setq m (- m 12) y (1+ y)))
+	(setq n1 (calendar-absolute-from-gregorian (list m d y)))
+	(setq m2 (+ m dn) y2 y)
+	(if (> m2 12) (setq y2 (1+ y2) m2 (- m2 12)))
+	(setq n2 (calendar-absolute-from-gregorian (list m2 d y2)))
+	(while (< n2 cday)
+	  (setq n1 n2 m m2 y y2)
+	  (setq m2 (+ m dn) y2 y)
+	  (if (> m2 12) (setq y2 (1+ y2) m2 (- m2 12)))
+	  (setq n2 (calendar-absolute-from-gregorian (list m2 d y2))))))
+
+      (if (> (abs (- cday n1)) (abs (- cday n2))) n2 n1))))
+
+(defun org-date-to-gregorian (date)
+  "Turn any specification of DATE into a gregorian date for the calendar."
+  (cond ((integerp date) (calendar-gregorian-from-absolute date))
+	((and (listp date) (= (length date) 3)) date)
+	((stringp date)
+	 (setq date (org-parse-time-string date))
+	 (list (nth 4 date) (nth 3 date) (nth 5 date)))
+	((listp date)
+	 (list (nth 4 date) (nth 3 date) (nth 5 date)))))
+
 (defun org-parse-time-string (s &optional nodefault)
   "Parse the standard Org-mode time string.
 This should be a lot faster than the normal `parse-time-string'.
@@ -12436,6 +13443,7 @@
   (let ((pos (point))
 	with-hm inactive
 	org-ts-what
+	extra
 	ts time time0)
     (if (not (org-at-timestamp-p t))
 	(error "Not at a timestamp"))
@@ -12445,12 +13453,13 @@
 	     (not (get-text-property (1- (point)) 'display)))
 	(setq org-ts-what 'day))
     (setq org-ts-what (or what org-ts-what)
-	  with-hm (<= (abs (- (cdr org-ts-lengths)
-			      (- (match-end 0) (match-beginning 0))))
-		      1)
 	  inactive (= (char-after (match-beginning 0)) ?\[)
 	  ts (match-string 0))
     (replace-match "")
+    (if (string-match " \\+[0-9]+[dwmy]" ts)
+	(setq extra (match-string 0 ts)))
+    (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts)
+	(setq with-hm t))
     (setq time0 (org-parse-time-string ts))
     (setq time
 	  (apply 'encode-time
@@ -12476,7 +13485,7 @@
 	  (setcar (nthcdr 2 time0) (or (nth 1 time0) 0))
 	  (setq time (apply 'encode-time time0))))
     (setq org-last-changed-timestamp
-	  (org-insert-time-stamp time with-hm inactive))
+	  (org-insert-time-stamp time with-hm inactive nil nil extra))
     (org-clock-update-time-maybe)
     (goto-char pos)
     ;; Try to recenter the calendar window, if any
@@ -12525,8 +13534,27 @@
 
 ;;; The clock for measuring work time.
 
+(defvar org-mode-line-string "")
+(put 'org-mode-line-string 'risky-local-variable t)
+
+(defvar org-mode-line-timer nil)
+(defvar org-clock-heading "")
+(defvar org-clock-start-time "")
+
+(defun org-update-mode-line ()
+  (let* ((delta (- (time-to-seconds (current-time))
+                   (time-to-seconds org-clock-start-time)))
+	 (h (floor delta 3600))
+	 (m (floor (- delta (* 3600 h)) 60)))
+    (setq org-mode-line-string
+	  (propertize (format "-[%d:%02d (%s)]" h m org-clock-heading)
+		      'help-echo "Org-mode clock is running"))
+    (force-mode-line-update)))
+
 (defvar org-clock-marker (make-marker)
   "Marker recording the last clock-in.")
+(defvar org-clock-mode-line-entry nil
+  "Information for the modeline about the running clock.")
 
 (defun org-clock-in ()
   "Start the clock on the current item.
@@ -12536,6 +13564,10 @@
   (let (ts)
     (save-excursion
       (org-back-to-heading t)
+      (if (looking-at org-todo-line-regexp)
+	  (setq org-clock-heading (match-string 3))
+	(setq org-clock-heading "???"))
+      (setq org-clock-heading (propertize org-clock-heading 'face nil))
       (beginning-of-line 2)
       (when (and (looking-at (concat "[ \t]*" org-keyword-time-regexp))
 		 (not (equal (match-string 1) org-clock-string)))
@@ -12545,8 +13577,15 @@
       (insert "\n") (backward-char 1)
       (indent-relative)
       (insert org-clock-string " ")
+      (setq org-clock-start-time (current-time))
       (setq ts (org-insert-time-stamp (current-time) 'with-hm 'inactive))
       (move-marker org-clock-marker (point) (buffer-base-buffer))
+      (or global-mode-string (setq global-mode-string '("")))
+      (or (memq 'org-mode-line-string global-mode-string)
+	  (setq global-mode-string
+		(append global-mode-string '(org-mode-line-string))))
+      (org-update-mode-line)
+      (setq org-mode-line-timer (run-with-timer 60 60 'org-update-mode-line))
       (message "Clock started at %s" ts))))
 
 (defun org-clock-out (&optional fail-quietly)
@@ -12577,6 +13616,12 @@
       (insert " => " (format "%2d:%02d" h m))
       (move-marker org-clock-marker nil)
       (org-add-log-maybe 'clock-out)
+      (when org-mode-line-timer
+	(cancel-timer org-mode-line-timer)
+	(setq org-mode-line-timer nil))
+      (setq global-mode-string
+	    (delq 'org-mode-line-string global-mode-string))
+      (force-mode-line-update)
       (message "Clock stopped at %s after HH:MM = %d:%02d" te h m)))))
 
 (defun org-clock-cancel ()
@@ -12704,7 +13749,7 @@
 (defun org-clock-out-if-current ()
   "Clock out if the current entry contains the running clock.
 This is used to stop the clock after a TODO entry is marked DONE."
-  (when (and (equal state org-done-string)
+  (when (and (member state org-done-keywords)
 	     (equal (marker-buffer org-clock-marker) (current-buffer))
 	     (< (point) org-clock-marker)
 	     (> (save-excursion (outline-next-heading) (point))
@@ -12984,86 +14029,89 @@
 
 (substitute-key-definition 'undo 'org-agenda-undo
 			   org-agenda-mode-map global-map)
-(define-key org-agenda-mode-map "\C-i"     'org-agenda-goto)
-(define-key org-agenda-mode-map [(tab)]    'org-agenda-goto)
-(define-key org-agenda-mode-map "\C-m"     'org-agenda-switch-to)
-(define-key org-agenda-mode-map "\C-k"     'org-agenda-kill)
-(define-key org-agenda-mode-map "\C-c$"    'org-agenda-archive)
-(define-key org-agenda-mode-map "\C-c\C-x\C-s" 'org-agenda-archive)
-(define-key org-agenda-mode-map "$"        'org-agenda-archive)
-(define-key org-agenda-mode-map "\C-c\C-o" 'org-agenda-open-link)
-(define-key org-agenda-mode-map " "        'org-agenda-show)
-(define-key org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo)
-(define-key org-agenda-mode-map "\C-c\C-xb" 'org-agenda-tree-to-indirect-buffer)
-(define-key org-agenda-mode-map "b"        'org-agenda-tree-to-indirect-buffer)
-(define-key org-agenda-mode-map "o"        'delete-other-windows)
-(define-key org-agenda-mode-map "L"        'org-agenda-recenter)
-(define-key org-agenda-mode-map "t"        'org-agenda-todo)
-(define-key org-agenda-mode-map "a"        'org-agenda-toggle-archive-tag)
-(define-key org-agenda-mode-map ":"        'org-agenda-set-tags)
-(define-key org-agenda-mode-map "."        'org-agenda-goto-today)
-(define-key org-agenda-mode-map "d"        'org-agenda-day-view)
-(define-key org-agenda-mode-map "w"        'org-agenda-week-view)
-(define-key org-agenda-mode-map (org-key 'S-right) 'org-agenda-date-later)
-(define-key org-agenda-mode-map (org-key 'S-left) 'org-agenda-date-earlier)
-(define-key org-agenda-mode-map [?\C-c ?\C-x (right)] 'org-agenda-date-later)
-(define-key org-agenda-mode-map [?\C-c ?\C-x (left)] 'org-agenda-date-earlier)
-
-(define-key org-agenda-mode-map ">" 'org-agenda-date-prompt)
-(define-key org-agenda-mode-map "\C-c\C-s" 'org-agenda-schedule)
-(define-key org-agenda-mode-map "\C-c\C-d" 'org-agenda-deadline)
+(org-defkey org-agenda-mode-map "\C-i"     'org-agenda-goto)
+(org-defkey org-agenda-mode-map [(tab)]    'org-agenda-goto)
+(org-defkey org-agenda-mode-map "\C-m"     'org-agenda-switch-to)
+(org-defkey org-agenda-mode-map "\C-k"     'org-agenda-kill)
+(org-defkey org-agenda-mode-map "\C-c$"    'org-agenda-archive)
+(org-defkey org-agenda-mode-map "\C-c\C-x\C-s" 'org-agenda-archive)
+(org-defkey org-agenda-mode-map "$"        'org-agenda-archive)
+(org-defkey org-agenda-mode-map "\C-c\C-o" 'org-agenda-open-link)
+(org-defkey org-agenda-mode-map " "        'org-agenda-show)
+(org-defkey org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo)
+(org-defkey org-agenda-mode-map [(control shift right)] 'org-agenda-todo-nextset)
+(org-defkey org-agenda-mode-map [(control shift left)]  'org-agenda-todo-previousset)
+(org-defkey org-agenda-mode-map "\C-c\C-xb" 'org-agenda-tree-to-indirect-buffer)
+(org-defkey org-agenda-mode-map "b"        'org-agenda-tree-to-indirect-buffer)
+(org-defkey org-agenda-mode-map "o"        'delete-other-windows)
+(org-defkey org-agenda-mode-map "L"        'org-agenda-recenter)
+(org-defkey org-agenda-mode-map "t"        'org-agenda-todo)
+(org-defkey org-agenda-mode-map "a"        'org-agenda-toggle-archive-tag)
+(org-defkey org-agenda-mode-map ":"        'org-agenda-set-tags)
+(org-defkey org-agenda-mode-map "."        'org-agenda-goto-today)
+(org-defkey org-agenda-mode-map "d"        'org-agenda-day-view)
+(org-defkey org-agenda-mode-map "w"        'org-agenda-week-view)
+(org-defkey org-agenda-mode-map [(shift right)] 'org-agenda-date-later)
+(org-defkey org-agenda-mode-map [(shift left)] 'org-agenda-date-earlier)
+(org-defkey org-agenda-mode-map [?\C-c ?\C-x (right)] 'org-agenda-date-later)
+(org-defkey org-agenda-mode-map [?\C-c ?\C-x (left)] 'org-agenda-date-earlier)
+
+(org-defkey org-agenda-mode-map ">" 'org-agenda-date-prompt)
+(org-defkey org-agenda-mode-map "\C-c\C-s" 'org-agenda-schedule)
+(org-defkey org-agenda-mode-map "\C-c\C-d" 'org-agenda-deadline)
 (let ((l '(1 2 3 4 5 6 7 8 9 0)))
-  (while l (define-key org-agenda-mode-map
+  (while l (org-defkey org-agenda-mode-map
 	     (int-to-string (pop l)) 'digit-argument)))
 
-(define-key org-agenda-mode-map "f" 'org-agenda-follow-mode)
-(define-key org-agenda-mode-map "l" 'org-agenda-log-mode)
-(define-key org-agenda-mode-map "D" 'org-agenda-toggle-diary)
-(define-key org-agenda-mode-map "g" 'org-agenda-toggle-time-grid)
-(define-key org-agenda-mode-map "r" 'org-agenda-redo)
-(define-key org-agenda-mode-map "q" 'org-agenda-quit)
-(define-key org-agenda-mode-map "x" 'org-agenda-exit)
-(define-key org-agenda-mode-map "s" 'org-save-all-org-buffers)
-(define-key org-agenda-mode-map "P" 'org-agenda-show-priority)
-(define-key org-agenda-mode-map "T" 'org-agenda-show-tags)
-(define-key org-agenda-mode-map "n" 'next-line)
-(define-key org-agenda-mode-map "p" 'previous-line)
-(define-key org-agenda-mode-map "\C-n" 'org-agenda-next-date-line)
-(define-key org-agenda-mode-map "\C-p" 'org-agenda-previous-date-line)
-(define-key org-agenda-mode-map "," 'org-agenda-priority)
-(define-key org-agenda-mode-map "\C-c," 'org-agenda-priority)
-(define-key org-agenda-mode-map "i" 'org-agenda-diary-entry)
-(define-key org-agenda-mode-map "c" 'org-agenda-goto-calendar)
+(org-defkey org-agenda-mode-map "f" 'org-agenda-follow-mode)
+(org-defkey org-agenda-mode-map "l" 'org-agenda-log-mode)
+(org-defkey org-agenda-mode-map "D" 'org-agenda-toggle-diary)
+(org-defkey org-agenda-mode-map "g" 'org-agenda-toggle-time-grid)
+(org-defkey org-agenda-mode-map "r" 'org-agenda-redo)
+(org-defkey org-agenda-mode-map "q" 'org-agenda-quit)
+(org-defkey org-agenda-mode-map "x" 'org-agenda-exit)
+(org-defkey org-agenda-mode-map "\C-x\C-w" 'org-write-agenda)
+(org-defkey org-agenda-mode-map "s" 'org-save-all-org-buffers)
+(org-defkey org-agenda-mode-map "P" 'org-agenda-show-priority)
+(org-defkey org-agenda-mode-map "T" 'org-agenda-show-tags)
+(org-defkey org-agenda-mode-map "n" 'next-line)
+(org-defkey org-agenda-mode-map "p" 'previous-line)
+(org-defkey org-agenda-mode-map "\C-n" 'org-agenda-next-date-line)
+(org-defkey org-agenda-mode-map "\C-p" 'org-agenda-previous-date-line)
+(org-defkey org-agenda-mode-map "," 'org-agenda-priority)
+(org-defkey org-agenda-mode-map "\C-c," 'org-agenda-priority)
+(org-defkey org-agenda-mode-map "i" 'org-agenda-diary-entry)
+(org-defkey org-agenda-mode-map "c" 'org-agenda-goto-calendar)
 (eval-after-load "calendar"
-  '(define-key calendar-mode-map org-calendar-to-agenda-key
+  '(org-defkey calendar-mode-map org-calendar-to-agenda-key
      'org-calendar-goto-agenda))
-(define-key org-agenda-mode-map "C" 'org-agenda-convert-date)
-(define-key org-agenda-mode-map "m" 'org-agenda-phases-of-moon)
-(define-key org-agenda-mode-map "M" 'org-agenda-phases-of-moon)
-(define-key org-agenda-mode-map "S" 'org-agenda-sunrise-sunset)
-(define-key org-agenda-mode-map "h" 'org-agenda-holidays)
-(define-key org-agenda-mode-map "H" 'org-agenda-holidays)
-(define-key org-agenda-mode-map "+" 'org-agenda-priority-up)
-(define-key org-agenda-mode-map "I" 'org-agenda-clock-in)
-(define-key org-agenda-mode-map "O" 'org-agenda-clock-out)
-(define-key org-agenda-mode-map "X" 'org-agenda-clock-cancel)
-(define-key org-agenda-mode-map "-" 'org-agenda-priority-down)
-(define-key org-agenda-mode-map (org-key 'S-up) 'org-agenda-priority-up)
-(define-key org-agenda-mode-map (org-key 'S-down) 'org-agenda-priority-down)
-(define-key org-agenda-mode-map [?\C-c ?\C-x (up)] 'org-agenda-priority-up)
-(define-key org-agenda-mode-map [?\C-c ?\C-x (down)] 'org-agenda-priority-down)
-(define-key org-agenda-mode-map [(right)] 'org-agenda-later)
-(define-key org-agenda-mode-map [(left)] 'org-agenda-earlier)
-(define-key org-agenda-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files)
+(org-defkey org-agenda-mode-map "C" 'org-agenda-convert-date)
+(org-defkey org-agenda-mode-map "m" 'org-agenda-phases-of-moon)
+(org-defkey org-agenda-mode-map "M" 'org-agenda-phases-of-moon)
+(org-defkey org-agenda-mode-map "S" 'org-agenda-sunrise-sunset)
+(org-defkey org-agenda-mode-map "h" 'org-agenda-holidays)
+(org-defkey org-agenda-mode-map "H" 'org-agenda-holidays)
+(org-defkey org-agenda-mode-map "I" 'org-agenda-clock-in)
+(org-defkey org-agenda-mode-map "O" 'org-agenda-clock-out)
+(org-defkey org-agenda-mode-map "X" 'org-agenda-clock-cancel)
+(org-defkey org-agenda-mode-map "+" 'org-agenda-priority-up)
+(org-defkey org-agenda-mode-map "-" 'org-agenda-priority-down)
+(org-defkey org-agenda-mode-map [(shift up)] 'org-agenda-priority-up)
+(org-defkey org-agenda-mode-map [(shift down)] 'org-agenda-priority-down)
+(org-defkey org-agenda-mode-map [?\C-c ?\C-x (up)] 'org-agenda-priority-up)
+(org-defkey org-agenda-mode-map [?\C-c ?\C-x (down)] 'org-agenda-priority-down)
+(org-defkey org-agenda-mode-map [(right)] 'org-agenda-later)
+(org-defkey org-agenda-mode-map [(left)] 'org-agenda-earlier)
+(org-defkey org-agenda-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files)
 (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map)
   "Local keymap for agenda entries from Org-mode.")
 
-(define-key org-agenda-keymap
+(org-defkey org-agenda-keymap
   (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)
-(define-key org-agenda-keymap
+(org-defkey org-agenda-keymap
   (if (featurep 'xemacs) [(button3)] [(mouse-3)]) 'org-agenda-show-mouse)
 (when org-agenda-mouse-1-follows-link
-  (define-key org-agenda-keymap [follow-link] 'mouse-face))
+  (org-defkey org-agenda-keymap [follow-link] 'mouse-face))
 (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
   '("Agenda"
     ("Agenda Files")
@@ -13120,6 +14168,7 @@
       :style toggle :selected org-agenda-include-diary :active (org-agenda-check-type nil 'agenda)]
      ["Use Time Grid" org-agenda-toggle-time-grid
       :style toggle :selected org-agenda-use-time-grid :active (org-agenda-check-type nil 'agenda)])
+    ["Write view to file" org-write-agenda t]
     ["Rebuild buffer" org-agenda-redo t]
     ["Save all Org-mode Buffers" org-save-all-org-buffers t]
     "--"
@@ -13146,6 +14195,11 @@
   `(unless (get-text-property (point) 'org-protected)
      ,@body))
 
+(defmacro org-unmodified (&rest body)
+  "Execute body without changing buffer-modified-p."
+  `(set-buffer-modified-p
+    (prog1 (buffer-modified-p) ,@body)))
+
 (defmacro org-with-remote-undo (_buffer &rest _body)
   "Execute BODY while recording undo information in two buffers."
   (declare (indent 1) (debug t))
@@ -13230,7 +14284,8 @@
 m     Call `org-tags-view' to display headlines with tags matching
       a condition  (the user is prompted for the condition).
 M     Like `m', but select only TODO entries, no ordinary headlines.
-l     Create a timeeline for the current buffer.
+l     Create a timeline for the current buffer.
+e     Export views to associated files.
 
 More commands can be added by configuring the variable
 `org-agenda-custom-commands'.  In particular, specific tags and TODO keyword
@@ -13261,7 +14316,7 @@
 		  (let ((header
 "Press key for an agenda command:
 --------------------------------         C   Configure custom agenda commands
-a   Agenda for current week or day
+a   Agenda for current week or day       e   Export agenda views
 t   List of all TODO entries             T   Entries with special TODO kwd
 m   Match a TAGS query                   M   Like m, but only TODO entries
 L   Timeline for current buffer          #   List stuck projects (!=configure)
@@ -13279,6 +14334,9 @@
 			      '(face bold))
 			  (cond
 			   ((stringp type) type)
+			   ((eq type 'agenda) "Agenda for current week or day")
+			   ((eq type 'alltodo) "List of all TODO entries")
+			   ((eq type 'stuck) "List of stuck projects")
 			   ((eq type 'todo) "TODO keyword")
 			   ((eq type 'tags) "Tags query")
 			   ((eq type 'tags-todo) "Tags (TODO)")
@@ -13333,6 +14391,13 @@
 	      (setq type (nth 1 entry) match (nth 2 entry) lprops (nth 3 entry)
 		    lprops (nth 3 entry))
 	      (cond
+	       ((eq type 'agenda)
+		(org-let lprops '(org-agenda-list current-prefix-arg)))
+	       ((eq type 'alltodo)
+		(org-let lprops '(org-todo-list current-prefix-arg)))
+	       ((eq type 'stuck)
+		(org-let lprops '(org-agenda-list-stuck-projects
+				  current-prefix-arg)))
 	       ((eq type 'tags)
 		(org-let lprops '(org-tags-view current-prefix-arg match)))
 	       ((eq type 'tags-todo)
@@ -13353,13 +14418,14 @@
 	       ((fboundp type)
 		(org-let lprops '(funcall type match)))
 	       (t (error "Invalid custom agenda command type %s" type))))
-	  (org-run-agenda-series (cddr entry))))
+	  (org-run-agenda-series (nth 1 entry) (cddr entry))))
        ((equal c ?C) (customize-variable 'org-agenda-custom-commands))
        ((equal c ?a) (call-interactively 'org-agenda-list))
        ((equal c ?t) (call-interactively 'org-todo-list))
        ((equal c ?T) (org-call-with-arg 'org-todo-list (or arg '(4))))
        ((equal c ?m) (call-interactively 'org-tags-view))
        ((equal c ?M) (org-call-with-arg 'org-tags-view (or arg '(4))))
+       ((equal c ?e) (call-interactively 'org-store-agenda-views))
        ((equal c ?L)
 	(unless restrict-ok
 	  (error "This is not an Org-mode file"))
@@ -13368,10 +14434,10 @@
        ((equal c ?!) (customize-variable 'org-stuck-projects))
        (t (error "Invalid key"))))))
 
-(defun org-run-agenda-series (series)
-  (org-prepare-agenda)
+(defun org-run-agenda-series (name series)
+  (org-prepare-agenda name)
   (let* ((org-agenda-multi t)
-	 (redo (list 'org-run-agenda-series (list 'quote series)))
+	 (redo (list 'org-run-agenda-series name (list 'quote series)))
 	 (cmds (car series))
 	 (gprops (nth 1 series))
 	 match ;; The byte compiler incorrectly complains about this.  Keep it!
@@ -13380,11 +14446,14 @@
       (setq type (car cmd) match (nth 1 cmd) lprops (nth 2 cmd))
       (cond
        ((eq type 'agenda)
-	(call-interactively 'org-agenda-list))
+	(org-let2 gprops lprops
+	  '(call-interactively 'org-agenda-list)))
        ((eq type 'alltodo)
-	(call-interactively 'org-todo-list))
+	(org-let2 gprops lprops
+	  '(call-interactively 'org-todo-list)))
        ((eq type 'stuck)
-	(call-interactively 'org-agenda-list-stuck-projects))
+	(org-let2 gprops lprops
+	  '(call-interactively 'org-agenda-list-stuck-projects)))
        ((eq type 'tags)
 	(org-let2 gprops lprops
 		  '(org-tags-view current-prefix-arg match)))
@@ -13405,17 +14474,208 @@
 
 ;;;###autoload
 (defmacro org-batch-agenda (cmd-key &rest parameters)
-  "Run an agenda command in batch mode, send result to STDOUT.
-CMD-KEY is a string that is also a key in `org-agenda-custom-commands'.
+  "Run an agenda command in batch mode and send the result to STDOUT.
+If CMD-KEY is a string of length 1, it is used as a key in
+`org-agenda-custom-commands' and triggers this command.  If it is a
+longer string it is used as a tags/todo match string.
 Paramters are alternating variable names and values that will be bound
 before running the agenda command."
   (let (pars)
     (while parameters
       (push (list (pop parameters) (if parameters (pop parameters))) pars))
-    (flet ((read-char-exclusive () (string-to-char cmd-key)))
-      (eval (list 'let (nreverse pars) '(org-agenda nil))))
+    (if (> (length cmd-key) 1)
+	(eval (list 'let (nreverse pars)
+		    (list 'org-tags-view nil cmd-key)))
+      (flet ((read-char-exclusive () (string-to-char cmd-key)))
+	(eval (list 'let (nreverse pars) '(org-agenda nil)))))
+    (set-buffer "*Org Agenda*")
+    (princ (org-encode-for-stdout (buffer-string)))))
+
+(defun org-encode-for-stdout (string)
+  (if (fboundp 'encode-coding-string)
+      (encode-coding-string string buffer-file-coding-system)
+    string))
+
+(defvar org-agenda-info nil)
+
+;;;###autoload
+(defmacro org-batch-agenda-csv (cmd-key &rest parameters)
+  "Run an agenda command in batch mode and send the result to STDOUT.
+If CMD-KEY is a string of length 1, it is used as a key in
+`org-agenda-custom-commands' and triggers this command.  If it is a
+longer string it is used as a tags/todo match string.
+Paramters are alternating variable names and values that will be bound
+before running the agenda command.
+
+The output gives a line for each selected agenda item.  Each
+item is a list of comma-separated values, like this:
+
+category,head,type,todo,tags,date,time,extra,priority-l,priority-n
+
+category     The category of the item
+head         The headline, without TODO kwd, TAGS and PRIORITY
+type         The type of the agenda entry, can be
+                todo               selected in TODO match
+                tagsmatch          selected in tags match
+                diary              imported from diary
+                deadline           a deadline on given date
+                scheduled          scheduled on given date
+                timestamp          entry has timestamp on given date
+                closed             entry was closed on given date
+                upcoming-deadline  warning about deadline
+                past-scheduled     forwarded scheduled item
+                block              entry has date block including g. date
+todo         The todo keyword, if any
+tags         All tags including inherited ones, separated by colons
+date         The relevant date, like 2007-2-14
+time         The time, like 15:00-16:50
+extra        Sting with extra planning info
+priority-l   The priority letter if any was given
+priority-n   The computed numerical priority"
+
+  (let (pars)
+    (while parameters
+      (push (list (pop parameters) (if parameters (pop parameters))) pars))
+    (push (list 'org-agenda-remove-tags t) pars)
+    (if (> (length cmd-key) 1)
+	(eval (list 'let (nreverse pars)
+		    (list 'org-tags-view nil cmd-key)))
+      (flet ((read-char-exclusive () (string-to-char cmd-key)))
+	(eval (list 'let (nreverse pars) '(org-agenda nil)))))
     (set-buffer "*Org Agenda*")
-    (princ (buffer-string))))
+    (let* ((lines (org-split-string (buffer-string) "\n"))
+	   line)
+      (while (setq line (pop lines))
+	(catch 'next
+	  (if (not (get-text-property 0 'org-category line)) (throw 'next nil))
+	  (setq org-agenda-info
+		(org-fix-agenda-info (text-properties-at 0 line)))
+	  (princ
+	   (org-encode-for-stdout
+	    (mapconcat 'org-agenda-export-csv-mapper
+		       '(org-category txt type todo tags date time-of-day extra
+				      priority-letter priority)
+		      ",")))
+	  (princ "\n"))))))
+
+(defun org-fix-agenda-info (props)
+  "FIXME"
+  (let (tmp re)
+    (when (setq tmp (plist-get props 'tags))
+      (setq props (plist-put props 'tags (mapconcat 'identity tmp ":"))))
+    (when (setq tmp (plist-get props 'date))
+      (if (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp)))
+      (let ((calendar-date-display-form '(year "-" month "-" day)))
+	'((format "%4d, %9s %2s, %4s" dayname monthname day year))
+
+	(setq tmp (calendar-date-string tmp)))
+      (setq props (plist-put props 'date tmp)))
+    (when (setq tmp (plist-get props 'day))
+      (if (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp)))
+      (let ((calendar-date-display-form '(year "-" month "-" day)))
+	(setq tmp (calendar-date-string tmp)))
+      (setq props (plist-put props 'day tmp)))
+    (when (setq tmp (plist-get props 'txt))
+      (when (string-match "\\[#\\([A-Z0-9]\\)\\] ?" tmp)
+	(plist-put props 'priority-letter (match-string 1 tmp))
+	(setq tmp (replace-match "" t t tmp)))
+      (when (and (setq re (plist-get props 'org-todo-regexp))
+		 (setq re (concat "\\`\\.*" re " ?"))
+		 (string-match re tmp))
+	(plist-put props 'todo (match-string 1 tmp))
+	(setq tmp (replace-match "" t t tmp)))
+      (plist-put props 'txt tmp)))
+  props)
+
+(defun org-agenda-export-csv-mapper (prop)
+  (let ((res (plist-get org-agenda-info prop)))
+    (setq res
+	  (cond
+	   ((not res) "")
+	   ((stringp res) res)
+	   (t (prin1-to-string res))))
+    (while (string-match "," res)
+      (setq res (replace-match ";" t t res)))
+    (org-trim res)))
+
+
+;;;###autoload
+(defun org-store-agenda-views (&rest parameters)
+  (interactive)
+  (eval (list 'org-batch-store-agenda-views)))
+
+(defvar org-agenda-buffer-name)
+
+;; FIXME, why is this a macro?????
+;;;###autoload
+(defmacro org-batch-store-agenda-views (&rest parameters)
+  "Run all custom agenda commands that have a file argument."
+  (let ((cmds org-agenda-custom-commands)
+	(dir (default-directory))
+	pars cmd thiscmdkey files opts)
+    (while parameters
+      (push (list (pop parameters) (if parameters (pop parameters))) pars))
+    (setq pars (reverse pars))
+    (save-window-excursion
+      (while cmds
+	(setq cmd (pop cmds)
+	      thiscmdkey (car cmd)
+	      opts (nth 3 cmd)
+	      files (org-last cmd))
+	(if (stringp files) (setq files (list files)))
+	(when files
+	  (flet ((read-char-exclusive () (string-to-char thiscmdkey)))
+	    (eval (list 'let (append org-agenda-exporter-settings opts pars)
+			'(org-agenda nil))))
+	  (set-buffer "*Org Agenda*")
+	  (while files
+	    (eval (list 'let (append org-agenda-exporter-settings opts pars)
+			(list 'org-write-agenda
+			      (expand-file-name (pop files) dir) t)))))
+	(kill-buffer org-agenda-buffer-name)))))
+
+(defun org-write-agenda (file &optional nosettings)
+  "Write the current buffer (an agenda view) as a file.
+Depending on the extension of the file name, plain text (.txt),
+HTML (.html or .htm) or Postscript (.ps) is produced.
+If NOSETTINGS is given, do not scope the settings of
+`org-agenda-exporter-settings' into the export commands.  This is used when
+the settings have already been scoped and we do not wish to overrule other,
+higher priority settings."
+  (interactive "FWrite agenda to file: ")
+  (if (not (file-writable-p file))
+      (error "Cannot write agenda to file %s" file))
+  (cond
+   ((string-match "\\.html?\\'" file) (require 'htmlize))
+   ((string-match "\\.ps\\'" file) (require 'ps-print)))
+  (org-let (if nosettings nil org-agenda-exporter-settings)
+    '(save-excursion
+       (save-window-excursion
+	 (cond
+	  ((string-match "\\.html?\\'" file)
+	   (set-buffer (htmlize-buffer (current-buffer)))
+
+	   (when (and org-agenda-export-html-style
+		      (string-match "<style>" org-agenda-export-html-style))
+	     ;; replace <style> section with org-agenda-export-html-style
+	     (goto-char (point-min))
+	     (kill-region (- (search-forward "<style") 6)
+			  (search-forward "</style>"))
+	     (insert org-agenda-export-html-style))
+	   (write-file file)
+	   (kill-buffer (current-buffer))
+	   (message "HTML written to %s" file))
+	  ((string-match "\\.ps\\'" file)
+	   (ps-print-buffer-with-faces file)
+	   (message "Postscript written to %s" file))
+	  (t
+	   (let ((bs (buffer-string)))
+	     (find-file file)
+	     (insert bs)
+	     (save-buffer 0)
+	     (kill-buffer (current-buffer))
+	     (message "Plain text written to %s" file))))))
+    (set-buffer org-agenda-buffer-name)))
 
 (defmacro org-no-read-only (&rest body)
   "Inhibit read-only for BODY."
@@ -13508,13 +14768,6 @@
       (find-file (car fs)))
     (if (buffer-base-buffer) (switch-to-buffer (buffer-base-buffer)))))
 
-(defun org-agenda-file-to-end ()
-  "Move/add the current file to the end of the agenda file list.
-If the file is not present in the list, it is appended to the list.  If it is
-present, it is moved there."
-  (interactive)
-  (org-agenda-file-to-front 'to-end))
-
 (defun org-agenda-file-to-front (&optional to-end)
   "Move/add the current file to the top of the agenda file list.
 If the file is not present in the list, it is added to the front.  If it is
@@ -13578,7 +14831,10 @@
 (defvar org-agenda-multi nil)  ; dynammically scoped
 (defvar org-agenda-buffer-name "*Org Agenda*")
 (defvar org-pre-agenda-window-conf nil)
-(defun org-prepare-agenda ()
+(defvar org-agenda-name nil)
+(defun org-prepare-agenda (&optional name)
+  (setq org-todo-keywords-for-agenda nil)
+  (setq org-done-keywords-for-agenda nil)
   (if org-agenda-multi
       (progn
 	(setq buffer-read-only nil)
@@ -13588,6 +14844,10 @@
 	(narrow-to-region (point) (point-max)))
     (org-agenda-maybe-reset-markers 'force)
     (org-prepare-agenda-buffers (org-agenda-files))
+    (setq org-todo-keywords-for-agenda
+	  (org-uniquify org-todo-keywords-for-agenda))
+    (setq org-done-keywords-for-agenda
+	  (org-uniquify org-done-keywords-for-agenda))
     (let* ((abuf (get-buffer-create org-agenda-buffer-name))
 	   (awin (get-buffer-window abuf)))
       (cond
@@ -13605,7 +14865,9 @@
 	(switch-to-buffer-other-window abuf))))
     (setq buffer-read-only nil)
     (erase-buffer)
-    (org-agenda-mode))
+    (org-agenda-mode)
+    (and name (not org-agenda-name)
+	 (org-set-local 'org-agenda-name name)))
   (setq buffer-read-only nil))
 
 (defun org-finalize-agenda ()
@@ -13617,7 +14879,9 @@
 	(goto-char (point-min))
 	(while (org-activate-bracket-links (point-max))
 	  (add-text-properties (match-beginning 0) (match-end 0)
-			       '(face org-link))))
+			       '(face org-link)))
+	(unless org-agenda-with-colors
+	  (remove-text-properties (point-min) (point-max) '(face nil))))
       (run-hooks 'org-finalize-agenda-hook))))
 
 (defun org-prepare-agenda-buffers (files)
@@ -13635,6 +14899,10 @@
 	  (set-buffer (org-get-agenda-file-buffer file))
 	  (widen)
 	  (setq bmp (buffer-modified-p))
+	  (setq org-todo-keywords-for-agenda
+		(append org-todo-keywords-for-agenda org-todo-keywords-1))
+	  (setq org-done-keywords-for-agenda
+		(append org-done-keywords-for-agenda org-done-keywords))
 	  (save-excursion
 	    (remove-text-properties (point-min) (point-max) pall)
 	    (when org-agenda-skip-archived-trees
@@ -13648,7 +14916,7 @@
 	      (add-text-properties
 	       (match-beginning 0) (org-end-of-subtree t) pc)))
 	  (set-buffer-modified-p bmp))))))
-  
+
 (defvar org-agenda-skip-function nil
   "Function to be called at each match during agenda construction.
 If this function return nil, the current match should not be skipped.
@@ -13733,9 +15001,13 @@
   "Get the table of categories and positions in current buffer."
   (let (tbl)
     (save-excursion
-      (goto-char (point-min))
-      (while (re-search-forward "\\(^\\|\r\\)#\\+CATEGORY:[ \t]*\\(.*\\)" nil t)
-	(push (cons (point) (org-trim (match-string 2))) tbl)))
+      (save-restriction
+	(widen)
+	(goto-char (point-min))
+	(while (re-search-forward "^#\\+CATEGORY:[ \t]*\\(.*\\)"
+				  nil t)
+	  (push (cons (match-beginning 1)
+		      (org-trim (match-string 1))) tbl))))
     tbl))
 
 (defun org-get-category (&optional pos)
@@ -13792,16 +15064,18 @@
 	(setq day-numbers (delq nil (mapcar (lambda(x)
 					      (if (>= x today) x nil))
 					    day-numbers))))
-    (org-prepare-agenda)
+    (org-prepare-agenda (concat "Timeline "
+				(file-name-nondirectory buffer-file-name)))
     (if doclosed (push :closed args))
     (push :timestamp args)
+    (push :sexp args)
     (if dotodo (push :todo args))
     (while (setq d (pop day-numbers))
       (if (and (listp d) (eq (car d) :omitted))
 	  (progn
 	    (setq s (point))
 	    (insert (format "\n[... %d empty days omitted]\n\n" (cdr d)))
-	    (put-text-property s (1- (point)) 'face 'org-level-3))
+	    (put-text-property s (1- (point)) 'face 'org-agenda-structure))
 	(if (listp d) (setq d (car d) emptyp t) (setq emptyp nil))
 	(if (and (>= d today)
 		 dopast
@@ -13824,7 +15098,7 @@
 ;	      (insert (format-time-string org-agenda-date-format
 ;					  (calendar-time-from-absolute d 0))
 ;		      "\n")
-	      (put-text-property s (1- (point)) 'face 'org-level-3)
+	      (put-text-property s (1- (point)) 'face 'org-agenda-structure)
 	      (put-text-property s (1- (point)) 'org-date-line t)
 	      (if (equal d today)
 		  (put-text-property s (1- (point)) 'org-today t))
@@ -13936,7 +15210,7 @@
       (push (1+ (car day-numbers)) day-numbers)
       (setq ndays (1- ndays)))
     (setq day-numbers (nreverse day-numbers))
-    (org-prepare-agenda)
+    (org-prepare-agenda "Day/Week")
     (org-set-local 'org-starting-day (car day-numbers))
     (org-set-local 'org-include-all-loc include-all)
     (when (and (or include-all org-agenda-include-all-todo)
@@ -13953,11 +15227,12 @@
       (when rtnall
 	(insert "ALL CURRENTLY OPEN TODO ITEMS:\n")
 	(add-text-properties (point-min) (1- (point))
-			     (list 'face 'org-level-3))
+			     (list 'face 'org-agenda-structure))
 	(insert (org-finalize-agenda-entries rtnall) "\n")))
     (setq s (point))
     (insert (if (= nd 7) "Week-" "Day-") "agenda:\n")
-    (add-text-properties s (1- (point)) (list 'face 'org-level-3))
+    (add-text-properties s (1- (point)) (list 'face 'org-agenda-structure
+					      'org-date-line t))
     (while (setq d (pop day-numbers))
       (setq date (calendar-gregorian-from-absolute d)
 	    s (point))
@@ -13974,10 +15249,10 @@
 	  (if org-agenda-show-log
 	      (setq rtn (org-agenda-get-day-entries
 			 file date
-			 :deadline :scheduled :timestamp :closed))
+			 :deadline :scheduled :timestamp :sexp :closed))
 	    (setq rtn (org-agenda-get-day-entries
 		       file date
-		       :deadline :scheduled :timestamp)))
+		       :deadline :scheduled :sexp :timestamp)))
 	  (setq rtnall (append rtnall rtn))))
       (if org-agenda-include-diary
 	  (progn
@@ -13994,7 +15269,7 @@
 ; FIXME: this gives a timezone problem
 ;	    (insert (format-time-string org-agenda-date-format
 ;					(calendar-time-from-absolute d 0)) "\n")
-	    (put-text-property s (1- (point)) 'face 'org-level-3)
+	    (put-text-property s (1- (point)) 'face 'org-agenda-structure)
 	    (put-text-property s (1- (point)) 'org-date-line t)
 	    (if todayp (put-text-property s (1- (point)) 'org-today t))
 	    (if rtnall (insert
@@ -14030,28 +15305,28 @@
 The prefix arg can be used to select a specific TODO keyword and limit
 the list to these.  When using \\[universal-argument], you will be prompted
 for a keyword.  A numeric prefix directly selects the Nth keyword in
-`org-todo-keywords'."
+`org-todo-keywords-1'."
   (interactive "P")
   (require 'calendar)
   (org-compile-prefix-format 'todo)
   (org-set-sorting-strategy 'todo)
+  (org-prepare-agenda "TODO")
   (let* ((today (time-to-days (current-time)))
 	 (date (calendar-gregorian-from-absolute today))
-	 (kwds org-todo-keywords)
+	 (kwds org-todo-keywords-for-agenda)
 	 (completion-ignore-case t)
 	 (org-select-this-todo-keyword
 	  (if (stringp arg) arg
 	    (and arg (integerp arg) (> arg 0)
-                 (nth (1- arg) org-todo-keywords))))
+                 (nth (1- arg) kwds))))
 	 rtn rtnall files file pos)
     (when (equal arg '(4))
       (setq org-select-this-todo-keyword
-	    (completing-read "Keyword: " (mapcar 'list org-todo-keywords)
-			     nil t)))
+	    (completing-read "Keyword (or KWD1|K2D2|...): "
+			     (mapcar 'list kwds) nil nil)))
     (and (equal 0 arg) (setq org-select-this-todo-keyword nil))
-    (org-prepare-agenda)
     (org-set-local 'org-last-arg arg)
-    (org-set-local 'org-todo-keywords kwds)
+;FIXME    (org-set-local 'org-todo-keywords-for-agenda kwds)
     (setq org-agenda-redo-command
 	  '(org-todo-list (or current-prefix-arg org-last-arg)))
     (setq files (org-agenda-files)
@@ -14063,23 +15338,25 @@
 	(setq rtnall (append rtnall rtn))))
     (if org-agenda-overriding-header
 	(insert (org-add-props (copy-sequence org-agenda-overriding-header)
-		    nil 'face 'org-level-3) "\n")
+		    nil 'face 'org-agenda-structure) "\n")
       (insert "Global list of TODO items of type: ")
       (add-text-properties (point-min) (1- (point))
-			   (list 'face 'org-level-3))
+			   (list 'face 'org-agenda-structure))
       (setq pos (point))
       (insert (or org-select-this-todo-keyword "ALL") "\n")
       (add-text-properties pos (1- (point)) (list 'face 'org-warning))
       (setq pos (point))
       (unless org-agenda-multi
-	(insert
-	 "Available with `N r': (0)ALL "
-	 (let ((n 0))
-	   (mapconcat (lambda (x)
-			(format "(%d)%s" (setq n (1+ n)) x))
-		      org-todo-keywords " "))
-	 "\n"))
-      (add-text-properties pos (1- (point)) (list 'face 'org-level-3)))
+	(insert "Available with `N r': (0)ALL")
+	(let ((n 0) s)
+	  (mapc (lambda (x)
+		  (setq s (format "(%d)%s" (setq n (1+ n)) x))
+		  (if (> (+ (current-column) (string-width s) 1) (frame-width))
+		      (insert "\n                    "))
+		  (insert " " s))
+		kwds))
+	(insert "\n"))
+      (add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure)))
     (when rtnall
       (insert (org-finalize-agenda-entries rtnall) "\n"))
     (goto-char (point-min))
@@ -14104,7 +15381,7 @@
 	 buffer)
     (setq matcher (org-make-tags-matcher match)
 	  match (car matcher) matcher (cdr matcher))
-    (org-prepare-agenda)
+    (org-prepare-agenda (concat "TAGS " match))
     (setq org-agenda-redo-command
 	  (list 'org-tags-view (list 'quote todo-only)
 		(list 'if 'current-prefix-arg nil match)))
@@ -14135,17 +15412,17 @@
 		(setq rtnall (append rtnall rtn))))))))
     (if org-agenda-overriding-header
 	(insert (org-add-props (copy-sequence org-agenda-overriding-header)
-		    nil 'face 'org-level-3) "\n")
+		    nil 'face 'org-agenda-structure) "\n")
       (insert "Headlines with TAGS match: ")
       (add-text-properties (point-min) (1- (point))
-			   (list 'face 'org-level-3))
+			   (list 'face 'org-agenda-structure))
       (setq pos (point))
       (insert match "\n")
       (add-text-properties pos (1- (point)) (list 'face 'org-warning))
       (setq pos (point))
       (unless org-agenda-multi
 	(insert "Press `C-u r' to search again with new search string\n"))
-      (add-text-properties pos (1- (point)) (list 'face 'org-level-3)))
+      (add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure)))
     (when rtnall
       (insert (org-finalize-agenda-entries rtnall) "\n"))
     (goto-char (point-min))
@@ -14187,21 +15464,34 @@
 	 (org-agenda-overriding-header "List of stuck projects: ")
 	 (matcher (nth 0 org-stuck-projects))
 	 (todo (nth 1 org-stuck-projects))
-	 (tags (nth 2 org-stuck-projects))
+	 (todo-wds (if (member "*" todo)
+		       (progn
+			 (org-prepare-agenda-buffers (org-agenda-files))
+			 (org-delete-all
+			  org-done-keywords-for-agenda
+			  (copy-sequence org-todo-keywords-for-agenda)))
+		     todo))
 	 (todo-re (concat "^\\*+[ \t]+\\("
-			  (mapconcat 'identity todo "\\|")
+			  (mapconcat 'identity todo-wds "\\|")
 			  "\\)\\>"))
-	 (tags-re (concat "^\\*+.*:\\("
-			  (mapconcat 'identity tags "\\|")
-			  "\\):[a-zA-Z0-9_@:]*[ \t]*$")))
-
+	 (tags (nth 2 org-stuck-projects))
+	 (tags-re (if (member "*" tags)
+		      "^\\*+.*:[a-zA-Z0-9_@]+:[ \t]*$"
+		    (concat "^\\*+.*:\\("
+			    (mapconcat 'identity tags "\\|")
+			    "\\):[a-zA-Z0-9_@:]*[ \t]*$")))
+	 (gen-re (nth 3 org-stuck-projects))
+	 (re-list
+	  (delq nil
+		(list
+		 (if todo todo-re)
+		 (if tags tags-re)
+		 (and gen-re (stringp gen-re) (string-match "\\S-" gen-re)
+		      gen-re)))))
     (setq org-agenda-skip-regexp
-	  (cond
-	   ((and todo tags)
-	    (concat todo-re "\\|" tags-re))
-	   (todo todo-re)
-	   (tags tags-re)
-	   (t (error "No information how to identify unstuck projects"))))
+	  (if re-list
+	      (mapconcat 'identity re-list "\\|")
+	    (error "No information how to identify unstuck projects")))
     (org-tags-view nil matcher)
     (with-current-buffer org-agenda-buffer-name
       (setq org-agenda-redo-command
@@ -14247,7 +15537,8 @@
 	     (lambda (x)
 	       (setq x (org-format-agenda-item "" x "Diary" nil 'time))
 	       ;; Extend the text properties to the beginning of the line
-	       (org-add-props x (text-properties-at (1- (length x)) x)))
+	       (org-add-props x (text-properties-at (1- (length x)) x)
+		 'type "diary" 'date date))
 	     entries)))))
 
 (defun org-agenda-cleanup-fancy-diary ()
@@ -14316,6 +15607,8 @@
 		 date range matching the selected date.  Deadlines will
 		 also be listed, on the expiration day.
 
+   :sexp         FIXME
+
    :deadline     List any deadlines past due, or due within
 		 `org-deadline-warning-days'.  The listing occurs only
 		 in the diary for *today*, not at any other date.  If
@@ -14340,10 +15633,10 @@
    &%%(org-diary)
 
 If you don't give any arguments (as in the example above), the default
-arguments (:deadline :scheduled :timestamp) are used.  So the example above may
-also be written as
-
-   &%%(org-diary :deadline :timestamp :scheduled)
+arguments (:deadline :scheduled :timestamp :sexp) are used.
+So the example above may also be written as
+
+   &%%(org-diary :deadline :timestamp :sexp :scheduled)
 
 The function expects the lisp variables `entry' and `date' to be provided
 by the caller, because this is how the calendar works.  Don't use this
@@ -14351,11 +15644,12 @@
   (org-agenda-maybe-reset-markers)
   (org-compile-prefix-format 'agenda)
   (org-set-sorting-strategy 'agenda)
-  (setq args (or args '(:deadline :scheduled :timestamp)))
+  (setq args (or args '(:deadline :scheduled :timestamp :sexp)))
   (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
 		    (list entry)
 		  (org-agenda-files t)))
 	 file rtn results)
+    (org-prepare-agenda-buffers files)
     ;; If this is called during org-agenda, don't return any entries to
     ;; the calendar.  Org Agenda will list these entries itself.
     (if org-disable-agenda-to-diary (setq files nil))
@@ -14373,7 +15667,7 @@
 the one returned by `calendar-current-date'.  ARGS are symbols indicating
 which kind of entries should be extracted.  For details about these, see
 the documentation of `org-diary'."
-  (setq args (or args '(:deadline :scheduled :timestamp)))
+  (setq args (or args '(:deadline :scheduled :timestamp :sexp)))
   (let* ((org-startup-folded nil)
 	 (org-startup-align-all-tables nil)
 	 (buffer (if (file-exists-p file)
@@ -14406,6 +15700,9 @@
 		  (setq results (append results rtn))
 		  (setq rtn (org-agenda-get-timestamps))
 		  (setq results (append results rtn)))
+		 ((eq arg :sexp)
+		  (setq rtn (org-agenda-get-sexps))
+		  (setq results (append results rtn)))
 		 ((eq arg :scheduled)
 		  (setq rtn (org-agenda-get-scheduled))
 		  (setq results (append results rtn)))
@@ -14447,15 +15744,20 @@
   (let* ((props (list 'face nil
 		      'done-face 'org-done
 		      'org-not-done-regexp org-not-done-regexp
+		      'org-todo-regexp org-todo-regexp
 		      'mouse-face 'highlight
 		      'keymap org-agenda-keymap
 		      'help-echo
 		      (format "mouse-2 or RET jump to org file %s"
 			      (abbreviate-file-name buffer-file-name))))
+	 ;; FIXME: get rid of the \n at some point  but watch out
 	 (regexp (concat "[\n\r]\\*+ *\\("
 			 (if org-select-this-todo-keyword
-			     (concat "\\<\\(" org-select-this-todo-keyword
-				     "\\)\\>")
+			     (if (equal org-select-this-todo-keyword "*")
+				 org-todo-regexp
+			       (concat "\\<\\("
+				       (mapconcat 'identity (org-split-string org-select-this-todo-keyword "|") "\\|")
+				     "\\)\\>"))
 			   org-not-done-regexp)
 			 "[^\n\r]*\\)"))
 	 marker priority category tags
@@ -14481,16 +15783,11 @@
 	      category (org-get-category)
 	      tags (org-get-tags-at (point))
 	      txt (org-format-agenda-item "" (match-string 1) category tags)
-	      priority
-	      (+ (org-get-priority txt)
-		 (if org-todo-kwd-priority-p
-		     (- org-todo-kwd-max-priority -2
-			(length
-			 (member (match-string 2) org-todo-keywords)))
-		     1)))
+	      priority (1+ (org-get-priority txt)))
 	(org-add-props txt props
 	  'org-marker marker 'org-hd-marker marker
-	  'priority priority 'org-category category)
+	  'priority priority 'org-category category
+	  'type "todo")
 	(push txt ee)
 	(if org-agenda-todo-list-sublevels
 	    (goto-char (match-end 1))
@@ -14504,38 +15801,61 @@
   "Return the date stamp information for agenda display."
   (let* ((props (list 'face nil
 		      'org-not-done-regexp org-not-done-regexp
+		      'org-todo-regexp org-todo-regexp
 		      'mouse-face 'highlight
 		      'keymap org-agenda-keymap
 		      'help-echo
 		      (format "mouse-2 or RET jump to org file %s"
 			      (abbreviate-file-name buffer-file-name))))
-	 (regexp (regexp-quote
-		  (substring
-		   (format-time-string
-		    (car org-time-stamp-formats)
-		    (apply 'encode-time  ; DATE bound by calendar
-			   (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
-		   0 11)))
+;????	 (regexp (regexp-quote
+;		  (substring
+;		   (format-time-string
+;		    (car org-time-stamp-formats)
+;		    (apply 'encode-time  ; DATE bound by calendar
+;			   (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
+;		   0 11)))
+	 (d1 (calendar-absolute-from-gregorian date))
+	 (regexp
+	  (concat
+	   (regexp-quote
+	    (substring
+	     (format-time-string
+	      (car org-time-stamp-formats)
+	      (apply 'encode-time  ; DATE bound by calendar
+		     (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
+	     0 11))
+	   "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[dwmy]>\\)"
+	   "\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
 	 marker hdmarker deadlinep scheduledp donep tmp priority category
-	 ee txt timestr tags)
+	 ee txt timestr tags b0 b3 e3)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
+      (setq b0 (match-beginning 0)
+	    b3 (match-beginning 3) e3 (match-end 3))
       (catch :skip
-	(and (save-match-data (org-at-date-range-p)) (throw :skip nil))
+	(and (org-at-date-range-p) (throw :skip nil))
 	(org-agenda-skip)
-	(setq marker (org-agenda-new-marker (match-beginning 0))
-	      category (org-get-category (match-beginning 0))
+	(if (and (match-end 1)
+		 (not (= d1 (org-time-string-to-absolute (match-string 1) d1))))
+	    (throw :skip nil))
+	(if (and e3
+		 (not (org-diary-sexp-entry (buffer-substring b3 e3) "" date)))
+	    (throw :skip nil))
+	(setq marker (org-agenda-new-marker b0)
+	      category (org-get-category b0)
 	      tmp (buffer-substring (max (point-min)
-					 (- (match-beginning 0)
-					    org-ds-keyword-length))
-				    (match-beginning 0))
-	      timestr (buffer-substring (match-beginning 0) (point-at-eol))
+					 (- b0 org-ds-keyword-length))
+				    b0)
+	      timestr (if b3 "" (buffer-substring b0 (point-at-eol)))
 	      deadlinep (string-match org-deadline-regexp tmp)
 	      scheduledp (string-match org-scheduled-regexp tmp)
 	      donep (org-entry-is-done-p))
 	(and org-agenda-skip-scheduled-if-done
 	     scheduledp donep
 	     (throw :skip t))
+	(and org-agenda-skip-deadline-if-done
+	     deadlinep donep
+	     (throw :skip t))
 	(if (string-match ">" timestr)
 	    ;; substring should only run to end of time stamp
 	    (setq timestr (substring timestr 0 (match-end 0))))
@@ -14558,22 +15878,68 @@
 	  (if deadlinep
 	      (org-add-props txt nil
 		'face (if donep 'org-done 'org-warning)
+		'type "deadline" 'date date
 		'undone-face 'org-warning 'done-face 'org-done
 		'org-category category 'priority (+ 100 priority))
 	    (if scheduledp
 		(org-add-props txt nil
 		  'face 'org-scheduled-today
+		  'type "scheduled" 'date date
 		  'undone-face 'org-scheduled-today 'done-face 'org-done
 		  'org-category category 'priority (+ 99 priority))
-	      (org-add-props txt nil 'priority priority 'org-category category)))
+	      (org-add-props txt nil 'priority priority
+			     'org-category category 'date date
+			     'type "timestamp")))
 	  (push txt ee))
 	(outline-next-heading)))
     (nreverse ee)))
 
+(defun org-agenda-get-sexps ()
+  "Return the sexp information for agenda display."
+  (require 'diary-lib)
+  (let* ((props (list 'face nil
+		      'mouse-face 'highlight
+		      'keymap org-agenda-keymap
+		      'help-echo
+		      (format "mouse-2 or RET jump to org file %s"
+			      (abbreviate-file-name buffer-file-name))))
+	 (regexp "^&?%%(")
+	 marker category ee txt tags entry result beg b sexp sexp-entry)
+    (goto-char (point-min))
+    (while (re-search-forward regexp nil t)
+      (catch :skip
+	(org-agenda-skip)
+	(setq beg (match-beginning 0))
+	(goto-char (1- (match-end 0)))
+	(setq b (point))
+	(forward-sexp 1)
+	(setq sexp (buffer-substring b (point)))
+	(setq sexp-entry (if (looking-at "[ \t]*\\(\\S-.*\\)")
+			     (org-trim (match-string 1))
+			   ""))
+	(setq result (org-diary-sexp-entry sexp sexp-entry date))
+	(when result
+	  (setq marker (org-agenda-new-marker beg)
+		category (org-get-category beg))
+
+	  (if (string-match "\\S-" result)
+	      (setq txt result)
+	    (setq txt "SEXP entry returned empty string"))
+
+	  (setq txt (org-format-agenda-item
+                     "" txt category tags 'time))
+	  (org-add-props txt props 'org-marker marker)
+	  (org-add-props txt nil
+	    'org-category category 'date date
+	    'type "sexp")
+	  (push txt ee))))
+    (nreverse ee)))
+
 (defun org-agenda-get-closed ()
   "Return the logged TODO entries for agenda display."
   (let* ((props (list 'mouse-face 'highlight
 		      'org-not-done-regexp org-not-done-regexp
+		      'org-todo-regexp org-todo-regexp
 		      'keymap org-agenda-keymap
 		      'help-echo
 		      (format "mouse-2 or RET jump to org file %s"
@@ -14617,6 +15983,7 @@
 	  (org-add-props txt props
 	    'org-marker marker 'org-hd-marker hdmarker 'face 'org-done
 	    'priority priority 'org-category category
+	    'type "closed" 'date date
 	    'undone-face 'org-warning 'done-face 'org-done)
 	  (push txt ee))
 	(outline-next-heading)))
@@ -14627,6 +15994,7 @@
   (let* ((wdays org-deadline-warning-days)
 	 (props (list 'mouse-face 'highlight
 		      'org-not-done-regexp org-not-done-regexp
+		      'org-todo-regexp org-todo-regexp
 		      'keymap org-agenda-keymap
 		      'help-echo
 		      (format "mouse-2 or RET jump to org file %s"
@@ -14641,8 +16009,9 @@
       (catch :skip
 	(org-agenda-skip)
 	(setq pos (1- (match-beginning 1))
-	      d2 (time-to-days
-		  (org-time-string-to-time (match-string 1)))
+;???	      d2 (time-to-days
+;???		  (org-time-string-to-time (match-string 1)))
+	      d2 (org-time-string-to-absolute (match-string 1) d1)
 	      diff (- d2 d1))
 	;; When to show a deadline in the calendar:
 	;; If the expiration is within wdays warning time.
@@ -14673,6 +16042,7 @@
 		  'org-hd-marker (org-agenda-new-marker pos1)
 		  'priority (+ (- 10 diff) (org-get-priority txt))
 		  'org-category category
+		  'type "upcoming-deadline" 'date d2
 		  'face face 'undone-face face 'done-face 'org-done)
 		(push txt ee))))))
     ee))
@@ -14681,6 +16051,7 @@
   "Return the scheduled information for agenda display."
   (let* ((props (list 'face 'org-scheduled-previously
 		      'org-not-done-regexp org-not-done-regexp
+		      'org-todo-regexp org-todo-regexp
 		      'undone-face 'org-scheduled-previously
 		      'done-face 'org-done
 		      'mouse-face 'highlight
@@ -14698,8 +16069,9 @@
       (catch :skip
 	(org-agenda-skip)
 	(setq pos (1- (match-beginning 1))
-	      d2 (time-to-days
-		  (org-time-string-to-time (match-string 1)))
+	      d2 (org-time-string-to-absolute (match-string 1) d1)
+;???	      d2 (time-to-days
+;???		  (org-time-string-to-time (match-string 1)))
 	      diff (- d2 d1))
 	;; When to show a scheduled item in the calendar:
 	;; If it is on or past the date.
@@ -14724,6 +16096,7 @@
 		(org-add-props txt props
 		  'org-marker (org-agenda-new-marker pos)
 		  'org-hd-marker (org-agenda-new-marker pos1)
+		  'type "past-scheduled" 'date d2
 		  'priority (+ (- 5 diff) (org-get-priority txt))
 		  'org-category category)
 		(push txt ee))))))
@@ -14733,6 +16106,7 @@
   "Return the date-range information for agenda display."
   (let* ((props (list 'face nil
 		      'org-not-done-regexp org-not-done-regexp
+		      'org-todo-regexp org-todo-regexp
 		      'mouse-face 'highlight
 		      'keymap org-agenda-keymap
 		      'help-echo
@@ -14771,6 +16145,7 @@
 		(setq txt org-agenda-no-heading-message))
 	      (org-add-props txt props
 		'org-marker marker 'org-hd-marker hdmarker
+		'type "block" 'date date
 		'priority (org-get-priority txt) 'org-category category)
 	      (push txt ee)))
 	(goto-char pos)))
@@ -14865,8 +16240,8 @@
 
       (when (string-match "\\([ \t]+\\)\\(:[a-zA-Z_@0-9:]+:\\)[ \t]*$" txt)
 	;; Tags are in the string
-	(if (or (eq org-agenda-remove-tags-when-in-prefix t)
-		(and org-agenda-remove-tags-when-in-prefix
+	(if (or (eq org-agenda-remove-tags t)
+		(and org-agenda-remove-tags
 		     org-prefix-has-tag))
 	    (setq txt (replace-match "" t t txt))
 	  (setq txt (replace-match
@@ -14891,9 +16266,12 @@
 	'org-category (downcase category) 'tags tags
 	'prefix-length (- (length rtn) (length txt))
 	'time-of-day time-of-day
+	'txt txt
+	'time time
+	'extra extra
 	'dotime dotime))))
 
-(defvar org-agenda-sorting-strategy)
+(defvar org-agenda-sorting-strategy) ;; FIXME: can be removed?
 (defvar org-agenda-sorting-strategy-selected nil)
 
 (defun org-agenda-add-time-grid-maybe (list ndays todayp)
@@ -15243,6 +16621,7 @@
   "Detach overlay INDEX."
   (funcall (if (featurep 'xemacs) 'detach-extent 'delete-overlay) org-hl))
 
+;; FIXME this is currently not used.
 (defun org-highlight-until-next-command (beg end &optional buffer)
   (org-highlight beg end buffer)
   (add-hook 'pre-command-hook 'org-unhighlight-once))
@@ -15350,12 +16729,13 @@
 		     (org-agenda-error)))
 	 (buffer (marker-buffer marker))
 	 (pos (marker-position marker))
+	 (type (get-text-property (point) 'type))
 	 dbeg dend (n 0) conf)
     (org-with-remote-undo buffer
      (with-current-buffer buffer
        (save-excursion
 	 (goto-char pos)
-	 (if (org-mode-p)
+	 (if (and (org-mode-p) (not (member type '("sexp"))))
 	     (setq dbeg (progn (org-back-to-heading t) (point))
 		   dend (org-end-of-subtree t))
 	   (setq dbeg (point-at-bol)
@@ -15502,6 +16882,16 @@
   "Marker pointing to the headline that last changed its TODO state
 by a remote command from the agenda.")
 
+(defun org-agenda-todo-nextset ()
+  "Switch TODO entry to next sequence."
+  (interactive)
+  (org-agenda-todo 'nextset))
+
+(defun org-agenda-todo-previousset ()
+  "Switch TODO entry to previous sequence."
+  (interactive)
+  (org-agenda-todo 'previousset))
+
 (defun org-agenda-todo (&optional arg)
   "Cycle TODO state of line at point, also in Org-mode file.
 This changes the line at point, all other lines in the agenda referring to
@@ -15656,7 +17046,7 @@
 	      (org-up-heading-all 1))
 	    (error nil))))
       tags)))
-  
+
 ;; FIXME: should fix the tags property of the agenda line.
 (defun org-agenda-set-tags ()
   "Set tags for the current headline."
@@ -15673,10 +17063,12 @@
       (with-current-buffer buffer
 	(widen)
 	(goto-char pos)
-	(org-show-context 'agenda)
+	(save-excursion
+	  (org-show-context 'agenda))
 	(save-excursion
 	  (and (outline-next-heading)
 	       (org-flag-heading nil)))   ; show the next heading
+	(goto-char pos)
 	(call-interactively 'org-set-tags)
 	(end-of-line 1)
 	(setq newhead (org-get-heading)))
@@ -15992,11 +17384,11 @@
 (defvar org-cdlatex-mode-map (make-sparse-keymap)
   "Keymap for the minor `org-cdlatex-mode'.")
 
-(define-key org-cdlatex-mode-map "_" 'org-cdlatex-underscore-caret)
-(define-key org-cdlatex-mode-map "^" 'org-cdlatex-underscore-caret)
-(define-key org-cdlatex-mode-map "`" 'cdlatex-math-symbol)
-(define-key org-cdlatex-mode-map "'" 'org-cdlatex-math-modify)
-(define-key org-cdlatex-mode-map "\C-c{" 'cdlatex-environment)
+(org-defkey org-cdlatex-mode-map "_" 'org-cdlatex-underscore-caret)
+(org-defkey org-cdlatex-mode-map "^" 'org-cdlatex-underscore-caret)
+(org-defkey org-cdlatex-mode-map "`" 'cdlatex-math-symbol)
+(org-defkey org-cdlatex-mode-map "'" 'org-cdlatex-math-modify)
+(org-defkey org-cdlatex-mode-map "\C-c{" 'cdlatex-environment)
 
 (defvar org-cdlatex-texmathp-advice-is-done nil
   "Flag remembering if we have applied the advice to texmathp already.")
@@ -16064,7 +17456,7 @@
 	(while (string-match re str start)
 	  (cond
 	   ((= (match-end 0) (length str))
-	    (throw 'exit (cons "$" (+ lim (match-beginning 0)))))
+	    (throw 'exit (cons "$" (+ lim (match-beginning 0) 1))))
 	   ((= (match-end 0) (- (length str) 5))
 	    (throw 'exit nil))
 	   (t (setq start (match-end 0))))))
@@ -16156,11 +17548,12 @@
 		      "Creating images for entry...%s"))))
 	(message msg "")
 	(narrow-to-region beg end)
+	(goto-char beg)
 	(org-format-latex
 	 (concat "ltxpng/" (file-name-sans-extension
 			    (file-name-nondirectory
 			     buffer-file-name)))
-	 default-directory 'overlays msg at)
+	 default-directory 'overlays msg at 'forbuffer)
       (message msg "done.  Use `C-c C-c' to remove images.")))))
 
 (defvar org-latex-regexps
@@ -16173,7 +17566,7 @@
     ("$$" "\\$\\$[^\000]*?\\$\\$" 0 t))
   "Regular expressions for matching embedded LaTeX.")
 
-(defun org-format-latex (prefix &optional dir overlays msg at)
+(defun org-format-latex (prefix &optional dir overlays msg at forbuffer)
   "Replace LaTeX fragments with links to an image, and produce images."
   (if (and overlays (fboundp 'clear-image-cache)) (clear-image-cache))
   (let* ((prefixnodir (file-name-nondirectory prefix))
@@ -16210,7 +17603,7 @@
 	      (setq checkdir t)
 	      (or (file-directory-p todir) (make-directory todir)))
 	    (org-create-formula-image
-	     txt movefile opt)
+	     txt movefile opt forbuffer)
 	    (if overlays
 		(progn
 		  (setq ov (org-make-overlay beg end))
@@ -16229,31 +17622,27 @@
 	      (insert link))))))))
 
 ;; This function borrows from Ganesh Swami's latex2png.el
-(defun org-create-formula-image (string tofile options)
+(defun org-create-formula-image (string tofile options buffer)
   (let* ((tmpdir (if (featurep 'xemacs)
 		     (temp-directory)
 		   temporary-file-directory))
 	 (texfilebase (make-temp-name
 		       (expand-file-name "orgtex" tmpdir)))
-
-;(texfilebase (make-temp-file "orgtex"))
-;	 (dummy (delete-file texfilebase))
 	 (texfile (concat texfilebase ".tex"))
 	 (dvifile (concat texfilebase ".dvi"))
 	 (pngfile (concat texfilebase ".png"))
-	 (scale (number-to-string (* 1000 (or (plist-get options :scale) 1.0))))
-	 (fg (or (plist-get options :foreground) "Black"))
-	 (bg (or (plist-get options :background) "Transparent")))
+	 (fnh (face-attribute 'default :height nil))
+	 (scale (or (plist-get options (if buffer :scale :html-scale)) 1.0))
+	 (dpi (number-to-string (* scale (floor (* 0.9 (if buffer fnh 140.))))))
+	 (fg (or (plist-get options (if buffer :foreground :html-foreground))
+		 "Black"))
+	 (bg (or (plist-get options (if buffer :background :html-background))
+		 "Transparent")))
+    (if (eq fg 'default) (setq fg (org-dvipng-color :foreground)))
+    (if (eq bg 'default) (setq bg (org-dvipng-color :background)))
     (with-temp-file texfile
-      (insert "\\documentclass{article}
-\\usepackage{fullpage}
-\\usepackage{amssymb}
-\\usepackage[usenames]{color}
-\\usepackage{amsmath}
-\\usepackage{latexsym}
-\\usepackage[mathscr]{eucal}
-\\pagestyle{empty}
-\\begin{document}\n" string "\n\\end{document}\n"))
+      (insert org-format-latex-header
+	      "\n\\begin{document}\n" string "\n\\end{document}\n"))
     (let ((dir default-directory))
       (condition-case nil
 	  (progn
@@ -16265,7 +17654,9 @@
 	(progn (message "Failed to create dvi file from %s" texfile) nil)
       (call-process "dvipng" nil nil nil
 		    "-E" "-fg" fg "-bg" bg
-		    "-x" scale "-y" scale "-T" "tight"
+                    "-D" dpi
+		    ;;"-x" scale "-y" scale
+		    "-T" "tight"
 		    "-o" pngfile
 		    dvifile)
       (if (not (file-exists-p pngfile))
@@ -16276,6 +17667,16 @@
 	      (delete-file (concat texfilebase e)))
 	pngfile))))
 
+(defun org-dvipng-color (attr)
+  "Return an rgb color specification for dvipng."
+  (apply 'format "rgb %s %s %s"
+	 (mapcar 'org-normalize-color
+		 (color-values (face-attribute 'default attr nil)))))
+
+(defun org-normalize-color (value)
+  "Return string to be used as color value for an RGB component."
+  (format "%g" (/ value 65535.0)))
+
 ;;;; Exporting
 
 ;;; Variables, constants, and parameter plists
@@ -16300,16 +17701,19 @@
     (:headline-levels      . org-export-headline-levels)
     (:section-numbers      . org-export-with-section-numbers)
     (:table-of-contents    . org-export-with-toc)
+    (:preserve-breaks      . org-export-preserve-breaks)
     (:archived-trees       . org-export-with-archived-trees)
     (:emphasize            . org-export-with-emphasize)
     (:sub-superscript      . org-export-with-sub-superscripts)
     (:TeX-macros           . org-export-with-TeX-macros)
     (:LaTeX-fragments      . org-export-with-LaTeX-fragments)
+    (:skip-before-1st-heading . org-export-skip-text-before-1st-heading)
     (:fixed-width          . org-export-with-fixed-width)
     (:timestamps           . org-export-with-timestamps)
     (:tables               . org-export-with-tables)
     (:table-auto-headline  . org-export-highlight-first-table-line)
     (:style                . org-export-html-style)
+    (:agenda-style         . org-agenda-export-html-style) ;; FIXME: Does this work????
     (:convert-org-links    . org-export-html-link-org-files-as-html)
     (:inline-images        . org-export-html-inline-images)
     (:expand-quoted-html   . org-export-html-expand)
@@ -16359,7 +17763,8 @@
 		    ("^"     . :sub-superscript)
 		    ("*"     . :emphasize)
 		    ("TeX"   . :TeX-macros)
-		    ("LaTeX" . :LaTeX-fragments)))
+		    ("LaTeX" . :LaTeX-fragments)
+		    ("skip"  . :skip-before-1st-heading)))
 	      o)
 	  (while (setq o (pop op))
 	    (if (string-match (concat (regexp-quote (car o))
@@ -16377,19 +17782,11 @@
 		val)))
     dir))
 
-(defun org-export-find-first-heading-line (list)
-  "Remove all lines from LIST which are before the first headline."
-  (let ((orig-list list)
-	(re (concat "^" outline-regexp)))
-    (while (and list
-		(not (string-match re (car list))))
-      (pop list))
-    (or list orig-list)))
-
 (defun org-skip-comments (lines)
   "Skip lines starting with \"#\" and subtrees starting with COMMENT."
   (let ((re1 (concat "^\\(\\*+\\)[ \t]+" org-comment-string))
 	(re2 "^\\(\\*+\\)[ \t\n\r]")
+	(case-fold-search nil)
 	rtn line level)
     (while (setq line (pop lines))
       (cond
@@ -16420,6 +17817,7 @@
 
 \[a] export as ASCII
 \[h] export as HTML
+\[H] export as HTML to temporary buffer
 \[b] export as HTML and browse immediately
 \[x] export as XOXO
 
@@ -16437,6 +17835,8 @@
 	   (?a . org-export-as-ascii)
 	   (?h . org-export-as-html)
 	   (?b . org-export-as-html-and-open)
+	   (?H . org-export-as-html-to-buffer)
+	   (?R . org-export-region-as-html)
 	   (?x . org-export-as-xoxo)
 	   (?i . org-export-icalendar-this-file)
 	   (?I . org-export-icalendar-all-agenda-files)
@@ -16465,6 +17865,7 @@
     ("curren")
     ("yen")
     ("brvbar")
+    ("vert" . "&#124;")
     ("sect")
     ("uml")
     ("copy")
@@ -16766,26 +18167,44 @@
 	 (re-angle-link (concat "\\([^[]\\)" org-angle-link-re))
 	 (re-archive (concat ":" org-archive-tag ":"))
 	 (re-quote (concat "^\\*+[ \t]+" org-quote-string "\\>"))
-	 (htmlp (memq :for-html parameters))
+	 (htmlp (plist-get parameters :for-html))
 	 (outline-regexp "\\*+")
-	 rtn)
+	 a b
+	 rtn p)
     (save-excursion
       (set-buffer (get-buffer-create " org-mode-tmp"))
       (erase-buffer)
       (insert string)
+      ;; Remove license-to-kill stuff
+      (while (setq p (text-property-any (point-min) (point-max)
+					:org-license-to-kill t))
+	(delete-region p (next-single-property-change p :org-license-to-kill)))
+
       (let ((org-inhibit-startup t)) (org-mode))
       (untabify (point-min) (point-max))
 
+      ;; Get the correct stuff before the first headline
+      (when (plist-get parameters :skip-before-1st-heading)
+	(goto-char (point-min))
+	(when (re-search-forward "^\\*+[ \t]" nil t)
+	  (delete-region (point-min) (match-beginning 0))
+	  (goto-char (point-min))
+	  (insert "\n")))
+      (when (plist-get parameters :add-text)
+	(goto-char (point-min))
+	(insert (plist-get parameters :add-text) "\n"))
+
       ;; Get rid of archived trees
       (when (not (eq org-export-with-archived-trees t))
 	(goto-char (point-min))
 	(while (re-search-forward re-archive nil t)
-	  (if (not (org-on-heading-p))
+	  (if (not (org-on-heading-p t))
 	      (org-end-of-subtree t)
 	    (beginning-of-line 1)
-	    (delete-region
-	     (if org-export-with-archived-trees (1+ (point-at-eol)) (point))
-	     (org-end-of-subtree t)))))
+	    (setq a (if org-export-with-archived-trees
+			(1+ (point-at-eol)) (point))
+		  b (org-end-of-subtree t))
+	    (if (> b a) (delete-region a b)))))
 
       ;; Protect stuff from HTML processing
       (goto-char (point-min))
@@ -16796,12 +18215,12 @@
 	(goto-char (point-min))
 	(while (re-search-forward "^#\\+HTML:[ \t]*\\(.*\\)" nil t)
 	  (replace-match "\\1" t)
-	  (add-text-properties 
+	  (add-text-properties
 	   (point-at-bol) (min (1+ (point-at-eol)) (point-max))
 	   '(org-protected t))))
       (goto-char (point-min))
       (while (re-search-forward
-	      "^#\\+BEGIN_HTML\\>.*\\(\n.*\\)*?\n#\\+END_HTML\\>.*\n?" nil t)
+	      "^#\\+BEGIN_HTML\\>.*\\(\\(\n.*\\)*?\n\\)#\\+END_HTML\\>.*\n?" nil t)
 	(if htmlp
 	    (add-text-properties (match-beginning 1) (1+ (match-end 1))
 				 '(org-protected t))
@@ -16839,7 +18258,7 @@
 	 (goto-char (match-beginning 0))))
 
       ;; Convert LaTeX fragments to images
-      (when (memq :LaTeX-fragments parameters)
+      (when (plist-get parameters :LaTeX-fragments)
 	(org-format-latex
 	 (concat "ltxpng/" (file-name-sans-extension
 			    (file-name-nondirectory
@@ -16851,6 +18270,7 @@
       ;; Expand link abbreviations
       (goto-char (point-min))
       (while (re-search-forward re-plain-link nil t)
+	(goto-char (1- (match-end 0)))
 	(org-if-unprotected
 	 (replace-match
 	  (concat
@@ -16858,6 +18278,7 @@
 	  t t)))
       (goto-char (point-min))
       (while (re-search-forward re-angle-link nil t)
+	(goto-char (1- (match-end 0)))
 	(org-if-unprotected
 	 (replace-match
 	  (concat
@@ -16877,17 +18298,35 @@
 	  t t)))
 
       ;; Find multiline emphasis and put them into single line
-      (when (memq :emph-multiline parameters)
+      (when (plist-get  parameters :emph-multiline)
 	(goto-char (point-min))
 	(while (re-search-forward org-emph-re nil t)
-	  (org-if-unprotected
-	   (subst-char-in-region (match-beginning 0) (match-end 0) ?\n ?\  t)
-	   (goto-char (1- (match-end 0))))))
+	  (if (not (= (char-after (match-beginning 3))
+		      (char-after (match-beginning 4))))
+	      (org-if-unprotected
+	       (subst-char-in-region (match-beginning 0) (match-end 0)
+				     ?\n ?\  t)
+	       (goto-char (1- (match-end 0))))
+	    (goto-char (1+ (match-beginning 0))))))
 
       (setq rtn (buffer-string)))
     (kill-buffer " org-mode-tmp")
     rtn))
 
+(defun org-export-grab-title-from-buffer ()
+  "Get a title for the current document, from looking at the buffer."
+  (let (buffer-read-only)
+    (save-excursion
+      (goto-char (point-min))
+      (let ((end (save-excursion (outline-next-heading) (point))))
+	(when (re-search-forward "^[ \t]*[^# \t\r\n].*\n" end t)
+	  ;; Mark the line so that it will not be exported as normal text.
+	  (org-unmodified
+	   (add-text-properties (match-beginning 0) (match-end 0)
+				(list :org-license-to-kill t)))
+	  ;; Return the title string
+	  (org-trim (match-string 0)))))))
+
 (defun org-solidify-link-text (s &optional alist)
   "Take link text and make a safe target out of it."
   (save-match-data
@@ -16959,16 +18398,7 @@
   (setq-default org-todo-line-regexp org-todo-line-regexp)
   (let* ((opt-plist (org-combine-plists (org-default-export-plist)
 					(org-infile-export-plist)))
-	 (region
-	  (buffer-substring
-	   (if (org-region-active-p) (region-beginning) (point-min))
-	   (if (org-region-active-p) (region-end) (point-max))))
 	 (custom-times org-display-custom-times)
-	 (lines (org-export-find-first-heading-line
-		 (org-skip-comments
-		  (org-split-string
-		   (org-cleaned-string-for-export region)
-		   "[\r\n]"))))
 	 (org-ascii-current-indentation '(0 . 0))
 	 (level 0) line txt
 	 (umax nil)
@@ -16986,15 +18416,36 @@
 	 (time  (format-time-string "%X" (org-current-time)))
 	 (author      (plist-get opt-plist :author))
 	 (title       (or (plist-get opt-plist :title)
+			  (and (not
+				(plist-get opt-plist :skip-before-1st-heading))
+			       (org-export-grab-title-from-buffer))
 			  (file-name-sans-extension
 			   (file-name-nondirectory buffer-file-name))))
 	 (email       (plist-get opt-plist :email))
 	 (language    (plist-get opt-plist :language))
 	 (quote-re0   (concat "^[ \t]*" org-quote-string "\\>"))
 ;	 (quote-re    (concat "^\\(\\*+\\)\\([ \t]*" org-quote-string "\\>\\)"))
-	 (text        nil)
 	 (todo nil)
-	 (lang-words nil))
+	 (lang-words nil)
+	 (region
+	  (buffer-substring
+	   (if (org-region-active-p) (region-beginning) (point-min))
+	   (if (org-region-active-p) (region-end) (point-max))))
+	 (lines (org-skip-comments
+		 (org-split-string
+		  (org-cleaned-string-for-export
+		   region
+		   :skip-before-1st-heading
+		   (plist-get opt-plist :skip-before-1st-heading)
+		   :add-text (plist-get opt-plist :text))
+		  "[\r\n]")))
+	 thetoc have-headings first-heading-pos
+	 table-open table-buffer)
+
+    (let (buffer-read-only)
+      (org-unmodified
+       (remove-text-properties (point-min) (point-max)
+			       '(:org-license-to-kill t))))
 
     (setq org-last-level 1)
     (org-init-section-numbers)
@@ -17028,27 +18479,27 @@
 			"\n")))
     (if (and date time)
 	(insert (concat (nth 2 lang-words) ": " date " " time "\n")))
-    (if text (insert (concat (org-html-expand-for-ascii text) "\n\n")))
 
     (insert "\n\n")
 
     (if org-export-with-toc
 	(progn
-	  (insert (nth 3 lang-words) "\n"
-		  (make-string (length (nth 3 lang-words)) ?=) "\n")
+	  (push (concat (nth 3 lang-words) "\n") thetoc)
+	  (push (concat (make-string (length (nth 3 lang-words)) ?=) "\n") thetoc)
 	  (mapcar '(lambda (line)
 		     (if (string-match org-todo-line-regexp
 				       line)
 			 ;; This is a headline
 			 (progn
+			   (setq have-headings t)
 			   (setq level (- (match-end 1) (match-beginning 1))
 				 level (org-tr-level level)
 				 txt (match-string 3 line)
 				 todo
 				 (or (and org-export-mark-todo-in-toc
 					  (match-beginning 2)
-					  (not (equal (match-string 2 line)
-						      org-done-string)))
+					  (not (member (match-string 2 line)
+						       org-done-keywords)))
 					; TODO, not DONE
 				     (and org-export-mark-todo-in-toc
 					  (= level umax-toc)
@@ -17067,12 +18518,15 @@
 						 " " txt)))
 			   (if (<= level umax-toc)
 			       (progn
-				 (insert
-				  (make-string (* (1- level) 4) ?\ )
-				  (format (if todo "%s (*)\n" "%s\n") txt))
+				 (push
+				  (concat
+				   (make-string (* (1- level) 4) ?\ )
+				   (format (if todo "%s (*)\n" "%s\n") txt))
+				  thetoc)
 				 (setq org-last-level level))
 			     ))))
-		  lines)))
+		  lines)
+	  (setq thetoc (if have-headings (nreverse thetoc) nil))))
 
     (org-init-section-numbers)
     (while (setq line (pop lines))
@@ -17091,12 +18545,44 @@
       (cond
        ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
 	;; a Headline
+	(setq first-heading-pos (or first-heading-pos (point)))
 	(setq level (org-tr-level (- (match-end 1) (match-beginning 1)))
 	      txt (match-string 2 line))
 	(org-ascii-level-start level txt umax lines))
+
+       ((and org-export-with-tables
+	     (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)" line))
+	(if (not table-open)
+	    ;; New table starts
+	    (setq table-open t table-buffer nil))
+	;; Accumulate lines
+	(setq table-buffer (cons line table-buffer))
+	(when (or (not lines)
+		  (not (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)"
+				     (car lines))))
+	  (setq table-open nil
+		table-buffer (nreverse table-buffer))
+	  (insert (mapconcat
+		   (lambda (x)
+		     (org-fix-indentation x org-ascii-current-indentation))
+		   (org-format-table-ascii table-buffer)
+		   "\n") "\n")))
        (t
 	(insert (org-fix-indentation line org-ascii-current-indentation) "\n"))))
     (normal-mode)
+
+    ;; insert the table of contents
+    (when thetoc
+      (goto-char (point-min))
+      (if (re-search-forward "^[ \t]*\\[TABLE-OF-CONTENTS\\][ \t]*$" nil t)
+	  (progn
+	    (goto-char (match-beginning 0))
+	    (replace-match ""))
+	(goto-char first-heading-pos))
+      (mapc 'insert thetoc)
+      (or (looking-at "[ \t]*\n[ \t]*\n")
+	  (insert "\n\n")))
+
     (save-buffer)
     ;; remove display and invisible chars
     (let (beg end)
@@ -17124,8 +18610,8 @@
 	    (progn
 	      (setq lv (- (match-end 1) (match-beginning 1))
 		    todo (and (match-beginning 2)
-			      (not (equal (match-string 2 line)
-					  org-done-string))))
+			      (not (member (match-string 2 line)
+					  org-done-keywords))))
 					; TODO, not DONE
 	      (if (<= lv level) (throw 'exit nil))
 	      (if todo (throw 'exit t))))))))
@@ -17187,7 +18673,7 @@
 command."
   (interactive
    (list (progn
-	   (message "Export visible: [a]SCII  [h]tml  [b]rowse HTML  [x]OXO  [ ]keep buffer")
+	   (message "Export visible: [a]SCII  [h]tml  [b]rowse HTML [H/R]uffer with HTML  [x]OXO  [ ]keep buffer")
 	   (read-char-exclusive))
 	 current-prefix-arg))
   (if (not (member type '(?a ?\C-a ?b ?\C-b ?h ?x ?\ )))
@@ -17198,6 +18684,8 @@
 				(?b . org-export-as-html-and-open)
 				(?\C-b . org-export-as-html-and-open)
 				(?h . org-export-as-html)
+				(?H . org-export-as-html-to-buffer)
+				(?R . org-export-region-as-html)
 				(?x . org-export-as-xoxo)))))
 	 (keepp (equal type ?\ ))
 	 (file buffer-file-name)
@@ -17253,10 +18741,11 @@
 #+EMAIL:     %s
 #+LANGUAGE:  %s
 #+TEXT:      Some descriptive text to be emitted.  Several lines OK.
-#+OPTIONS:   H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s *:%s TeX:%s LaTeX:%s
+#+OPTIONS:   H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s *:%s TeX:%s LaTeX:%s skip:%s
 #+CATEGORY:  %s
 #+SEQ_TODO:  %s
 #+TYP_TODO:  %s
+#+PRIORITIES: %c %c %c
 #+STARTUP:   %s %s %s %s %s
 #+TAGS:      %s
 #+ARCHIVE:   %s
@@ -17274,13 +18763,11 @@
    org-export-with-emphasize
    org-export-with-TeX-macros
    org-export-with-LaTeX-fragments
+   org-export-skip-text-before-1st-heading
    (file-name-nondirectory buffer-file-name)
-   (if (equal org-todo-interpretation 'sequence)
-       (mapconcat 'identity org-todo-keywords " ")
-     "TODO FEEDBACK VERIFY DONE")
-   (if (equal org-todo-interpretation 'type)
-       (mapconcat 'identity org-todo-keywords " ")
-     "Me Jason Marie DONE")
+   "TODO FEEDBACK VERIFY DONE"
+   "Me Jason Marie DONE"
+   org-highest-priority org-lowest-priority org-default-priority
    (cdr (assoc org-startup-folded
 	       '((nil . "showall") (t . "overview") (content . "content"))))
    (if org-odd-levels-only "odd" "oddeven")
@@ -17372,19 +18859,96 @@
 	--visit=MyFile --funcall org-export-as-html-batch"
   (org-export-as-html org-export-headline-levels 'hidden))
 
-(defun org-export-as-html (arg &optional hidden ext-plist)
+(defun org-export-as-html-to-buffer (arg)
+  "Call `org-exort-as-html` with output to a temporary buffer.
+No file is created.  The prefix ARG is passed through to `org-export-as-html'."
+  (interactive "P")
+  (org-export-as-html arg nil nil "*Org HTML Export*")
+  (switch-to-buffer-other-window "*Org HTML Export*"))
+
+(defun org-replace-region-by-html (beg end)
+  "Assume the current region has org-mode syntax, and convert it to HTML.
+This can be used in any buffer.  For example, you could write an
+itemized list in org-mode syntax in an HTML buffer and then use this
+command to convert it."
+  (interactive "r")
+  (let (reg html buf)
+    (if (org-mode-p)
+	(setq html (org-export-region-as-html
+		    beg end t 'string))
+      (setq reg (buffer-substring beg end)
+	    buf (get-buffer-create "*Org tmp*"))
+      (save-excursion
+	(set-buffer buf)
+	(erase-buffer)
+	(insert reg)
+	(org-mode)
+	(setq html (org-export-region-as-html
+		    (point-min) (point-max) t 'string)))
+      (kill-buffer buf))
+    (delete-region beg end)
+    (insert html)))
+
+(defun org-export-region-as-html (beg end &optional body-only buffer)
+  "Convert region from BEG to END in org-mode buffer to HTML.
+If prefix arg BODY-ONLY is set, omit file header, footer, and table of
+contents, and only produce the region of converted text, useful for
+cut-and-paste operations.
+If BUFFER is a buffer or a string, use/create that buffer as a target
+of the converted HTML.  If BUFFER is the symbol `string', return the
+produced HTML as a string and leave not buffer behind.  For example,
+a Lisp program could call this function in the following way:
+
+  (setq html (org-export-region-as-html beg end t 'string))
+
+When called interactively, the output buffer is selected, and shown
+in a window.  A non-interactive call will only retunr the buffer."
+  (interactive "r\nP")
+  (when (interactive-p)
+    (setq buffer "*Org HTML EXPORT*"))
+  (let ((transient-mark-mode t) (zmacs-regions t)
+	rtn)
+    (goto-char end)
+    (set-mark (point)) ;; to activate the region
+    (goto-char beg)
+    (setq rtn (org-export-as-html
+	       nil nil nil
+	       buffer body-only))
+    (if (fboundp 'deactivate-mark) (deactivate-mark))
+    (if (and (interactive-p) (bufferp rtn))
+	(switch-to-buffer-other-window rtn)
+      rtn)))
+
+(defun org-export-as-html (arg &optional hidden ext-plist
+			       to-buffer body-only)
   "Export the outline as a pretty HTML file.
-If there is an active region, export only the region.
-The prefix ARG specifies how many levels of the outline should become
-headlines.  The default is 3.  Lower levels will become bulleted lists.
-When HIDDEN is non-nil, don't display the HTML buffer.
+If there is an active region, export only the region.  The prefix
+ARG specifies how many levels of the outline should become
+headlines.  The default is 3.  Lower levels will become bulleted
+lists.  When HIDDEN is non-nil, don't display the HTML buffer.
 EXT-PLIST is a property list with external parameters overriding
-org-mode's default settings, but still inferior to file-local settings."
-  (interactive "P")
+org-mode's default settings, but still inferior to file-local
+settings.  When TO-BUFFER is non-nil, create a buffer with that
+name and export to that buffer.  If TO-BUFFER is the symbol `string',
+don't leave any buffer behind but just return the resulting HTML as
+a string.  When BODY-ONLY is set, don't produce the file header and footer,
+simply return the content of <body>...</body>, without even
+the body tags themselves."
+  (interactive "P")
+
+  ;; Make sure we have a file name when we need it.
+  (when (and (not (or to-buffer body-only))
+	     (not buffer-file-name))
+    (if (buffer-base-buffer)
+	(org-set-local 'buffer-file-name
+		       (with-current-buffer (buffer-base-buffer)
+			 buffer-file-name))
+      (error "Need a file name to be able to export.")))
+
   (message "Exporting...")
   (setq-default org-todo-line-regexp org-todo-line-regexp)
   (setq-default org-deadline-line-regexp org-deadline-line-regexp)
-  (setq-default org-done-string org-done-string)
+  (setq-default org-done-keywords org-done-keywords)
   (setq-default org-maybe-keyword-time-regexp org-maybe-keyword-time-regexp)
   (let* ((opt-plist (org-combine-plists (org-default-export-plist)
 					ext-plist
@@ -17392,42 +18956,42 @@
 
 	 (style (plist-get opt-plist :style))
 	 (link-validate (plist-get opt-plist :link-validation-function))
-	 valid
+	 valid thetoc have-headings first-heading-pos
 	 (odd org-odd-levels-only)
 	 (region-p (org-region-active-p))
-         (region
-          (buffer-substring
-           (if region-p (region-beginning) (point-min))
-           (if region-p (region-end) (point-max))))
 	 ;; The following two are dynamically scoped into other
 	 ;; routines below.
 	 (org-current-export-dir (org-export-directory :html opt-plist))
 	 (org-current-export-file buffer-file-name)
-         (all_lines
-          (org-skip-comments (org-split-string
-			      (org-cleaned-string-for-export
-			       region :emph-multiline :for-html
-			       (if (plist-get opt-plist :LaTeX-fragments)
-				   :LaTeX-fragments))
-			      "[\r\n]")))
-         (lines (org-export-find-first-heading-line all_lines))
          (level 0) (line "") (origline "") txt todo
          (umax nil)
          (umax-toc nil)
-         (filename (concat (file-name-as-directory
-			    (org-export-directory :html opt-plist))
-			   (file-name-sans-extension
-			    (file-name-nondirectory buffer-file-name))
-			   ".html"))
-	 (current-dir (file-name-directory buffer-file-name))
-         (buffer (find-file-noselect filename))
+         (filename (if to-buffer nil
+		     (concat (file-name-as-directory
+			      (org-export-directory :html opt-plist))
+			     (file-name-sans-extension
+			      (file-name-nondirectory buffer-file-name))
+			     ".html")))
+	 (current-dir (if buffer-file-name
+			  (file-name-directory buffer-file-name)
+			default-directory))
+	 (buffer (if to-buffer
+		     (cond
+		      ((eq to-buffer 'string) (get-buffer-create "*Org HTML Export*"))
+		      (t (get-buffer-create  to-buffer)))
+		   (find-file-noselect filename)))
          (org-levels-open (make-vector org-level-max nil))
 	 (date (format-time-string "%Y/%m/%d" (current-time)))
 	 (time  (format-time-string "%X" (org-current-time)))
          (author      (plist-get opt-plist :author))
 	 (title       (or (plist-get opt-plist :title)
-			  (file-name-sans-extension
-			   (file-name-nondirectory buffer-file-name))))
+			  (and (not
+				(plist-get opt-plist :skip-before-1st-heading))
+			       (org-export-grab-title-from-buffer))
+			  (and buffer-file-name
+			       (file-name-sans-extension
+				(file-name-nondirectory buffer-file-name)))
+			  "UNTITLED"))
 	 (quote-re0   (concat "^[ \t]*" org-quote-string "\\>"))
 	 (quote-re    (concat "^\\(\\*+\\)\\([ \t]*" org-quote-string "\\>\\)"))
 	 (inquote     nil)
@@ -17438,7 +19002,6 @@
 	 (llt org-plain-list-ordered-item-terminator)
 	 (email       (plist-get opt-plist :email))
          (language    (plist-get opt-plist :language))
-	 (text        (plist-get opt-plist :text))
 	 (lang-words  nil)
 	 (target-alist nil) tg
 	 (head-count  0) cnt
@@ -17450,11 +19013,34 @@
 	 (charset (and coding-system
 		       (fboundp 'coding-system-get)
 		       (coding-system-get coding-system 'mime-charset)))
+         (region
+          (buffer-substring
+           (if region-p (region-beginning) (point-min))
+           (if region-p (region-end) (point-max))))
+         (lines
+          (org-skip-comments (org-split-string
+			      (org-cleaned-string-for-export
+			       region
+			       :emph-multiline t
+			       :for-html t
+			       :skip-before-1st-heading
+			       (plist-get opt-plist :skip-before-1st-heading)
+			       :add-text
+			       (plist-get opt-plist :text)
+			       :LaTeX-fragments
+			       (plist-get opt-plist :LaTeX-fragments))
+			      "[\r\n]")))
 	 table-open type
 	 table-buffer table-orig-buffer
-	 ind start-is-num starter
+	 ind start-is-num starter didclose
 	 rpl path desc descp desc1 desc2 link
 	 )
+
+    (let (buffer-read-only)
+      (org-unmodified
+       (remove-text-properties (point-min) (point-max)
+			       '(:org-license-to-kill t))))
+
     (message "Exporting...")
 
     (setq org-last-level 1)
@@ -17465,9 +19051,7 @@
                          (assoc "en" org-export-language-setup)))
 
     ;; Switch to the output buffer
-    (if (or hidden t)
-        (set-buffer buffer)
-      (switch-to-buffer-other-window buffer))
+    (set-buffer buffer)
     (erase-buffer)
     (fundamental-mode)
     (let ((case-fold-search nil)
@@ -17483,10 +19067,10 @@
       (setq umax-toc (if (integerp org-export-with-toc)
 			 (min org-export-with-toc umax)
 		       umax))
-
-      ;; File header
-      (insert (format
-               "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
+      (unless body-only
+	;; File header
+	(insert (format
+		 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
                \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
 <html xmlns=\"http://www.w3.org/1999/xhtml\"
 lang=\"%s\" xml:lang=\"%s\">
@@ -17499,94 +19083,96 @@
 %s
 </head><body>
 "
-	       language language (org-html-expand title) (or charset "iso-8859-1")
-	       date time author style))
-
-
-      (insert (or (plist-get opt-plist :preamble) ""))
-
-      (when (plist-get opt-plist :auto-preamble)
-	(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
+		 language language (org-html-expand title)
+		 (or charset "iso-8859-1") date time author style))
+
+	(insert (or (plist-get opt-plist :preamble) ""))
+
+	(when (plist-get opt-plist :auto-preamble)
+	  (if title (insert (format org-export-html-title-format
+				    (org-html-expand title))))))
+
+      (if (and org-export-with-toc (not body-only))
 	  (progn
-	    (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>")
+	    (push (format "<h%d>%s</h%d>\n"
+			  org-export-html-toplevel-hlevel
+			  (nth 3 lang-words)
+			  org-export-html-toplevel-hlevel)
+		  thetoc)
+	    (push "<ul>\n<li>" thetoc)
 	    (setq lines
-	    (mapcar '(lambda (line)
-		       (if (string-match org-todo-line-regexp line)
-			   ;; This is a headline
-			   (progn
-			     (setq level (- (match-end 1) (match-beginning 1))
-				   level (org-tr-level level)
-				   txt (save-match-data
-					 (org-html-expand
-					  (org-export-cleanup-toc-line
-					   (match-string 3 line))))
-				   todo
-				   (or (and org-export-mark-todo-in-toc
-					    (match-beginning 2)
-					    (not (equal (match-string 2 line)
-							org-done-string)))
+		  (mapcar '(lambda (line)
+		    (if (string-match org-todo-line-regexp line)
+			;; This is a headline
+			(progn
+			  (setq have-headings t)
+			  (setq level (- (match-end 1) (match-beginning 1))
+				level (org-tr-level level)
+				txt (save-match-data
+				      (org-html-expand
+				       (org-export-cleanup-toc-line
+					(match-string 3 line))))
+				todo
+				(or (and org-export-mark-todo-in-toc
+					 (match-beginning 2)
+					 (not (member (match-string 2 line)
+						      org-done-keywords)))
 					; TODO, not DONE
-				       (and org-export-mark-todo-in-toc
-					    (= level umax-toc)
-					    (org-search-todo-below
-					     line lines level))))
-			     (if (and (memq org-export-with-tags '(not-in-toc nil))
-				      (string-match "[ \t]+:[a-zA-Z0-9_@:]+:[ \t]*$" txt))
-				 (setq txt (replace-match "" t t txt)))
-			     (if (string-match quote-re0 txt)
-				 (setq txt (replace-match "" t t txt)))
-			     (if org-export-with-section-numbers
-				 (setq txt (concat (org-section-number level)
-						   " " txt)))
-			     (if (<= level umax-toc)
-				 (progn
-				   (setq head-count (+ head-count 1))
-				   (if (> level org-last-level)
-				       (progn
-					 (setq cnt (- level org-last-level))
-					 (while (>= (setq cnt (1- cnt)) 0)
-					   (insert "\n<ul>\n<li>"))
-					 (insert "\n")))
-				   (if (< level org-last-level)
-				       (progn
-					 (setq cnt (- org-last-level level))
-					 (while (>= (setq cnt (1- cnt)) 0)
-					   (insert "</li>\n</ul>"))
-					 (insert "\n")))
-				   ;; Check for targets
-				   (while (string-match org-target-regexp line)
-				     (setq tg (match-string 1 line)
-					   line (replace-match
-						 (concat "@<span class=\"target\">" tg "@</span> ")
-						 t t line))
-				     (push (cons (org-solidify-link-text tg)
-						 (format "sec-%d" head-count))
-					   target-alist))
-				   (while (string-match "&lt;\\(&lt;\\)+\\|&gt;\\(&gt;\\)+" txt)
-				     (setq txt (replace-match "" t t txt)))
-				   (insert
-				    (format
-				     (if todo
-					 "</li>\n<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a>"
-				       "</li>\n<li><a href=\"#sec-%d\">%s</a>")
-				     head-count txt))
-
-				   (setq org-last-level level))
-			       )))
-		       line)
-		    lines))
+				    (and org-export-mark-todo-in-toc
+					 (= level umax-toc)
+					 (org-search-todo-below
+					  line lines level))))
+			  (if (and (memq org-export-with-tags '(not-in-toc nil))
+				   (string-match "[ \t]+:[a-zA-Z0-9_@:]+:[ \t]*$" txt))
+			      (setq txt (replace-match "" t t txt)))
+			  (if (string-match quote-re0 txt)
+			      (setq txt (replace-match "" t t txt)))
+			  (if org-export-with-section-numbers
+			      (setq txt (concat (org-section-number level)
+						" " txt)))
+			  (if (<= level (max umax umax-toc))
+			      (setq head-count (+ head-count 1)))
+			  (if (<= level umax-toc)
+			      (progn
+				(if (> level org-last-level)
+				    (progn
+				      (setq cnt (- level org-last-level))
+				      (while (>= (setq cnt (1- cnt)) 0)
+					(push "\n<ul>\n<li>" thetoc))
+				      (push "\n" thetoc)))
+				(if (< level org-last-level)
+				    (progn
+				      (setq cnt (- org-last-level level))
+				      (while (>= (setq cnt (1- cnt)) 0)
+					(push "</li>\n</ul>" thetoc))
+				      (push "\n" thetoc)))
+				;; Check for targets
+				(while (string-match org-target-regexp line)
+				  (setq tg (match-string 1 line)
+					line (replace-match
+					      (concat "@<span class=\"target\">" tg "@</span> ")
+					      t t line))
+				  (push (cons (org-solidify-link-text tg)
+					      (format "sec-%d" head-count))
+					target-alist))
+				(while (string-match "&lt;\\(&lt;\\)+\\|&gt;\\(&gt;\\)+" txt)
+				  (setq txt (replace-match "" t t txt)))
+				(push
+				 (format
+				  (if todo
+				      "</li>\n<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a>"
+				    "</li>\n<li><a href=\"#sec-%d\">%s</a>")
+				  head-count txt) thetoc)
+
+				(setq org-last-level level))
+			    )))
+		    line)
+			  lines))
 	    (while (> org-last-level 0)
 	      (setq org-last-level (1- org-last-level))
-	      (insert "</li>\n</ul>\n"))
-	    ))
+	      (push "</li>\n</ul>\n" thetoc))
+	    (setq thetoc (if have-headings (nreverse thetoc) nil))))
+
       (setq head-count 0)
       (org-init-section-numbers)
 
@@ -17618,7 +19204,16 @@
 
 	  ;; Protected HTML
 	  (when (get-text-property 0 'org-protected line)
-	    (insert line "\n")
+	    (let (par)
+	      (when (re-search-backward
+		     "\\(<p>\\)\\([ \t\r\n]*\\)\\=" (- (point) 100) t)
+		(setq par (match-string 1))
+		(replace-match "\\2\n"))
+	      (insert line "\n")
+	      (while (and lines
+			  (get-text-property 0 'org-protected (car lines)))
+		(insert (pop lines) "\n"))
+	      (and par (insert "<p>\n")))
 	    (throw 'nextline nil))
 
 	  ;; Horizontal line
@@ -17676,7 +19271,8 @@
 	      (setq rpl
 		    (concat
 		     "<a href=\"#"
-		     (org-solidify-link-text path target-alist)
+		     (org-solidify-link-text
+		      (save-match-data (org-link-unescape path)) target-alist)
 		     "\">" desc "</a>")))
 	     ((member type '("http" "https")) ; FIXME: need to test this.
 	      ;; standard URL, just check if we need to inline an image
@@ -17738,12 +19334,24 @@
 	  ;; TODO items
 	  (if (and (string-match org-todo-line-regexp line)
 		   (match-beginning 2))
-	      (if (equal (match-string 2 line) org-done-string)
+	      (if (member (match-string 2 line) org-done-keywords)
 		  (setq line (replace-match
 			      "<span class=\"done\">\\2</span>"
 			      t nil line 2))
-		(setq line (replace-match "<span class=\"todo\">\\2</span>"
-					  t nil line 2))))
+		(setq line
+                      (concat (substring line 0 (match-beginning 2))
+                              "<span class=\"todo\">" (match-string 2 line)
+                              "</span>" (substring line (match-end 2))))))
+
+	  ;; Does this contain a reference to a footnote?
+	  (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line)
+	    (let ((n (match-string 2 line)))
+	      (setq line
+		    (replace-match
+		     (format
+		      "%s<sup><a class=\"footref\" name=\"fnr.%s\" href=\"#fn.%s\">%s</a></sup>"
+		      (match-string 1 line) n n n)
+		     t t line))))
 
 	  (cond
 	   ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
@@ -17752,7 +19360,8 @@
 		  txt (match-string 2 line))
 	    (if (string-match quote-re0 txt)
 		(setq txt (replace-match "" t t txt)))
-	    (if (<= level umax) (setq head-count (+ head-count 1)))
+	    (if (<= level (max umax umax-toc))
+		(setq head-count (+ head-count 1)))
 	    (when in-local-list
 	      ;; Close any local lists before inserting a new header line
 	      (while local-list-num
@@ -17761,6 +19370,7 @@
 		(pop local-list-num))
 	      (setq local-list-indent nil
 		    in-local-list nil))
+	    (setq first-heading-pos (or first-heading-pos (point)))
 	    (org-html-level-start level txt umax
 				  (and org-export-with-toc (<= level umax))
 				  head-count)
@@ -17801,11 +19411,15 @@
 		    line (substring line (match-beginning 5)))
 	      (unless (string-match "[^ \t]" line)
 		;; empty line.  Pretend indentation is large.
-		(setq ind (1+ (or (car local-list-indent) 1))))
+		(setq ind (if org-empty-line-terminates-plain-lists
+			      0
+			    (1+ (or (car local-list-indent) 1)))))
+	      (setq didclose nil)
 	      (while (and in-local-list
 			  (or (and (= ind (car local-list-indent))
 				   (not starter))
 			      (< ind (car local-list-indent))))
+		(setq didclose t)
 		(org-close-li)
 		(insert (if (car local-list-num) "</ol>\n" "</ul>"))
 		(pop local-list-num) (pop local-list-indent)
@@ -17814,7 +19428,7 @@
 	       ((and starter
 		     (or (not in-local-list)
 			 (> ind (car local-list-indent))))
-		;; Start new (level of ) list
+		;; Start new (level of) list
 		(org-close-par-maybe)
 		(insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n"))
 		(push start-is-num local-list-num)
@@ -17823,7 +19437,10 @@
 	       (starter
 		;; continue current list
 		(org-close-li)
-		(insert "<li>\n")))
+		(insert "<li>\n"))
+	       (didclose
+		;; we did close a list, normal text follows: need <p>
+		(org-open-par)))
 	      (if (string-match "^[ \t]*\\[\\([X ]\\)\\]" line)
 		  (setq line
 			(replace-match
@@ -17837,6 +19454,13 @@
 	    ;; also start a new paragraph.
 	    (if (string-match "^ [-+*]-\\|^[ \t]*$" line) (org-open-par))
 
+	    ;; Is this the start of a footnote?
+	    (when (string-match "^[ \t]*\\[\\([0-9]+\\)\\]" line)
+	      (org-close-par-maybe)
+	      (let ((n (match-string 1 line)))
+		(setq line (replace-match
+			    (format "<p class=\"footnote\"><sup><a class=\"footnum\" name=\"fn.%s\" href=\"#fnr.%s\">%s</a></sup>" n n n) t t line))))
+
 	    ;; Check if the line break needs to be conserved
 	    (cond
 	     ((string-match "\\\\\\\\[ \t]*$" line)
@@ -17860,24 +19484,43 @@
 			    (and org-export-with-toc (<= level umax))
 			    head-count)
 
-      (when (plist-get opt-plist :auto-postamble)
-	(when author
-	  (insert "<p class=\"author\"> "
-		  (nth 1 lang-words) ": " author "\n")
-	  (when email
-	    (insert "<a href=\"mailto:" email "\">&lt;"
-		    email "&gt;</a>\n"))
-	  (insert "</p>\n"))
-	(when (and date time)
-	  (insert "<p class=\"date\"> "
-		  (nth 2 lang-words) ": "
-		  date " " time "</p>\n")))
-
-      (if org-export-html-with-timestamp
-	  (insert org-export-html-html-helper-timestamp))
-      (insert (or (plist-get opt-plist :postamble) ""))
-      (insert "</body>\n</html>\n")
+      (unless body-only
+	(when (plist-get opt-plist :auto-postamble)
+	  (when author
+	    (insert "<p class=\"author\"> "
+		    (nth 1 lang-words) ": " author "\n")
+	    (when email
+	      (insert "<a href=\"mailto:" email "\">&lt;"
+		      email "&gt;</a>\n"))
+	    (insert "</p>\n"))
+	  (when (and date time)
+	    (insert "<p class=\"date\"> "
+		    (nth 2 lang-words) ": "
+		    date " " time "</p>\n")))
+
+	(if org-export-html-with-timestamp
+	    (insert org-export-html-html-helper-timestamp))
+	(insert (or (plist-get opt-plist :postamble) ""))
+	(insert "</body>\n</html>\n"))
+
       (normal-mode)
+      (if (eq major-mode default-major-mode) (html-mode))
+
+      ;; insert the table of contents
+      (goto-char (point-min))
+      (when thetoc
+	(if (or (re-search-forward
+		 "<p>\\s-*\\[TABLE-OF-CONTENTS\\]\\s-*</p>" nil t)
+		(re-search-forward
+		 "\\[TABLE-OF-CONTENTS\\]" nil t))
+	    (progn
+	      (goto-char (match-beginning 0))
+	      (replace-match ""))
+	  (goto-char first-heading-pos)
+	  (when (looking-at "\\s-*</p>")
+	    (goto-char (match-end 0))
+	    (insert "\n")))
+	(mapc 'insert thetoc))
       ;; remove empty paragraphs and lists
       (goto-char (point-min))
       (while (re-search-forward "<p>[ \r\n\t]*</p>" nil t)
@@ -17885,13 +19528,62 @@
       (goto-char (point-min))
       (while (re-search-forward "<li>[ \r\n\t]*</li>\n?" nil t)
 	(replace-match ""))
-      (save-buffer)
+      (or to-buffer (save-buffer))
       (goto-char (point-min))
-      (message "Exporting... done"))))
+      (message "Exporting... done")
+      (if (eq to-buffer 'string)
+	  (prog1 (buffer-substring (point-min) (point-max))
+	    (kill-buffer (current-buffer)))
+	(current-buffer)))))
+
+(defvar org-table-colgroup-info nil) ;; FIXME: mode to a better place
+(defun org-format-table-ascii (lines)
+  "Format a table for ascii export."
+  (if (stringp lines)
+      (setq lines (org-split-string lines "\n")))
+  (if (not (string-match "^[ \t]*|" (car lines)))
+      ;; Table made by table.el - test for spanning
+      lines
+
+    ;; A normal org table
+    ;; Get rid of hlines at beginning and end
+    (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
+    (setq lines (nreverse lines))
+    (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
+    (setq lines (nreverse lines))
+    (when org-export-table-remove-special-lines
+      ;; Check if the table has a marking column.  If yes remove the
+      ;; column and the special lines
+      (setq lines (org-table-clean-before-export lines)))
+    ;; Get rid of the vertical lines except for grouping
+    (let ((vl (org-colgroup-info-to-vline-list org-table-colgroup-info))
+	  rtn line vl1 start)
+      (while (setq line (pop lines))
+	(if (string-match org-table-hline-regexp line)
+	    (and (string-match "|\\(.*\\)|" line)
+		 (setq line (replace-match " \\1" t nil line)))
+	  (setq start 0 vl1 vl)
+	  (while (string-match "|" line start)
+	    (setq start (match-end 0))
+	    (or (pop vl1) (setq line (replace-match " " t t line)))))
+	(push line rtn))
+      (nreverse rtn))))
+
+(defun org-colgroup-info-to-vline-list (info)
+  (let (vl new last rtn line)
+    (while info
+      (setq last new new (pop info))
+      (if (or (memq last '(:end :startend))
+	      (memq new  '(:start :startend)))
+	  (push t vl)
+	(push nil vl)))
+    (setq vl (cons nil (nreverse vl)))))
 
 
 (defun org-format-table-html (lines olines)
   "Find out which HTML converter to use and return the HTML code."
+  (if (stringp lines)
+      (setq lines (org-split-string lines "\n")))
   (if (string-match "^[ \t]*|" (car lines))
       ;; A normal org table
       (org-format-org-table-html lines)
@@ -17931,7 +19623,7 @@
 			      (lambda (x) (string-match "^[ \t]*|-" x))
 			      (cdr lines)))))
 	(nlines 0) fnum i
-	tbopen line fields html)
+	tbopen line fields html gr)
     (if splice (setq head nil))
     (unless splice (push (if head "<thead>" "<tbody>") html))
     (setq tbopen t)
@@ -17939,7 +19631,7 @@
       (catch 'next-line
 	(if (string-match "^[ \t]*|-" line)
 	    (progn
-	      (unless splice 
+	      (unless splice
 		(push (if head "</thead>" "</tbody>") html)
 		(if lines (push "<tbody>" html) (setq tbopen nil)))
 	      (setq head nil)   ;; head ends here, first time around
@@ -17957,8 +19649,10 @@
 				  (string-match org-table-number-regexp x))
 			     (incf (aref fnum i)))
 			 (if head
-			     (concat "<th>" x "</th>")
-			   (concat "<td>" x "</td>")))
+			     (concat (car org-export-table-header-tags) x
+				     (cdr org-export-table-header-tags))
+			   (concat (car org-export-table-data-tags) x
+				   (cdr org-export-table-data-tags))))
 		       fields "")
 		      "</tr>")
 	      html)))
@@ -17969,9 +19663,12 @@
       ;; Put in COL tags with the alignment (unfortuntely often ignored...)
       (push (mapconcat
 	     (lambda (x)
-	       (format "<COL align=\"%s\">"
+	       (setq gr (pop org-table-colgroup-info))
+	       (format "%s<COL align=\"%s\">%s"
+		       (if (memq gr '(:start :startend)) "<colgroup>" "")
 		       (if (> (/ (float x) nlines) org-table-number-fraction)
-			   "right" "left")))
+			   "right" "left")
+		       (if (memq gr '(:end :startend)) "</colgroup>" "")))
 	     fnum "")
 	    html)
       (push org-export-html-table-tag html))
@@ -17980,34 +19677,52 @@
 (defun org-table-clean-before-export (lines)
   "Check if the table has a marking column.
 If yes remove the column and the special lines."
+  (setq org-table-colgroup-info nil)
   (if (memq nil
 	    (mapcar
 	     (lambda (x) (or (string-match "^[ \t]*|-" x)
 			     (string-match "^[ \t]*| *\\([#!$*_^ /]\\) *|" x)))
 	     lines))
       (progn
-	(setq org-table-clean-did-remove-column-1 nil)
-	lines)
-    (setq org-table-clean-did-remove-column-1 t)
+	(setq org-table-clean-did-remove-column nil)
+	(delq nil
+	      (mapcar
+	       (lambda (x)
+		 (cond
+		  ((string-match  "^[ \t]*| */ *|" x)
+		   (setq org-table-colgroup-info
+			 (mapcar (lambda (x)
+				   (cond ((member x '("<" "&lt;")) :start)
+					 ((member x '(">" "&gt;")) :end)
+					 ((member x '("<>" "&lt;&gt;")) :startend)
+					 (t nil)))
+				 (org-split-string x "[ \t]*|[ \t]*")))
+		   nil)
+		  (t x)))
+	       lines)))
+    (setq org-table-clean-did-remove-column t)
     (delq nil
 	  (mapcar
-	   (lambda (x) (if (string-match "^[ \t]*| *[!_^/] *|" x)
-			   nil ; ignore this line
-			 (and (or (string-match "^[ \t]*|-+\\+" x)
-				  (string-match "^[ \t]*|[^|]*|" x))
-			      (replace-match "|" t t x))))
+	   (lambda (x)
+	     (cond
+	      ((string-match  "^[ \t]*| */ *|" x)
+	       (setq org-table-colgroup-info
+		     (mapcar (lambda (x)
+			       (cond ((member x '("<" "&lt;")) :start)
+				     ((member x '(">" "&gt;")) :end)
+				     ((member x '("<>" "&lt;&gt;")) :startend)
+				     (t nil)))
+			     (cdr (org-split-string x "[ \t]*|[ \t]*"))))
+	       nil)
+	      ((string-match "^[ \t]*| *[!_^/] *|" x)
+	       nil) ; ignore this line
+	      ((or (string-match "^\\([ \t]*\\)|-+\\+" x)
+		   (string-match "^\\([ \t]*\\)|[^|]*|" x))
+	       ;; remove the first column
+	       (replace-match "\\1|" t nil x))
+	      (t (error "This should not happen"))))
 	   lines))))
 
-(defun org-fake-empty-table-line (line)
-  "Replace everything except \"|\" with spaces."
-  (let ((i (length line))
-	(newstr (copy-sequence line)))
-    (while (> i 0)
-      (setq i (1- i))
-      (if (not (eq (aref newstr i) ?|))
-	  (aset newstr i ?\ )))
-    newstr))
-
 (defun org-format-table-table-html (lines)
   "Format a table generated by table.el into HTML.
 This conversion does *not* use `table-generate-source' from table.el.
@@ -18024,17 +19739,21 @@
 	    (progn
 	      (if field-buffer
 		  (progn
-		    (setq html (concat
-				html
-				"<tr>"
-				(mapconcat
-				 (lambda (x)
-				   (if (equal x "") (setq x empty))
-				   (if head
-				       (concat "<th>" x "</th>\n")
-				     (concat "<td>" x "</td>\n")))
-				 field-buffer "\n")
-				"</tr>\n"))
+		    (setq
+		     html
+		     (concat
+		      html
+		      "<tr>"
+		      (mapconcat
+		       (lambda (x)
+			 (if (equal x "") (setq x empty))
+			 (if head
+			     (concat (car org-export-table-header-tags) x
+				     (cdr org-export-table-header-tags))
+			   (concat (car org-export-table-data-tags) x
+				   (cdr org-export-table-data-tags))))
+		       field-buffer "\n")
+		      "</tr>\n"))
 		    (setq head nil)
 		    (setq field-buffer nil)))
 	      ;; Ignore this line
@@ -18115,6 +19834,9 @@
   (when org-export-remove-timestamps-from-toc
     (while (string-match org-maybe-keyword-time-regexp s)
       (setq s (replace-match "" t t s))))
+  (while (string-match org-bracket-link-regexp s)
+    (setq s (replace-match (match-string (if (match-end 3) 3 1) s)
+			   t t s)))
   s)
 
 (defun org-html-expand (string)
@@ -18179,27 +19901,42 @@
    "\\(\\(?:\\*\\|[-+]?[^-+*!@#$%^_ \t\r\n,:\"?<>~;./{}=()]+\\)\\)\\)")
   "The regular expression matching a sub- or superscript.")
 
+;(let ((s "a\\_b"))
+;  (and (string-match org-match-substring-regexp s)
+;       (conca	     t (match-string 1 s) ":::" (match-string 2 s))))
+
 (defun org-export-html-convert-sub-super (string)
   "Convert sub- and superscripts in STRING to HTML."
-  (let (key c)
-    (while (string-match org-match-substring-regexp string)
-      (setq key (if (string= (match-string 2 string) "_") "sub" "sup"))
-      (setq c (or (match-string 8 string)
-		  (match-string 6 string)
-		  (match-string 5 string)))
-      (setq string (replace-match
-		    (concat (match-string 1 string)
-			    "<" key ">" c "</" key ">")
-		    t t string)))
+  (let (key c (s 0) (requireb (eq org-export-with-sub-superscripts '{})))
+    (while (string-match org-match-substring-regexp string s)
+      (if (and requireb (match-end 8))
+	  (setq s (match-end 2))
+	(setq s (match-end 1)
+	      key (if (string= (match-string 2 string) "_") "sub" "sup")
+	      c (or (match-string 8 string)
+		    (match-string 6 string)
+		    (match-string 5 string))
+	      string (replace-match
+		      (concat (match-string 1 string)
+			      "<" key ">" c "</" key ">")
+		      t t string))))
     (while (string-match "\\\\\\([_^]\\)" string)
-      (setq string (replace-match (match-string 1 string) t t string))))
-  string)
+      (setq string (replace-match (match-string 1 string) t t string)))
+    string))
 
 (defun org-export-html-convert-emphasize (string)
   "Apply emphasis."
-  (while (string-match org-emph-re string)
-    (setq string (replace-match (concat "\\1" (nth 2 (assoc (match-string 3 string) org-emphasis-alist)) "\\4" (nth 3 (assoc (match-string 3 string) org-emphasis-alist)) "\\5") t nil string)))
-  string)
+  (let ((s 0))
+    (while (string-match org-emph-re string s)
+      (if (not (equal
+		(substring string (match-beginning 3) (1+ (match-beginning 3)))
+		(substring string (match-beginning 4) (1+ (match-beginning 4)))))
+	  (setq string (replace-match
+			(concat "\\1" (nth 2 (assoc (match-string 3 string) org-emphasis-alist))
+				"\\4" (nth 3 (assoc (match-string 3 string) org-emphasis-alist))
+				"\\5") t nil string))
+	(setq s (1+ s))))
+    string))
 
 (defvar org-par-open nil)
 (defun org-open-par ()
@@ -18216,10 +19953,6 @@
   "Close <li> if necessary."
   (org-close-par-maybe)
   (insert "</li>\n"))
-;  (when (save-excursion
-;	  (re-search-backward "</?\\(ul\\|ol\\|li\\|[hH][0-9]\\)>" nil t))
-;    (if (member (match-string 0) '("</ul>" "</ol>" "<li>"))
-;	(insert "</li>"))))
 
 (defun org-html-level-start (level title umax with-toc head-count)
   "Insert a new level in HTML export.
@@ -18260,7 +19993,7 @@
 	    (setq title (concat (org-section-number level) " " title)))
 	(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"
+	    (insert (format "\n<h%d id=\"sec-%d\">%s</h%d>\n"
 			    level head-count title level))
 	  (insert (format "\n<h%d>%s</h%d>\n" level title level)))
 	(org-open-par)))))
@@ -18268,7 +20001,7 @@
 (defun org-html-level-close (&rest args)
   "Terminate one level in HTML export."
   (org-close-li)
-  (insert "</ul>"))
+  (insert "</ul>\n"))
 
 ;;; iCalendar export
 
@@ -18300,11 +20033,13 @@
 If COMBINE is non-nil, combine all calendar entries into a single large
 file and store it under the name `org-combined-agenda-icalendar-file'."
   (save-excursion
+    (org-prepare-agenda-buffers files)
     (let* ((dir (org-export-directory
 		 :ical (list :publishing-directory
 			     org-export-publishing-directory)))
 	   file ical-file ical-buffer category started org-agenda-new-buffers)
 
+      (and (get-buffer "*ical-tmp*") (kill-buffer "*ical-tmp*"))
       (when combine
 	(setq ical-file
 	      (if (file-name-absolute-p org-combined-agenda-icalendar-file)
@@ -18349,70 +20084,112 @@
 (defun org-print-icalendar-entries (&optional combine)
   "Print iCalendar entries for the current Org-mode file to `standard-output'.
 When COMBINE is non nil, add the category to each line."
-  (let ((re2 (concat "--?-?\\(" org-ts-regexp "\\)"))
+  (let ((re1 (concat org-ts-regexp "\\|<%%([^>\n]+>"))
+	(re2 (concat "--?-?\\(" org-ts-regexp "\\)"))
 	(org-category-table (org-get-category-table))
 	(dts (org-ical-ts-to-string
 	      (format-time-string (cdr org-time-stamp-formats) (current-time))
 	      "DTSTART"))
-	hd ts ts2 state status (inc t) pos
-	scheduledp deadlinep tmp pri category)
+	hd ts ts2 state status (inc t) pos b sexp rrule
+	scheduledp deadlinep tmp pri category
+	(sexp-buffer (get-buffer-create "*ical-tmp*")))
     (save-excursion
       (goto-char (point-min))
-      (while (re-search-forward org-ts-regexp nil t)
-	(setq pos (match-beginning 0)
-	      ts (match-string 0)
-	      inc t
-	      hd (org-get-heading)
-	      category (org-get-category))
-	(if (looking-at re2)
-	    (progn
-	      (goto-char (match-end 0))
-	      (setq ts2 (match-string 1) inc nil))
-	  (setq ts2 ts
-		tmp (buffer-substring (max (point-min)
+      (while (re-search-forward re1 nil t)
+	(catch :skip
+	  (org-agenda-skip)
+	  (setq pos (match-beginning 0)
+		ts (match-string 0)
+		inc t
+		hd (org-get-heading)
+		category (org-get-category))
+	  (if (looking-at re2)
+	      (progn
+		(goto-char (match-end 0))
+		(setq ts2 (match-string 1) inc nil))
+	    (setq ts2 ts
+		  tmp (buffer-substring (max (point-min)
 					     (- pos org-ds-keyword-length))
-				      pos)
-		deadlinep (string-match org-deadline-regexp tmp)
-		scheduledp (string-match org-scheduled-regexp tmp)
-		;; donep (org-entry-is-done-p)
-                ))
-	(if (or (string-match org-tr-regexp hd)
-		(string-match org-ts-regexp hd))
-	    (setq hd (replace-match "" t t hd)))
-	(if (string-match org-bracket-link-regexp hd)
-	    (setq hd (replace-match (if (match-end 3) (match-string 3 hd)
-				      (match-string 1 hd))
-				    t t hd)))
-	(if deadlinep (setq hd (concat "DL: " hd)))
-	(if scheduledp (setq hd (concat "S: " hd)))
-	(princ (format "BEGIN:VEVENT
+					pos)
+		  deadlinep (string-match org-deadline-regexp tmp)
+		  scheduledp (string-match org-scheduled-regexp tmp)
+		  ;; donep (org-entry-is-done-p)
+		  ))
+	  (if (or (string-match org-tr-regexp hd)
+		  (string-match org-ts-regexp hd))
+	      (setq hd (replace-match "" t t hd)))
+	  (if (string-match "\\+\\([0-9]+\\)\\([dwmy]\\)>" ts)
+	      (setq rrule
+		    (concat "\nRRULE:FREQ="
+			    (cdr (assoc
+				  (match-string 2 ts)
+				  '(("d" . "DAILY")("w" . "WEEKLY")
+				    ("m" . "MONTHLY")("y" . "YEARLY"))))
+			    ";INTERVAL=" (match-string 1 ts)))
+	    (setq rrule ""))
+	  (if (string-match org-bracket-link-regexp hd)
+	      (setq hd (replace-match (if (match-end 3) (match-string 3 hd)
+					(match-string 1 hd))
+				      t t hd)))
+	  (if deadlinep (setq hd (concat "DL: " hd)))
+	  (if scheduledp (setq hd (concat "S: " hd)))
+	  (if (string-match "\\`<%%" ts)
+	      (with-current-buffer sexp-buffer
+		(insert (substring ts 1 -1) " " hd "\n"))
+	    (princ (format "BEGIN:VEVENT
 %s
-%s
+%s%s
 SUMMARY:%s
 CATEGORIES:%s
 END:VEVENT\n"
-		       (org-ical-ts-to-string ts "DTSTART")
-		       (org-ical-ts-to-string ts2 "DTEND" inc)
-		       hd category)))
+			   (org-ical-ts-to-string ts "DTSTART")
+			   (org-ical-ts-to-string ts2 "DTEND" inc)
+			   rrule hd category)))))
+
+      (when (and org-icalendar-include-sexps
+		 (condition-case nil (require 'icalendar) (error nil))
+		 (fboundp 'icalendar-export-region))
+	;; Get all the literal sexps
+	(goto-char (point-min))
+	(while (re-search-forward "^&?%%(" nil t)
+	  (catch :skip
+	    (org-agenda-skip)
+	    (setq b (match-beginning 0))
+	    (goto-char (1- (match-end 0)))
+	    (forward-sexp 1)
+	    (end-of-line 1)
+	    (setq sexp (buffer-substring b (point)))
+	    (with-current-buffer sexp-buffer
+	      (insert sexp "\n"))
+	    (princ (org-diary-to-ical-string sexp-buffer)))))
+
       (when org-icalendar-include-todo
 	(goto-char (point-min))
 	(while (re-search-forward org-todo-line-regexp nil t)
-	  (setq state (match-string 2))
-	  (setq status (if (equal state org-done-string)
-			   "COMPLETED" "NEEDS-ACTION"))
-	  (when (and state
-		     (or (not (equal state org-done-string))
-			 (eq org-icalendar-include-todo 'all)))
-	    (setq hd (match-string 3))
-	    (if (string-match org-priority-regexp hd)
-		(setq pri (string-to-char (match-string 2 hd))
-		      hd (concat (substring hd 0 (match-beginning 1))
-				 (substring hd (match-end 1))))
-	      (setq pri org-default-priority))
-	    (setq pri (floor (1+ (* 8. (/ (float (- org-lowest-priority pri))
-					  (- org-lowest-priority ?A))))))
-
-	    (princ (format "BEGIN:VTODO
+	  (catch :skip
+	    (org-agenda-skip)
+	    (setq state (match-string 2))
+	    (setq status (if (member state org-done-keywords)
+			     "COMPLETED" "NEEDS-ACTION"))
+	    (when (and state
+		       (or (not (member state org-done-keywords))
+			   (eq org-icalendar-include-todo 'all))
+		       (not (member org-archive-tag (org-get-tags-at)))
+		       )
+	      (setq hd (match-string 3))
+	      (if (string-match org-bracket-link-regexp hd)
+		  (setq hd (replace-match (if (match-end 3) (match-string 3 hd)
+					    (match-string 1 hd))
+					  t t hd)))
+	      (if (string-match org-priority-regexp hd)
+		  (setq pri (string-to-char (match-string 2 hd))
+			hd (concat (substring hd 0 (match-beginning 1))
+				   (substring hd (match-end 1))))
+		(setq pri org-default-priority))
+	      (setq pri (floor (1+ (* 8. (/ (float (- org-lowest-priority pri))
+					    (- org-lowest-priority org-highest-priority))))))
+
+	      (princ (format "BEGIN:VTODO
 %s
 SUMMARY:%s
 CATEGORIES:%s
@@ -18420,7 +20197,7 @@
 PRIORITY:%d
 STATUS:%s
 END:VTODO\n"
-			   dts hd category pri status))))))))
+			     dts hd category pri status)))))))))
 
 (defun org-start-icalendar-file (name)
   "Start an iCalendar file by inserting the header."
@@ -18545,47 +20322,44 @@
 
 ;;;; Key bindings
 
-;; - Bindings in Org-mode map are currently
-;;   0123456789abcdefghijklmnopqrstuvwxyz!?@#$%^&-+*/=()_{}[]:;"|,.<>~`'\t  the alphabet
-;;             abcd fgh j lmnopqrstuvwxyz!? #$ ^ -+*/=     [] ; |,.<>~ '\t  necessary bindings
-;;                 e                                                        (?) useful from outline-mode
-;;                     i k                 @                                expendable from outline-mode
-;;   0123456789                               % &     ()_{}    "      `     free
-
 ;; Make `C-c C-x' a prefix key
-(define-key org-mode-map "\C-c\C-x" (make-sparse-keymap))
+(org-defkey org-mode-map "\C-c\C-x" (make-sparse-keymap))
 
 ;; TAB key with modifiers
-(define-key org-mode-map "\C-i"       'org-cycle)
-(define-key org-mode-map [(tab)]      'org-cycle)
-(define-key org-mode-map [(control tab)] 'org-force-cycle-archived)
-(define-key org-mode-map [(meta tab)] 'org-complete)
-(define-key org-mode-map "\M-\t" 'org-complete)
-(define-key org-mode-map "\M-\C-i"      'org-complete)
+(org-defkey org-mode-map "\C-i"       'org-cycle)
+(org-defkey org-mode-map [(tab)]      'org-cycle)
+(org-defkey org-mode-map [(control tab)] 'org-force-cycle-archived)
+(org-defkey org-mode-map [(meta tab)] 'org-complete)
+(org-defkey org-mode-map "\M-\t" 'org-complete)
+(org-defkey org-mode-map "\M-\C-i"      'org-complete)
 ;; The following line is necessary under Suse GNU/Linux
 (unless (featurep 'xemacs)
-  (define-key org-mode-map [S-iso-lefttab]  'org-shifttab))
-(define-key org-mode-map [(shift tab)]    'org-shifttab)
-
-(define-key org-mode-map (org-key 'S-return)   'org-table-copy-down)
-(define-key org-mode-map [(meta shift return)] 'org-insert-todo-heading)
-(define-key org-mode-map [(meta return)]       'org-meta-return)
+  (org-defkey org-mode-map [S-iso-lefttab]  'org-shifttab))
+(org-defkey org-mode-map [(shift tab)]    'org-shifttab)
+(define-key org-mode-map (kbd "<backtab>") 'org-shifttab)
+
+(org-defkey org-mode-map [(shift return)]   'org-table-copy-down)
+(org-defkey org-mode-map [(meta shift return)] 'org-insert-todo-heading)
+(org-defkey org-mode-map [(meta return)]       'org-meta-return)
 
 ;; Cursor keys with modifiers
-(define-key org-mode-map [(meta left)]  'org-metaleft)
-(define-key org-mode-map [(meta right)] 'org-metaright)
-(define-key org-mode-map [(meta up)]    'org-metaup)
-(define-key org-mode-map [(meta down)]  'org-metadown)
-
-(define-key org-mode-map [(meta shift left)]   'org-shiftmetaleft)
-(define-key org-mode-map [(meta shift right)]  'org-shiftmetaright)
-(define-key org-mode-map [(meta shift up)]     'org-shiftmetaup)
-(define-key org-mode-map [(meta shift down)]   'org-shiftmetadown)
-
-(define-key org-mode-map (org-key 'S-up)       'org-shiftup)
-(define-key org-mode-map (org-key 'S-down)     'org-shiftdown)
-(define-key org-mode-map (org-key 'S-left)     'org-shiftleft)
-(define-key org-mode-map (org-key 'S-right)    'org-shiftright)
+(org-defkey org-mode-map [(meta left)]  'org-metaleft)
+(org-defkey org-mode-map [(meta right)] 'org-metaright)
+(org-defkey org-mode-map [(meta up)]    'org-metaup)
+(org-defkey org-mode-map [(meta down)]  'org-metadown)
+
+(org-defkey org-mode-map [(meta shift left)]   'org-shiftmetaleft)
+(org-defkey org-mode-map [(meta shift right)]  'org-shiftmetaright)
+(org-defkey org-mode-map [(meta shift up)]     'org-shiftmetaup)
+(org-defkey org-mode-map [(meta shift down)]   'org-shiftmetadown)
+
+(org-defkey org-mode-map [(shift up)]          'org-shiftup)
+(org-defkey org-mode-map [(shift down)]        'org-shiftdown)
+(org-defkey org-mode-map [(shift left)]        'org-shiftleft)
+(org-defkey org-mode-map [(shift right)]       'org-shiftright)
+
+(org-defkey org-mode-map [(control shift right)] 'org-shiftcontrolright)
+(org-defkey org-mode-map [(control shift left)]  'org-shiftcontrolleft)
 
 ;;; Extra keys for tty access.
 ;;  We only set them when really needed because otherwise the
@@ -18593,102 +20367,105 @@
 
 (when (or (featurep 'xemacs)   ;; because XEmacs supports multi-device stuff
 	  (not window-system))
-  (define-key org-mode-map "\C-c\C-xc"    'org-table-copy-down)
-  (define-key org-mode-map "\C-c\C-xM"    'org-insert-todo-heading)
-  (define-key org-mode-map "\C-c\C-xm"    'org-meta-return)
-  (define-key org-mode-map [?\e (return)] 'org-meta-return)
-  (define-key org-mode-map [?\e (left)]   'org-metaleft)
-  (define-key org-mode-map "\C-c\C-xl"    'org-metaleft)
-  (define-key org-mode-map [?\e (right)]  'org-metaright)
-  (define-key org-mode-map "\C-c\C-xr"    'org-metaright)
-  (define-key org-mode-map [?\e (up)]     'org-metaup)
-  (define-key org-mode-map "\C-c\C-xu"    'org-metaup)
-  (define-key org-mode-map [?\e (down)]   'org-metadown)
-  (define-key org-mode-map "\C-c\C-xd"    'org-metadown)
-  (define-key org-mode-map "\C-c\C-xL"    'org-shiftmetaleft)
-  (define-key org-mode-map "\C-c\C-xR"    'org-shiftmetaright)
-  (define-key org-mode-map "\C-c\C-xU"    'org-shiftmetaup)
-  (define-key org-mode-map "\C-c\C-xD"    'org-shiftmetadown)
-  (define-key org-mode-map [?\C-c ?\C-x (up)]    'org-shiftup)
-  (define-key org-mode-map [?\C-c ?\C-x (down)]  'org-shiftdown)
-  (define-key org-mode-map [?\C-c ?\C-x (left)]  'org-shiftleft)
-  (define-key org-mode-map [?\C-c ?\C-x (right)] 'org-shiftright))
+  (org-defkey org-mode-map "\C-c\C-xc"    'org-table-copy-down)
+  (org-defkey org-mode-map "\C-c\C-xM"    'org-insert-todo-heading)
+  (org-defkey org-mode-map "\C-c\C-xm"    'org-meta-return)
+  (org-defkey org-mode-map [?\e (return)] 'org-meta-return)
+  (org-defkey org-mode-map [?\e (left)]   'org-metaleft)
+  (org-defkey org-mode-map "\C-c\C-xl"    'org-metaleft)
+  (org-defkey org-mode-map [?\e (right)]  'org-metaright)
+  (org-defkey org-mode-map "\C-c\C-xr"    'org-metaright)
+  (org-defkey org-mode-map [?\e (up)]     'org-metaup)
+  (org-defkey org-mode-map "\C-c\C-xu"    'org-metaup)
+  (org-defkey org-mode-map [?\e (down)]   'org-metadown)
+  (org-defkey org-mode-map "\C-c\C-xd"    'org-metadown)
+  (org-defkey org-mode-map "\C-c\C-xL"    'org-shiftmetaleft)
+  (org-defkey org-mode-map "\C-c\C-xR"    'org-shiftmetaright)
+  (org-defkey org-mode-map "\C-c\C-xU"    'org-shiftmetaup)
+  (org-defkey org-mode-map "\C-c\C-xD"    'org-shiftmetadown)
+  (org-defkey org-mode-map [?\C-c (up)]    'org-shiftup)
+  (org-defkey org-mode-map [?\C-c (down)]  'org-shiftdown)
+  (org-defkey org-mode-map [?\C-c (left)]  'org-shiftleft)
+  (org-defkey org-mode-map [?\C-c (right)] 'org-shiftright)
+  (org-defkey org-mode-map [?\C-c ?\C-x (right)] 'org-shiftcontrolright)
+  (org-defkey org-mode-map [?\C-c ?\C-x (left)] 'org-shiftcontrolleft))
 
   ;; All the other keys
 
-(define-key org-mode-map "\C-c\C-a" 'show-all)  ; in case allout messed up.
-(define-key org-mode-map "\C-c\C-r" 'org-reveal)
-(define-key org-mode-map "\C-xns" 'org-narrow-to-subtree)
-(define-key org-mode-map "\C-c$"    'org-archive-subtree)
-(define-key org-mode-map "\C-c\C-x\C-s" 'org-advertized-archive-subtree)
-(define-key org-mode-map "\C-c\C-x\C-a" 'org-toggle-archive-tag)
-(define-key org-mode-map "\C-c\C-xb" 'org-tree-to-indirect-buffer)
-(define-key org-mode-map "\C-c\C-j" 'org-goto)
-(define-key org-mode-map "\C-c\C-t" 'org-todo)
-(define-key org-mode-map "\C-c\C-s" 'org-schedule)
-(define-key org-mode-map "\C-c\C-d" 'org-deadline)
-(define-key org-mode-map "\C-c;"    'org-toggle-comment)
-(define-key org-mode-map "\C-c\C-v" 'org-show-todo-tree)
-(define-key org-mode-map "\C-c\C-w" 'org-check-deadlines)
-(define-key org-mode-map "\C-c/"    'org-occur)   ; Minor-mode reserved
-(define-key org-mode-map "\C-c\\"   'org-tags-sparse-tree) ; Minor-mode res.
-(define-key org-mode-map "\C-c\C-m" 'org-insert-heading)
-(define-key org-mode-map "\M-\C-m"  'org-insert-heading)
-(define-key org-mode-map "\C-c\C-x\C-n" 'org-next-link)
-(define-key org-mode-map "\C-c\C-x\C-p" 'org-previous-link)
-(define-key org-mode-map "\C-c\C-l" 'org-insert-link)
-(define-key org-mode-map "\C-c\C-o" 'org-open-at-point)
-(define-key org-mode-map "\C-c%"    'org-mark-ring-push)
-(define-key org-mode-map "\C-c&"    'org-mark-ring-goto)
-(define-key org-mode-map "\C-c\C-z" 'org-time-stamp)  ; Alternative binding
-(define-key org-mode-map "\C-c."    'org-time-stamp)  ; Minor-mode reserved
-(define-key org-mode-map "\C-c!"    'org-time-stamp-inactive) ; Minor-mode r.
-(define-key org-mode-map "\C-c,"    'org-priority)    ; Minor-mode reserved
-(define-key org-mode-map "\C-c\C-y" 'org-evaluate-time-range)
-(define-key org-mode-map "\C-c>"    'org-goto-calendar)
-(define-key org-mode-map "\C-c<"    'org-date-from-calendar)
-(define-key org-mode-map [(control ?,)]     'org-cycle-agenda-files)
-(define-key org-mode-map [(control ?\')]     'org-cycle-agenda-files)
-(define-key org-mode-map "\C-c["    'org-agenda-file-to-front)
-(define-key org-mode-map "\C-c]"    'org-remove-file)
-(define-key org-mode-map "\C-c-"    'org-table-insert-hline)
-(define-key org-mode-map "\C-c^"    'org-sort)
-(define-key org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c)
-(define-key org-mode-map "\C-c#"    'org-update-checkbox-count)
-(define-key org-mode-map "\C-m"     'org-return)
-(define-key org-mode-map "\C-c?"    'org-table-field-info)
-(define-key org-mode-map "\C-c "    'org-table-blank-field)
-(define-key org-mode-map "\C-c+"    'org-table-sum)
-(define-key org-mode-map "\C-c="    'org-table-eval-formula)
-(define-key org-mode-map "\C-c'"    'org-table-edit-formulas)
-(define-key org-mode-map "\C-c`"    'org-table-edit-field)
-(define-key org-mode-map "\C-c|"    'org-table-create-or-convert-from-region)
-(define-key org-mode-map "\C-c*"    'org-table-recalculate)
-(define-key org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks)
-(define-key org-mode-map "\C-c~"    'org-table-create-with-table.el)
-(define-key org-mode-map "\C-c\C-q" 'org-table-wrap-region)
-(define-key org-mode-map "\C-c}"    'org-table-toggle-coordinate-overlays)
-(define-key org-mode-map "\C-c{"    'org-table-toggle-formula-debugger)
-(define-key org-mode-map "\C-c\C-e" 'org-export)
-(define-key org-mode-map "\C-c:"    'org-toggle-fixed-width-section)
-
-(define-key org-mode-map "\C-c\C-x\C-k" 'org-cut-special)
-(define-key org-mode-map "\C-c\C-x\C-w" 'org-cut-special)
-(define-key org-mode-map "\C-c\C-x\M-w" 'org-copy-special)
-(define-key org-mode-map "\C-c\C-x\C-y" 'org-paste-special)
-
-(define-key org-mode-map "\C-c\C-x\C-t" 'org-toggle-time-stamp-overlays)
-(define-key org-mode-map "\C-c\C-x\C-i" 'org-clock-in)
-(define-key org-mode-map "\C-c\C-x\C-o" 'org-clock-out)
-(define-key org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel)
-(define-key org-mode-map "\C-c\C-x\C-d" 'org-clock-display)
-(define-key org-mode-map "\C-c\C-x\C-r" 'org-clock-report)
-(define-key org-mode-map "\C-c\C-x\C-u" 'org-dblock-update)
-(define-key org-mode-map "\C-c\C-x\C-l" 'org-preview-latex-fragment)
-(define-key org-mode-map "\C-c\C-x\C-b" 'org-toggle-checkbox)
+(org-defkey org-mode-map "\C-c\C-a" 'show-all)  ; in case allout messed up.
+(org-defkey org-mode-map "\C-c\C-r" 'org-reveal)
+(org-defkey org-mode-map "\C-xns" 'org-narrow-to-subtree)
+(org-defkey org-mode-map "\C-c$"    'org-archive-subtree)
+(org-defkey org-mode-map "\C-c\C-x\C-s" 'org-advertized-archive-subtree)
+(org-defkey org-mode-map "\C-c\C-x\C-a" 'org-toggle-archive-tag)
+(org-defkey org-mode-map "\C-c\C-xb" 'org-tree-to-indirect-buffer)
+(org-defkey org-mode-map "\C-c\C-j" 'org-goto)
+(org-defkey org-mode-map "\C-c\C-t" 'org-todo)
+(org-defkey org-mode-map "\C-c\C-s" 'org-schedule)
+(org-defkey org-mode-map "\C-c\C-d" 'org-deadline)
+(org-defkey org-mode-map "\C-c;"    'org-toggle-comment)
+(org-defkey org-mode-map "\C-c\C-v" 'org-show-todo-tree)
+(org-defkey org-mode-map "\C-c\C-w" 'org-check-deadlines)
+(org-defkey org-mode-map "\C-c/"    'org-occur)   ; Minor-mode reserved
+(org-defkey org-mode-map "\C-c\\"   'org-tags-sparse-tree) ; Minor-mode res.
+(org-defkey org-mode-map "\C-c\C-m" 'org-ctrl-c-ret)
+(org-defkey org-mode-map "\M-\C-m"  'org-insert-heading)
+(org-defkey org-mode-map "\C-c\C-x\C-n" 'org-next-link)
+(org-defkey org-mode-map "\C-c\C-x\C-p" 'org-previous-link)
+(org-defkey org-mode-map "\C-c\C-l" 'org-insert-link)
+(org-defkey org-mode-map "\C-c\C-o" 'org-open-at-point)
+(org-defkey org-mode-map "\C-c%"    'org-mark-ring-push)
+(org-defkey org-mode-map "\C-c&"    'org-mark-ring-goto)
+(org-defkey org-mode-map "\C-c\C-z" 'org-time-stamp)  ; Alternative binding
+(org-defkey org-mode-map "\C-c."    'org-time-stamp)  ; Minor-mode reserved
+(org-defkey org-mode-map "\C-c!"    'org-time-stamp-inactive) ; Minor-mode r.
+(org-defkey org-mode-map "\C-c,"    'org-priority)    ; Minor-mode reserved
+(org-defkey org-mode-map "\C-c\C-y" 'org-evaluate-time-range)
+(org-defkey org-mode-map "\C-c>"    'org-goto-calendar)
+(org-defkey org-mode-map "\C-c<"    'org-date-from-calendar)
+(org-defkey org-mode-map [(control ?,)]     'org-cycle-agenda-files)
+(org-defkey org-mode-map [(control ?\')]     'org-cycle-agenda-files)
+(org-defkey org-mode-map "\C-c["    'org-agenda-file-to-front)
+(org-defkey org-mode-map "\C-c]"    'org-remove-file)
+(org-defkey org-mode-map "\C-c-"    'org-table-insert-hline)
+(org-defkey org-mode-map "\C-c^"    'org-sort)
+(org-defkey org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c)
+(org-defkey org-mode-map "\C-c#"    'org-update-checkbox-count)
+(org-defkey org-mode-map "\C-m"     'org-return)
+(org-defkey org-mode-map "\C-c?"    'org-table-field-info)
+(org-defkey org-mode-map "\C-c "    'org-table-blank-field)
+(org-defkey org-mode-map "\C-c+"    'org-table-sum)
+(org-defkey org-mode-map "\C-c="    'org-table-eval-formula)
+(org-defkey org-mode-map "\C-c'"    'org-table-edit-formulas)
+(org-defkey org-mode-map "\C-c`"    'org-table-edit-field)
+(org-defkey org-mode-map "\C-c|"    'org-table-create-or-convert-from-region)
+(org-defkey org-mode-map "\C-c*"    'org-table-recalculate)
+(org-defkey org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks)
+(org-defkey org-mode-map "\C-c~"    'org-table-create-with-table.el)
+(org-defkey org-mode-map "\C-c\C-q" 'org-table-wrap-region)
+(org-defkey org-mode-map "\C-c}"    'org-table-toggle-coordinate-overlays)
+(org-defkey org-mode-map "\C-c{"    'org-table-toggle-formula-debugger)
+(org-defkey org-mode-map "\C-c\C-e" 'org-export)
+(org-defkey org-mode-map "\C-c:"    'org-toggle-fixed-width-section)
+(org-defkey org-mode-map "\C-c\C-x\C-f" 'org-emphasize)
+
+(org-defkey org-mode-map "\C-c\C-x\C-k" 'org-cut-special)
+(org-defkey org-mode-map "\C-c\C-x\C-w" 'org-cut-special)
+(org-defkey org-mode-map "\C-c\C-x\M-w" 'org-copy-special)
+(org-defkey org-mode-map "\C-c\C-x\C-y" 'org-paste-special)
+
+(org-defkey org-mode-map "\C-c\C-x\C-t" 'org-toggle-time-stamp-overlays)
+(org-defkey org-mode-map "\C-c\C-x\C-i" 'org-clock-in)
+(org-defkey org-mode-map "\C-c\C-x\C-o" 'org-clock-out)
+(org-defkey org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel)
+(org-defkey org-mode-map "\C-c\C-x\C-d" 'org-clock-display)
+(org-defkey org-mode-map "\C-c\C-x\C-r" 'org-clock-report)
+(org-defkey org-mode-map "\C-c\C-x\C-u" 'org-dblock-update)
+(org-defkey org-mode-map "\C-c\C-x\C-l" 'org-preview-latex-fragment)
+(org-defkey org-mode-map "\C-c\C-x\C-b" 'org-toggle-checkbox)
 
 (when (featurep 'xemacs)
-  (define-key org-mode-map 'button3   'popup-mode-menu))
+  (org-defkey org-mode-map 'button3   'popup-mode-menu))
 
 (defsubst org-table-p () (org-at-table-p))
 
@@ -18779,7 +20556,6 @@
 (put 'org-delete-char 'flyspell-delayed t)
 (put 'org-delete-backward-char 'flyspell-delayed t)
 
-
 ;; How to do this: Measure non-white length of current string
 ;; If equal to column width, we should realign.
 
@@ -18790,7 +20566,7 @@
     (while commands
       (setq old (pop commands) new (pop commands))
       (if (fboundp 'command-remapping)
-	  (define-key map (vector 'remap old) new)
+	  (org-defkey map (vector 'remap old) new)
 	(substitute-key-definition old new map global-map)))))
 
 (when (eq org-enable-table-editor 'optimized)
@@ -18800,7 +20576,7 @@
 	     'self-insert-command 'org-self-insert-command
 	     'delete-char 'org-delete-char
 	     'delete-backward-char 'org-delete-backward-char)
-  (define-key org-mode-map "|" 'org-force-self-insert))
+  (org-defkey org-mode-map "|" 'org-force-self-insert))
 
 (defun org-shiftcursor-error ()
   "Throw an error because Shift-Cursor command was applied in wrong context."
@@ -18821,7 +20597,8 @@
 
 (defun org-shiftmetaleft ()
   "Promote subtree or delete table column.
-Calls `org-promote-subtree' or `org-table-delete-column', depending on context.
+Calls `org-promote-subtree', `org-outdent-item',
+or `org-table-delete-column', depending on context.
 See the individual commands for more information."
   (interactive)
   (cond
@@ -18832,7 +20609,8 @@
 
 (defun org-shiftmetaright ()
   "Demote subtree or insert table column.
-Calls `org-demote-subtree' or `org-table-insert-column', depending on context.
+Calls `org-demote-subtree', `org-indent-item',
+or `org-table-insert-column', depending on context.
 See the individual commands for more information."
   (interactive)
   (cond
@@ -18916,8 +20694,8 @@
 
 (defun org-shiftup (&optional arg)
   "Increase item in timestamp or increase priority of current headline.
-Calls `org-timestamp-up' or `org-priority-up', depending on context.
-See the individual commands for more information."
+Calls `org-timestamp-up' or `org-priority-up', or `org-previous-item',
+depending on context.  See the individual commands for more information."
   (interactive "P")
   (cond
    ((org-at-timestamp-p t) (call-interactively 'org-timestamp-up))
@@ -18927,8 +20705,8 @@
 
 (defun org-shiftdown (&optional arg)
   "Decrease item in timestamp or decrease priority of current headline.
-Calls `org-timestamp-down' or `org-priority-down', depending on context.
-See the individual commands for more information."
+Calls `org-timestamp-down' or `org-priority-down', or `org-next-item'
+depending on context.  See the individual commands for more information."
   (interactive "P")
   (cond
    ((org-at-timestamp-p t) (call-interactively 'org-timestamp-down))
@@ -18951,6 +20729,27 @@
    ((org-on-heading-p) (org-call-with-arg 'org-todo 'left))
    (t (org-shiftcursor-error))))
 
+(defun org-shiftcontrolright ()
+  "Switch to next TODO set."
+  (interactive)
+  (cond
+   ((org-on-heading-p) (org-call-with-arg 'org-todo 'nextset))
+   (t (org-shiftcursor-error))))
+
+(defun org-shiftcontrolleft ()
+  "Switch to previous TODO set."
+  (interactive)
+  (cond
+   ((org-on-heading-p) (org-call-with-arg 'org-todo 'previousset))
+   (t (org-shiftcursor-error))))
+
+(defun org-ctrl-c-ret ()
+  "Call `org-table-hline-and-move' or `org-insert-heading' dep. on context."
+  (interactive)
+  (cond
+   ((org-at-table-p) (call-interactively 'org-table-hline-and-move))
+   (t (call-interactively 'org-insert-heading))))
+
 (defun org-copy-special ()
   "Copy region in table or copy current subtree.
 Calls `org-table-copy' or `org-copy-subtree', depending on context.
@@ -19159,7 +20958,11 @@
      ["Next Same Level" outline-forward-same-level t]
      ["Previous Same Level" outline-backward-same-level t]
      "--"
-     ["Jump" org-goto t])
+     ["Jump" org-goto t]
+     "--"
+     ["C-a finds headline start"
+      (setq org-special-ctrl-a (not org-special-ctrl-a))
+      :style toggle :selected org-special-ctrl-a])
     ("Edit Structure"
      ["Move Subtree Up" org-shiftmetaup (not (org-at-table-p))]
      ["Move Subtree Down" org-shiftmetadown (not (org-at-table-p))]
@@ -19177,6 +20980,8 @@
      "--"
      ["Convert to odd levels" org-convert-to-odd-levels t]
      ["Convert to odd/even levels" org-convert-to-oddeven-levels t])
+    ("Editing"
+     ["Emphasis..." org-emphasize t])
     ("Archive"
      ["Toggle ARCHIVE tag" org-toggle-archive-tag t]
 ;     ["Check and Tag Children" (org-toggle-archive-tag (4))
@@ -19202,7 +21007,9 @@
      ("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))])
+      ["Complete Keyword" org-complete (assq :todo-keyword (org-context))]
+      ["Next keyword set" org-shiftcontrolright (and (> (length org-todo-sets) 1) (org-on-heading-p))]
+      ["Previous keyword set" org-shiftcontrolright (and (> (length org-todo-sets) 1) (org-on-heading-p))])
      ["Show TODO Tree" org-show-todo-tree t]
      ["Global TODO list" org-todo-list t]
      "--"
@@ -19210,6 +21017,7 @@
      ["Priority Up" org-shiftup t]
      ["Priority Down" org-shiftdown t]
      "--"
+     ;; FIXME:  why is this still here????
 ;     ["Insert Checkbox" org-insert-todo-heading (org-in-item-p)]
 ;     ["Toggle Checkbox" org-ctrl-c-ctrl-c (org-at-item-checkbox-p)]
 ;     ["Insert [n/m] cookie" (progn (insert "[/]") (org-update-checkbox-count))
@@ -19245,7 +21053,7 @@
      ["Record DONE time"
       (progn (setq org-log-done (not org-log-done))
 	     (message "Switching to %s will %s record a timestamp"
-		      org-done-string
+		      (car org-done-keywords)
 		      (if org-log-done "automatically" "not")))
       :style toggle :selected org-log-done])
     "--"
@@ -19297,15 +21105,6 @@
     ["Refresh setup" org-mode-restart t]
     ))
 
-(defun org-toggle-log-option (type)
-  (if (not (listp org-log-done)) (setq org-log-done nil))
-  (if (memq type org-log-done)
-      (setq org-log-done (delq type org-log-done))
-    (add-to-list 'org-log-done type)))
-
-(defun org-check-log-option (type)
-  (and (listp org-log-done) (memq type org-log-done)))
-
 (defun org-info (&optional node)
   "Read documentation for Org-mode in the info system.
 With optional NODE, go directly to that node."
@@ -19394,7 +21193,7 @@
 	 (p (point)) clist o)
     ;; First the large context
     (cond
-     ((org-on-heading-p)
+     ((org-on-heading-p t)
       (push (list :headline (point-at-bol) (point-at-eol)) clist)
       (when (progn
 	      (beginning-of-line 1)
@@ -19404,7 +21203,7 @@
 	(push (org-point-in-group p 4 :tags) clist))
       (goto-char p)
       (skip-chars-backward "^[\n\r \t") (or (eobp) (backward-char 1))
-      (if (looking-at "\\[#[A-Z]\\]")
+      (if (looking-at "\\[#[A-Z0-9]\\]")
 	  (push (org-point-in-group p 0 :priority) clist)))
 
      ((org-at-item-p)
@@ -19459,6 +21258,7 @@
     (setq clist (nreverse (delq nil clist)))
     clist))
 
+;; FIXME Compare with at-regexp-p
 (defun org-in-regexp (re &optional nlines visually)
   "Check if point is inside a match of regexp.
 Normally only the current line is checked, but you can include NLINES extra
@@ -19472,10 +21272,34 @@
       (save-excursion
 	(beginning-of-line (- 1 (or nlines 0)))
 	(while (re-search-forward re eol t)
-	  (if (and (<= (match-beginning 0) pos) 
+	  (if (and (<= (match-beginning 0) pos)
 		   (>= (+ inc (match-end 0)) pos))
 	      (throw 'exit (cons (match-beginning 0) (match-end 0)))))))))
 
+(defun org-at-regexp-p (regexp)
+  "Is point inside a match of REGEXP in the current line?"
+  (catch 'exit
+    (save-excursion
+      (let ((pos (point)) (end (point-at-eol)))
+	(beginning-of-line 1)
+	(while (re-search-forward regexp end t)
+	  (if (and (<= (match-beginning 0) pos)
+		   (>= (match-end 0) pos))
+	      (throw 'exit t)))
+	nil))))
+
+(defun org-uniquify (list)
+  "Remove duplicate elements from LIST."
+  (let (res)
+    (mapc (lambda (x) (add-to-list 'res x 'append)) list)
+    res))
+
+(defun org-delete-all (elts list)
+  "Remove all elements in ELTS from LIST."
+  (while elts
+    (setq list (delete (pop elts) list)))
+  list)
+
 (defun org-point-in-group (point group &optional context)
   "Check if POINT is in match-group GROUP.
 If CONTEXT is non-nil, return a list with CONTEXT and the boundaries of the
@@ -19535,7 +21359,7 @@
 for example \"%-5s\".  Replacements happen in the sequence given by TABLE,
 so values can contain further %-escapes if they are define later in TABLE."
   (let ((case-fold-search nil)
-	e re rpl)	  
+	e re rpl)
     (while (setq e (pop table))
       (setq re (concat "%-?[0-9.]*" (substring (car e) 1)))
       (while (string-match re string)
@@ -19555,27 +21379,49 @@
       (setq c (1+ c)))
     (nreverse rtn)))
 
-(defun org-at-regexp-p (regexp)
-  "Is point inside a match of REGEXP in the current line?"
-  (catch 'exit
-    (save-excursion
-      (let ((pos (point)) (end (point-at-eol)))
-	(beginning-of-line 1)
-	(while (re-search-forward regexp end t)
-	  (if (and (<= (match-beginning 0) pos)
-		   (>= (match-end 0) pos))
-	      (throw 'exit t)))
-	nil))))
-
 (defun org-find-base-buffer-visiting (file)
   "Like `find-buffer-visiting' but alway return the base buffer and
 not an indirect buffer"
   (let ((buf (find-buffer-visiting file)))
     (or (buffer-base-buffer buf) buf)))
 
+(defun org-image-file-name-regexp ()
+  "Return regexp matching the file names of images."
+  (if (fboundp 'image-file-name-regexp)
+      (image-file-name-regexp)
+    (let ((image-file-name-extensions
+	   '("png" "jpeg" "jpg" "gif" "tiff" "tif"
+	     "xbm" "xpm" "pbm" "pgm" "ppm")))
+      (concat "\\."
+	      (regexp-opt (nconc (mapcar 'upcase
+					 image-file-name-extensions)
+				 image-file-name-extensions)
+			  t)
+	      "\\'"))))
+
+(defun org-file-image-p (file)
+  "Return non-nil if FILE is an image."
+  (save-match-data
+    (string-match (org-image-file-name-regexp) file)))
+
 ;;; Paragraph filling stuff.
 ;; We want this to be just right, so use the full arsenal.
-;; FIXME: configure filladapt for XEmacs
+
+(defun org-indent-line-function ()
+  "Indent line like previous, but further if previous was headline or item."
+  (interactive)
+  (let ((column (save-excursion
+		  (beginning-of-line)
+		  (if (looking-at "#") 0
+		    (skip-chars-backward "\n \t")
+		    (beginning-of-line)
+		    (if (or (looking-at "\\*+[ \t]+")
+			    (looking-at "[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)"))
+			(progn (goto-char (match-end 0)) (current-column))
+		      (current-indentation))))))
+    (if (<= (current-column) (current-indentation))
+	(indent-line-to column)
+      (save-excursion (indent-line-to column)))))
 
 (defun org-set-autofill-regexps ()
   (interactive)
@@ -19584,6 +21430,7 @@
   ;; fill the headline as well.
   (org-set-local 'comment-start-skip "^#+[ \t]*")
   (org-set-local 'paragraph-separate "\f\\|\\*\\|[ 	]*$\\|[ \t]*[:|]")
+;; FIXME!!!!!!!  (org-set-local 'paragraph-separate "\f\\|[ 	]*$")
   ;; The paragraph starter includes hand-formatted lists.
   (org-set-local 'paragraph-start
 		 "\f\\|[ 	]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]")
@@ -19627,30 +21474,12 @@
 work correctly."
   (cond ((looking-at "#[ \t]+")
 	 (match-string 0))
-	((looking-at " *\\([-*+] \\|[0-9]+[.)] \\)?")
-	 (make-string (- (match-end 0) (match-beginning 0)) ?\ ))
+	((looking-at "[ \t]*\\([-*+] \\|[0-9]+[.)] \\)?")
+	 (save-excursion
+	   (goto-char (match-end 0))
+	   (make-string (current-column) ?\ )))
 	(t nil)))
 
-
-(defun org-image-file-name-regexp ()
-  "Return regexp matching the file names of images."
-  (if (fboundp 'image-file-name-regexp)
-      (image-file-name-regexp)
-    (let ((image-file-name-extensions
-	   '("png" "jpeg" "jpg" "gif" "tiff" "tif"
-	     "xbm" "xpm" "pbm" "pgm" "ppm")))
-      (concat "\\."
-	      (regexp-opt (nconc (mapcar 'upcase
-					 image-file-name-extensions)
-				 image-file-name-extensions)
-			  t)
-	      "\\'"))))
-
-(defun org-file-image-p (file)
-  "Return non-nil if FILE is an image."
-  (save-match-data
-    (string-match (org-image-file-name-regexp) file)))
-
 ;;;; Functions extending outline functionality
 
 ;; C-a should go to the beginning of a *visible* line, also in the
@@ -19659,15 +21488,22 @@
   "Go to the beginning of the current line.  If that is invisible, continue
 to a visible line beginning.  This makes the function of C-a more intuitive."
   (interactive)
-  (beginning-of-line 1)
-  (if (bobp)
-      nil
-    (backward-char 1)
-    (if (org-invisible-p)
-	(while (and (not (bobp)) (org-invisible-p))
-	  (backward-char 1)
-	  (beginning-of-line 1))
-      (forward-char 1))))
+  (let ((pos (point)))
+    (beginning-of-line 1)
+    (if (bobp)
+	nil
+      (backward-char 1)
+      (if (org-invisible-p)
+	  (while (and (not (bobp)) (org-invisible-p))
+	    (backward-char 1)
+	    (beginning-of-line 1))
+	(forward-char 1)))
+    (when (and org-special-ctrl-a (looking-at org-todo-line-regexp)
+	       (= (char-after (match-end 1)) ?\ ))
+      (goto-char
+       (cond ((> pos (match-beginning 3)) (match-beginning 3))
+	     ((= pos (point)) (match-beginning 3))
+	     (t (point)))))))
 
 (define-key org-mode-map "\C-a" 'org-beginning-of-line)
 
@@ -19689,6 +21525,9 @@
 
 (defalias 'org-back-to-heading 'outline-back-to-heading)
 (defalias 'org-on-heading-p 'outline-on-heading-p)
+(defalias 'org-at-heading-p 'outline-on-heading-p)
+(defun org-at-heading-or-item-p ()
+  (or (org-on-heading-p) (org-at-item-p)))
 
 (defun org-on-target-p ()
   (or (org-in-regexp org-radio-target-regexp)
@@ -19751,7 +21590,7 @@
 			   (save-excursion (outline-end-of-heading) (point))
 			   flag))))
 
-(defun org-end-of-subtree (&optional invisible-OK)
+(defun org-end-of-subtree (&optional invisible-OK to-heading)
   ;; This is an exact copy of the original function, but it uses
   ;; `org-back-to-heading', to make it work also in invisible
   ;; trees.  And is uses an invisible-OK argument.
@@ -19763,13 +21602,14 @@
 		(or first (> (funcall outline-level) level)))
       (setq first nil)
       (outline-next-heading))
-    (if (memq (preceding-char) '(?\n ?\^M))
-	(progn
-	  ;; Go to end of line before heading
-	  (forward-char -1)
-	  (if (memq (preceding-char) '(?\n ?\^M))
-	      ;; leave blank line before heading
-	      (forward-char -1)))))
+    (unless to-heading
+      (if (memq (preceding-char) '(?\n ?\^M))
+	  (progn
+	    ;; Go to end of line before heading
+	    (forward-char -1)
+	    (if (memq (preceding-char) '(?\n ?\^M))
+		;; leave blank line before heading
+		(forward-char -1))))))
   (point))
 
 (defun org-show-subtree ()
@@ -19824,7 +21664,13 @@
   (remove-hook 'post-command-hook 'org-isearch-post-command 'local)
   (org-show-context 'isearch))
 
-;;;; Repair problems with some other packages
+
+;;;; Address problems with some other packages
+
+;; Make flyspell not check words in links, to not mess up our keymap
+(defun org-mode-flyspell-verify ()
+  "Don't let flyspell put overlays at active buttons."
+  (not (get-text-property (point) 'keymap)))
 
 ;; Make `bookmark-jump' show the jump location if it was hidden.
 (eval-after-load "bookmark"
@@ -19850,6 +21696,26 @@
 
 ;;;; Experimental code
 
+(defun org-closed-in-range ()
+  "Sparse tree of items closed in a certain time range.
+Still experimental, may disappear in the furture."
+  (interactive)
+  ;; Get the time interval from the user.
+  (let* ((time1 (time-to-seconds
+                 (org-read-date nil 'to-time nil "Starting date: ")))
+         (time2 (time-to-seconds
+                 (org-read-date nil 'to-time nil "End date:")))
+         ;; callback function
+         (callback (lambda ()
+                     (let ((time
+                            (time-to-seconds
+                             (apply 'encode-time
+                                    (org-parse-time-string
+                                     (match-string 1))))))
+                       ;; check if time in interval
+                       (and (>= time time1) (<= time time2))))))
+    ;; make tree, check each match with the callback
+    (org-occur "CLOSED: +\\[\\(.*?\\)\\]" nil callback)))
 
 ;;;; Finish up
 
--- a/lisp/tutorial.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/tutorial.el	Mon Jun 11 00:58:11 2007 +0000
@@ -155,9 +155,9 @@
                           " RET instead."))
               (insert "\n\nWith your current key bindings"
                       " you can use "
-                      (if (string-equal "the menus" where)
+                      (if (string-match "^the .*menus?$" where)
                           ""
-                        "the key ")
+                        "the key")
                       where
                       " to get the function `"
                       (format "%s" db)
@@ -406,7 +406,7 @@
   WHERE       is a text describing the key sequences to which DEF-FUN is
               bound now (or, if it is remapped, a key sequence
               for the function it is remapped to)
-  REMARK      is a list with info about rebinding.  It has either of
+  REMARK      is a list with info about rebinding. It has either of
               these formats:
 
                 \(TEXT cua-mode)
@@ -434,14 +434,26 @@
 	       (key-fun (if (eq def-fun 'ESC-prefix)
 			    (lookup-key global-map [27])
 			  (key-binding key)))
-	       (where (where-is-internal (if rem-fun rem-fun def-fun))))
+	       (where (where-is-internal (if rem-fun rem-fun def-fun)))
+	       cwhere)
 	  (if where
 	      (progn
-		(setq where (key-description (car where)))
+		(setq cwhere (car where)
+		      where (key-description cwhere))
 		(when (and (< 10 (length where))
 			   (string= (substring where 0 (length "<menu-bar>"))
 				    "<menu-bar>"))
-		  (setq where "the menus")))
+		  (setq where
+			(if (and (vectorp cwhere)
+				 (setq cwhere (elt cwhere 1))
+				 (setq cwhere
+				       (cadr
+					(assoc cwhere
+					       (lookup-key global-map
+							   [menu-bar]))))
+				 (stringp cwhere))
+			    (format "the `%s' menu" cwhere)
+			  "the menus"))))
 	    (setq where ""))
 	  (setq remark nil)
 	  (unless
@@ -915,7 +927,7 @@
 In certain places Emacs can replace a string shown to the user with
 a language specific string.  This function retrieves such strings.
 
-LANG is the language specification.  It should be one of those
+LANG is the language specification. It should be one of those
 strings that can be returned by `read-language-name'.  STRINGID
 is a symbol that specifies the string to retrieve.
 
--- a/lisp/version.el	Fri Jun 08 12:41:25 2007 +0000
+++ b/lisp/version.el	Mon Jun 11 00:58:11 2007 +0000
@@ -27,6 +27,9 @@
 
 ;;; Code:
 
+(defconst emacs-copyright "Copyright (C) 2007 Free Software Foundation, Inc."
+  "Short copyright string for this version of Emacs.")
+
 (defconst emacs-version "23.0.0" "\
 Version numbers of this version of Emacs.")
 
--- a/lispintro/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/lispintro/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,7 @@
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
 2007-01-30  Robert J. Chassell  <bob@rattlesnake.com>
 
 	* emacs-lisp-intro.texi (else): Rephrase message of first
--- a/lispref/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/lispref/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,9 +1,31 @@
+2007-06-03  Nick Roberts  <nickrob@snap.net.nz>
+
+	* commands.texi (Click Events): Describe width and height when
+	object is nil.
+
 2007-05-30  Nick Roberts  <nickrob@snap.net.nz>
 
 	* commands.texi (Click Events): Layout more logically.  Describe
 	width and height.
 	(Drag Events, Motion Events): Update to new format for position.
 
+2007-06-02  Richard Stallman  <rms@gnu.org>
+
+	* frames.texi (Color Parameters): Add xref to (emacs)Standard Faces.
+
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
+2007-06-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* text.texi (Special Properties): Correct meaning of fontified
+	face.
+
+2007-05-30  Richard Stallman  <rms@gnu.org>
+
+	* text.texi (Special Properties): Add link to Adjusting Point.
+
 2007-05-12  Richard Stallman  <rms@gnu.org>
 
 	* text.texi (Margins): indent-to-left-margin is not the default.
--- a/lispref/commands.texi	Fri Jun 08 12:41:25 2007 +0000
+++ b/lispref/commands.texi	Mon Jun 11 00:58:11 2007 +0000
@@ -1225,7 +1225,7 @@
 
 
 @item @var{x}, @var{y}
-These are the pixel-denominated coordinates of the click, relative to
+These are the pixel coordinates of the click, relative to
 the top left corner of @var{window}, which is @code{(0 . 0)}.
 For the mode or header line, @var{y} does not have meaningful data.
 For the vertical line, @var{x} does not have meaningful data.
@@ -1266,13 +1266,14 @@
 an image object as returned by @code{find-image} if click was in an image.
 
 @item @var{dx}, @var{dy}
-These are the pixel-denominated coordinates of the click, relative to
+These are the pixel coordinates of the click, relative to
 the top left corner of @var{object}, which is @code{(0 . 0)}.  If
 @var{object} is @code{nil}, the coordinates are relative to the top
 left corner of the character glyph clicked on.
 
 @item @var{width}, @var{height}
-These are the pixel-denominated width and height of @var{object}.
+These are the pixel width and height of @var{object} or, if this is
+@code{nil}, those of the character glyph clicked on.
 @end table
  
 @sp 1
--- a/lispref/display.texi	Fri Jun 08 12:41:25 2007 +0000
+++ b/lispref/display.texi	Mon Jun 11 00:58:11 2007 +0000
@@ -2505,8 +2505,9 @@
 @cindex automatic face assignment
 @cindex faces, automatic choice
 
-  This hook is used for automatically assigning faces to text in the
-buffer.  It is part of the implementation of Font-Lock mode.
+  This hook is used for automatically assigning facesto text in the
+buffer.  It is part of the implementation of Jit-Lock mode, used by
+Font-Lock.
 
 @defvar fontification-functions
 This variable holds a list of functions that are called by Emacs
--- a/lispref/elisp.texi	Fri Jun 08 12:41:25 2007 +0000
+++ b/lispref/elisp.texi	Mon Jun 11 00:58:11 2007 +0000
@@ -7,7 +7,7 @@
 @c Version of the manual and of Emacs.
 @c Please remember to update the edition number in README as well.
 @set VERSION  2.9
-@set EMACSVER 22.0.990
+@set EMACSVER 22.1.50
 
 @dircategory Emacs
 @direntry
--- a/lispref/frames.texi	Fri Jun 08 12:41:25 2007 +0000
+++ b/lispref/frames.texi	Mon Jun 11 00:58:11 2007 +0000
@@ -706,6 +706,7 @@
 
 These frame parameters are semi-obsolete in that they are automatically
 equivalent to particular face attributes of particular faces.
+@xref{Standard Faces,,, emacs, The Emacs Manual}.
 
 @table @code
 @item font
--- a/lispref/text.texi	Fri Jun 08 12:41:25 2007 +0000
+++ b/lispref/text.texi	Mon Jun 11 00:58:11 2007 +0000
@@ -2951,6 +2951,11 @@
 names that control filling and property inheritance.  All other names
 have no standard meaning, and you can use them as you like.
 
+  Note: the properties @code{composition}, @code{display},
+@code{invisible} and @code{intangible} can also cause point to move to
+an acceptable place, after each Emacs command.  @xref{Adjusting
+Point}.
+
 @table @code
 @cindex property category of text character
 @kindex category @r{(text property)}
@@ -3019,24 +3024,11 @@
 
 @item fontified
 @kindex fontified @r{(text property)}
-This property says whether the character has a face assigned to it by font
-locking.  The display engine tests it to decide whether a buffer
-portion needs refontifying before display.  @xref{Auto Faces}.  It
-takes one of three values:
-
-@table @asis
-@item @code{nil}
-Font locking is disabled, or the character's @code{face} property, if
-any, is invalid.
-
-@item @code{defer}
-This value is only used when ``just in time'' font locking is enabled
-and it means that the character's @code{face} property is invalid and
-needs deferred fontification.
-
-@item @code{t}
-The character's @code{face} property, or absence of one, is valid.
-@end table
+This property says whether the text is ready for display.  If
+@code{nil}, Emacs's redisplay routine calls the functions in
+@code{fontification-functions} (@pxref{Auto Faces}) to prepare this
+part of the buffer before it is displayed.  It is used internally by
+the ``just in time'' font locking code.
 
 @item display
 This property activates various features that change the
@@ -3138,6 +3130,10 @@
 the end of the group.  If you try to move point backward into the group,
 point actually moves to the start of the group.
 
+If consecutive characters have unequal non-@code{nil}
+@code{intangible} properties, they belong to separate groups; each
+group is separately treated as described above.
+
 When the variable @code{inhibit-point-motion-hooks} is non-@code{nil},
 the @code{intangible} property is ignored.
 
--- a/lwlib/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/lwlib/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,7 @@
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
 2007-02-28  Glenn Morris  <rgm@gnu.org>
 
 	* Makefile.in (distclean): Delete Makefile.
--- a/mac/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/mac/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,7 @@
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
 2007-05-24  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* INSTALL: Add note about moving self-contained application bundle
--- a/man/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/man/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,10 +1,33 @@
-2007-05-28  Michael Albinus  <michael.albinus@gmx.de>
+2007-06-06  Andreas Seltenreich  <andreas@gate450.dyndns.org>
+
+	* gnus.texi (Misc Group Stuff, Summary Buffer)
+	(Server Commands, Article Keymap): Fix typo.  s/function/command/.
+
+2007-06-07  Alan Mackenzie  <acm@muc.de>
+
+	* display.texi (Optional Mode Line): Document the new form of
+	line+column numbers, "(561,2)".
+
+2007-06-06  Juanma Barranquero  <lekktu@gmail.com>
+
+	* cc-mode.texi (Comment Commands, Getting Started, Style Variables):
+	* gnus.texi (Article Buttons, Mail Source Customization)
+	(Sending or Not Sending, Customizing NNDiary):
+	* maintaining.texi (Create Tags Table):
+	* message.texi (Message Headers):
+	* mh-e.texi (HTML): Fix typos.
+
+2007-06-07  Michael Albinus  <michael.albinus@gmx.de>
 
 	Sync with Tramp 2.0.56.
 
 	* tramp.texi (Frequently Asked Questions): Improve ~/.zshrc
 	settings.  Reported by Ted Zlatanov <tzz@lifelogs.com>.
 
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
 2007-05-26  Michael Olson  <mwolson@gnu.org>
 
 	* erc.texi (Modules): Fix references to completion modules.
@@ -15,12 +38,12 @@
 
 2007-05-09  Didier Verna  <didier@xemacs.org>
 
-	* gnus.texi (Email Based Diary): New. Proper documentation for the
+	* gnus.texi (Email Based Diary): New.  Proper documentation for the
 	nndiary back end and the gnus-diary library.
 
 2007-05-07  Karl Berry  <karl@gnu.org>
 
-	* emacs.texi (EMACSVER): back to 22.
+	* emacs.texi (EMACSVER): Back to 22.
 
 2007-05-06  Richard Stallman  <rms@gnu.org>
 
@@ -39,9 +62,9 @@
 
 	* emacs.texi (EMACSVER) [smallbook]: 22 for printed version.
 
-	* .cvsignore (*.pdf): new entry.
-
-	* texinfo.tex: update from current version for better pdf generation.
+	* .cvsignore (*.pdf): New entry.
+
+	* texinfo.tex: Update from current version for better pdf generation.
 
 	* emacs.texi (\urlcolor, \linkcolor) [smallbook]: \let to \Black
 	for printing.
@@ -1375,9 +1398,9 @@
 	* emacs.texi (\hbadness): Set to 6000 so we aren't bothered by
 	not-too-underfull hboxes in the TeX output.
 	* abbrevs.texi, buffers.texi, building.texi, calendar.texi,
-	cmdargs.texi, custom.texi, dired.texi, macos.texi,
-	maintaining.texi, misc.texi, mule.texi, programs.texi, rmail.texi,
-	sending.texi, text.texi: fix overfull/underfull boxes.
+	* cmdargs.texi, custom.texi, dired.texi, macos.texi,
+	* maintaining.texi, misc.texi, mule.texi, programs.texi, rmail.texi,
+	* sending.texi, text.texi: Fix overfull/underfull boxes.
 
 2006-07-03  Romain Francoise  <romain@orebokech.com>
 
@@ -1460,7 +1483,7 @@
 
 2006-06-25  Nick Roberts  <nickrob@snap.net.nz>
 
-	* frames.texi (XTerm Mouse) Rename to...
+	* frames.texi (XTerm Mouse): Rename to...
 	(Text-Only Mouse): ...this.  Mention t-mouse-mode.
 
 	* emacs.texi (Top): Use new node name.
@@ -1803,7 +1826,7 @@
 2006-05-06  Eli Zaretskii  <eliz@gnu.org>
 
 	* makefile.w32-in (emacs.dvi):
-	* Makefile.in (emacs.dvi): Add xresmini.texi
+	* Makefile.in (emacs.dvi): Add xresmini.texi.
 
 	* xresmini.texi (Table of Resources): Remove xref to non-existent
 	node "LessTif Resources".
@@ -1889,7 +1912,7 @@
 	Next, and Up links.
 
 	* emacs.texi (Top) [ifnottex]: Add menu entries for "Picture Mode"
-	and its sections.  @include picture-xtra.texi
+	and its sections.  @include picture-xtra.texi.
 
 	* maintaining.texi (Maintaining) [ifnottex]: Add menu entry for
 	"Emerge".
@@ -1944,11 +1967,11 @@
 
 2006-05-05  Karl Berry  <karl@gnu.org>
 
-	* texinfo.tex (\definetextfonsizexi, \definetextfonsizex): new cmds.
-	(\fonttextsize): new user-level command to change text font size.
-	* emacs.texi: call  @fonttextsize 10, inside @tex to avoid
+	* texinfo.tex (\definetextfonsizexi, \definetextfonsizex): New cmds.
+	(\fonttextsize): New user-level command to change text font size.
+	* emacs.texi: Call @fonttextsize 10, inside @tex to avoid
 	errors from the current release of makeinfo (4.8).
-	* help.texi (Library Keywords): change widest word in multitable
+	* help.texi (Library Keywords): Change widest word in multitable
 	template from `emulations' to `convenience'.  (Not sure if this is
 	related to the font change.)
 
@@ -2148,7 +2171,7 @@
 	(Inserting Version Control Headers, Customizing VC, General Options)
 	(Options for RCS and SCCS, Options specific for CVS): Move all
 	these nodes to emacs-xtra.texi, for brevity.
-	* cmdargs.texi, files.texi: change cross-references.
+	* cmdargs.texi, files.texi: Change cross-references.
 
 2006-04-11  Reiner Steib  <Reiner.Steib@gmx.de>
 
@@ -2179,13 +2202,13 @@
 
 2006-04-09  Karl Berry  <karl@gnu.org>
 
-	* msdog.texi, emacs-xtra.texi: move all the MS-DOS material to
+	* msdog.texi, emacs-xtra.texi: Move all the MS-DOS material to
 	emacs-xtra.texi, leaving only MS Windows information.
 	* building.texi, emacs.texi, frames.texi, gnu.texi, macos.texi,
-	msdog.texi, mule.texi, trouble.texi: change cross-references and
+	* msdog.texi, mule.texi, trouble.texi: Change cross-references and
 	node names.
 
-	* emacs.texi: move @summarycontents and @contents to the beginning
+	* emacs.texi: Move @summarycontents and @contents to the beginning
 	of the file.
 
 2006-04-07  Reiner Steib  <Reiner.Steib@gmx.de>
@@ -2264,7 +2287,7 @@
 
 	* sending.texi (Mail Sending): pxref to Top needs five args.
 
-	* texinfo.tex: update to current version (2006-03-21.13).
+	* texinfo.tex: Update to current version (2006-03-21.13).
 
 2006-04-02  Bill Wohler  <wohler@newt.com>
 
@@ -2913,7 +2936,7 @@
 	* mark.texi: Minor clarifications.
 	(Selective Undo): Node deleted.
 
-	* m-x.texi: Minor clarifications
+	* m-x.texi: Minor clarifications.
 
 	* killing.texi: Minor clarifications.
 	Refer to "graphical" terminals, rather than window systems.
@@ -3603,7 +3626,7 @@
 
 2005-11-04  Carsten Dominik  <dominik@science.uva.nl>
 
-	* org.texi: Version number changed to 3.19
+	* org.texi: Version number changed to 3.19.
 
 2005-11-04  Romain Francoise  <romain@orebokech.com>
 
@@ -3802,7 +3825,7 @@
 
 2005-10-10  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
-	* cmdargs.texi (Icons X): -nb => -nbi
+	* cmdargs.texi (Icons X): -nb => -nbi.
 
 2005-10-10  Chong Yidong  <cyd@stupidchicken.com>
 
@@ -3893,7 +3916,7 @@
 
 2005-09-23  Carsten Dominik  <dominik@science.uva.nl>
 
-	* org.texi Version 3.16
+	* org.texi Version 3.16.
 
 2005-09-21  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
@@ -4153,11 +4176,11 @@
 
 2005-07-19  Carsten Dominik  <dominik@science.uva.nl>
 
-	* org.texi: Version 3.14
+	* org.texi: Version 3.14.
 
 2005-07-04  Carsten Dominik  <dominik@science.uva.nl>
 
-	* org.texi: Version 3.13
+	* org.texi: Version 3.13.
 
 2005-07-19  Juri Linkov  <juri@jurta.org>
 
@@ -4261,7 +4284,7 @@
 
 2005-06-29  Carsten Dominik  <dominik@science.uva.nl>
 
-	* org.texi: Version 3.12
+	* org.texi: Version 3.12.
 
 2005-06-24  Richard M. Stallman  <rms@gnu.org>
 
@@ -4341,7 +4364,7 @@
 
 2005-06-13  Carsten Dominik  <dominik@science.uva.nl>
 
-	* org.texi: Version 3.11
+	* org.texi: Version 3.11.
 
 2005-06-12  Jay Belanger  <belanger@truman.edu>
 
@@ -4487,11 +4510,11 @@
 
 2005-05-20  Carsten Dominik  <dominik@science.uva.nl>
 
-	* org.texi: Version 3.09
+	* org.texi: Version 3.09.
 
 2005-05-18  Carsten Dominik  <dominik@science.uva.nl>
 
-	* reftex.texi: Version 4.28
+	* reftex.texi: Version 4.28.
 
 2005-05-18  Luc Teirlinck  <teirllm@auburn.edu>
 
@@ -4639,7 +4662,7 @@
 
 2005-04-25  Chong Yidong  <cyd@stupidchicken.com>
 
-	* ack.texi (Acknowledgments): Delete info about iso-acc.el
+	* ack.texi (Acknowledgments): Delete info about iso-acc.el.
 
 	* dired.texi (Misc Dired Features): Document
 	dired-compare-directories.
@@ -6199,7 +6222,7 @@
 
 2004-09-10  Eli Zaretskii  <eliz@gnu.org>
 
-	* Makefile.in (../info/gnus, gnus.dvi): Depend on gnus-faq.texi
+	* Makefile.in (../info/gnus, gnus.dvi): Depend on gnus-faq.texi.
 
 2004-09-09  Kim F. Storm  <storm@cua.dk>
 
@@ -7305,7 +7328,7 @@
 
 2003-02-17  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
-	* xresources.texi (GTK names in Emacs): Add emacs-toolbar - GtkToolbar
+	* xresources.texi (GTK names in Emacs): Add emacs-toolbar - GtkToolbar.
 
 2003-02-05  Kai Gro,A_(Bjohann  <kai.grossjohann@uni-duisburg.de>
 
@@ -7375,8 +7398,8 @@
 	Also use @ifnottex instead of @ifinfo around the top node, where
 	needed for the sake of the HTML output.
 	(The Gnus manual is not fixed since it's not clear to me how it
-	 works; and the Tramp manual already uses @copying, although in an
-	 unusual way.  All others were changed.)
+	works; and the Tramp manual already uses @copying, although in an
+	unusual way.  All others were changed.)
 
 2002-09-10  Jonathan Yavner  <jyavner@engineer.com>
 
@@ -7501,7 +7524,7 @@
 1999-10-12  Stefan Monnier  <monnier@cs.yale.edu>
 
 	* Makefile.in (faq): Use ../info/emacs-faq.info (as specified in the
-	  faq.texi file) rather than ../info/faq.
+	faq.texi file) rather than ../info/faq.
 
 1999-10-07  Gerd Moellmann  <gerd@gnu.org>
 
--- a/man/cc-mode.texi	Fri Jun 08 12:41:25 2007 +0000
+++ b/man/cc-mode.texi	Mon Jun 11 00:58:11 2007 +0000
@@ -236,113 +236,113 @@
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 @menu
-* Introduction::                
-* Overview::                    
-* Getting Started::             
-* Commands::                    
-* Font Locking::                
-* Config Basics::               
-* Custom Filling and Breaking::  
-* Custom Auto-newlines::        
-* Clean-ups::                   
-* Indentation Engine Basics::   
-* Customizing Indentation::     
-* Custom Macros::               
-* Odds and Ends::               
-* Sample .emacs File::          
-* Performance Issues::          
-* Limitations and Known Bugs::  
-* FAQ::                         
-* Updating CC Mode::            
-* Mailing Lists and Bug Reports::  
+* Introduction::
+* Overview::
+* Getting Started::
+* Commands::
+* Font Locking::
+* Config Basics::
+* Custom Filling and Breaking::
+* Custom Auto-newlines::
+* Clean-ups::
+* Indentation Engine Basics::
+* Customizing Indentation::
+* Custom Macros::
+* Odds and Ends::
+* Sample .emacs File::
+* Performance Issues::
+* Limitations and Known Bugs::
+* FAQ::
+* Updating CC Mode::
+* Mailing Lists and Bug Reports::
 * GNU Free Documentation License::
-* Command and Function Index::  
-* Variable Index::              
-* Concept and Key Index::       
+* Command and Function Index::
+* Variable Index::
+* Concept and Key Index::
 
 @detailmenu
  --- The Detailed Node Listing ---
 
 Commands
 
-* Indentation Commands::        
-* Comment Commands::            
-* Movement Commands::           
-* Filling and Breaking::        
-* Minor Modes::                 
-* Electric Keys::               
-* Auto-newlines::               
-* Hungry WS Deletion::          
-* Subword Movement::            
-* Other Commands::              
+* Indentation Commands::
+* Comment Commands::
+* Movement Commands::
+* Filling and Breaking::
+* Minor Modes::
+* Electric Keys::
+* Auto-newlines::
+* Hungry WS Deletion::
+* Subword Movement::
+* Other Commands::
 
 Font Locking
 
-* Font Locking Preliminaries::  
-* Faces::                       
-* Doc Comments::                
-* AWK Mode Font Locking::       
+* Font Locking Preliminaries::
+* Faces::
+* Doc Comments::
+* AWK Mode Font Locking::
 
 Configuration Basics
 
-* CC Hooks::                    
-* Style Variables::             
-* Styles::                      
+* CC Hooks::
+* Style Variables::
+* Styles::
 
 Styles
 
-* Built-in Styles::             
-* Choosing a Style::            
-* Adding Styles::               
-* File Styles::                 
+* Built-in Styles::
+* Choosing a Style::
+* Adding Styles::
+* File Styles::
 
 Customizing Auto-newlines
 
-* Hanging Braces::              
-* Hanging Colons::              
-* Hanging Semicolons and Commas::  
+* Hanging Braces::
+* Hanging Colons::
+* Hanging Semicolons and Commas::
 
 Hanging Braces
 
-* Custom Braces::               
+* Custom Braces::
 
 Indentation Engine Basics
 
-* Syntactic Analysis::          
-* Syntactic Symbols::           
-* Indentation Calculation::     
+* Syntactic Analysis::
+* Syntactic Symbols::
+* Indentation Calculation::
 
 Syntactic Symbols
 
-* Function Symbols::            
-* Class Symbols::               
-* Conditional Construct Symbols::  
-* Switch Statement Symbols::    
-* Brace List Symbols::          
-* External Scope Symbols::      
-* Paren List Symbols::          
-* Literal Symbols::             
-* Multiline Macro Symbols::     
-* Objective-C Method Symbols::  
-* Anonymous Class Symbol::      
-* Statement Block Symbols::     
-* K&R Symbols::                 
+* Function Symbols::
+* Class Symbols::
+* Conditional Construct Symbols::
+* Switch Statement Symbols::
+* Brace List Symbols::
+* External Scope Symbols::
+* Paren List Symbols::
+* Literal Symbols::
+* Multiline Macro Symbols::
+* Objective-C Method Symbols::
+* Anonymous Class Symbol::
+* Statement Block Symbols::
+* K&R Symbols::
 
 Customizing Indentation
 
-* c-offsets-alist::             
-* Interactive Customization::   
-* Line-Up Functions::           
-* Custom Line-Up::              
-* Other Indentation::           
+* c-offsets-alist::
+* Interactive Customization::
+* Line-Up Functions::
+* Custom Line-Up::
+* Other Indentation::
 
 Line-Up Functions
 
-* Brace/Paren Line-Up::         
-* List Line-Up::                
-* Operator Line-Up::            
-* Comment Line-Up::             
-* Misc Line-Up::                
+* Brace/Paren Line-Up::
+* List Line-Up::
+* Operator Line-Up::
+* Comment Line-Up::
+* Misc Line-Up::
 
 @end detailmenu
 @end menu
@@ -534,7 +534,7 @@
 @end example
 
 @noindent
-Details of of this and other similar ``Minor Modes'' appear in the
+Details of this and other similar ``Minor Modes'' appear in the
 section @ref{Minor Modes}.
 
 @item Making the @key{RET} key indent the new line
@@ -613,16 +613,16 @@
 
 
 @menu
-* Indentation Commands::        
-* Comment Commands::            
-* Movement Commands::           
-* Filling and Breaking::        
-* Minor Modes::                 
-* Electric Keys::               
-* Auto-newlines::               
-* Hungry WS Deletion::          
-* Subword Movement::            
-* Other Commands::              
+* Indentation Commands::
+* Comment Commands::
+* Movement Commands::
+* Filling and Breaking::
+* Minor Modes::
+* Electric Keys::
+* Auto-newlines::
+* Hungry WS Deletion::
+* Subword Movement::
+* Other Commands::
 @end menu
 
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -852,7 +852,7 @@
 isn't present on the list then the line is indented to the column
 specified by @code{comment-column}.
 
-See the documentation string for for a full description of this
+See the documentation string for a full description of this
 variable (use @kbd{C-h v c-indent-comment-alist}).
 @end defopt
 
@@ -1810,10 +1810,10 @@
 sections apply to the other languages.
 
 @menu
-* Font Locking Preliminaries::  
-* Faces::                       
-* Doc Comments::                
-* AWK Mode Font Locking::       
+* Font Locking Preliminaries::
+* Faces::
+* Doc Comments::
+* AWK Mode Font Locking::
 @end menu
 
 
@@ -2318,9 +2318,9 @@
 @end table
 
 @menu
-* CC Hooks::                    
-* Style Variables::             
-* Styles::                      
+* CC Hooks::
+* Style Variables::
+* Styles::
 @end menu
 
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -2409,7 +2409,7 @@
 @dfn{style variables}.  Note that style variables are ordinary Lisp
 variables, which the style system initializes; you can change their
 values at any time (e.g. in a hook function).  The style system can
-also also set other variables, to some extent.  @xref{Styles}.
+also set other variables, to some extent.  @xref{Styles}.
 
 @dfn{Style variables} are handled specially in several ways:
 
@@ -2509,10 +2509,10 @@
 existing code using these styles.
 
 @menu
-* Built-in Styles::             
-* Choosing a Style::            
-* Adding Styles::               
-* File Styles::                 
+* Built-in Styles::
+* Choosing a Style::
+* Adding Styles::
+* File Styles::
 @end menu
 
 
@@ -3059,9 +3059,9 @@
 circumstances.  @xref{Clean-ups}.
 
 @menu
-* Hanging Braces::              
-* Hanging Colons::              
-* Hanging Semicolons and Commas::  
+* Hanging Braces::
+* Hanging Colons::
+* Hanging Semicolons and Commas::
 @end menu
 
 
@@ -3212,7 +3212,7 @@
 @end defopt
 
 @menu
-* Custom Braces::               
+* Custom Braces::
 @end menu
 
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -3732,9 +3732,9 @@
 @end defopt
 
 @menu
-* Syntactic Analysis::          
-* Syntactic Symbols::           
-* Indentation Calculation::     
+* Syntactic Analysis::
+* Syntactic Symbols::
+* Indentation Calculation::
 @end menu
 
 
@@ -4113,19 +4113,19 @@
 @end table
 
 @menu
-* Function Symbols::            
-* Class Symbols::               
-* Conditional Construct Symbols::  
-* Switch Statement Symbols::    
-* Brace List Symbols::          
-* External Scope Symbols::      
-* Paren List Symbols::          
-* Literal Symbols::             
-* Multiline Macro Symbols::     
-* Objective-C Method Symbols::  
-* Anonymous Class Symbol::      
-* Statement Block Symbols::     
-* K&R Symbols::                 
+* Function Symbols::
+* Class Symbols::
+* Conditional Construct Symbols::
+* Switch Statement Symbols::
+* Brace List Symbols::
+* External Scope Symbols::
+* Paren List Symbols::
+* Literal Symbols::
+* Multiline Macro Symbols::
+* Objective-C Method Symbols::
+* Anonymous Class Symbol::
+* Statement Block Symbols::
+* K&R Symbols::
 @end menu
 
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -5019,11 +5019,11 @@
 indentation.
 
 @menu
-* c-offsets-alist::             
-* Interactive Customization::   
-* Line-Up Functions::           
-* Custom Line-Up::              
-* Other Indentation::           
+* c-offsets-alist::
+* Interactive Customization::
+* Line-Up Functions::
+* Custom Line-Up::
+* Other Indentation::
 @end menu
 
 
@@ -5371,11 +5371,11 @@
 @end iftex
 
 @menu
-* Brace/Paren Line-Up::         
-* List Line-Up::                
-* Operator Line-Up::            
-* Comment Line-Up::             
-* Misc Line-Up::                
+* Brace/Paren Line-Up::
+* List Line-Up::
+* Operator Line-Up::
+* Comment Line-Up::
+* Misc Line-Up::
 @end menu
 
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--- a/man/display.texi	Fri Jun 08 12:41:25 2007 +0000
+++ b/man/display.texi	Mon Jun 11 00:58:11 2007 +0000
@@ -922,8 +922,18 @@
 Number mode is enabled.  Use the command @kbd{M-x line-number-mode} to
 turn this mode on and off; normally it is on.  The line number appears
 after the buffer percentage @var{pos}, with the letter @samp{L} to
-indicate what it is.  @xref{Minor Modes}, for more information about
-minor modes and about how to use this command.
+indicate what it is.
+
+@cindex Column Number mode
+@cindex mode, Column Number
+@findex column-number-mode
+  Similarly, you can display the current column number by turning on
+Column number mode with @kbd{M-x column-number-mode}.  The column
+number is indicated by the letter @samp{C}.  However, when both of
+these modes are enabled, the line and column numbers are displayed in
+parentheses, the line number first, rather than with @samp{L} and
+@samp{C}.  For example: @samp{(561,2)}.  @xref{Minor Modes}, for more
+information about minor modes and about how to use these commands.
 
 @cindex narrowing, and line number display
   If you have narrowed the buffer (@pxref{Narrowing}), the displayed
@@ -946,13 +956,6 @@
 @code{line-number-display-limit-width}.  The default value is 200
 characters.
 
-@cindex Column Number mode
-@cindex mode, Column Number
-@findex column-number-mode
-  You can also display the current column number by turning on Column
-Number mode.  It displays the current column number preceded by the
-letter @samp{C}.  Type @kbd{M-x column-number-mode} to toggle this mode.
-
 @findex display-time
 @cindex time (on mode line)
   Emacs can optionally display the time and system load in all mode
--- a/man/gnus.texi	Fri Jun 08 12:41:25 2007 +0000
+++ b/man/gnus.texi	Mon Jun 11 00:58:11 2007 +0000
@@ -4084,8 +4084,8 @@
 @item v
 @kindex v (Group)
 @cindex keys, reserved for users (Group)
-The key @kbd{v} is reserved for users.  You can bind it key to some
-function or better use it as a prefix key.  For example:
+The key @kbd{v} is reserved for users.  You can bind it to some
+command or better use it as a prefix key.  For example:
 
 @lisp
 (define-key gnus-group-mode-map (kbd "v j d")
@@ -4498,8 +4498,8 @@
 
 @kindex v (Summary)
 @cindex keys, reserved for users (Summary)
-The key @kbd{v} is reserved for users.  You can bind it key to some
-function or better use it as a prefix key.  For example:
+The key @kbd{v} is reserved for users.  You can bind it to some
+command or better use it as a prefix key.  For example:
 @lisp
 (define-key gnus-summary-mode-map (kbd "v -") "LrS") ;; lower subthread
 @end lisp
@@ -8936,7 +8936,7 @@
 message ID or a mail address.  If it is one of the symbols @code{mid} or
 @code{mail}, Gnus will always assume that the string is a message ID or
 a mail address, respectively.  If this variable is set to the symbol
-@code{ask}, always query the user what do do.  If it is a function, this
+@code{ask}, always query the user what to do.  If it is a function, this
 function will be called with the string as its only argument.  The
 function must return @code{mid}, @code{mail}, @code{invalid} or
 @code{ask}.  The default value is the function
@@ -11422,8 +11422,8 @@
 
 @kindex v (Article)
 @cindex keys, reserved for users (Article)
-The key @kbd{v} is reserved for users.  You can bind it key to some
-function or better use it as a prefix key.
+The key @kbd{v} is reserved for users.  You can bind it to some
+command or better use it as a prefix key.
 
 A few additional keystrokes are available:
 
@@ -12460,8 +12460,8 @@
 @item v
 @kindex v (Server)
 @cindex keys, reserved for users (Server)
-The key @kbd{v} is reserved for users.  You can bind it key to some
-function or better use it as a prefix key.
+The key @kbd{v} is reserved for users.  You can bind it to some
+command or better use it as a prefix key.
 
 @item a
 @kindex a (Server)
@@ -14034,7 +14034,7 @@
 
 @item mail-source-delete-old-incoming-confirm
 @vindex mail-source-delete-old-incoming-confirm
-If non-@code{nil}, ask for for confirmation before deleting old incoming
+If non-@code{nil}, ask for confirmation before deleting old incoming
 files.  This variable only applies when
 @code{mail-source-delete-incoming} is a positive number.
 
@@ -16589,7 +16589,7 @@
 messages instead of the internal article date.  See section 6.4.4 of
 RFC 2060 for more information on valid strings.
 
-However, if @code{nnimap-search-uids-not-since-is-evil} 
+However, if @code{nnimap-search-uids-not-since-is-evil}
 is true, this variable has no effect since the search logic
 is reversed, as described below.
 
@@ -18107,7 +18107,7 @@
 
 @defvar nndiary-reminders
 This is the list of times when you want to be reminded of your
-appointements (e.g. 3 weeks before, then 2 days before, then 1 hour
+appointments (e.g. 3 weeks before, then 2 days before, then 1 hour
 before and that's it).  Remember that ``being reminded'' means that the
 diary message will pop up as brand new and unread again when you get new
 mail.
@@ -18258,14 +18258,14 @@
 @node Sending or Not Sending
 @subsection Sending or Not Sending
 
-Well, assuming you've read of of the above, here are two final notes on
+Well, assuming you've read all of the above, here are two final notes on
 mail sending with @code{nndiary}:
 
 @itemize @bullet
 @item
 @code{nndiary} is a @emph{real} mail back end.  You really send real diary
 messsages for real.  This means for instance that you can give
-appointements to anybody (provided they use Gnus and @code{nndiary}) by
+appointments to anybody (provided they use Gnus and @code{nndiary}) by
 sending the diary message to them as well.
 @item
 However, since @code{nndiary} also has a @code{request-post} method, you
--- a/man/maintaining.texi	Fri Jun 08 12:41:25 2007 +0000
+++ b/man/maintaining.texi	Mon Jun 11 00:58:11 2007 +0000
@@ -409,8 +409,8 @@
 files.  If the tags file is in @file{/dev}, however, the file names are
 made relative to the current working directory.  This is useful, for
 example, when writing the tags to @file{/dev/stdout}.
- 
-  When using a a relative file name, it should not be a symbolic link
+
+  When using a relative file name, it should not be a symbolic link
 pointing to a tags file in a different directory, because this would
 generally render the file names invalid.
 
--- a/man/message.texi	Fri Jun 08 12:41:25 2007 +0000
+++ b/man/message.texi	Mon Jun 11 00:58:11 2007 +0000
@@ -1450,7 +1450,7 @@
 @vindex message-subject-trailing-was-regexp
 Controls what to do with trailing @samp{(was: <old subject>)} in subject
 lines.  If @code{nil}, leave the subject unchanged.  If it is the symbol
-@code{ask}, query the user what do do.  In this case, the subject is
+@code{ask}, query the user what to do.  In this case, the subject is
 matched against @code{message-subject-trailing-was-ask-regexp}.  If
 @code{message-subject-trailing-was-query} is @code{t}, always strip the
 trailing old subject.  In this case,
--- a/man/mh-e.texi	Fri Jun 08 12:41:25 2007 +0000
+++ b/man/mh-e.texi	Mon Jun 11 00:58:11 2007 +0000
@@ -132,64 +132,64 @@
 
 Tour Through MH-E
 
-* Sending Mail Tour::           
-* Reading Mail Tour::           
-* Processing Mail Tour::        
-* Leaving MH-E::                
-* More About MH-E::             
+* Sending Mail Tour::
+* Reading Mail Tour::
+* Processing Mail Tour::
+* Leaving MH-E::
+* More About MH-E::
 
 Using This Manual
 
-* Options::                     
-* Ranges::                      
-* Folder Selection::            
+* Options::
+* Ranges::
+* Folder Selection::
 
 Reading Your Mail
 
-* Viewing::                     
-* Viewing Attachments::         
-* HTML::                        
-* Digests::                     
-* Reading PGP::                 
-* Printing::                    
-* Files and Pipes::             
-* Navigating::                  
-* Miscellaneous Commands and Options::  
+* Viewing::
+* Viewing Attachments::
+* HTML::
+* Digests::
+* Reading PGP::
+* Printing::
+* Files and Pipes::
+* Navigating::
+* Miscellaneous Commands and Options::
 
 Sending Mail
 
-* Composing::                   
-* Replying::                    
-* Forwarding::                  
-* Redistributing::              
-* Editing Again::               
+* Composing::
+* Replying::
+* Forwarding::
+* Redistributing::
+* Editing Again::
 
 Editing a Draft
 
-* Editing Message::             
-* Inserting Letter::            
-* Inserting Messages::          
-* Signature::                   
-* Picture::                     
-* Adding Attachments::          
-* Sending PGP::                 
-* Checking Recipients::         
-* Sending Message::             
-* Killing Draft::               
+* Editing Message::
+* Inserting Letter::
+* Inserting Messages::
+* Signature::
+* Picture::
+* Adding Attachments::
+* Sending PGP::
+* Checking Recipients::
+* Sending Message::
+* Killing Draft::
 
 Odds and Ends
 
-* Bug Reports::                 
-* Mailing Lists::               
-* MH FAQ and Support::          
-* Getting MH-E::                
+* Bug Reports::
+* Mailing Lists::
+* MH FAQ and Support::
+* Getting MH-E::
 
 History of MH-E
 
-* From Brian Reid::             
-* From Jim Larus::              
-* From Stephen Gildea::         
-* From Bill Wohler::            
+* From Brian Reid::
+* From Jim Larus::
+* From Stephen Gildea::
+* From Bill Wohler::
 
 @end detailmenu
 @end menu
@@ -360,7 +360,7 @@
 numerical argument before entering the command.
 @end quotation
 @sp 1
- 
+
 @cindex @file{.emacs}
 @cindex Emacs, variables
 @cindex files, @file{.emacs}
@@ -415,7 +415,7 @@
 @findex customize-option
 
 Commands often offer @dfn{hooks} which enable you to extend or modify
-the way a command works. 
+the way a command works.
 @ifnothtml
 @ref{Hooks, , Hooks, emacs, The GNU Emacs Manual}, in @cite{The GNU
 Emacs Manual}
@@ -673,11 +673,11 @@
 get the big picture, and then you can read the manual as you wish.
 
 @menu
-* Sending Mail Tour::           
-* Reading Mail Tour::           
-* Processing Mail Tour::        
-* Leaving MH-E::                
-* More About MH-E::             
+* Sending Mail Tour::
+* Reading Mail Tour::
+* Processing Mail Tour::
+* Leaving MH-E::
+* More About MH-E::
 @end menu
 
 @node Sending Mail Tour, Reading Mail Tour, Tour Through MH-E, Tour Through MH-E
@@ -843,10 +843,10 @@
 
 @cartouche
 @smallexample
-To: 
-cc: 
-Subject: Re: Test 
-In-reply-to: <31054.1142621351@@stop.mail-abuse.org> 
+To:
+cc:
+Subject: Re: Test
+In-reply-to: <31054.1142621351@@stop.mail-abuse.org>
 References: <31054.1142621351@@stop.mail-abuse.org>
 Comments: In-reply-to Bill Wohler <wohler@@stop.mail-abuse.org>
    message dated "Fri, 17 Mar 2006 10:49:11 -0800."
@@ -1161,9 +1161,9 @@
 your initials. (Unless, of course, your initials happen to be @emph{mh}!)
 
 @menu
-* Options::                     
-* Ranges::                      
-* Folder Selection::            
+* Options::
+* Ranges::
+* Folder Selection::
 @end menu
 
 @node Options, Ranges, Using This Manual, Using This Manual
@@ -2001,15 +2001,15 @@
 detail in the following sections.
 
 @menu
-* Viewing::                     
-* Viewing Attachments::         
-* HTML::                        
-* Digests::                     
-* Reading PGP::                 
-* Printing::                    
-* Files and Pipes::             
-* Navigating::                  
-* Miscellaneous Commands and Options::  
+* Viewing::
+* Viewing Attachments::
+* HTML::
+* Digests::
+* Reading PGP::
+* Printing::
+* Files and Pipes::
+* Navigating::
+* Miscellaneous Commands and Options::
 @end menu
 
 @node Viewing, Viewing Attachments, Reading Mail, Reading Mail
@@ -2047,7 +2047,7 @@
 over large messages which may be slow to load. The default value of 0
 means that all message are shown regardless of size.
 
-A litany of options control what displayed messages look like. 
+A litany of options control what displayed messages look like.
 
 @vindex mh-show-cc
 @vindex mh-show-date
@@ -2637,7 +2637,7 @@
 @end ifinfo
 @ifnotinfo
 see section @uref{http://www.gnus.org/manual/emacs-mime_6.html,
-Display Customization} in the @cite{The Emacs MIME Manual} and the the
+Display Customization} in the @cite{The Emacs MIME Manual} and the
 documentation for the Gnus command @kbd{W h} (see section
 @uref{http://www.gnus.org/manual/gnus_99.html, Article Washing} in the
 @cite{The Gnus Manual}).
@@ -2808,7 +2808,7 @@
 @cindex customization group, @samp{pgg}
 
 The @samp{pgg} customization group may have some settings which may
-interest you. 
+interest you.
 @iftex
 See @cite{The PGG Manual}.
 @end iftex
@@ -3942,11 +3942,11 @@
 in the following sections.
 
 @menu
-* Composing::                   
-* Replying::                    
-* Forwarding::                  
-* Redistributing::              
-* Editing Again::               
+* Composing::
+* Replying::
+* Forwarding::
+* Redistributing::
+* Editing Again::
 @end menu
 
 @node Composing, Replying, Sending Mail, Sending Mail
@@ -4686,16 +4686,16 @@
 detail in the following sections.
 
 @menu
-* Editing Message::             
-* Inserting Letter::            
-* Inserting Messages::          
-* Signature::                   
-* Picture::                     
-* Adding Attachments::          
-* Sending PGP::                 
-* Checking Recipients::         
-* Sending Message::             
-* Killing Draft::               
+* Editing Message::
+* Inserting Letter::
+* Inserting Messages::
+* Signature::
+* Picture::
+* Adding Attachments::
+* Sending PGP::
+* Checking Recipients::
+* Sending Message::
+* Killing Draft::
 @end menu
 
 @node Editing Message, Inserting Letter, Editing Drafts, Editing Drafts
@@ -4795,7 +4795,7 @@
 @code{mh-alias-flash-on-comma} is turned on.
 
 @c XXX Document the replacement for the inaccessible 'long argument.
- 
+
 @findex mh-letter-toggle-header-field-display
 @kindex C-c C-t
 
@@ -5543,7 +5543,7 @@
 @cindex customization group, @samp{pgg}
 
 The @samp{pgg} customization group may have some settings which may
-interest you. 
+interest you.
 @iftex
 See @cite{The PGG Manual}.
 @end iftex
@@ -5954,7 +5954,7 @@
 regular expression
 @ifnothtml
 (@pxref{Regexps, , Syntax of Regular Expressions, emacs, The
-GNU Emacs Manual}). 
+GNU Emacs Manual}).
 @end ifnothtml
 @ifhtml
 (see the section
@@ -6104,7 +6104,7 @@
 and enter a regular expression for the recipient's address
 @ifnothtml
 (@pxref{Regexps, , Syntax of Regular Expressions, emacs, The
-GNU Emacs Manual}). 
+GNU Emacs Manual}).
 @end ifnothtml
 @ifhtml
 (see the section
@@ -6142,7 +6142,7 @@
 reply.
 @c -------------------------
 @item Other Field
-Other header fields may be added using this menu item. 
+Other header fields may be added using this menu item.
 @end table
 
 @findex mh-insert-auto-fields
@@ -6181,7 +6181,7 @@
 an existing handler function associated with the field you want to
 change with the name of a function you have written. You can also
 click on an @samp{INS} button and insert a field of your choice and
-the name of the function you have written to handle it. 
+the name of the function you have written to handle it.
 
 @vindex mh-identity-list
 
@@ -6210,7 +6210,7 @@
 @kindex M-x speedbar
 @kindex Mouse-2
 
-You can also use the speedbar 
+You can also use the speedbar
 @ifnothtml
 (@pxref{Speedbar, , Speedbar Frames, emacs, The GNU Emacs Manual},)
 @end ifnothtml
@@ -6573,7 +6573,7 @@
 in searching.
 
 @vtable @code
-@item mh-search-program 
+@item mh-search-program
 Search program that MH-E shall use (default: @samp{Auto-detect}).
 @end vtable
 
@@ -7145,7 +7145,7 @@
 @c -------------------------
 @kindex / m
 @findex mh-narrow-to-from
-@item / m	
+@item / m
 Limit to messages with the same @samp{From:} field
 (@code{mh-narrow-to-from}).
 @c -------------------------
@@ -7635,7 +7635,7 @@
 
 Note that one of the recipes above throws away messages with a score
 greater than or equal to 10. Here's how you can determine a value that
-works best for you. 
+works best for you.
 
 First, run @samp{spamassassin -t} on every mail message in your
 archive and use @command{gnumeric} to verify that the average plus the
@@ -8579,10 +8579,10 @@
 I also point out some additional sources of information.
 
 @menu
-* Bug Reports::                 
-* Mailing Lists::               
-* MH FAQ and Support::          
-* Getting MH-E::                
+* Bug Reports::
+* Mailing Lists::
+* MH FAQ and Support::
+* Getting MH-E::
 @end menu
 
 @node Bug Reports, Mailing Lists, Odds and Ends, Odds and Ends
@@ -8713,10 +8713,10 @@
 lives today.
 
 @menu
-* From Brian Reid::             
-* From Jim Larus::              
-* From Stephen Gildea::         
-* From Bill Wohler::            
+* From Brian Reid::
+* From Jim Larus::
+* From Stephen Gildea::
+* From Bill Wohler::
 @end menu
 
 @node From Brian Reid, From Jim Larus, History, History
@@ -9715,7 +9715,7 @@
 @c The following are words that ispell should ignore that would not
 @c normally be in a dictionary (global or personal). Be careful not to
 @c include words here that could potentially be typos of other words
-@c (such as url, elisp, or MHE). 
+@c (such as url, elisp, or MHE).
 @c
 @c LocalWords: CTRL ESC SPC f's
 @c LocalWords: addr Aliasfile alist
--- a/man/org.texi	Fri Jun 08 12:41:25 2007 +0000
+++ b/man/org.texi	Mon Jun 11 00:58:11 2007 +0000
@@ -3,8 +3,8 @@
 @setfilename ../info/org
 @settitle Org Mode Manual
 
-@set VERSION 4.67
-@set DATE February 2007
+@set VERSION 4.77
+@set DATE June 2007
 
 @dircategory Emacs
 @direntry
@@ -89,7 +89,6 @@
 * Miscellaneous::               All the rest which did not fit elsewhere
 * Extensions and Hacking::      It is possible to write add-on code
 * History and Acknowledgments::  How Org-mode came into being 
-* GNU Free Documentation License:: The license for this documentation.
 * Index::                       The fast road to specific information
 * Key Index::                   Key bindings and where they are described
 
@@ -123,6 +122,7 @@
 
 * Built-in table editor::       Simple tables
 * Narrow columns::              Stop wasting space in tables   
+* Column groups::               Grouping to trigger vertical lines
 * orgtbl-mode::                 The table editor as minor mode
 * The spreadsheet::             The table editor has spreadsheet capabilities.
 
@@ -163,26 +163,32 @@
 * TODO basics::                 Marking and displaying TODO entries
 * TODO extensions::             Workflow and assignments
 * Priorities::                  Some things are more important than others
-* Breaking down tasks::         Splitting a task into managable pieces
+* Breaking down tasks::         Splitting a task into manageable pieces
 * Checkboxes::                  Tick-off lists
 
 Extended use of TODO keywords
 
 * Workflow states::             From TODO to DONE in steps
 * TODO types::                  I do this, Fred the rest
+* Multiple sets in one file::   Mixing it all, and still finding your way
 * Per file keywords::           Different files, different requirements
 
 Timestamps
 
 * Time stamps::                 Assigning a time to a tree entry
 * Creating timestamps::         Commands which insert timestamps
-* Custom time format::          If you cannot work with the ISO format
-* Repeating items::             Deadlines that come back again and again
+* Deadlines and scheduling::    Planning your work
 * Progress logging::            Documenting when what work was done.
 
 Creating timestamps
 
 * The date/time prompt::        How org-mode helps you entering date and time
+* Custom time format::          Making dates look differently
+
+Deadlines and Scheduling
+
+* Inserting deadline/schedule::  
+* Repeated tasks::              
 
 Progress Logging
 
@@ -224,7 +230,8 @@
 * Storing searches::            Type once, use often
 * Block agenda::                All the stuff you need in a single buffer
 * Setting Options::             Changing the rules
-* Batch processing::            Agenda views from the command line
+* Exporting Agenda Views::      Writing agendas to files.
+* Extracting Agenda Information for other programs::  
 
 Embedded LaTeX
 
@@ -244,7 +251,7 @@
 
 HTML export
 
-* Export commands::             How to invode HTML export
+* Export commands::             How to invoke HTML export
 * Quoting HTML tags::           Using direct HTML in Org-mode
 * Links::                       How hyperlinks get transferred to HTML
 * Images::                      To inline or not to inline?
@@ -253,6 +260,8 @@
 Text interpretation by the exporter
 
 * Comment lines::               Some lines will not be exported
+* Initial text::                Text before the first headline
+* Footnotes::                   Numbers like [1]
 * Enhancing text::              Subscripts, symbols and more
 * Export options::              How to influence the export settings
 
@@ -371,7 +380,7 @@
 Org-mode's automatic, context sensitive table editor with spreadsheet
 capabilities can be integrated into any major mode by activating the
 minor Orgtbl-mode.  Using a translation step, it can be used to maintain
-tables in arbitray file types, for example in LaTeX.
+tables in arbitrary file types, for example in LaTeX.
 
 @cindex FAQ
 There is a website for Org-mode which provides links to the newest
@@ -578,8 +587,9 @@
 @cindex outline tree
 
 Headlines define the structure of an outline tree.  The headlines in
-Org-mode start with one or more stars, on the left margin.  For
-example:
+Org-mode start with one or more stars, on the left margin@footnote{See
+the variable @code{org-special-ctrl-a} to configure special behavior of
+@kbd{C-a} in headlines.}.  For example:
 
 @example
 * Top level headline
@@ -588,6 +598,7 @@
     some text
 *** 3rd level
     more text
+
 * Another top level headline
 @end example
 
@@ -595,6 +606,12 @@
 outline that has whitespace followed by a single star as headline
 starters.  @ref{Clean view} describes a setup to realize this.
 
+An empty line after the end of a subtree is considered part of it and
+will be hidden when the subtree is folded.  However, if you leave at
+least two empty lines, one empty line will remain visible after folding
+the subtree, in order to structure the collapsed view.  See the
+variable @code{org-cycle-separator-lines} for modifying this behavior.
+
 @node Visibility cycling, Motion, Headlines, Document structure
 @section Visibility cycling
 @cindex cycling, visibility
@@ -615,7 +632,7 @@
 @table @kbd
 @kindex @key{TAB}
 @item @key{TAB}
-@emph{Subtree cycling}: Rotate current subtree between the states
+@emph{Subtree cycling}: Rotate current subtree among the states
 
 @example
 ,-> FOLDED -> CHILDREN -> SUBTREE --.
@@ -637,7 +654,7 @@
 @kindex S-@key{TAB}
 @item S-@key{TAB}
 @itemx C-u @key{TAB}
-@emph{Global cycling}: Rotate the entire buffer between the states
+@emph{Global cycling}: Rotate the entire buffer among the states
 
 @example
 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
@@ -662,13 +679,19 @@
 @kindex C-c C-x b
 @item C-c C-x b
 Show the current subtree in an indirect buffer@footnote{The indirect
-buffer (@pxref{Indirect Buffers,Indirect Buffers,Indirect
-Buffers,emacs,GNU Emacs Manual}) will contain the entire buffer, but
-will be narrowed to the current tree.  Editing the indirect buffer will
-also change the original buffer, but without affecting visibility in
-that buffer.}.  With numerical prefix ARG, go up to this level and then
-take that tree.  If ARG is negative, go up that many levels.  With
-@kbd{C-u} prefix, do not remove the previously used indirect buffer.
+buffer
+@ifinfo
+(@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
+@end ifinfo
+@ifnotinfo
+(see the Emacs manual for more information about indirect buffers)
+@end ifnotinfo
+will contain the entire buffer, but will be narrowed to the current
+tree.  Editing the indirect buffer will also change the original buffer,
+but without affecting visibility in that buffer.}.  With numerical
+prefix ARG, go up to this level and then take that tree.  If ARG is
+negative, go up that many levels.  With @kbd{C-u} prefix, do not remove
+the previously used indirect buffer.
 @end table
 
 When Emacs first visits an Org-mode file, the global state is set to
@@ -710,10 +733,16 @@
 @item C-c C-j
 Jump to a different place without changing the current outline
 visibility.  Shows the document structure in a temporary buffer, where
-you can use visibility cycling (@key{TAB}) to find your destination.
-After pressing @key{RET}, the cursor moves to the selected location in
-the original buffer, and the headings hierarchy above it is made
-visible.
+you can use the following keys to find your destination:
+@example
+@key{TAB}         @r{Cycle visibility.}
+@key{down} / @key{up}   @r{Next/previous visible headline.}
+n / p        @r{Next/previous visible headline.}
+f / b        @r{Next/previous headline same level.}
+u            @r{One level up.}
+0-9          @r{Digit argument.}
+@key{RET}         @r{Select this location.}
+@end example
 @end table
 
 @node Structure editing, Archiving, Motion, Document structure
@@ -980,14 +1009,17 @@
 headlines.  Also, when you are hiding leading stars to get a clean
 outline view, plain list items starting with a star are visually
 indistinguishable from true headlines.  In short: even though @samp{*}
-is supported, it may be better not to use it for plain list items} as
+is supported, it may be better not to use it for plain list items.} as
 bullets.  Ordered list items start with @samp{1.} or @samp{1)}.  Items
 belonging to the same list must have the same indentation on the first
 line.  In particular, if an ordered list reaches number @samp{10.}, then
 the 2--digit numbers must be written left-aligned with the other numbers
 in the list.  Indentation also determines the end of a list item.  It
 ends before the next line that is indented like the bullet/number, or
-less.  For example:
+less.  Empty lines are part of the previous item, so you can have
+several paragraphs in one item.  If you would like an emtpy line to
+terminate all currently open plain lists, configure the variable
+@code{org-empty-line-terminates-plain-lists}.  Here is an for example:
 
 @example
 @group
@@ -1078,6 +1110,7 @@
 @menu
 * Built-in table editor::       Simple tables
 * Narrow columns::              Stop wasting space in tables   
+* Column groups::               Grouping to trigger vertical lines
 * orgtbl-mode::                 The table editor as minor mode
 * The spreadsheet::             The table editor has spreadsheet capabilities.
 @end menu
@@ -1141,16 +1174,16 @@
 @kindex C-c C-c
 @item C-c C-c
 Re-align the table without moving the cursor.
-
+@c
 @kindex @key{TAB}
 @item @key{TAB}
 Re-align the table, move to the next field.  Creates a new row if
 necessary.
-
+@c
 @kindex S-@key{TAB}
 @item S-@key{TAB}
 Re-align, move to previous field.
-
+@c
 @kindex @key{RET}
 @item @key{RET}
 Re-align the table and move down to next row.  Creates a new row if
@@ -1163,34 +1196,34 @@
 @item M-@key{left}
 @itemx M-@key{right}
 Move the current column left/right.
-
+@c
 @kindex M-S-@key{left}
 @item M-S-@key{left}
 Kill the current column.
-
+@c
 @kindex M-S-@key{right}
 @item M-S-@key{right}
 Insert a new column to the left of the cursor position.
-
+@c
 @kindex M-@key{up}
 @kindex M-@key{down}
 @item M-@key{up}
 @itemx M-@key{down}
 Move the current row up/down.
-
+@c
 @kindex M-S-@key{up}
 @item M-S-@key{up}
 Kill the current row or horizontal line.
-
+@c
 @kindex M-S-@key{down}
 @item M-S-@key{down}
 Insert a new row above (with arg: below) the current row.
-
+@c
 @kindex C-c -
 @item C-c -
 Insert a horizontal line below current row. With prefix arg, the line
 is created above the current line.
-
+@c
 @kindex C-c ^
 @item C-c ^
 Sort the table lines in the region.  The position of point indicates the
@@ -1209,10 +1242,12 @@
 Copy a rectangular region from a table to a special clipboard.  Point
 and mark determine edge fields of the rectangle.  The process ignores
 horizontal separator lines.
+@c
 @kindex C-c C-x C-w
 @item C-c C-x C-w
 Copy a rectangular region from a table to a special clipboard, and
 blank all fields in the rectangle.  So this is the ``cut'' operation.
+@c
 @kindex C-c C-x C-y
 @item C-c C-x C-y
 Paste a rectangular region into a table.
@@ -1220,6 +1255,7 @@
 will be overwritten.  If the rectangle does not fit into the present table,
 the table is enlarged as needed.  The process ignores horizontal separator
 lines.
+@c
 @kindex C-c C-q
 @item C-c C-q
 Wrap several fields in a column like a paragraph.  If there is an active
@@ -1235,7 +1271,6 @@
 @tsubheading{Calculations}
 @cindex formula, in tables
 @cindex calculations, in tables
-
 @cindex region, active
 @cindex active region
 @cindex transient-mark-mode
@@ -1244,7 +1279,7 @@
 Sum the numbers in the current column, or in the rectangle defined by
 the active region.  The result is shown in the echo area and can
 be inserted with @kbd{C-y}.
-
+@c
 @kindex S-@key{RET}
 @item S-@key{RET}
 When current field is empty, copy from first non-empty field above.
@@ -1261,12 +1296,12 @@
 that are not fully visible (@pxref{Narrow columns}).  When called with a
 @kbd{C-u} prefix, just make the full field visible, so that it can be
 edited in place.
-
+@c
 @kindex C-c @key{TAB}
 @item C-c @key{TAB}
 This is an alias for @kbd{C-u C-c `} to make the current field fully
 visible.
-
+@c
 @item M-x org-table-import
 Import a file as a table.  The table should be TAB- or whitespace
 separated.  Useful, for example, to import an Excel table or data from a
@@ -1274,11 +1309,14 @@
 files.  This command works by inserting the file into the buffer and
 then converting the region to a table.  Any prefix argument is passed on
 to the converter, which uses it to determine the separator.
-
+@item C-c |
+Tables can also be imported by pasting tabular text into the org-mode
+buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
+@kbd{C-c |} command (see above under @i{Creation and conversion}.
+@c
 @item M-x org-table-export
 Export the table as a TAB-separated file.  Useful for data exchange with,
 for example, Excel or database programs.
-
 @end table
 
 If you don't like the automatic table editor because it gets in your
@@ -1292,7 +1330,7 @@
 @noindent Then the only table command that still works is
 @kbd{C-c C-c} to do a manual re-align.
 
-@node Narrow columns, orgtbl-mode, Built-in table editor, Tables
+@node Narrow columns, Column groups, Built-in table editor, Tables
 @section Narrow columns
 @cindex narrow columns in tables
 
@@ -1320,7 +1358,7 @@
 @noindent
 Fields that are wider become clipped and end in the string @samp{=>}.
 Note that the full text is still in the buffer, it is only invisible.
-To see the full text, hold the mouse over the field - a tooltip window
+To see the full text, hold the mouse over the field - a tool-tip window
 will show the full content.  To edit such a field, use the command
 @kbd{C-c `} (that is @kbd{C-c} followed by the backquote).  This will
 open a new window with the full field.  Edit it and finish with @kbd{C-c
@@ -1338,7 +1376,42 @@
 #+STARTUP: noalign
 @end example
 
-@node orgtbl-mode, The spreadsheet, Narrow columns, Tables
+@node Column groups, orgtbl-mode, Narrow columns, Tables
+@section Column groups
+@cindex grouping columns in tables
+
+When Org-mode exports tables, it does so by default without vertical
+lines because that is visually more satisfying in general.  Occasionally
+however, vertical lines can be useful to structure a table into groups
+of columns, much like horizontal lines can do for groups of rows.  In
+order to specify column groups, you can use a special row where the
+first field contains only @samp{/}.  The further fields can either
+contain @samp{<} to indicate that this column should start a group,
+@samp{>} to indicate the end of a column, or @samp{<>} to make a column
+a group of its own.  Boundaries between colum groups will upon export be
+marked with vertical lines.  Here is an example:
+
+@example
+|   |  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
+|---+----+-----+-----+-----+---------+------------|
+| / | <> |   < |     |   > |       < |          > |
+| # |  1 |   1 |   1 |   1 |       1 |          1 |
+| # |  2 |   4 |   8 |  16 |  1.4142 |     1.1892 |
+| # |  3 |   9 |  27 |  81 |  1.7321 |     1.3161 |
+|---+----+-----+-----+-----+---------+------------|
+#+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2))
+@end example
+
+It is also sufficient to just insert the colum group starters after
+every vertical line you'd like to have:
+
+@example
+|  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
+|----+-----+-----+-----+---------+------------|
+| /  | <   |     |     | <       |            |
+@end example
+
+@node orgtbl-mode, The spreadsheet, Column groups, Tables
 @section The Orgtbl minor mode
 @cindex orgtbl-mode
 @cindex minor mode for tables
@@ -1356,7 +1429,7 @@
 Furthermore, with some special setup, it is possible to maintain tables
 in arbitrary syntax with Orgtbl-mode.  For example, it is possible to
 construct LaTeX tables with the underlying ease and power of
-Orgtbl-mode, including spreadsheet capabulities.  For details, see
+Orgtbl-mode, including spreadsheet capabilities.  For details, see
 @ref{Tables in arbitrary syntax}.
 
 @node The spreadsheet,  , orgtbl-mode, Tables
@@ -1367,7 +1440,12 @@
 
 The table editor makes use of the Emacs @file{calc} package to implement
 spreadsheet-like capabilities.  It can also evaluate Emacs Lisp forms to
-derive fields from other fields.
+derive fields from other fields.  While fully featured, Org-mode's
+implementation is not identical to other spreadsheets.  For example,
+Org-mode knows the concept of a @emph{column formula} that will be
+applied to all non-header fields in a column without having to copy the
+formula to each relevant field.
+
 @menu
 * References::                  How to refer to another field or range
 * Formula syntax for Calc::     Using Calc to compute stuff
@@ -1387,17 +1465,26 @@
 reference other fields or ranges.  In Org-mode, fields can be referenced
 by name, by absolute coordinates, and by relative coordinates.  To find
 out what the coordinates of a field are, press @kbd{C-c ?} in that
-field.
+field, or press @kbd{C-c @}} to toggle the display of a grid.
 
 @subsubheading Field references
 @cindex field references
 @cindex references, to fields
 
-Formulas can reference the value of another field with the operator
+Formulas can reference the value of another field in two ways.  Like in
+any other spreadsheet, you may reference fields with a letter/number
+combination like @code{B3}, meaning the 2nd field in the 3rd row.
+@c Such references are always fixed to that field, they don't change
+@c when you copy and paste a formula to a different field.  So
+@c Org-mode's @code{B3} behaves like @code{$B$3} in other spreadsheets.
+
+@noindent
+Org-mode also uses another, more general operator that looks like this:
 @example
 @@row$column
 @end example
 
+@noindent
 Column references can be absolute like @samp{1}, @samp{2},...@samp{N},
 or relative to the current column like @samp{+1} or @samp{-2}.
 
@@ -1417,18 +1504,20 @@
 either the column or the row part of the reference, the current
 row/column is implied. 
 
-Org-mode's references with @emph{positive} numbers correspond to fixed
-references in other spreadsheet programs.  For example, @code{@@3$28}
-corresponds to @code{$AB$3}.  Org-mode's references with @emph{negative}
-numbers behave similar to non-fixed references in other spreadsheet
-programs, because when the same formula is used in several fields,
-different fields are referenced each time.
+Org-mode's references with @emph{unsigned} numbers are fixed references
+in the sense that if you use the same reference in the formula for two
+different fields, the same field will be referenced each time.
+Org-mode's references with @emph{signed} numbers are floating
+references because the same reference operator can reference different
+fields depending on the field being calculated by the formula.
 
 Here are a few examples:
 
 @example
 @@2$3      @r{2nd row, 3rd column}
+C2        @r{same as previous}
 $5        @r{column 5 in the current row}
+E&        @r{same as previous}
 @@2        @r{current column, row 2}
 @@-1$-3    @r{the field one row up, three columns to the left}
 @@-I$2     @r{field just under hline above current row, column 2}
@@ -1449,6 +1538,7 @@
 $1..$3        @r{First three fields in the current row.}
 $P..$Q        @r{Range, using column names (see under Advanced)}
 @@2$1..@@4$3    @r{6 fields between these two fields.}
+A2..C4        @r{Same as above.}
 @@-1$-2..@@-1   @r{3 numbers from the column to the left, 2 up to current row}
 @end example
 
@@ -1466,12 +1556,18 @@
 
 @samp{$name} is interpreted as the name of a column, parameter or
 constant.  Constants are defined globally through the variable
-@code{org-table-formula-constants}.  If you have the
-@file{constants.el} package, it will also be used to resolve
-constants, including natural constants like @samp{$h} for Planck's
-constant, and units like @samp{$km} for kilometers.  Column names and
-parameters can be specified in special table lines.  These are
-described below, see @ref{Advanced features}.
+@code{org-table-formula-constants}.  If you have the @file{constants.el}
+package, it will also be used to resolve constants, including natural
+constants like @samp{$h} for Planck's constant, and units like
+@samp{$km} for kilometers@footnote{@file{Constant.el} can supply the
+values of constants in two different unit systems, @code{SI} and
+@code{cgs}.  Which one is used depends on the value of the variable
+@code{constants-unit-system}.  You can use the @code{#+STARTUP} options
+@code{constSI} and @code{constcgs} to set this value for the current
+buffer.}.  Column names and parameters can be specified in special table
+lines.  These are described below, see @ref{Advanced features}.  All
+names must start with a letter, and further consist of letters and
+numbers.
 
 @node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
 @subsection Formula syntax for Calc
@@ -1485,6 +1581,7 @@
 evaluation by @code{calc-eval} (@pxref{Calling Calc from
 Your Programs,calc-eval,Calling calc from Your Lisp Programs,calc,GNU
 Emacs Calc Manual}),
+@c FIXME:  The link to the calc manual in HTML does not work.
 variable substitution takes place according to the rules described above.
 @cindex vectors, in table calculations
 The range vectors can be directly fed into the calc vector functions
@@ -1518,7 +1615,7 @@
 $1+$2                @r{Sum of first and second field}
 $1+$2;%.2f           @r{Same, format result to two decimals}
 exp($2)+exp($1)      @r{Math functions can be used}
-$;%.1f               @r{Reformat current cell to 1 decimal}
+$0;%.1f              @r{Reformat current cell to 1 decimal}
 ($3-32)*5/9          @r{Degrees F -> C conversion}
 $c/$1/$cm            @r{Hz -> cm conversion, using @file{constants.el}}
 tan($1);Dp3s1        @r{Compute in degrees, precision 3, display SCI 1}
@@ -1528,21 +1625,28 @@
 taylor($3,x=7,2)     @r{taylor series of $3, at x=7, second degree}
 @end example
 
+Calc also contains a complete set of logical operations.  For example
+
+@example
+if($1<20,teen,string(""))  @r{``teen'' if age $1 less than 20, else empty}
+@end example
+
 @node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
 @subsection Emacs Lisp forms as formulas
 @cindex Lisp forms, as table formulas
 
 It is also possible to write a formula in Emacs Lisp; this can be useful
-for string manipulation and control structures.  If a formula starts
-with a single quote followed by an opening parenthesis, then it is
-evaluated as a lisp form.  The evaluation should return either a string
-or a number.  Just as with @file{calc} formulas, you can specify modes
-and a printf format after a semicolon.  A reference will be replaced
-with a string (in double quotes) containing the field.  If you provide
-the @samp{N} mode switch, all referenced elements will be numbers.
-Ranges are inserted as space-separated fields, so you can embed them in
-list or vector syntax.  A few examples, note how the @samp{N} mode is
-used when we do computations in lisp.
+for string manipulation and control structures, if the Calc's
+functionality is not enough.  If a formula starts with a single quote
+followed by an opening parenthesis, then it is evaluated as a lisp form.
+The evaluation should return either a string or a number.  Just as with
+@file{calc} formulas, you can specify modes and a printf format after a
+semicolon.  A reference will be replaced with a string (in double
+quotes) containing the field.  If you provide the @samp{N} mode switch,
+all referenced elements will be numbers.  Ranges are inserted as
+space-separated fields, so you can embed them in list or vector syntax.
+A few examples, note how the @samp{N} mode is used when we do
+computations in lisp.
 
 @example
 @r{Swap the first two characters of the content of column 1}
@@ -1567,12 +1671,11 @@
 Formulas are stored in a special line starting with @samp{#+TBLFM:}
 directly below the table.  If you typed the equation in the 4th field of
 the 3rd data line in the table, the formula will look like
-@samp{@@3$2=$1+$2}.  When inserting/deleting/swapping column and rows
+@samp{@@3$4=$1+$2}.  When inserting/deleting/swapping column and rows
 with the appropriate commands, @i{absolute references} (but not relative
-ones) in stored formulas are modified in order to
-still reference the same field.  Of cause this is not true if you edit
-the table structure with normal editing commands - then you must go and
-fix equations yourself.
+ones) in stored formulas are modified in order to still reference the
+same field.  Of cause this is not true if you edit the table structure
+with normal editing commands - then you must fix the equations yourself.
 
 Instead of typing an equation into the field, you may also use the
 following command
@@ -1593,7 +1696,9 @@
 Often in a table, the same formula should be used for all fields in a
 particular column.  Instead of having to copy the formula to all fields
 in that column, org-mode allows to assign a single formula to an entire
-column.
+column.  If the table contains horizontal separator hlines, everything
+before the first such line is considered part of the table @emph{header}
+and will not be modified by column formulas.
 
 To assign a formula to a column, type it directly into any field in the
 column, preceded by an equal sign, like @samp{=$1+$2}.  When you press
@@ -1626,7 +1731,11 @@
 
 You can edit individual formulas in the minibuffer or directly in the
 field.  Org-mode can also prepare a special buffer with all active
-formulas of a table.
+formulas of a table.  When offering a formula for editing, Org-mode
+converts references to the standard format (like @code{B3} or @code{D&})
+if possible.  If you prefer to only work with the internal format (like
+@code{@@3$2} or @code{$4}), configure the variable
+@code{org-table-use-standard-references}.
 
 @table @kbd
 @kindex C-c =
@@ -1645,21 +1754,36 @@
 @item C-c ?
 While editing a formula in a table field, highlight the field(s)
 referenced by the reference at the cursor position in the formula.
+@kindex C-c @}
+@item C-c @}
+Toggle the display of row and column numbers for a table, using
+overlays.  These are updated each time the table is aligned, you can
+force it with @kbd{C-c C-c}.
+@kindex C-c @{
+@item C-c @{
+Toggle the formula debugger on and off.  See below.
 @kindex C-c '
 @item C-c '
 Edit all formulas for the current table in a special buffer, where the
-formulas will be displayed one per line. 
+formulas will be displayed one per line.  If the current field has an
+active formula, the cursor in the formula editor will mark it.
 While inside the special buffer, Org-mode will automatically highlight
 any field or range reference at the cursor position.  You may edit,
 remove and add formulas, and use the following commands:
 @table @kbd
 @kindex C-c C-c
+@kindex C-x C-s
 @item C-c C-c
-Exit the buffer and store the modified formulas.  With @kbd{C-u} prefix,
-also apply the new formulas to the entire table.
+@itemx C-x C-s
+Exit the formula editor and store the modified formulas.  With @kbd{C-u}
+prefix, also apply the new formulas to the entire table.
 @kindex C-c C-q
 @item C-c C-q
-Exit the buffer without installing changes.
+Exit the formula editor without installing changes.
+@kindex C-c C-r
+@item C-c C-r
+Toggle all references in the formula editor between standard (like
+@code{B3}) and internal (like @code{@@3$2}).
 @kindex @key{TAB}
 @item @key{TAB}
 Pretty-print or indent lisp formula at point.  When in a line containing
@@ -1671,23 +1795,25 @@
 Complete Lisp symbols, just like in Emacs-lisp-mode.
 @kindex S-@key{up}
 @kindex S-@key{down}
-@item S-@key{up}/@key{down}
-Move the reference line in the Org-mode buffer up and down.  This is
-important for highlighting the references of column formulas for
-different rows.
+@kindex S-@key{left}
+@kindex S-@key{right}
+@item S-@key{up}/@key{down}/@key{left}/@key{right}
+Shift the reference at point.  For example, if the reference is
+@code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
+This also works for relative references, and for hline references.
+@kindex M-S-@key{up}
+@kindex M-S-@key{down}
+@item M-S-@key{up}/@key{down}
+Move the test line for column formulas in the Org-mode buffer up and
+down.
 @kindex M-@key{up}
 @kindex M-@key{down}
 @item M-@key{up}/@key{down}
 Scroll the window displaying the table.
-@end table
 @kindex C-c @}
 @item C-c @}
-Toggle the display of row and column numbers for a table, using
-overlays.  These are uptated each time the table is aligned, you can
-force it with @kbd{C-c C-c}.
-@kindex C-c @{
-@item C-c @{
-Toggle the formula debugger on and off.  See below.
+Turn the coordinate grid in the table on and off.
+@end table
 @end table
 
 Making a table field blank does not remove the formula associated with
@@ -1708,8 +1834,8 @@
 becomes the string @samp{#ERROR}.  If you would like see what is going
 on during variable substitution and calculation in order to find a bug,
 turn on formula debugging in the @code{Tbl} menu and repeat the
-calculation, for example by pressing @kbd{C-c = @key{RET}} in a field.
-Detailed information will be displayed.
+calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
+field.  Detailed information will be displayed.
 
 @node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
 @subsection Updating the Table
@@ -1728,14 +1854,14 @@
 @item C-c *
 Recalculate the current row by first applying the stored column formulas
 from left to right, and all field formulas in the current row.
-
+@c
 @kindex C-u C-c *
 @item C-u C-c *
 @kindex C-u C-c C-c
 @itemx C-u C-c C-c
 Recompute the entire table, line by line.  Any lines before the first
 hline are left alone, assuming that these are part of the table header.
-
+@c
 @kindex C-u C-u C-c *
 @item C-u C-u C-c *
 Iterate the table by recomputing it until no further changes occur.
@@ -1743,7 +1869,6 @@
 fields that are computed @i{later} in the calculation sequence.
 @end table
 
-
 @node Advanced features,  , Updating the table, The spreadsheet
 @subsection Advanced features
 
@@ -2058,7 +2183,7 @@
 enough, you can write custom functions to select the search string and
 to do the search for particular file types - see @ref{Custom searches}.
 The key binding @kbd{C-c l} is only a suggestion - see @ref{Installation}.
-
+@c
 @kindex C-c C-l
 @cindex link completion
 @cindex completion, of links
@@ -2068,24 +2193,26 @@
 You can just type a link, using text for an internal link, or one of the
 link type prefixes mentioned in the examples above.  All links stored
 during the current session are part of the history for this prompt, so
-you can access them with @key{up} and @key{down}, or with
-completion@footnote{After insertion of a stored link, the link will be
-removed from the list of stored links.  To keep it in the list later
+you can access them with @key{up} and @key{down}.  Completion, on the
+other hand, will help you to insert valid link prefixes like
+@samp{http:} or @samp{ftp:}, including the prefixes defined through link
+abbreviations (@pxref{Link abbreviations}).  The link will be inserted
+into the buffer@footnote{After insertion of a stored link, the link will
+be removed from the list of stored links.  To keep it in the list later
 use, use a triple @kbd{C-u} prefix to @kbd{C-c C-l}, or configure the
-option @code{org-keep-stored-link-after-insertion}.}.  The link will be
-inserted into the buffer, along with a descriptive text.  If some text
-was selected when this command is called, the selected text becomes the
-default description.@* Note that you don't have to use this command to
-insert a link.  Links in Org-mode are plain text, and you can type or
-paste them straight into the buffer.  By using this command, the links
-are automatically enclosed in double brackets, and you will be asked for
-the optional descriptive text.
-
+option @code{org-keep-stored-link-after-insertion}.}, along with a
+descriptive text.  If some text was selected when this command is
+called, the selected text becomes the default description.@* Note that
+you don't have to use this command to insert a link.  Links in Org-mode
+are plain text, and you can type or paste them straight into the buffer.
+By using this command, the links are automatically enclosed in double
+brackets, and you will be asked for the optional descriptive text.
+@c
 @c  If the link is a @samp{file:} link and
 @c the linked file is located in the same directory as the current file or
 @c a subdirectory of it, the path of the file will be inserted relative to
 @c the current directory.
-
+@c
 @kindex C-u C-c C-l
 @cindex file name completion
 @cindex completion, of file names
@@ -2098,11 +2225,11 @@
 to the current directory using @samp{../}.  Otherwise an absolute path
 is used, if possible with @samp{~/} for your home directory.  You can
 force an absolute path with two @kbd{C-u} prefixes.
-
-@item C-c C-l @r{with cursor on existing link}
+@c
+@item C-c C-l @r{(with cursor on existing link)}
 When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
 link and description parts of the link.
-
+@c
 @cindex following links
 @kindex C-c C-o
 @item C-c C-o
@@ -2118,26 +2245,26 @@
 is based on file extension only.  See option @code{org-file-apps}.  If
 you want to override the default application and visit the file with
 Emacs, use a @kbd{C-u} prefix.
-
+@c
 @kindex mouse-2
 @kindex mouse-1
 @item mouse-2
 @itemx mouse-1
 On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
 would.  Under Emacs 22, also @kbd{mouse-1} will follow a link.
-
+@c
 @kindex mouse-3
 @item mouse-3
 Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
 internal links to be displayed in another window@footnote{See the
 variable @code{org-display-internal-link-with-indirect-buffer}}.
-
+@c
 @cindex mark ring
 @kindex C-c %
 @item C-c %
 Push the current position onto the mark ring, to be able to return
 easily. Commands following an internal link do this automatically.
-
+@c
 @cindex links, returning to
 @kindex C-c &
 @item C-c &
@@ -2145,7 +2272,7 @@
 commands following internal links, and by @kbd{C-c %}.  Using this
 command several times in direct succession moves through a ring of
 previously recorded positions.
-
+@c
 @kindex C-c C-x C-n
 @kindex C-c C-x C-p
 @cindex links, finding next/previous
@@ -2341,8 +2468,8 @@
 @noindent In these entries, the character specifies how to select the
 template.  The first string specifies the template.  Two more (optional)
 strings give the file in which, and the headline under which the new
-note should be stored.  The file defaults to
-@code{org-default-notes-file}, the heading to
+note should be stored.  The file defaults (if not present or @code{nil})
+to @code{org-default-notes-file}, the heading to
 @code{org-remember-default-headline}.  Both defaults help to get to the
 storing location quickly, but you can change the location interactively
 while storing the note.
@@ -2398,8 +2525,7 @@
 @end example
 
 @noindent
-If you would like to have the cursor in a specific position after the
-template has been expanded:
+To place the cursor after template expansion use:
 
 @example
 %?          @r{After completing the template, position cursor here.}
@@ -2408,7 +2534,7 @@
 @noindent
 If you change you mind about which template to use, call
 @code{org-remember} in the remember buffer.  You may then select a new
-template that will be filled with the previoous context information.
+template that will be filled with the previous context information.
 
 @node Storing notes,  , Remember templates, Remember
 @subsection Storing notes
@@ -2419,20 +2545,27 @@
 template is used.  Then the command offers the headings tree of the
 selected file, with the cursor position at the default headline (if you
 had specified one in the template).  You can either immediately press
-@key{RET} to get the note placed there.  Or you can use vertical cursor
-motion (@key{up} and @key{down}) and visibility cycling (@key{TAB}) to
-find a better place.  Pressing @key{RET} or @key{left} or @key{right}
+@key{RET} to get the note placed there.  Or you can use the following
+keys to find a better location:
+@example
+@key{TAB}         @r{Cycle visibility.}
+@key{down} / @key{up}   @r{Next/previous visible headline.}
+n / p        @r{Next/previous visible headline.}
+f / b        @r{Next/previous headline same level.}
+u            @r{One level up.}
+@c 0-9          @r{Digit argument.}
+@end example
+@noindent
+Pressing @key{RET} or @key{left} or @key{right}
 then leads to the following result.
 
-@multitable @columnfractions 0.2 0.1 0.7
+@multitable @columnfractions 0.2 0.15 0.65
 @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
 @item buffer-start @tab @key{RET} @tab as level 2 heading at end of file
 @item on headline @tab @key{RET} @tab as sublevel of the heading at cursor
-@item             @tab @key{left}  @tab as same level, before current heading
-@item             @tab @key{right} @tab as same level, after current heading
+@item             @tab @key{left}/@key{right} @tab as same level, before/after current heading
 @item not on headline @tab @key{RET}
       @tab at cursor position, level taken from context.
-           Or use prefix arg to specify level manually.
 @end multitable
 
 So a fast way to store the note to its default location is to press
@@ -2467,7 +2600,7 @@
 * TODO basics::                 Marking and displaying TODO entries
 * TODO extensions::             Workflow and assignments
 * Priorities::                  Some things are more important than others
-* Breaking down tasks::         Splitting a task into managable pieces
+* Breaking down tasks::         Splitting a task into manageable pieces
 * Checkboxes::                  Tick-off lists
 @end menu
 
@@ -2488,7 +2621,7 @@
 @kindex C-c C-t
 @cindex cycling, of TODO states
 @item C-c C-t
-Rotate the TODO state of the current item between
+Rotate the TODO state of the current item among
 
 @example
 ,-> (unmarked) -> TODO -> DONE --.
@@ -2508,9 +2641,11 @@
 @item C-c C-v
 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds
 the entire buffer, but shows all TODO items and the headings hierarchy
-above them.  With prefix arg, show also the DONE entries.  With
-numerical prefix N, show the tree for the Nth keyword in the variable
-@code{org-todo-keywords}.
+above them.  With prefix arg, search for a specific TODO.  You will be
+prompted for the keyword, and you can also give a list of keywords like
+@code{kwd1|kwd2|...}.  With numerical prefix N, show the tree for the
+Nth keyword in the variable @code{org-todo-keywords}.  With two prefix
+args, find all TODO and DONE entries.
 @kindex C-c a t
 @item C-c a t
 Show the global TODO list.  This collects the TODO items from all
@@ -2523,16 +2658,14 @@
 @c agenda, customize the variable @code{org-agenda-include-all-todo}.
 @end table
 
-
 @node TODO extensions, Priorities, TODO basics, TODO items
 @section Extended use of TODO keywords
 @cindex extended TODO keywords
 
 The default implementation of TODO entries is just two states: TODO and
-DONE.  You can, however, use the TODO feature for more complicated
-things by configuring the variables @code{org-todo-keywords} and
-@code{org-todo-interpretation}.  Using special setup, you can even use
-TODO keywords in different ways in different org files.
+DONE.  You can use the TODO feature for more complicated things by
+configuring the variable @code{org-todo-keywords}.  With special setup,
+the TODO keyword system can work differently in different files.
 
 Note that @i{tags} are another way to classify headlines in general and
 TODO items in particular (@pxref{Tags}).
@@ -2540,6 +2673,7 @@
 @menu
 * Workflow states::             From TODO to DONE in steps
 * TODO types::                  I do this, Fred the rest
+* Multiple sets in one file::   Mixing it all, and still finding your way
 * Per file keywords::           Different files, different requirements
 @end menu
 
@@ -2548,103 +2682,149 @@
 @cindex TODO workflow
 @cindex workflow states as TODO keywords
 
-You can use TODO keywords to indicate different states in the process
-of working on an item, for example:
+You can use TODO keywords to indicate different @emph{sequential} states
+in the process of working on an item, for example@footnote{Changing
+this variable only becomes effective after restarting Org-mode in a
+buffer.}:
 
 @lisp
-(setq org-todo-keywords '("TODO" "FEEDBACK" "VERIFY" "DONE")
-      org-todo-interpretation 'sequence)
+(setq org-todo-keywords
+  '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
 @end lisp
 
+The vertical bar separates the TODO keywords (states that @emph{need
+action}) from the DONE states (which need @emph{no further action}.  If
+you don't provide the separator bar, the last state is used as the DONE
+state.
 @cindex completion, of TODO keywords
-Changing these variables only becomes effective in a new Emacs session.
-With this setup, the command @kbd{C-c C-t} will cycle an entry from
-TODO to FEEDBACK, then to VERIFY, and finally to DONE.  You may also
-use a prefix argument to quickly select a specific state.  For example
-@kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
+With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
+to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED.  You may
+also use a prefix argument to quickly select a specific state.  For
+example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
 If you define many keywords, you can use in-buffer completion (see
-@ref{Completion}) to insert these words into the buffer.  Changing a todo
-state can be logged with a timestamp, see @ref{Tracking TODO state
+@ref{Completion}) to insert these words into the buffer.  Changing a
+todo state can be logged with a timestamp, see @ref{Tracking TODO state
 changes} for more information.
 
-@node TODO types, Per file keywords, Workflow states, TODO extensions
+@node TODO types, Multiple sets in one file, Workflow states, TODO extensions
 @subsection TODO keywords as types
 @cindex TODO types
 @cindex names as TODO keywords
 @cindex types as TODO keywords
 
 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
-@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
-action items directly to persons, by using their names as TODO
-keywords.  This would be set up like this:
+@emph{types} of action items.  For example, you might want to indicate
+that items are for ``work'' or ``home''.  Or, when you work with several
+people on a single project, you might want to assign action items
+directly to persons, by using their names as TODO keywords.  This would
+be set up like this:
+
+@lisp
+(setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
+@end lisp
+
+In this case, different keywords do not indicate a sequence, but rather
+different types.  So the normal work flow would be to assign a task to a
+person, and later to mark it DONE.  Org-mode supports this style by
+adapting the workings of the command @kbd{C-c C-t}@footnote{This is also
+true for the @kbd{t} command in the timeline and agenda buffers.}.  When
+used several times in succession, it will still cycle through all names,
+in order to first select the right type for a task.  But when you return
+to the item after some time and execute @kbd{C-c C-t} again, it will
+switch from any name directly to DONE.  Use prefix arguments or
+completion to quickly select a specific name.  You can also review the
+items of a specific TODO type in a sparse tree by using a numeric prefix
+to @kbd{C-c C-v}.  For example, to see all things Lucy has to do, you
+would use @kbd{C-3 C-c C-v}.  To collect Lucy's items from all agenda
+files into a single buffer, you would use the prefix arg as well when
+creating the global todo list: @kbd{C-3 C-c t}.
+
+@node Multiple sets in one file, Per file keywords, TODO types, TODO extensions
+@subsection Multiple keyword sets in one file
+@cindex todo keyword sets
+
+Sometimes you may want to use different sets of TODO keywords in
+parallel.  For example, you may want to have the basic
+@code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
+separate state indicating that an item has been canceled (so it is not
+DONE, but also does not require action).  Your setup would then look
+like this:
 
 @lisp
-(setq org-todo-keywords '("Fred" "Sara" "Lucy" "Mike" "DONE")
-      org-todo-interpretation 'type)
+(setq org-todo-keywords
+      '((sequence "TODO" "|" "DONE")
+        (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
+        (sequence "|" "CANCELED")))
 @end lisp
 
-In this case, different keywords do not indicate a sequence, but
-rather different types.  So it is normally not useful to change from
-one type to another.  Therefore, in this case the behavior of the
-command @kbd{C-c C-t} is changed slightly@footnote{This is also true
-for the @kbd{t} command in the timeline and agenda buffers.}.  When
-used several times in succession, it will still cycle through all
-names.  But when you return to the item after some time and execute
-@kbd{C-c C-t} again, it will switch from each name directly to DONE.
-Use prefix arguments or completion to quickly select a specific name.
-You can also review the items of a specific TODO type in a sparse tree
-by using a numeric prefix to @kbd{C-c C-v}.  For example, to see all
-things Lucy has to do, you would use @kbd{C-3 C-c C-v}.  To collect
-Lucy's items from all agenda files into a single buffer, you
-would use the prefix arg as well when creating the global todo list:
-@kbd{C-3 C-c t}.
-
-@node Per file keywords,  , TODO types, TODO extensions
-@subsection Setting up TODO keywords for individual files
+The keywords should all be different, this helps Org-mode to keep track
+of which subsequence should be used for a given entry.  In this setup,
+@kbd{C-c C-t} only operates within a subsequence, so it switches from
+@code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
+(nothing) to @code{REPORT}.  Therefore you need a mechanism to initially
+select the correct sequence.  Besides the obvious ways like typing a
+keyword or using completion, you may also apply the following commands:
+
+@table @kbd
+@kindex C-S-@key{right}
+@kindex C-S-@key{left}
+@item C-S-@key{right}
+@itemx C-S-@key{left}
+These keys jump from one TODO subset to the next.  In the above example,
+@kbd{C-S-@key{right}} would jump from @code{TODO} or @code{DONE} to
+@code{REPORT}, and any of the words in the second row to @code{CANCELED}.
+@kindex S-@key{right}
+@kindex S-@key{left}
+@item S-@key{right}
+@itemx S-@key{left}
+@kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through
+@emph{all} keywords from all sets, so for example @kbd{S-@key{<right>}}
+would switch from @code{DONE} to @code{REPORT} in the example above.
+@end table
+
+@node Per file keywords,  , Multiple sets in one file, TODO extensions
+@subsection Setting up keywords for individual files
 @cindex keyword options
 @cindex per file keywords
 
-It can be very useful to use different aspects of the TODO mechanism
-in different files, which is not possible with the global settings
-described above.  For file-local settings, you need to add special
-lines to the file which set the keywords and interpretation for that
-file only.  For example, to set one of the two examples discussed
-above, you need one of the following lines, starting in column zero
-anywhere in the file:
+It can be very useful to use different aspects of the TODO mechanism in
+different files.  For file-local settings, you need to add special lines
+to the file which set the keywords and interpretation for that file
+only.  For example, to set one of the two examples discussed above, you
+need one of the following lines, starting in column zero anywhere in the
+file:
 
 @example
-#+SEQ_TODO: TODO FEEDBACK VERIFY DONE
-#+TYP_TODO: Fred Sara Lucy Mike DONE
+#+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED
+@end example
+or
+@example
+#+TYP_TODO: Fred Sara Lucy Mike | DONE
 @end example
 
+A setup for using several sets in parallel would be:
+
+@example
+#+SEQ_TODO: "TODO" "|" "DONE"
+#+SEQ_TODO: "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED"
+#+SEQ_TODO: "|" "CANCELED"
+@end example
+
+
 @cindex completion, of option keywords
 @kindex M-@key{TAB}
 @noindent To make sure you are using the correct keyword, type
 @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
 
 @cindex DONE, final TODO keyword
-Remember that the last keyword must always mean that the item is DONE
-(although you may use a different word).  Also note that in each file,
-only one of the two aspects of TODO keywords can be used.  After
-changing one of these lines, use @kbd{C-c C-c} with the cursor still
-in the line to make the changes known to Org-mode@footnote{Org-mode
-parses these lines only when Org-mode is activated after visiting a
-file.  @kbd{C-c C-c} with the cursor in a line starting with @samp{#+}
-is simply restarting Org-mode for the current buffer.}.
-
-If you want to use very many keywords, for example when working with a
-large group of people, you may split the names over several lines:
-
-@example
-#+TYP_TODO: Fred Sara Lucy Mike
-#+TYP_TODO: Luis George Jules Jessica
-#+TYP_TODO: Kim Arnold Peter
-#+TYP_TODO: DONE
-@end example
+Remember that the keywords after the vertical bar (or the last keyword
+if no bar is there) must always mean that the item is DONE (although you
+may use a different word).  After changing one of these lines, use
+@kbd{C-c C-c} with the cursor still in the line to make the changes
+known to Org-mode@footnote{Org-mode parses these lines only when
+Org-mode is activated after visiting a file.  @kbd{C-c C-c} with the
+cursor in a line starting with @samp{#+} is simply restarting Org-mode
+for the current buffer.}.
 
 @node Priorities, Breaking down tasks, TODO extensions, TODO items
 @section Priorities
@@ -2673,7 +2853,7 @@
 @key{SPC} instead, the priority cookie is removed from the headline.
 The priorities can also be changed ``remotely'' from the timeline and
 agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
-
+@c
 @kindex S-@key{up}
 @kindex S-@key{down}
 @item S-@key{up}
@@ -2683,11 +2863,22 @@
 Furthermore, these keys are also used by CUA-mode (@pxref{Conflicts}).
 @end table
 
+You can change the range of allowed priorities by setting the variables
+@code{org-highest-priority}, @code{org-lowest-priority}, and
+@code{org-default-priority}.  For an individual buffer, you may set
+these values (highest, lowest, default) like this (please make sure that
+the highest priority is earlier in the alphabet than the lowest
+priority):
+
+@example
+#+PRIORITIES: A C B
+@end example
+
 @node Breaking down tasks, Checkboxes, Priorities, TODO items
 @section Breaking tasks down into subtasks
 @cindex tasks, breaking down
 
-It is often advisable to break down large tasks into smaller, managable
+It is often advisable to break down large tasks into smaller, manageable
 subtasks.  You can do this by creating an outline tree below a TODO
 item, with detailed subtasks on the tree@footnote{To keep subtasks out
 of the global TODO list, see the
@@ -2780,8 +2971,7 @@
 @menu
 * Time stamps::                 Assigning a time to a tree entry
 * Creating timestamps::         Commands which insert timestamps
-* Custom time format::          If you cannot work with the ISO format
-* Repeating items::             Deadlines that come back again and again
+* Deadlines and scheduling::    Planning your work
 * Progress logging::            Documenting when what work was done.
 @end menu
 
@@ -2799,7 +2989,7 @@
 09:39>}@footnote{This is the standard ISO date/time format.  If you
 cannot get used to these, see @ref{Custom time format}}.  A time stamp
 can appear anywhere in the headline or body of an org-tree entry.  Its
-presence allows entries to be shown on specific dates in the agenda
+presence causes entries to be shown on specific dates in the agenda
 (@pxref{Weekly/Daily agenda}).  We distinguish:
 
 @table @var
@@ -2815,6 +3005,39 @@
 * Meet Peter at the movies <2006-11-01 Wed 19:15>
 @end example
 
+@item Time stamp with repeater interval
+@cindex timestamp, with repeater interval
+A time stamp may contain a @emph{repeater interval}, indicating that it
+applies not only on the given date, but again and again after a certain
+interval of N days (d), weeks (w), months(m), or years(y).  The
+following will show up in the agenda every Wednesday:
+
+@example
+* Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
+@end example
+
+@item Diary-style sexp entries
+For more complex date specifications, Org-mode supports using the
+special sexp diary entries implemented in the Emacs calendar/diary
+package.  For example
+
+@example
+* The nerd meeting on every 2nd Thursday of the month
+  <%%(diary-float t 4 2)>
+@end example
+
+@item Time/Date range
+@cindex timerange
+@cindex date range
+Two time stamps connected by @samp{--} denote a range.  The headline
+will be shown on the first and last day of the range, and on any dates
+that are displayed and fall in the range.  Here is an example:
+
+@example
+** Meeting in Amsterdam
+   <2004-08-23 Mon>--<2004-08-26 Thu>
+@end example
+
 @item Inactive time stamp
 @cindex timestamp, inactive
 @cindex inactive timestamp
@@ -2826,65 +3049,9 @@
 * Gillian comes late for the fifth time [2006-11-01 Wed]
 @end example
 
-@item Time stamp range
-@cindex timerange
-Two time stamps connected by @samp{--} denote a time range.  The
-headline will be shown on the first and last day of the range, and on
-any dates that are displayed and fall in the range.  Here is an
-example:
-
-@example
-** Meeting in Amsterdam
-   <2004-08-23 Mon>--<2004-08-26 Thu>
-@end example
-
-@item Time stamp with SCHEDULED keyword
-@cindex SCHEDULED keyword
-If a time stamp is preceded by the word @samp{SCHEDULED:}, it means you
-are planning to start working on that task on the given date. So this is
-not about recording an event, but about planning your work.  The
-headline will be listed under the given date@footnote{It will still be
-listed on that date after it has been marked DONE.  If you don't like
-this, set the variable @code{org-agenda-skip-scheduled-if-done}.}.  In
-addition, a reminder that the scheduled date has passed will be present
-in the compilation for @emph{today}, until the entry is marked DONE.
-I.e., the task will automatically be forwarded until completed.
-
-@example
-*** TODO Call Trillian for a date on New Years Eve.
-    SCHEDULED: <2004-12-25 Sat>
-@end example
-
-@item Time stamp with DEADLINE keyword
-@cindex DEADLINE keyword
-If a time stamp is preceded by the word @samp{DEADLINE:}, the task
-(most likely a TODO item) is supposed to be finished on that date, and
-it will be listed then.  In addition, the compilation for @emph{today}
-will carry a warning about the approaching or missed deadline,
-starting @code{org-deadline-warning-days} before the due date, and
-continuing until the entry is marked DONE.  An example:
-
-@example
-*** TODO write article about the Earth for the Guide
-    The editor in charge is [[bbdb:Ford Prefect]]
-    DEADLINE: <2004-02-29 Sun>
-@end example
-@item Time stamp with CLOSED keyword
-@cindex CLOSED keyword
-When @code{org-log-done} is non-nil, Org-mode will automatically insert
-a special time stamp each time a TODO entry is marked done
-(@pxref{Progress logging}).  This time stamp is enclosed in square
-brackets instead of angular brackets.
-
-@item Time range with CLOCK keyword
-@cindex CLOCK keyword
-When using the clock to time the work that is being done on specific
-items, time ranges preceded by the CLOCK keyword are inserted
-automatically into the file.  The time stamps are enclosed in square
-brackets instead of angular brackets.  @xref{Clocking work time}.
 @end table
 
-@node Creating timestamps, Custom time format, Time stamps, Timestamps
+@node Creating timestamps, Deadlines and scheduling, Time stamps, Timestamps
 @section Creating timestamps
 @cindex creating timestamps
 @cindex timestamps, creating
@@ -2899,61 +3066,40 @@
 Prompt for a date and insert a corresponding time stamp.  When the
 cursor is at a previously used time stamp, it is updated to NOW.  When
 this command is used twice in succession, a time range is inserted.
-
+@c
 @kindex C-u C-c .
 @item C-u C-c .
 Like @kbd{C-c .}, but use the alternative format which contains date
 and time.  The default time can be rounded to multiples of 5 minutes,
 see the option @code{org-time-stamp-rounding-minutes}.
-
+@c
 @kindex C-c !
 @item C-c !
-Like @kbd{C-c .}, but insert an inactive time stamp not triggering the
-agenda.
-
+Like @kbd{C-c .}, but insert an inactive time stamp that will not cause
+an agenda entry.
+@c
 @kindex C-c <
 @item C-c <
 Insert a time stamp corresponding to the cursor date in the Calendar.
-
+@c
 @kindex C-c >
 @item C-c >
 Access the Emacs calendar for the current date.  If there is a
 timestamp in the current line, goto the corresponding date
 instead.
-
+@c
 @kindex C-c C-o
 @item C-c C-o
 Access the agenda for the date given by the time stamp or -range at
 point (@pxref{Weekly/Daily agenda}).
-
-@kindex C-c C-d
-@item C-c C-d
-Insert @samp{DEADLINE} keyword along with a stamp.  The insertion will
-happen in the line directly following the headline.  
-@c FIXME Any CLOSED timestamp will be removed.????????
-
-@kindex C-c C-w
-@cindex sparse tree, for deadlines
-@item C-c C-w
-Create a sparse tree with all deadlines that are either past-due, or
-which will become due within @code{org-deadline-warning-days}.
-With @kbd{C-u} prefix, show all deadlines in the file.  With a numeric
-prefix, check that many days.  For example, @kbd{C-1 C-c C-w} shows
-all deadlines due tomorrow.
-
-@kindex C-c C-s
-@item C-c C-s
-Insert @samp{SCHEDULED} keyword along with a stamp.  The insertion will
-happen in the line directly following the headline.  Any CLOSED
-timestamp will be removed.
-
+@c
 @kindex S-@key{left}
 @kindex S-@key{right}
 @item S-@key{left}
 @itemx S-@key{right}
 Change date at cursor by one day.  These key bindings conflict with
 CUA-mode (@pxref{Conflicts}).
-
+@c
 @kindex S-@key{up}
 @kindex S-@key{down}
 @item S-@key{up}
@@ -2963,8 +3109,7 @@
 headline and not at a time stamp, these same keys modify the priority of
 an item.  (@pxref{Priorities}). The key bindings also conflict with
 CUA-mode (@pxref{Conflicts}).
-
-
+@c
 @kindex C-c C-y
 @cindex evaluate time range
 @item C-c C-y
@@ -2976,9 +3121,10 @@
 
 @menu
 * The date/time prompt::        How org-mode helps you entering date and time
+* Custom time format::          Making dates look differently
 @end menu
 
-@node The date/time prompt,  , Creating timestamps, Creating timestamps
+@node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
 @subsection The date/time prompt
 @cindex date, reading in minibuffer
 @cindex time, reading in minibuffer
@@ -3047,8 +3193,8 @@
 Choose date in calendar (only if nothing was typed into minibuffer).
 @end table
 
-@node Custom time format, Repeating items, Creating timestamps, Timestamps
-@section Custom time format
+@node Custom time format,  , The date/time prompt, Creating timestamps
+@subsection Custom time format
 @cindex custom date/time format
 @cindex time format, custom
 @cindex date format, custom
@@ -3090,48 +3236,119 @@
 format is shorter, things do work as expected.
 @end itemize
 
-@node Repeating items, Progress logging, Custom time format, Timestamps
-@section Repeating items
-@cindex TODO items, repeating
-@cindex deadlines, repeating
-@cindex scheduling, repeating
-
-Org-mode integrates with the Emacs calendar and diary to display cyclic
-appointments, anniversaries and other special entries in the agenda
-(@pxref{Weekly/Daily agenda}).  However, it can be useful to have
-certain deadlines and scheduling items to auto-repeat.  The advantage of
-a deadline or scheduled item is that the they produce warnings ahead of
-time and automatically forward themselves in the agenda until they are
-done.  The abstract difference is therefore between cyclic
-@i{appointments} and cyclic @i{action items}.  For appointments you
-should use the diary, for actions you can uses an org-mode deadline or
-scheduling time stamp together with a REPEAT cookie.  For example:
+
+@node Deadlines and scheduling, Progress logging, Creating timestamps, Timestamps
+@section Deadlines and Scheduling
+
+A time stamp may be preceded by special keywords to facilitate planning
+of work:
+
+@table @var
+@item DEADLINE
+@cindex DEADLINE keyword
+The task (most likely a TODO item) is supposed to be finished on that
+date, and it will be listed then.  In addition, the compilation for
+@emph{today} will carry a warning about the approaching or missed
+deadline, starting @code{org-deadline-warning-days} before the due date,
+and continuing until the entry is marked DONE.  An example:
+
+@example
+*** TODO write article about the Earth for the Guide
+    The editor in charge is [[bbdb:Ford Prefect]]
+    DEADLINE: <2004-02-29 Sun>
+@end example
+
+@item SCHEDULED
+@cindex SCHEDULED keyword
+You are planning to start working on that task on the given date. The
+headline will be listed under the given date@footnote{It will still be
+listed on that date after it has been marked DONE.  If you don't like
+this, set the variable @code{org-agenda-skip-scheduled-if-done}.}.  In
+addition, a reminder that the scheduled date has passed will be present
+in the compilation for @emph{today}, until the entry is marked DONE.
+I.e., the task will automatically be forwarded until completed.
 
 @example
-* TODO Replace batteries in smoke detector REPEAT(+18m)
-  SCHEDULED: <2007-01-01 Mon>
-
-* TODO Get dentist appointment REPEAT(+6m)
-  SCHEDULED: <2006-12-19 Tue>
-
-* TODO Tax report to IRS REPEAT(+1y)
-  DEADLINE: <2007-04-01 Sun>
+*** TODO Call Trillian for a date on New Years Eve.
+    SCHEDULED: <2004-12-25 Sat>
 @end example
-
-Each time you try to mark one of these entries DONE using @kbd{C-c C-t},
-they will automatically switch back to the state TODO, and the
-deadline/scheduling will be shifted accordingly.  The time units
-recognized by org-mode are year (y), month (m), week (w), and day (d).
-Org-mode will also prompt you for a note and record the fact that you
-have closed this item in a note under the headline.
-
-One unusual property of these repeating items is that only one instance
-of each exist at any given time.  So if you look back or ahead in the
-agenda, you will not find past and future instances, only the current
-one will show up.  Use a cyclic diary entry if you need all past and
-future instances to be visible in the agenda.
-
-@node Progress logging,  , Repeating items, Timestamps
+@end table
+
+@menu
+* Inserting deadline/schedule::  
+* Repeated tasks::              
+@end menu
+
+@node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
+@subsection Inserting deadline/schedule
+
+The following commands allow to quickly insert a deadline or to schedule
+an item:
+
+@table @kbd
+@c
+@kindex C-c C-d
+@item C-c C-d
+Insert @samp{DEADLINE} keyword along with a stamp.  The insertion will
+happen in the line directly following the headline.
+@c FIXME Any CLOSED timestamp will be removed.????????
+@c
+@kindex C-c C-w
+@cindex sparse tree, for deadlines
+@item C-c C-w
+Create a sparse tree with all deadlines that are either past-due, or
+which will become due within @code{org-deadline-warning-days}.
+With @kbd{C-u} prefix, show all deadlines in the file.  With a numeric
+prefix, check that many days.  For example, @kbd{C-1 C-c C-w} shows
+all deadlines due tomorrow.
+@c
+@kindex C-c C-s
+@item C-c C-s
+Insert @samp{SCHEDULED} keyword along with a stamp.  The insertion will
+happen in the line directly following the headline.  Any CLOSED
+timestamp will be removed.
+@end table
+
+@node Repeated tasks,  , Inserting deadline/schedule, Deadlines and scheduling
+@subsection Repeated Tasks
+
+Some tasks need to be repeated again and again, and Org-mode therefore
+allows to use a repeater in a DEADLINE or SCHEDULED time stamp, for
+example:
+@example
+** TODO Pay the rent
+   DEADLINE: <2005-10-01 Sat +1m>
+@end example
+
+Deadlines and scheduled items produce entries in the agenda when they
+are over-due, so it is important to be able to mark such an entry as
+completed once you have done so.  When you mark a DEADLINE or a SCHEDULE
+with the todo keyword DONE, it will no longer produce entries in the
+agenda. The problem with this is, however, that then also the
+@emph{next} instance of the repeated entry will not be active.  Org-mode
+deals with this in the following way: When you try to mark such an entry
+DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
+time stamp by the repeater interval, and immediately set the entry state
+back to TODO.  In the example above, setting the state to DONE would
+actually switch the date like this:
+
+@example
+** TODO Pay the rent
+   DEADLINE: <2005-11-01 Tue +1m>
+@end example
+
+You will also be prompted for a note that will be put under the DEADLINE
+line to keep a record that you actually acted on the previous instance
+of this deadline.
+
+As a consequence of shifting the base date, this entry will no longer be
+visible in the agenda when checking past dates, but all future instances
+will be visible.
+
+You may have both scheduling and deadline information for a specific
+task - just make sure that the repeater intervals on both are the same.
+
+@node Progress logging,  , Deadlines and scheduling, Timestamps
 @section Progress Logging
 @cindex progress logging
 @cindex logging, of progress
@@ -3199,6 +3416,7 @@
 #+STARTUP: lognotestate
 @end example
 
+
 @node Clocking work time,  , Tracking TODO state changes, Progress logging
 @subsection Clocking work time
 
@@ -3743,6 +3961,23 @@
 calendars, respectively.  @kbd{c} can be used to switch back and forth
 between calendar and agenda.
 
+If you are using the diary only for sexp entries and holidays, it is
+faster to not use the above setting, but instead to copy or even move
+the entries into an Org-mode file. Org-mode evaluates diary-style sexp
+entries, and does it faster because there is no overhead for first
+creating the diary display.  Note that the sexp entries must start at
+the left margin, no white space is allowed before them.  For example,
+the following segment of an Org-mode file will be processed and entries
+will be made in the agenda:
+
+@example
+* Birthdays and similar stuff
+#+CATEGORY: Holiday
+%%(org-calendar-holiday)   ; special function for holiday names
+#+CATEGORY: Ann
+%%(diary-anniversary 14  5 1956) Artur Dent %d is years old
+%%(diary-anniversary  2 10 1869) Mahatma Gandhi would be %d years old
+@end example
 
 @node Global TODO list, Matching headline tags, Weekly/Daily agenda, Built-in agenda views
 @subsection The global TODO list
@@ -3762,10 +3997,12 @@
 @kindex C-c a T
 @item C-c a T
 @cindex TODO keyword matching
-Like the above, but allows selection of a specific TODO keyword.  You can
-also do this by specifying a prefix argument to @kbd{C-c a t}.  With a
-@kbd{C-u} prefix you are prompted for a keyword.  With a numeric
-prefix, the Nth keyword in @code{org-todo-keywords} is selected.
+Like the above, but allows selection of a specific TODO keyword.  You
+can also do this by specifying a prefix argument to @kbd{C-c a t}.  With
+a @kbd{C-u} prefix you are prompted for a keyword, and you may also
+specify several keywords by separating them with @samp{|} as boolean OR
+operator.  With a numeric prefix, the Nth keyword in
+@code{org-todo-keywords} is selected.
 @kindex r
 The @kbd{r} key in the agenda buffer regenerates it, and you can give
 a prefix argument to this command to change the selected TODO keyword,
@@ -3875,16 +4112,18 @@
 projects with a tag PROJECT, and that you use a todo keyword MAYBE to
 indicate a project that should not be considered yet.  Lets further
 assume that the todo keyword DONE marks finished projects, and that NEXT
-and TODO indicate next actions.  Finally, the tag @@SHOP indicates
-shopping and is a next action even without the NEXT tag.  In this case
-you would start by identifying eligible projects with a tags/todo match
-@samp{+PROJECT/-MAYBE-DONE}, and then check for TODO, NEXT and @@SHOP in
-the subtree to identify projects that are not stuck.  The correct
-customization for this is
+and TODO indicate next actions.  The tag @@SHOP indicates shopping and
+is a next action even without the NEXT tag.  Finally, if the project
+contains the special word IGNORE anywhere, it should not be listed
+either.  In this case you would start by identifying eligible projects
+with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for
+TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that
+are not stuck.  The correct customization for this is
 
 @lisp
 (setq org-stuck-projects
-      ("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")))
+      '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
+                               "\\<IGNORE\\>"))
 @end lisp
 
 
@@ -4031,11 +4270,11 @@
 @item mouse-3
 @itemx @key{SPC}
 Display the original location of the item in another window.
-
+@c
 @kindex L
 @item L
 Display original location and recenter that window.
-
+@c
 @kindex mouse-2
 @kindex mouse-1
 @kindex @key{TAB}
@@ -4044,11 +4283,11 @@
 @itemx @key{TAB}
 Go to the original location of the item in another window.  Under Emacs
 22, @kbd{mouse-1} will also works for this.
-
+@c
 @kindex @key{RET}
 @itemx @key{RET}
 Go to the original location of the item and delete other windows.
-
+@c
 @kindex f
 @item f
 Toggle Follow mode.  In Follow mode, as you move the cursor through
@@ -4056,14 +4295,14 @@
 location in the org file.  The initial setting for this mode in new
 agenda buffers can be set with the variable
 @code{org-agenda-start-with-follow-mode}.
-
+@c
 @kindex b
 @item b
 Display the entire subtree of the current item in an indirect buffer.
 With numerical prefix ARG, go up to this level and then take that tree.
 If ARG is negative, go up that many levels.  With @kbd{C-u} prefix, do
 not remove the previously used indirect buffer.
-
+@c
 @kindex l
 @item l
 Toggle Logbook mode.  In Logbook mode, entries that where marked DONE while
@@ -4075,24 +4314,24 @@
 @kindex o
 @item o
 Delete other windows.
-
+@c
 @kindex w
 @item w
 Switch to weekly view (7 days displayed together).
-
+@c
 @kindex d
 @item d
 Switch to daily view (just one day displayed).
-
+@c
 @kindex D
 @item D
 Toggle the inclusion of diary entries.  See @ref{Weekly/Daily agenda}.
-
+@c
 @kindex g
 @item g
 Toggle the time grid on and off.  See also the variables
 @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
-
+@c
 @kindex r
 @item r
 Recreate the agenda buffer, for example to reflect the changes
@@ -4100,21 +4339,21 @@
 S-@key{right}.  When the buffer is the global todo list, a prefix
 argument is interpreted to create a selective list for a specific TODO
 keyword.
-
+@c
 @kindex s
 @item s
 Save all Org-mode buffers in the current Emacs session.
-
+@c
 @kindex @key{right}
 @item @key{right}
 Display the following @code{org-agenda-ndays} days.  For example, if
 the display covers a week, switch to the following week.  With prefix
 arg, go forward that many times @code{org-agenda-ndays} days.
-
+@c
 @kindex @key{left}
 @item @key{left}
 Display the previous dates.
-
+@c
 @kindex .
 @item .
 Goto today.
@@ -4124,53 +4363,53 @@
 
 @item 0-9
 Digit argument.
-
+@c
 @cindex undoing remote-editing events
 @cindex remote editing, undo
 @kindex C-_
 @item C-_
 Undo a change due to a remote editing command.  The change is undone
 both in the agenda buffer and in the remote buffer.
-
+@c
 @kindex t
 @item t
 Change the TODO state of the item, both in the agenda and in the
 original org file.
-
+@c
 @kindex C-k
 @item C-k
 Delete the current agenda item along with the entire subtree belonging
 to it in the original Org-mode file.  If the text to be deleted remotely
 is longer than one line, the kill needs to be confirmed by the user.  See
 variable @code{org-agenda-confirm-kill}.
-
+@c
 @kindex $
 @item $
 Archive the subtree corresponding to the current headline.
-
+@c
 @kindex T
 @item T
 Show all tags associated with the current item.  Because of
 inheritance, this may be more than the tags listed in the line itself.
-
+@c
 @kindex :
 @item :
 Set tags for the current headline.
-
+@c
 @kindex a
 @item a
 Toggle the ARCHIVE tag for the current headline.
-
+@c
 @kindex ,
 @item ,
 Set the priority for the current item.  Org-mode prompts for the
 priority character. If you reply with @key{SPC}, the priority cookie
 is removed from the entry.
-
+@c
 @kindex P
 @item P
 Display weighted priority of current item.
-
+@c
 @kindex +
 @kindex S-@key{up}
 @item +
@@ -4178,21 +4417,21 @@
 Increase the priority of the current item.  The priority is changed in
 the original buffer, but the agenda is not resorted.  Use the @kbd{r}
 key for this.
-
+@c
 @kindex -
 @kindex S-@key{down}
 @item -
 @itemx S-@key{down}
 Decrease the priority of the current item.
-
+@c
 @kindex C-c C-s
 @item C-c C-s
 Schedule this item
-
+@c
 @kindex C-c C-d
 @item C-c C-d
 Set a deadline for this item.
-
+@c
 @kindex S-@key{right}
 @item S-@key{right}
 Change the time stamp associated with the current line by one day into
@@ -4201,25 +4440,27 @@
 stamp is changed in the original org file, but the change is not
 directly reflected in the agenda buffer.  Use the
 @kbd{r} key to update the buffer.
-
+@c
 @kindex S-@key{left}
 @item S-@key{left}
 Change the time stamp associated with the current line by one day
 into the past.
-
+@c
 @kindex >
 @item >
 Change the time stamp associated with the current line to today.
 The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
 on my keyboard.
-
+@c
 @kindex I
 @item I
 Start the clock on the current item.  If a clock is running already, it
 is stopped first.
+@c
 @kindex O
 @item O
 Stop the previously started clock.
+@c
 @kindex X
 @item X
 Cancel the currently running clock.
@@ -4229,11 +4470,11 @@
 @kindex c
 @item c
 Open the Emacs calendar and move to the date at the agenda cursor.
-
+@c
 @item c
 When in the calendar, compute and show the Org-mode agenda for the
 date at the cursor.
-
+@c
 @cindex diary entries, creating from agenda
 @kindex i
 @item i
@@ -4241,42 +4482,53 @@
 (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
 entry in the diary, just as @kbd{i d} etc. would do in the calendar.
 The date is taken from the cursor position.
-
+@c
 @kindex M
 @item M
 Show the phases of the moon for the three months around current date.
-
+@c
 @kindex S
 @item S
 Show sunrise and sunset times.  The geographical location must be set
 with calendar variables, see documentation of the Emacs calendar.
-
+@c
 @kindex C
 @item C
 Convert the date at cursor into many other cultural and historic
 calendars.
-
+@c
 @kindex H
 @item H
 Show holidays for three month around the cursor date.
-
+@c
 @c FIXME:  This should be a different key.
 @kindex C-c C-x C-c
 @item C-c C-x C-c
 Export a single iCalendar file containing entries from all agenda files.
 
+@tsubheading{Exporting to a file}
+@kindex C-x C-w
+@item C-x C-w
+@cindex exporting agenda views
+@cindex agenda views, exporting
+Write the agenda view to a file.  Depending on the extension of the
+selected file name, the view will be exported as HTML (extension
+@file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
+plain text (any other extension).  Use the variable
+@code{org-agenda-exporter-settings} to set options for @file{ps-print}
+and for @file{htmlize} to be used during export.
+
 @tsubheading{Quit and Exit}
 @kindex q
 @item q
 Quit agenda, remove the agenda buffer.
-
+@c
 @kindex x
 @cindex agenda files, removing buffers
 @item x
 Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
 for the compilation of the agenda.  Buffers created by the user to
 visit org files will not be removed.
-
 @end table
 
 
@@ -4294,7 +4546,8 @@
 * Storing searches::            Type once, use often
 * Block agenda::                All the stuff you need in a single buffer
 * Setting Options::             Changing the rules
-* Batch processing::            Agenda views from the command line
+* Exporting Agenda Views::      Writing agendas to files.
+* Extracting Agenda Information for other programs::  
 @end menu
 
 @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
@@ -4386,7 +4639,7 @@
 command @kbd{C-c a o} provides a similar view for office tasks.
 
 
-@node Setting Options, Batch processing, Block agenda, Custom agenda views
+@node Setting Options, Exporting Agenda Views, Block agenda, Custom agenda views
 @subsection Setting Options for custom commands
 @cindex options, for custom agenda views
 
@@ -4434,7 +4687,8 @@
       '(("h" "Agenda and Home-related tasks"
          ((agenda)
           (tags-todo "HOME")
-          (tags "GARDEN" ((org-agenda-sorting-strategy '(priority-up)))))
+          (tags "GARDEN"
+                ((org-agenda-sorting-strategy '(priority-up)))))
          ((org-agenda-sorting-strategy '(priority-down))))
         ("o" "Agenda and Office-related tasks"
          ((agenda)
@@ -4450,36 +4704,234 @@
 value is a string, you need to add the double quotes around the value
 yourself.
 
-@node Batch processing,  , Setting Options, Custom agenda views
-@subsection Creating agenda views in batch processing
-@cindex agenda, batch production
-
-If you want to print or otherwise reprocess agenda views, it can be
-useful to create an agenda from the command line.  This is the purpose
-of the function @code{org-batch-agenda}.  It takes as a parameter one of
-the strings that are the keys in @code{org-agenda-custom-commands}.  For
-example, to directly print the current TODO list, you could use
+
+@node Exporting Agenda Views, Extracting Agenda Information for other programs, Setting Options, Custom agenda views
+@subsection Exporting Agenda Views
+@cindex agenda views, exporting
+
+If you are away from your computer, it can be very useful to have a
+printed version of some agenda views to carry around.  Org-mode can
+export custom agenda views as plain text, HTML@footnote{You need to
+install Hrvoje Niksic' @file{htmlize.el}.} and postscript.  If you want
+to do this only occasionally, use the commend
+
+@table @kbd
+@kindex C-x C-w
+@item C-x C-w
+@cindex exporting agenda views
+@cindex agenda views, exporting
+Write the agenda view to a file.  Depending on the extension of the
+selected file name, the view will be exported as HTML (extension
+@file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
+plain text (any other extension).  Use the variable
+@code{org-agenda-exporter-settings} to set options for @file{ps-print}
+and for @file{htmlize} to be used during export, for example
+@lisp
+(setq org-agenda-exporter-settings
+      '((ps-number-of-columns 2)
+        (ps-landscape-mode t)
+        (htmlize-output-type 'css)))
+@end lisp
+@end table
+
+If you need to export certain agenda views frequently, you can associate
+any custom agenda command with a list of output file names
+@footnote{If you want to store standard views like the weekly agenda
+or the global TODO list as well, you need to define custom commands for
+them in order to be able to specify filenames.}.  Here is an example
+that first does define custom commands for the agenda and the global
+todo list, together with a number of files to which to export them.
+Then we define two block agenda commands and specify filenames for them
+as well.  File names can be relative to the current working directory,
+or absolute.
+
+@lisp
+@group
+(setq org-agenda-custom-commands
+      '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
+        ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
+        ("h" "Agenda and Home-related tasks"
+         ((agenda)
+          (tags-todo "HOME")
+          (tags "GARDEN"))
+         nil
+         ("~/views/home.html"))
+        ("o" "Agenda and Office-related tasks"
+         ((agenda)
+          (tags-todo "WORK")
+          (tags "OFFICE"))
+         nil
+         ("~/views/office.ps"))))
+@end group
+@end lisp
+
+The extension of the file name determines the type of export.  If it is
+@file{.html}, Org-mode will use the @file{htmlize.el} package to convert
+the buffer to HTML and save it to this file name.  If the extension is
+@file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
+postscript output.  Any other extension produces a plain ASCII file.
+
+The export files are @emph{not} created when you use one of those
+commands interactively.  Instead, there is a special command to produce
+@emph{all} specified files in one step:
+
+@table @kbd
+@kindex C-c a e
+@item C-c a e
+Export all agenda views that have export filenames associated with
+them.
+@end table
+
+You can use the options section of the custom agenda commands to also
+set options for the export commands.  For example:
+
+@lisp
+(setq org-agenda-custom-commands
+      '(("X" agenda ""
+         ((ps-number-of-columns 2)
+          (ps-landscape-mode t)
+          (org-agenda-prefix-format " [ ] ")
+          (org-agenda-with-colors nil)
+          (org-agenda-remove-tags t))
+         ("theagenda.ps"))))
+@end lisp
+
+@noindent
+This command sets two options for the postscript exporter, to make it
+print in two columns in landscape format - the resulting page can be cut
+in two and then used in a paper agenda.  The remaining settings modify
+the agenda prefix to omit category and scheduling information, and
+instead include a checkbox to check off items.  We also remove the tags
+to make the lines compact, and we don't want to use colors for the
+black-and-white printer.  Settings specified in
+@code{org-agenda-exporter-settings} will also apply, but the settings
+in @code{org-agenda-custom-commands} take precedence.
+
+@noindent
+From the command line you may also use
+@example
+emacs -f org-batch-store-agenda-views -kill
+@end example
+@noindent
+or, if you need to modify some parameters
+@example
+emacs -eval '(org-batch-store-agenda-views                      \
+              org-agenda-ndays 30                               \
+              org-agenda-include-diary nil                      \
+              org-agenda-files (quote ("~/org/project.org")))'  \
+      -kill
+@end example
+@noindent
+which will create the agenda views restricted to the file
+@file{~/org/project.org}, without diary entries and with 30 days
+extent. 
+
+@node Extracting Agenda Information for other programs,  , Exporting Agenda Views, Custom agenda views
+@subsection Extracting Agenda Information for other programs
+@cindex agenda, pipe
+@cindex Scripts, for agenda processing
+
+Org-mode provides commands to access agenda information for the command
+line in emacs batch mode.  This extracted information can be sent
+directly to a printer, or it can be read by a program that does further
+processing of the data.  The first of these commands is the function
+@code{org-batch-agenda}, that produces an agenda view and sends it as
+ASCII text to STDOUT.  The command takes a single string as parameter.
+If the string has length 1, it is used as a key to one of the commands
+you have configured in @code{org-agenda-custom-commands}, basically any
+key you can use after @kbd{C-c a}.  For example, to directly print the
+current TODO list, you could use
 
 @example
 emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
 @end example
 
+If the parameter is a string with 2 or more characters, it is used as a
+tags/todo match string.  For example, to print your local shopping list
+(all items with the tag @samp{shop}, but excluding the tag
+@samp{NewYork}), you could use
+
+@example
+emacs -batch -l ~/.emacs                                      \       
+      -eval '(org-batch-agenda "+shop-NewYork")' | lpr
+@end example
+
 @noindent
 You may also modify parameters on the fly like this:
 
 @example
 emacs -batch -l ~/.emacs                                      \
    -eval '(org-batch-agenda "a"                               \
-            org-agenda-ndays 300                              \
+            org-agenda-ndays 30                               \
             org-agenda-include-diary nil                      \
             org-agenda-files (quote ("~/org/project.org")))'  \
    | lpr
 @end example
 
 @noindent
-which will produce a 300 day agenda, fully restricted to the Org file
+which will produce a 30 day agenda, fully restricted to the Org file
 @file{~/org/projects.org}, not even including the diary.
 
+If you want to process the agenda data in more sophisticated ways, you
+can use the command @code{org-batch-agenda-csv} to get a comma-separated
+list of values for each agenda item.  Each line in the output will
+contain a number of fields separated by commas.  The fields in a line
+are:
+
+@example
+category     @r{The category of the item}
+head         @r{The headline, without TODO kwd, TAGS and PRIORITY}
+type         @r{The type of the agenda entry, can be}
+                todo               @r{selected in TODO match}
+                tagsmatch          @r{selected in tags match}
+                diary              @r{imported from diary}
+                deadline           @r{a deadline}
+                scheduled          @r{scheduled}
+                timestamp          @r{appointment, selected by timestamp}
+                closed             @r{entry was closed on date}
+                upcoming-deadline  @r{warning about nearing deadline}
+                past-scheduled     @r{forwarded scheduled item}
+                block              @r{entry has date block including date}
+todo         @r{The todo keyword, if any}
+tags         @r{All tags including inherited ones, separated by colons}
+date         @r{The relevant date, like 2007-2-14}
+time         @r{The time, like 15:00-16:50}
+extra        @r{String with extra planning info}
+priority-l   @r{The priority letter if any was given}
+priority-n   @r{The computed numerical priority}
+@end example
+
+@noindent
+Time and date will only be given if a timestamp (or deadline/scheduled)
+lead to the selection of the item.
+
+A CSV list like this is very easy to use in a post processing script.
+For example, here is a Perl program that gets the TODO list from
+Emacs/org-mode and prints all the items, preceded by a checkbox:
+
+@example
+@group
+#!/usr/bin/perl
+
+# define the Emacs command to run
+$cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
+
+# run it and capture the output
+$agenda = qx@{$cmd 2>/dev/null@};
+
+# loop over all lines
+foreach $line (split(/\n/,$agenda)) @{
+
+  # get the individual values
+  ($category,$head,$type,$todo,$tags,$date,$time,$extra,
+   $priority_l,$priority_n) = split(/,/,$line);
+
+  # proccess and print
+  print "[ ] $head\n";
+@}
+@end group
+@end example
+
 @node Embedded LaTeX, Exporting, Agenda views, Top
 @chapter Embedded LaTeX
 @cindex @TeX{} interpretation
@@ -4566,7 +5018,9 @@
 all fragments will be converted to images and inlined into the HTML
 document.  For this to work you need to be on a system with a working
 La@TeX{} installation.  You also need the @file{dvipng} program,
-available at @url{http://sourceforge.net/projects/dvipng/}.
+available at @url{http://sourceforge.net/projects/dvipng/}.  The LaTeX
+header that will be used when processing a fragment can be configured
+with the variable @code{org-format-latex-header}.
 
 La@TeX{} fragments don't need any special marking at all.  The following
 snippets will be identified as LaTeX source code:
@@ -4773,7 +5227,7 @@
 language, but with additional support for tables.
 
 @menu
-* Export commands::             How to invode HTML export
+* Export commands::             How to invoke HTML export
 * Quoting HTML tags::           Using direct HTML in Org-mode
 * Links::                       How hyperlinks get transferred to HTML
 * Images::                      To inline or not to inline?
@@ -4793,11 +5247,27 @@
 @kindex C-c C-e b
 @item C-c C-e b
 Export as HTML file and open it with a browser.
+@kindex C-c C-e H
+@item C-c C-e H
+Export to a temporary buffer, do not create a file.
+@kindex C-c C-e R
+@item C-c C-e H
+Export the active region to a temporary buffer.  With prefix arg, do not
+produce file header and foot, but just the plain HTML section for the
+region.  This is good for cut-and-paste operations.
 @kindex C-c C-e v h
 @kindex C-c C-e v b
+@kindex C-c C-e v H
+@kindex C-c C-e v R
 @item C-c C-e v h
 @item C-c C-e v b
+@item C-c C-e v H
+@item C-c C-e v R
 Export only the visible part of the document.
+@item M-x org-export-region-as-html
+Convert the region to HTML under the assumption that it was org-mode
+syntax before.  This is a global command that can be invoked in any
+buffer.
 @end table
 
 @cindex headline levels, for exporting
@@ -4975,19 +5445,20 @@
 
 @menu
 * Comment lines::               Some lines will not be exported
+* Initial text::                Text before the first headline
+* Footnotes::                   Numbers like [1]
 * Enhancing text::              Subscripts, symbols and more
 * Export options::              How to influence the export settings
 @end menu
 
-@node Comment lines, Enhancing text, Text interpretation, Text interpretation
+@node Comment lines, Initial text, Text interpretation, Text interpretation
 @subsection Comment lines
 @cindex comment lines
 @cindex exporting, not
 
 Lines starting with @samp{#} in column zero are treated as comments
 and will never be exported.  Also entire subtrees starting with the
-word @samp{COMMENT} will never be exported.  Finally, any text before
-the first headline will not be exported either.
+word @samp{COMMENT} will never be exported.
 
 @table @kbd
 @kindex C-c ;
@@ -4995,7 +5466,70 @@
 Toggle the COMMENT keyword at the beginning of an entry.
 @end table
 
-@node Enhancing text, Export options, Comment lines, Text interpretation
+@node Initial text, Footnotes, Comment lines, Text interpretation
+@subsection Text before the first headline
+
+Org-mode normally ignores any text before the first headline when
+exporting, leaving this region for internal links to speed up navigation
+etc.  However, in publishing-oriented files, you might want to have some
+text before the first headline, like a small introduction, special HTML
+code with a navigation bar, etc.  You can ask to have this part of the
+file exported as well by setting the variable
+@code{org-export-skip-text-before-1st-heading} to @code{nil}.  On a
+per-file basis, you can get the same effect with
+
+@example
+#+OPTIONS: skip:nil
+@end example
+
+The text before the first headline will be fully processed
+(@pxref{Enhancing text}), and the first non-comment line becomes the
+title of the exported document.  If you need to include literal HTML,
+use the special constructs described in @ref{Quoting HTML tags}.  The
+table of contents is normally inserted directly before the first
+headline of the file.  If you would like to get it to a different
+location, insert the string @code{[TABLE-OF-CONTENTS]} on a line by
+itself at the desired location.
+
+Finally, if you want to use the space before the first headline for
+internal purposes, but @emph{still} want to place something before the
+first headline when exporting the file, you can use the @code{#+TEXT}
+construct:
+
+@example
+#+OPTIONS: skip:t
+#+TEXT: This text will go before the *first* headline.
+#+TEXT: We place the table of contents here:
+#+TEXT: [TABLE-OF-CONTENTS]
+#+TEXT: This goes between the table of contents and the first headline
+@end example
+
+@node Footnotes, Enhancing text, Initial text, Text interpretation
+@subsection Footnotes
+@cindex footnotes
+@cindex @file{footnote.el}
+
+Numbers in square brackets are treated as footnotes, so that you can use
+the Emacs package @file{footnote.el} to create footnotes.  For example:
+
+@example
+The org-mode homepage[1] clearly needs help from
+a good web designer.
+
+[1] The link is: http://www.astro.uva.nl/~dominik/Tools/org
+@end example
+
+@noindent
+@kindex C-c !
+Note that the @file{footnote} package uses @kbd{C-c !} to invoke its
+commands.  This binding conflicts with the org-mode command for
+inserting inactive time stamps.  You could use the variable
+@code{footnote-prefix} to switch footnotes commands to another key.  Or,
+if you are too used to this binding, you could use
+@code{org-replace-disputed-keys} and @code{org-disputed-keys} to change
+the settings in Org-mode.
+
+@node Enhancing text, Export options, Footnotes, Text interpretation
 @subsection Enhancing text for export
 @cindex enhancing text
 @cindex richer text
@@ -5019,7 +5553,9 @@
 @cindex italic text
 @item
 You can make words @b{*bold*}, @i{/italic/}, _underlined_,
-@code{=code=}, and @samp{+strikethrough+}.
+@code{=code=}, and even @samp{+strikethrough+}@footnote{but remember
+that strikethrough is typographically evil and should @i{never} be
+used.}.
 
 @cindex horizontal rules, in exported files
 @item
@@ -5057,7 +5593,7 @@
 @end itemize
 
 If these conversions conflict with your habits of typing ASCII text,
-they can all be turned off with corresponding variables (see the
+they can all be turned off with corresponding variables.  See the
 customization group @code{org-export-general}, and the following section
 which explains how to set export options with special lines in a
 buffer.
@@ -5088,7 +5624,7 @@
 #+LANGUAGE:  language for HTML, e.g. @samp{en} (@code{org-export-default-language})
 #+TEXT:      Some descriptive text to be inserted at the beginning.
 #+TEXT:      Several lines may be given.
-#+OPTIONS:   H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t *:nil TeX:t LaTeX:t
+#+OPTIONS:   H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t *:nil TeX:t LaTeX:t skip:t
 @end example
 
 @noindent
@@ -5113,10 +5649,13 @@
 @@:      @r{turn on/off quoted HTML tags}
 ::      @r{turn on/off fixed-width sections}
 |:      @r{turn on/off tables}
-^:      @r{turn on/off @TeX{}-like syntax for sub- and superscripts.}
+^:      @r{turn on/off @TeX{}-like syntax for sub- and superscripts.  If}
+        @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
+        @r{the simple @code{a_b} will be left as it is.}
 *:      @r{turn on/off emphasized text (bold, italic, underlined)}
 TeX:    @r{turn on/off simple @TeX{} macros in plain text}
 LaTeX:  @r{turn on/off La@TeX{} fragments}
+skip:   @r{turn on/off skipping the text before the first heading}
 @end example
 
 @node Publishing, Miscellaneous, Exporting, Top
@@ -5444,13 +5983,13 @@
 following functions: 
 
 @table @kbd
-@item C-c C-e c
+@item C-c C-e C
 Prompt for a specific project and publish all files that belong to it.
-@item C-c C-e p
+@item C-c C-e P
 Publish the project containing the current file.
-@item C-c C-e f
+@item C-c C-e F
 Publish only the current file.
-@item C-c C-e a
+@item C-c C-e A
 Publish all projects.
 @end table
 
@@ -5584,11 +6123,15 @@
 @cindex @code{lognotedone}, STARTUP keyword
 @cindex @code{lognoteclock-out}, STARTUP keyword
 @cindex @code{lognotestate}, STARTUP keyword
+@cindex @code{logrepeat}, STARTUP keyword
+@cindex @code{nologrepeat}, STARTUP keyword
 @example
 logging          @r{record a timestamp when an item is marked DONE}
 nologging        @r{don't record when items are marked DONE}
 lognotedone      @r{record timestamp and a note when DONE}
 lognotestate     @r{record timestamp, note when TODO state changes}
+logrepeat        @r{record a not when re-instating a repeating item}
+nologrepeat      @r{do not record when re-instating repeating item}
 lognoteclock-out @r{record timestamp and a note when clocking out}
 @end example
 Here are the options for hiding leading stars in outline headings.  The
@@ -5612,6 +6155,14 @@
 @example
 customtime @r{overlay custom time format}
 @end example
+The following options influence the table spreadsheet (variable
+@code{constants-unit-system}).
+@cindex @code{constcgs}, STARTUP keyword
+@cindex @code{constSI}, STARTUP keyword
+@example
+constcgs   @r{@file{constants.el} should use the c-g-s unit system}
+constSI    @r{@file{constants.el} should use the SI unit system}
+@end example
 @item #+SEQ_TODO:   #+TYP_TODO:
 These lines set the TODO keywords and their interpretation in the
 current file.  The corresponding variables are @code{org-todo-keywords}
@@ -5633,6 +6184,10 @@
 all subsequent lines until the next @samp{#+CATEGORY} line, or the end
 of the file.  The first such line also applies to any entries before it.
 The corresponding variable is @code{org-archive-location}.
+@item #+PRIORITIES: highest lowest default
+This line sets the limits and the default for the priorities.  All three
+must be either letters A-Z or numbers 0-9.  The highest priority must
+have a lower ASCII number that the lowest priority.
 @item #+TBLFM:
 This line contains the formulas for the table directly above the line.
 @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS:
@@ -5816,10 +6371,12 @@
 @item @kbd{S-@key{RET}}     @tab @kbd{C-c C-x c}           @tab
 @item @kbd{M-@key{RET}}     @tab @kbd{C-c C-x m}           @tab @kbd{@key{Esc} @key{RET}}
 @item @kbd{M-S-@key{RET}}   @tab @kbd{C-c C-x M}           @tab
-@item @kbd{S-@key{left}}    @tab @kbd{C-c C-x @key{left}}  @tab
-@item @kbd{S-@key{right}}   @tab @kbd{C-c C-x @key{right}} @tab
-@item @kbd{S-@key{up}}      @tab @kbd{C-c C-x @key{up}}    @tab
-@item @kbd{S-@key{down}}    @tab @kbd{C-c C-x @key{down}}  @tab
+@item @kbd{S-@key{left}}    @tab @kbd{C-c @key{left}}      @tab
+@item @kbd{S-@key{right}}   @tab @kbd{C-c @key{right}}     @tab
+@item @kbd{S-@key{up}}      @tab @kbd{C-c @key{up}}        @tab
+@item @kbd{S-@key{down}}    @tab @kbd{C-c @key{down}}      @tab
+@item @kbd{C-S-@key{left}}  @tab @kbd{C-c C-x @key{left}}  @tab
+@item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
 @end multitable
 
 @node Interaction, Bugs, TTY keys, Miscellaneous
@@ -5887,7 +6444,7 @@
 @item C-c C-c
 Recognize @file{table.el} table.  Works when the cursor is in a
 table.el table.
-
+@c
 @kindex C-c ~
 @item C-c ~
 Insert a table.el table.  If there is already a table at point, this
@@ -5897,6 +6454,10 @@
 possible.
 @end table
 @file{table.el} is part of Emacs 22.
+@cindex @file{footnote.el}
+@item @file{footnote.el} by Steven L. Baur
+Org-mode recognizes numerical footnotes as provided by this package
+(@pxref{Footnotes}).
 @end table
 
 @node Conflicts,  , Cooperation, Interaction
@@ -5927,7 +6488,6 @@
 @example
 S-UP    -> M-p             S-DOWN  -> M-n
 S-LEFT  -> M--             S-RIGHT -> M-+
-S-RET   -> C-S-RET
 @end example
 
 Yes, these are unfortunately more difficult to remember.  If you want
@@ -5937,6 +6497,16 @@
 @cindex @file{windmove.el}
 Also this package uses the @kbd{S-<cursor>} keys, so everything written
 in the paragraph above about CUA mode also applies here.
+
+@cindex @file{footnote.el}
+@item @file{footnote.el} by Steven L. Baur
+Org-mode supports the syntax of the footnote package, but only the
+numerical footnote markers.  Also, the default key for footnote
+commands, @kbd{C-c !} is already used by org-mode.  You could use the
+variable @code{footnote-prefix} to switch footnotes commands to another
+key.  Or, you could use @code{org-replace-disputed-keys} and
+@code{org-disputed-keys} to change the settings in Org-mode.
+
 @end table
 
 
@@ -6417,7 +6987,7 @@
 @end lisp
 
 
-@node History and Acknowledgments, GNU Free Documentation License, Extensions and Hacking, Top
+@node History and Acknowledgments, Index, Extensions and Hacking, Top
 @appendix History and Acknowledgments
 @cindex acknowledgments
 @cindex history
@@ -6478,6 +7048,9 @@
 @i{Christian Egli} converted the documentation into TeXInfo format,
 patched CSS formatting into the HTML exporter, and inspired the agenda.
 @item
+@i{David Emery} provided a patch for custom CSS support in exported
+HTML agendas.
+@item
 @i{Nic Ferrier} contributed mailcap and XOXO support.
 @item
 @i{John Foerch} figured out how to make incremental search show context
@@ -6490,13 +7063,19 @@
 @item
 @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
 @item
-@i{Shidai Liu} (``Leo'') provided extensive feedback and some patches.
+@i{Shidai Liu} ("Leo") asked for embedded LaTeX and tested it.  He also
+provided frequent feedback and some patches.
 @item
-@i{Leon Liu} asked for embedded LaTeX and tested it.
+@i{Jason F. McBrayer} suggested agenda export to CSV format.
+@item
+@i{Dmitri Minaev} sent a patch to set priority limits on a per-file
+basis.
 @item
 @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
 happy.
 @item
+@i{Rick Moynihan} proposed to allow multiple TODO sequences in a file.
+@item
 @i{Todd Neal} provided patches for links to Info files and elisp forms.
 @item
 @i{Tim O'Callaghan} suggested in-file links, search options for general
@@ -6568,12 +7147,8 @@
 and contributed various ideas and code snippets.
 @end itemize
 
-@node GNU Free Documentation License, Index, History and Acknowledgments, Top
-@appendix GNU Free Documentation License
-@include doclicense.texi
-
-
-@node Index, Key Index, GNU Free Documentation License, Top
+
+@node Index, Key Index, History and Acknowledgments, Top
 @unnumbered Index
 
 @printindex cp
--- a/msdos/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/msdos/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,7 @@
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
 2007-02-10  Glenn Morris  <rgm@gnu.org>
 
 	* COPYING.DJ: Remove file since it is no longer needed (see README
--- a/nt/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/nt/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,7 @@
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
 2007-05-22  Eli Zaretskii  <eliz@gnu.org>
 
 	* INSTALL: Add information about where to find GDB, and warn
--- a/oldXMenu/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/oldXMenu/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,12 @@
+2007-06-04  Ulrich Mueller  <ulm@gentoo.org>  (tiny change)
+
+	* ChgPane.c, ChgSel.c: Quiet --with-x-toolkit=no
+	compilation warnings: #include <config.h>.
+
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
 2007-05-30  Ulrich Mueller  <ulm@gentoo.org>  (tiny change)
 
 	* XMakeAssoc.c (XMakeAssoc): Use malloc rather than xmalloc.
--- a/oldXMenu/ChgPane.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/oldXMenu/ChgPane.c	Mon Jun 11 00:58:11 2007 +0000
@@ -13,6 +13,7 @@
  *
  */
 
+#include <config.h>
 #include "XMenuInt.h"
 
 int
--- a/oldXMenu/ChgSel.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/oldXMenu/ChgSel.c	Mon Jun 11 00:58:11 2007 +0000
@@ -13,6 +13,7 @@
  *
  */
 
+#include <config.h>
 #include "XMenuInt.h"
 
 int
--- a/src/ChangeLog	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/ChangeLog	Mon Jun 11 00:58:11 2007 +0000
@@ -1,3 +1,224 @@
+2007-06-10  Jason Rumney  <jasonr@gnu.org>
+
+	* w32fns.c (Fx_file_dialog): Take size from struct not pointer.
+
+2007-06-08  Juanma Barranquero	<lekktu@gmail.com>
+
+	* callint.c (Fcall_interactively):
+	* editfns.c (Fdelete_and_extract_region):
+	* fileio.c (Fread_file_name):
+	* fns.c (Fmapconcat):
+	* keyboard.c (cmd_error_internal):
+	* keymap.c (Fkey_description):
+	* lread.c (openp):
+	* minibuf.c (read_minibuf):
+	* search.c (wordify):
+	* sunfns.c (sel_read):
+	* xdisp.c (Fformat_mode_line, syms_of_xdisp):
+	* xfns.c (x_default_scroll_bar_color_parameter):
+	* xmenu.c (menu_help_callback):
+	* xselect.c (Fx_get_atom_name):
+	* xterm.c (x_term_init): Use empty_unibyte_string.
+
+2007-06-08  Dmitry Antipov  <dmitry.antipov@mail.ru>  (tiny change)
+
+	* alloc.c (init_strings): Initialize canonical empty strings.
+	(make_uninit_string, make_uninit_multibyte_string): Return appropriate
+	canonical empty string when the requested size is 0.
+
+	* emacs.c (empty_unibyte_string): Rename from empty_string.
+	(empty_multibyte_string): New canonical empty string.
+	(syms_of_emacs): Don't initialize empty_string.
+
+	* lisp.h (STRING_SET_UNIBYTE): Return the canonical empty unibyte
+	string, if appropriate.
+	(empty_unibyte_string, empty_multibyte_string): New externs.
+	(empty_string): Remove extern.
+
+	* lread.c (syms_of_lread): Use empty_unibyte_string.
+
+2007-06-07  Jason Rumney  <jasonr@gnu.org>
+
+	* s/ms-w32.h: Don't define HAVE_TZNAME.
+
+	* editfns.c (Fcurrent_time_zone): Remove hack for Japanese Windows.
+
+2007-06-07  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* mac.c (xrm_get_preference_database): Remove BLOCK_INPUT.
+
+	* macfns.c (mac_get_window_bounds): Move extern to macterm.h.
+	(compute_tip_xy) [TARGET_API_MAC_CARBON]: Use GetGlobalMouse.
+
+	* macmenu.c [TARGET_API_MAC_CARBON] (menu_target_item_handler):
+	Don't call next handler.
+	[TARGET_API_MAC_CARBON] (install_menu_target_item_handler):
+	Remove argument.  Install handler to application.
+	(set_frame_menubar): Don't change deep_p.
+	(mac_menu_show):  Use FRAME_OUTER_TO_INNER_DIFF_X and
+	FRAME_OUTER_TO_INNER_DIFF_Y.
+	(DIALOG_BUTTON_COMMAND_ID_OFFSET, DIALOG_BUTTON_COMMAND_ID_P)
+	(DIALOG_BUTTON_COMMAND_ID_VALUE, DIALOG_BUTTON_MAKE_COMMAND_ID)
+	[HAVE_DIALOGS]: New macros.
+	[HAVE_DIALOGS] (mac_handle_dialog_event, create_and_show_dialog):
+	Use them.
+	(fill_menubar) [TARGET_API_MAC_CARBON]: Use CFString.
+
+	* macselect.c [MAC_OSX] (install_service_handler): Rename from
+	init_service_handler.  All callers changed.  Return OSStatus value.
+
+	* macterm.c (mac_begin_cg_clip): New arg F.  Call SetPortWindowPort.
+	All callers changed so as not to call SetPortWindowPort.
+	(mac_begin_cg_clip) [USE_CG_DRAWING]: Call mac_prepare_for_quickdraw.
+	(mac_draw_image_string_atsui) [USE_ATSUI]: New function created from
+	mac_draw_string_common.
+	(mac_draw_image_string_qd): Likewise.
+	(mac_draw_string_common): Use them.  Add INLINE.
+	(XTmouse_position, x_scroll_bar_report_motion) [TARGET_API_MAC_CARBON]:
+	Use FRAME_OUTER_TO_INNER_DIFF_X, FRAME_OUTER_TO_INNER_DIFF_Y, and
+	GetGlobalMouse.
+	(x_set_mouse_pixel_position) [MAC_OSX]: Use FRAME_OUTER_TO_INNER_DIFF_X
+	and FRAME_OUTER_TO_INNER_DIFF_Y.
+	[TARGET_API_MAC_CARBON] (mac_handle_mouse_event): Likewise.
+	[USE_MAC_TSM] (mac_handle_text_input_event): Likewise.
+	(x_make_frame_visible) [TARGET_API_MAC_CARBON]: Move code for
+	repositioning window to mac_handle_window_event.
+	(x_make_frame_invisible) [TARGET_API_MAC_CARBON]: Move code for
+	saving window location to mac_handle_window_event
+	[USE_MAC_FONT_PANEL] (mac_show_hide_font_panel): Install handler here.
+	(install_menu_target_item_handler): Remove argument in extern.
+	[TARGET_API_MAC_CARBON] (mac_event_to_emacs_modifiers):
+	Also accept command events.
+	(do_keystroke): New function created from XTread_socket.
+	(init_command_handler): Remove functions.
+	[TARGET_API_MAC_CARBON] (mac_handle_window_event): Reposition window
+	and save window location by kEventWindowShowing and kEventWindowHiding
+	handlers here.  Don't call next handler for window state change and
+	focus events.
+	(mac_handle_application_event, mac_handle_keyboard_event)
+	[TARGET_API_MAC_CARBON]: New functions.
+	(install_window_handler) [TARGET_API_MAC_CARBON]: Register handlers for
+	kEventWindowShowing and kEventWindowHiding events.  Move installation
+	of mouse, font, text input and menu target item handlers to
+	install_application_handler.
+	(install_application_handler) [TARGET_API_MAC_CARBON]: New function.
+	(mac_handle_cg_display_reconfig) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]:
+	New function.
+	(init_dm_notification_handler) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]:
+	Register it.
+	(XTread_socket) [TARGET_API_MAC_CARBON]: Consolidate
+	SendEventToEventTarget calls.  Use FRAME_OUTER_TO_INNER_DIFF_X and
+	FRAME_OUTER_TO_INNER_DIFF_Y.  Move application activation handler
+	to mac_handle_application_event.  Move keyboard handler to
+	mac_handle_keyboard_event.
+	(XTread_socket) [!TARGET_API_MAC_CARBON]: Use do_keystroke.
+	(mac_initialize) [TARGET_API_MAC_CARBON]: Don't call
+	init_command_handler.  Call install_application_handler.
+
+	* macterm.h (mac_get_window_bounds): Move extern from macfns.c.
+	(FRAME_OUTER_TO_INNER_DIFF_X, FRAME_OUTER_TO_INNER_DIFF_Y): New macros.
+
+2007-06-07  Glenn Morris  <rgm@gnu.org>
+
+	* emacs.c (main): Use `emacs-copyright' in --version output.
+
+2007-06-06  Chong Yidong  <cyd@stupidchicken.com>
+
+	* image.c (xpm_load): Remove spurious call to
+	xpm_init_color_cache.
+
+2007-06-06  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macfns.c (mac_window): Replace WindowPtr with WindowRef.
+
+	* macgui.h: Replace WindowPtr with WindowRef.
+
+	* macmenu.c: Replace MenuHandle and GetMenuHandle with MenuRef and
+	GetMenuRef, respectively.  Replace WindowPtr with WindowRef.
+	Replace ControlHandle with ControlRef.
+	(install_menu_quit_handler): Rename arg MENU_HANDLE to ROOT_MENU.
+
+	* macterm.c: Replace MenuHandle and GetMenuHandle with MenuRef and
+	GetMenuRef, respectively.  Replace WindowPtr with WindowRef.
+	Replace ControlHandle with ControlRef.
+	(USE_CARBON_EVENTS): Remove.  Use TARGET_API_MAC_CARBON instead.
+	[MAC_OS8] (do_get_menus): Rename variable `menu_handle' to `menu'.
+
+	* macterm.h (struct scroll_bar): Rename member control_handle_low
+	and control_handle_high to control_ref_low and control_ref_high.
+	All uses changed.
+	(SCROLL_BAR_CONTROL_REF, SET_SCROLL_BAR_CONTROL_REF): Rename from
+	SCROLL_BAR_CONTROL_HANDLE and SET_SCROLL_BAR_CONTROL_HANDLE,
+	respectively.  All uses changed.
+	(XCreatePixmap, XCreatePixmapFromBitmapData, XSetWindowBackground)
+	(install_window_handler, remove_window_handler): Replace WindowPtr
+	with WindowRef in externs.
+
+2007-06-05  Juanma Barranquero  <lekktu@gmail.com>
+
+	* xfaces.c (Finternal_lisp_face_p): Signal error for face alias loops.
+
+2007-06-03  Nick Roberts  <nickrob@snap.net.nz>
+
+	* keyboard.c (discard_mouse_events): Add GPM_CLICK_EVENT case.
+
+	* frame.c (Fmouse_position, Fmouse_pixel_position):
+	Condition on HAVE_GPM too.
+
+	* term.c (term_mouse_highlight): Remove unused variables.
+	(Fterm_open_connection): Set gpm_zerobased to 1.
+	(term_mouse_movement, term_mouse_click, handle_one_term_event):
+	Use zero based co-ordinates.
+	(handle_one_term_event): Report a drag as mouse movement too.
+
+	* Makefile.in (MOUSE_SUPPORT): Define for HAVE_GPM.
+
+2007-06-03  Chong Yidong  <cyd@stupidchicken.com>
+
+	* image.c (search_image_cache): New function.  Require background
+	color match if background color is unspecified in the image spec.
+	(uncache_image, lookup_image): Use it.
+
+2007-06-01  Juanma Barranquero  <lekktu@gmail.com>
+
+	* window.c (Fshrink_window): Reflow docstring.
+
+2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
+
+	* Version 22.1 released.
+
+2007-06-01  Richard Stallman  <rms@gnu.org>
+
+	* xfns.c (x_encode_text): Add GCPRO.
+
+2007-06-01  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* xfns.c (x_set_name_internal): Save encoded name before
+	x_encode_text in case string data is relocated.
+
+2007-05-31  Richard Stallman  <rms@gnu.org>
+
+	* buffer.c (syms_of_buffer): Doc fix.
+
+2007-05-30  Nick Roberts  <nickrob@snap.net.nz>
+
+	* sysdep.c (init_sys_modes): Add rather than replace with
+	O_NONBLOCK.
+
+	* frame.c [HAVE_GPM] (Fset_mouse_pixel_position): Add call to
+	term_mouse_moveto.
+
+	* termhooks.h (term_mouse_moveto): New extern.
+
+	* term.c (mouse_face_window): Rename...
+	(Qmouse_face_window): ...to this.
+	(term_show_mouse_face, term_clear_mouse_face)
+	(term_mouse_highlight): Use Qmouse_face_window.
+	(term_mouse_moveto): New function.
+	(term_mouse_position): Make it work.
+	(syms_of_term): Uncomment assignment to mouse_position_hook.
+	Staticpro Qmouse_face_window.
+
 2007-05-28  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* xdisp.c (redisplay_internal): Bind inhibit-point-motion-hooks to t
@@ -6,14 +227,14 @@
 2007-05-26  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* xfaces.c (syms_of_xfaces): Delete stray semicolon.
-	* xdisp.c (next_element_from_buffer): 
-	* window.c (delete_window): 
-	* term.c (term_mouse_highlight): 
-	* msdos.c (getdefdir): 
+	* xdisp.c (next_element_from_buffer):
+	* window.c (delete_window):
+	* term.c (term_mouse_highlight):
+	* msdos.c (getdefdir):
 	* macterm.c (mac_create_bitmap_from_bitmap_data)
-	(init_font_name_table): 
-	* fns.c (Fsxhash): 
-	* data.c (Fmake_local_variable): 
+	(init_font_name_table):
+	* fns.c (Fsxhash):
+	* data.c (Fmake_local_variable):
 	* ccl.c (ccl_driver): Likewise.
 
 2007-05-24  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
@@ -25,7 +246,7 @@
 
 	* image.c (uncache_image): Fix typo.
 
-2007-05-23  Johannes Weiner <hannes@saeurebad.de> (tiny change)
+2007-05-23  Johannes Weiner  <hannes@saeurebad.de>  (tiny change)
 
 	* keyboard.c (make_lispy_movement): Condition on HAVE_GPM too.
 
@@ -78,7 +299,7 @@
 
 	* termhooks.h [HAVE_GPM_H] (enum event_kind): Add GPM_CLICK_EVENT.
 	Include gpm.h.
-	(handle_one_term_event, term_gpm) New externs.
+	(handle_one_term_event, term_gpm): New externs.
 
 	* sysdep.c [HAVE_GPM_H] (init_sys_modes): Make gpm_fd nonblocking
 	and allow it to be interrupted by SIGIO.
@@ -144,11 +365,12 @@
 
 2007-05-07  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-	* editfns.c (Ftranspose_regions): Yet another int/Lisp_Object mixup (YAILOM)
+	* editfns.c (Ftranspose_regions): Yet another int/Lisp_Object
+	mixup (YAILOM).
 
 2007-05-07  Andreas Schwab  <schwab@suse.de>
 
-	* keymap.c (Flookup_key): Fix typo in last change. 
+	* keymap.c (Flookup_key): Fix typo in last change.
 
 2007-05-07  Stefan Monnier  <monnier@iro.umontreal.ca>
 
@@ -2599,7 +2821,7 @@
 	for writing files.  Call gtk_file_chooser_set_current_name to keep
 	default filename.
 
-	* minibuf.c (Finternal_complete_buffer): Move after DEFUN:s it calls
+	* minibuf.c (Finternal_complete_buffer): Move after DEFUN:s it calls.
 
 2006-09-02  Jindrich Makovicka  <makovick@gmail.com>  (tiny change)
 
@@ -2856,7 +3078,7 @@
 	* 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*
+	* xterm.c (x_term_init): Initialize dpyinfo->x_dnd_atoms*.
 
 2006-08-10  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
@@ -4022,7 +4244,7 @@
 
 2006-05-23  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
-	* xterm.c: Remove declarations already in xterm.h
+	* xterm.c: Remove declarations already in xterm.h.
 
 	* xterm.h: Add extern declarations for x_clear_errors,
 	x_fully_uncatch_errors, x_catching_errors and
@@ -4763,7 +4985,8 @@
 
 	* puresize.h (pure_write_error): Mark as NO_RETURN.
 
-	* lisp.h (args_out_of_range, args_out_of_range_3)
+	* lisp.h (args_out_of_range, args_out_of_range_3, Fkill_emacs):
+	Likewise.
 
 2006-04-08  Eli Zaretskii  <eliz@gnu.org>
 
@@ -6380,7 +6603,7 @@
 
 	* macterm.c (Qmac_ready_for_drag_n_drop, Qapplication, Qabout)
 	(Qpreferences): Remove variables.
-	(syms_of_macterm) : Don't initialize them.
+	(syms_of_macterm): Don't initialize them.
 	(Qhicommand) [USE_CARBON_EVENTS]: New variable.
 	(syms_of_macterm) [USE_CARBON_EVENTS]: Initialize it.
 	(init_required_apple_events, do_ae_open_application)
@@ -7062,7 +7285,7 @@
 
 	* mac.c [TARGET_API_MAC_CARBON] (get_cfstring_encoding_from_lisp):
 	Allow nil as argument.
-	 [TARGET_API_MAC_CARBON] (Fmac_code_convert_string): Regard nil
+	[TARGET_API_MAC_CARBON] (Fmac_code_convert_string): Regard nil
 	for encoding arguments as UTF-16 in native byte order, no BOM.
 
 	* macfns.c (Fx_create_frame): Add debugging code.
@@ -9998,7 +10221,7 @@
 	(cfobject_desc_to_lisp, cfproperty_list_to_lisp): Likewise.
 
 	* process.c (init_process): Change `#ifdef DARWIN' to `#if
-	defined (DARWIN) || defined (MAC_OSX)'
+	defined (DARWIN) || defined (MAC_OSX)'.
 
 	* s/darwin.h (DARWIN): Don't define.
 
@@ -10535,7 +10758,7 @@
 2005-02-03  Kim F. Storm  <storm@cua.dk>
 
 	* dispnew.c (build_frame_matrix_from_leaf_window)
-	 [!GLYPH_DEBUG]: Fix xassert.
+	[!GLYPH_DEBUG]: Fix xassert.
 
 	* xfaces.c (x_free_gc) [!GLYPH_DEBUG]: Fix xassert.
 
@@ -11425,7 +11648,7 @@
 
 2004-12-20  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
-	* macterm.c (mac_do_list_fonts): Fix memory leak
+	* macterm.c (mac_do_list_fonts): Fix memory leak.
 
 2004-12-20  Richard M. Stallman  <rms@gnu.org>
 
@@ -12205,7 +12428,7 @@
 	* Makefile.in (SOME_MACHINE_OBJECTS): Add fringe.o, image.o
 	and w32*.o.
 	(temacs${EXEEXT}): Generate buildobj.lst when temacs is linked.
-	(mostlyclean): Rm buildobj.lst
+	(mostlyclean): Rm buildobj.lst.
 
 	* makefile.w32-in ($(TEMACS)): Generate buildobj.lst when temacs
 	is linked.
@@ -12543,7 +12766,7 @@
 	(SAFE_ALLOCA, SAFE_ALLOCA_LISP): Increment it when malloc is used.
 	(SAFE_FREE): Test it to determine if we need to unwind to free.
 	Remove size arg.  All users changed.
-	(SAFE_FREE_LISP) Remove.  All users changed to use SAFE_FREE.
+	(SAFE_FREE_LISP): Remove.  All users changed to use SAFE_FREE.
 
 2004-10-26  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
@@ -13200,7 +13423,7 @@
 	(single_submenu): Use ENCODE_MENU_STRING
 	(mac_menu_show): Use ENCODE_MENU_STRING.  Reset grabbed because
 	button release isn't passed to event loop
-	(add_menu_item): Use SetMenuItemWithCFString
+	(add_menu_item): Use SetMenuItemWithCFString.
 
 2004-08-26  Steven Tamm  <steventamm@mac.com>
 
@@ -13469,7 +13692,7 @@
 	blocking on event queue only by calling ReceiveNextEvent
 	instead of select (since GUI events aren't on an fd).
 	(sys_read): Remove function
-	* sysdep.c: Remove redefine of read to sys_read if HAVE_CARBON
+	* sysdep.c: Remove redefine of read to sys_read if HAVE_CARBON.
 
 2004-07-18  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
@@ -13479,12 +13702,12 @@
 	* macterm.c (x_make_frame_visible): Comment in polling on
 	frame creation.
 
-	* keyboard.c: Undef SIGIO on Carbon
+	* keyboard.c: Undef SIGIO on Carbon.
 
 	* atimer.c (alarm_signal_handler): Call alarm handlers after
 	scheduling.
 
-	* eval.c (Feval): Remove quit_char test
+	* eval.c (Feval): Remove quit_char test.
 
 	* process.c (wait_reading_process_input): Remove clearing
 	stdin for select call on process input.
@@ -14436,7 +14659,7 @@
 2004-05-11  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* macterm.c (x_flush, XTframe_up_to_date): Use FRAME_MAC_P
-	instead of FRAME_X_P
+	instead of FRAME_X_P.
 
 2004-05-11  Kim F. Storm  <storm@cua.dk>
 
@@ -14606,7 +14829,7 @@
 
 2004-05-01  Jason Rumney  <jasonr@gnu.org>
 
-	* w32term.c (x_draw_hollow_cursor): Sync with xterm.c
+	* w32term.c (x_draw_hollow_cursor): Sync with xterm.c.
 
 2004-04-30  Kim F. Storm  <storm@cua.dk>
 
@@ -17399,7 +17622,7 @@
 
 	* makefile.w32-in (alloca.o): Remove.
 	(coding.o): Depend on intervals.h
-	(emacs.o, bytecode.o): Depend on window.h
+	(emacs.o, bytecode.o): Depend on window.h.
 
 2003-09-01  Dave Love  <fx@gnu.org>
 
@@ -18180,7 +18403,7 @@
 	* gtkutil.c: Include keyboard.h, charset.h, coding.h.
 	(xg_create_frame_widgets): Use ENCODE_UTF_8.
 
-	* xterm.c (Qutf_8): Move to coding.c
+	* xterm.c (Qutf_8): Move to coding.c.
 
 	* xmenu.c (ENCODE_MENU_STRING): New.
 	(list_of_panes, list_of_items, digest_single_submenu, xmenu_show):
@@ -20909,7 +21132,7 @@
 	(redisplay_internal): Add check for USE_GTK and popup_activated.
 	(redisplay_window): Add check for USE_GTK and FRAME_EXTERNAL_MENU_BAR.
 	(redisplay_window): Add check for USE_GTK and FRAME_EXTERNAL_TOOL_BAR.
-	(display_menu_bar): Add check for USE_GTK
+	(display_menu_bar): Add check for USE_GTK.
 
 	* lisp.h (Vx_resource_name): Declare extern.
 
@@ -22027,7 +22250,7 @@
 
 	* buffer.c (assoc_ignore_text_properties, Fother_buffer, Fkill_buffer)
 	(call_overlay_mod_hooks): Use CONSP and XCAR/XCDR.
-	(Fget_buffer_create, advance_to_char_boundary): Use BEG and BEG_BYTE;
+	(Fget_buffer_create, advance_to_char_boundary): Use BEG and BEG_BYTE.
 
 2002-10-21  Stefan Monnier  <monnier@cs.yale.edu>
 
@@ -23726,8 +23949,8 @@
 	* fns.c (Fstring_make_unibyte): Doc fix.
 
 	* xselect.c (lisp_data_to_selection_data): If the requested type
-	 is STRING, call string_make_unibyte to encode the selected text
-	 as a string.
+	is STRING, call string_make_unibyte to encode the selected text
+	as a string.
 
 	* window.c (Fset_window_hscroll): Doc fix.
 
--- a/src/Makefile.in	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/Makefile.in	Mon Jun 11 00:58:11 2007 +0000
@@ -691,8 +691,12 @@
 #define MOUSE_SUPPORT ${lispsource}mouse.elc \
   ${lispsource}select.elc ${lispsource}scroll-bar.elc
 #else
+#ifdef HAVE_GPM
+#define MOUSE_SUPPORT ${lispsource}mouse.elc
+#else
 #define MOUSE_SUPPORT
 #endif
+#endif
 
 #ifdef VMS
 #define VMS_SUPPORT ${lispsource}vmsproc.elc ${lispsource}vms-patch.elc
--- a/src/alloc.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/alloc.c	Mon Jun 11 00:58:11 2007 +0000
@@ -1756,6 +1756,8 @@
   string_blocks = NULL;
   n_string_blocks = 0;
   string_free_list = NULL;
+  empty_unibyte_string = make_pure_string ("", 0, 0, 0);
+  empty_multibyte_string = make_pure_string ("", 0, 0, 1);
 }
 
 
@@ -2479,6 +2481,9 @@
      int length;
 {
   Lisp_Object val;
+
+  if (!length)
+    return empty_unibyte_string;
   val = make_uninit_multibyte_string (length, length);
   STRING_SET_UNIBYTE (val);
   return val;
@@ -2497,6 +2502,8 @@
 
   if (nchars < 0)
     abort ();
+  if (!nbytes)
+    return empty_multibyte_string;
 
   s = allocate_string ();
   allocate_string_data (s, nchars, nbytes);
--- a/src/buffer.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/buffer.c	Mon Jun 11 00:58:11 2007 +0000
@@ -6002,7 +6002,7 @@
 The default is t, which means that text is invisible
 if it has a non-nil `invisible' property.
 If the value is a list, a text character is invisible if its `invisible'
-property is an element in that list.
+property is an element in that list (or is a list with members in common).
 If an element is a cons cell of the form (PROP . ELLIPSIS),
 then characters with property value PROP are invisible,
 and they have an ellipsis as well if ELLIPSIS is non-nil.  */);
--- a/src/callint.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/callint.c	Mon Jun 11 00:58:11 2007 +0000
@@ -585,7 +585,7 @@
 	case 'G':		/* Possibly nonexistent file name,
 				   default to directory alone. */
 	  args[i] = Fread_file_name (callint_message,
-				     Qnil, Qnil, Qnil, build_string (""), Qnil);
+				     Qnil, Qnil, Qnil, empty_unibyte_string, Qnil);
 	  break;
 
 	case 'i':		/* Ignore an argument -- Does not do I/O */
--- a/src/editfns.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/editfns.c	Mon Jun 11 00:58:11 2007 +0000
@@ -1972,6 +1972,7 @@
       int offset = tm_diff (t, &gmt);
       char *s = 0;
       char buf[6];
+
 #ifdef HAVE_TM_ZONE
       if (t->tm_zone)
 	s = (char *)t->tm_zone;
@@ -1982,19 +1983,6 @@
 #endif
 #endif /* not HAVE_TM_ZONE */
 
-#if defined HAVE_TM_ZONE || defined HAVE_TZNAME
-      if (s)
-	{
-	  /* On Japanese w32, we can get a Japanese string as time
-	     zone name.  Don't accept that.  */
-	  char *p;
-	  for (p = s; *p && (isalnum ((unsigned char)*p) || *p == ' '); ++p)
-	    ;
-	  if (p == s || *p)
-	    s = NULL;
-	}
-#endif
-
       if (!s)
 	{
 	  /* No local time zone name is available; use "+-NNNN" instead.  */
@@ -2002,6 +1990,7 @@
 	  sprintf (buf, "%c%02d%02d", (offset < 0 ? '-' : '+'), am/60, am%60);
 	  s = buf;
 	}
+
       return Fcons (make_number (offset), Fcons (build_string (s), Qnil));
     }
   else
@@ -3174,7 +3163,7 @@
 {
   validate_region (&start, &end);
   if (XINT (start) == XINT (end))
-    return build_string ("");
+    return empty_unibyte_string;
   return del_range_1 (XINT (start), XINT (end), 1, 1);
 }
 
--- a/src/emacs.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/emacs.c	Mon Jun 11 00:58:11 2007 +0000
@@ -133,8 +133,8 @@
 /* Hook run by `kill-emacs' before it does really anything.  */
 Lisp_Object Vkill_emacs_hook;
 
-/* An empty lisp string.  To avoid having to build any other.  */
-Lisp_Object empty_string;
+/* Empty lisp strings.  To avoid having to build any others.  */
+Lisp_Object empty_unibyte_string, empty_multibyte_string;
 
 /* Search path separator.  */
 Lisp_Object Vpath_separator;
@@ -859,17 +859,23 @@
          So ignore --version otherwise.  */
       && initialized)
     {
-      Lisp_Object tem;
+      Lisp_Object tem, tem2;
       tem = Fsymbol_value (intern ("emacs-version"));
+      tem2 = Fsymbol_value (intern ("emacs-copyright"));
       if (!STRINGP (tem))
 	{
 	  fprintf (stderr, "Invalid value of `emacs-version'\n");
 	  exit (1);
 	}
+      if (!STRINGP (tem2))
+	{
+	  fprintf (stderr, "Invalid value of `emacs-copyright'\n");
+	  exit (1);
+	}
       else
 	{
 	  printf ("GNU Emacs %s\n", SDATA (tem));
-	  printf ("Copyright (C) 2007 Free Software Foundation, Inc.\n");
+	  printf ("%s\n", SDATA(tem2));
 	  printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n");
 	  printf ("You may redistribute copies of Emacs\n");
 	  printf ("under the terms of the GNU General Public License.\n");
@@ -2494,9 +2500,6 @@
 The hook is not run in batch mode, i.e., if `noninteractive' is non-nil.  */);
   Vkill_emacs_hook = Qnil;
 
-  empty_string = build_string ("");
-  staticpro (&empty_string);
-
   DEFVAR_INT ("emacs-priority", &emacs_priority,
 	      doc: /* Priority for Emacs to run at.
 This value is effective only if set before Emacs is dumped,
--- a/src/fileio.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/fileio.c	Mon Jun 11 00:58:11 2007 +0000
@@ -6346,7 +6346,7 @@
       if (! replace_in_history)
 	add_to_history = 1;
 
-      val = empty_string;
+      val = empty_unibyte_string;
     }
 
   unbind_to (count, Qnil);
--- a/src/fns.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/fns.c	Mon Jun 11 00:58:11 2007 +0000
@@ -2497,7 +2497,7 @@
     wrong_type_argument (Qlistp, sequence);
   leni = XINT (len);
   nargs = leni + leni - 1;
-  if (nargs < 0) return build_string ("");
+  if (nargs < 0) return empty_unibyte_string;
 
   SAFE_ALLOCA_LISP (args, nargs);
 
--- a/src/frame.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/frame.c	Mon Jun 11 00:58:11 2007 +0000
@@ -1460,7 +1460,7 @@
   f = SELECTED_FRAME ();
   x = y = Qnil;
 
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
   /* It's okay for the hook to refrain from storing anything.  */
   if (mouse_position_hook)
     (*mouse_position_hook) (&f, -1,
@@ -1504,7 +1504,7 @@
   f = SELECTED_FRAME ();
   x = y = Qnil;
 
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
   /* It's okay for the hook to refrain from storing anything.  */
   if (mouse_position_hook)
     (*mouse_position_hook) (&f, -1,
@@ -1591,6 +1591,13 @@
       Fselect_frame (frame);
       mouse_moveto (XINT (x), XINT (y));
     }
+#else
+#ifdef HAVE_GPM
+    {
+      Fselect_frame (frame);
+      term_mouse_moveto (XINT (x), XINT (y));
+    }
+#endif
 #endif
 #endif
 
--- a/src/image.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/image.c	Mon Jun 11 00:58:11 2007 +0000
@@ -1609,6 +1609,7 @@
 			     Image Cache
  ***********************************************************************/
 
+static struct image *search_image_cache P_ ((struct frame *, Lisp_Object, unsigned));
 static void cache_image P_ ((struct frame *f, struct image *img));
 static void postprocess_image P_ ((struct frame *, struct image *));
 
@@ -1631,24 +1632,47 @@
 }
 
 
-/* Search frame F for an images with spec SPEC, and free it.  */
+/* Find an image matching SPEC in the cache, and return it.  If no
+   image is found, return NULL.  */
+static struct image *
+search_image_cache (f, spec, hash)
+     struct frame *f;
+     Lisp_Object spec;
+     unsigned hash;
+{
+  struct image *img;
+  struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
+  Lisp_Object specified_bg = image_spec_value (spec, QCbackground, NULL);
+  int i = hash % IMAGE_CACHE_BUCKETS_SIZE;
+
+  /* If the image spec does not specify a background color, the cached
+     image must have the same background color as the current frame.
+     The following code be improved.  For example, jpeg does not
+     support transparency, but currently a jpeg image spec won't match
+     a cached spec created with a different frame background.  The
+     extra memory usage is probably negligible in practice.  */
+  if (!c) return NULL;
+
+  for (img = c->buckets[i]; img; img = img->next)
+    if (img->hash == hash
+	&& !NILP (Fequal (img->spec, spec))
+	&& (STRINGP (specified_bg)
+	    || img->background == FRAME_BACKGROUND_PIXEL (f)))
+      break;
+  return img;
+}
+
+
+/* Search frame F for an image with spec SPEC, and free it.  */
 
 static void
 uncache_image (f, spec)
      struct frame *f;
      Lisp_Object spec;
 {
-  struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
-  struct image *img;
-  unsigned hash = sxhash (spec, 0);
-  int i = hash % IMAGE_CACHE_BUCKETS_SIZE;
-
-  for (img = c->buckets[i]; img; img = img->next)
-    if (img->hash == hash && !NILP (Fequal (img->spec, spec)))
-      {
-	free_image (f, img);
-	break;
-      }
+  struct image *img = search_image_cache (f, spec, sxhash (spec, 0));
+  if (img)
+    free_image (f, img);
 }
 
 
@@ -1875,9 +1899,7 @@
      struct frame *f;
      Lisp_Object spec;
 {
-  struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
   struct image *img;
-  int i;
   unsigned hash;
   struct gcpro gcpro1;
   EMACS_TIME now;
@@ -1891,12 +1913,7 @@
 
   /* Look up SPEC in the hash table of the image cache.  */
   hash = sxhash (spec, 0);
-  i = hash % IMAGE_CACHE_BUCKETS_SIZE;
-
-  for (img = c->buckets[i]; img; img = img->next)
-    if (img->hash == hash && !NILP (Fequal (img->spec, spec)))
-      break;
-
+  img = search_image_cache (f, spec, hash);
   if (img && img->load_failed_p)
     {
       free_image (f, img);
@@ -3961,9 +3978,6 @@
   attrs.valuemask |= XpmCloseness;
 #endif /* not XpmAllocCloseColors */
 #endif /* ALLOC_XPM_COLORS */
-#ifdef ALLOC_XPM_COLORS
-  xpm_init_color_cache (f, &attrs);
-#endif
 
   /* If image specification contains symbolic color definitions, add
      these to `attrs'.  */
--- a/src/keyboard.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/keyboard.c	Mon Jun 11 00:58:11 2007 +0000
@@ -1249,7 +1249,7 @@
   /* Use user's specified output function if any.  */
   if (!NILP (Vcommand_error_function))
     call3 (Vcommand_error_function, data,
-	   build_string (context ? context : ""),
+	   context ? build_string (context) : empty_unibyte_string,
 	   Vsignaling_function);
   /* If the window system or terminal frame hasn't been initialized
      yet, or we're not interactive, write the message to stderr and exit.  */
@@ -3918,6 +3918,9 @@
 #ifdef WINDOWSNT
 	  || sp->kind == W32_SCROLL_BAR_CLICK_EVENT
 #endif
+#ifdef HAVE_GPM
+	  || sp->kind == GPM_CLICK_EVENT
+#endif
 	  || sp->kind == SCROLL_BAR_CLICK_EVENT)
 	{
 	  sp->kind = NO_EVENT;
--- a/src/keymap.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/keymap.c	Mon Jun 11 00:58:11 2007 +0000
@@ -2218,7 +2218,7 @@
 	  len += 2;
 	}
       else if (len == 0)
-	return empty_string;
+	return empty_unibyte_string;
       return Fconcat (len - 1, args);
     }
 
--- a/src/lisp.h	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/lisp.h	Mon Jun 11 00:58:11 2007 +0000
@@ -704,7 +704,10 @@
 #endif /* not GC_CHECK_STRING_BYTES */
 
 /* Mark STR as a unibyte string.  */
-#define STRING_SET_UNIBYTE(STR)      (XSTRING (STR)->size_byte = -1)
+#define STRING_SET_UNIBYTE(STR)  \
+  do { if (EQ (STR, empty_multibyte_string))  \
+      (STR) = empty_unibyte_string;  \
+    else XSTRING (STR)->size_byte = -1; } while (0)
 
 /* Get text properties.  */
 #define STRING_INTERVALS(STR)  (XSTRING (STR)->intervals + 0)
@@ -3098,7 +3101,8 @@
 /* defined in emacs.c */
 extern Lisp_Object decode_env_path P_ ((char *, char *));
 extern Lisp_Object Vinvocation_name, Vinvocation_directory;
-extern Lisp_Object Vinstallation_directory, empty_string;
+extern Lisp_Object Vinstallation_directory;
+extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
 EXFUN (Fkill_emacs, 1);
 #if HAVE_SETLOCALE
 void fixup_locale P_ ((void));
--- a/src/lread.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/lread.c	Mon Jun 11 00:58:11 2007 +0000
@@ -1397,7 +1397,7 @@
 	fn = (char *) alloca (fn_size = 100 + want_size);
 
       /* Loop over suffixes.  */
-      for (tail = NILP (suffixes) ? Fcons (build_string (""), Qnil) : suffixes;
+      for (tail = NILP (suffixes) ? Fcons (empty_unibyte_string, Qnil) : suffixes;
 	   CONSP (tail); tail = XCDR (tail))
 	{
 	  int lsuffix = SBYTES (XCAR (tail));
@@ -4201,8 +4201,7 @@
 in order to do so.  However, if you want to customize which suffixes
 the loading functions recognize as compression suffixes, you should
 customize `jka-compr-load-suffixes' rather than the present variable.  */);
-  /* We don't use empty_string because it's not initialized yet.  */
-  Vload_file_rep_suffixes = Fcons (build_string (""), Qnil);
+  Vload_file_rep_suffixes = Fcons (empty_unibyte_string, Qnil);
 
   DEFVAR_BOOL ("load-in-progress", &load_in_progress,
 	       doc: /* Non-nil iff inside of `load'.  */);
--- a/src/mac.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/mac.c	Mon Jun 11 00:58:11 2007 +0000
@@ -1826,8 +1826,6 @@
 
   GCPRO3 (database, quarks, value);
 
-  BLOCK_INPUT;
-
   app_id = kCFPreferencesCurrentApplication;
   if (application)
     {
@@ -1879,8 +1877,6 @@
     CFRelease (key_set);
   CFRelease (app_id);
 
-  UNBLOCK_INPUT;
-
   UNGCPRO;
 
   return database;
--- a/src/macfns.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/macfns.c	Mon Jun 11 00:58:11 2007 +0000
@@ -218,9 +218,6 @@
 void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
 void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object));
 void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
-
-extern void mac_get_window_bounds P_ ((struct frame *, Rect *, Rect *));
-
 
 
 /* Store the screen positions of frame F into XPTR and YPTR.
@@ -2263,11 +2260,11 @@
 	  FRAME_MAC_WINDOW (f) = NULL;
 	}
     }
-#else
+#else  /* !TARGET_API_MAC_CARBON */
   FRAME_MAC_WINDOW (f)
     = NewCWindow (NULL, &r, "\p", false, zoomDocProc,
-		  (WindowPtr) -1, 1, (long) f->output_data.mac);
-#endif
+		  (WindowRef) -1, 1, (long) f->output_data.mac);
+#endif  /* !TARGET_API_MAC_CARBON */
   /* so that update events can find this mac_output struct */
   f->output_data.mac->mFP = f;  /* point back to emacs frame */
 
@@ -3120,7 +3117,7 @@
       UNBLOCK_INPUT;
     }
 #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
-  else
+  else				/* CGDisplayScreenSize == NULL */
 #endif
 #endif	/* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030  */
 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
@@ -3157,7 +3154,7 @@
       UNBLOCK_INPUT;
     }
 #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
-  else
+  else				/* CGDisplayScreenSize == NULL */
 #endif
 #endif	/* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030  */
 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
@@ -4076,8 +4073,12 @@
       Point mouse_pos;
 
       BLOCK_INPUT;
+#if TARGET_API_MAC_CARBON
+      GetGlobalMouse (&mouse_pos);
+#else
       GetMouse (&mouse_pos);
       LocalToGlobal (&mouse_pos);
+#endif
       *root_x = mouse_pos.h;
       *root_y = mouse_pos.v;
       UNBLOCK_INPUT;
--- a/src/macgui.h	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/macgui.h	Mon Jun 11 00:58:11 2007 +0000
@@ -71,7 +71,7 @@
 #undef Z
 #define Z (current_buffer->text->z)
 #else /* not HAVE_CARBON */
-#include <QuickDraw.h>		/* for WindowPtr */
+#include <QuickDraw.h>		/* for WindowRef */
 #include <QDOffscreen.h>	/* for GWorldPtr */
 #include <Appearance.h>		/* for ThemeCursor */
 #include <Windows.h>
@@ -119,7 +119,7 @@
 #endif
 #endif
 
-typedef WindowPtr Window;
+typedef WindowRef Window;
 typedef GWorldPtr Pixmap;
 
 #define Cursor ThemeCursor
--- a/src/macmenu.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/macmenu.c	Mon Jun 11 00:58:11 2007 +0000
@@ -200,7 +200,7 @@
 
 static void find_and_call_menu_selection P_ ((FRAME_PTR, int, Lisp_Object,
 					      void *));
-static int fill_menu P_ ((MenuHandle, widget_value *, enum mac_menu_kind, int));
+static int fill_menu P_ ((MenuRef, widget_value *, enum mac_menu_kind, int));
 static void fill_menubar P_ ((widget_value *, int));
 static void dispose_menus P_ ((enum mac_menu_kind, int));
 
@@ -1162,7 +1162,7 @@
 #endif
     if (menu_id)
       {
-        MenuHandle menu = GetMenuHandle (menu_id);
+        MenuRef menu = GetMenuRef (menu_id);
 
         if (menu)
           {
@@ -1595,15 +1595,13 @@
      EventRef event;
      void *data;
 {
-  OSStatus err, result;
+  OSStatus err;
   MenuRef menu;
   MenuItemIndex menu_item;
   Lisp_Object help;
   GrafPtr port;
   int specpdl_count = SPECPDL_INDEX ();
 
-  result = CallNextEventHandler (next_handler, event);
-
   err = GetEventParameter (event, kEventParamDirectObject, typeMenuRef,
 			   NULL, sizeof (MenuRef), NULL, &menu);
   if (err == noErr)
@@ -1626,30 +1624,21 @@
   SetPort (port);
   unbind_to (specpdl_count, Qnil);
 
-  return err == noErr ? noErr : result;
+  return err == noErr ? noErr : eventNotHandledErr;
 }
-#endif
 
 OSStatus
-install_menu_target_item_handler (window)
-     WindowPtr window;
+install_menu_target_item_handler ()
 {
-  OSStatus err = noErr;
-#if TARGET_API_MAC_CARBON
   static const EventTypeSpec specs[] =
     {{kEventClassMenu, kEventMenuTargetItem}};
-  static EventHandlerUPP menu_target_item_handlerUPP = NULL;
-
-  if (menu_target_item_handlerUPP == NULL)
-    menu_target_item_handlerUPP =
-      NewEventHandlerUPP (menu_target_item_handler);
-
-  err = InstallWindowEventHandler (window, menu_target_item_handlerUPP,
-				   GetEventTypeCount (specs), specs,
-				   NULL, NULL);
-#endif
-  return err;
+
+  return InstallApplicationEventHandler (NewEventHandlerUPP
+					 (menu_target_item_handler),
+					 GetEventTypeCount (specs),
+					 specs, NULL, NULL);
 }
+#endif  /* TARGET_API_MAC_CARBON */
 
 /* Event handler function that pops down a menu on C-g.  We can only pop
    down menus if CancelMenuTracking is present (OSX 10.3 or later).  */
@@ -1687,15 +1676,15 @@
 }
 #endif	/* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
 
-/* Add event handler to all menus that belong to KIND so we can detect C-g.
-   MENU_HANDLE is the root menu of the tracking session to dismiss
-   when C-g is detected.  NULL means the menu bar.
-   If CancelMenuTracking isn't available, do nothing.  */
+/* Add event handler to all menus that belong to KIND so we can detect
+   C-g.  ROOT_MENU is the root menu of the tracking session to dismiss
+   when C-g is detected.  NULL means the menu bar.  If
+   CancelMenuTracking isn't available, do nothing.  */
 
 static void
-install_menu_quit_handler (kind, menu_handle)
+install_menu_quit_handler (kind, root_menu)
      enum mac_menu_kind kind;
-     MenuHandle menu_handle;
+     MenuRef root_menu;
 {
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
   static const EventTypeSpec typesList[] =
@@ -1708,13 +1697,13 @@
 #endif
   for (id = min_menu_id[kind]; id < min_menu_id[kind + 1]; id++)
     {
-      MenuHandle menu = GetMenuHandle (id);
+      MenuRef menu = GetMenuRef (id);
 
       if (menu == NULL)
 	break;
       InstallMenuEventHandler (menu, menu_quit_handler,
 			       GetEventTypeCount (typesList),
-			       typesList, menu_handle, NULL);
+			       typesList, root_menu, NULL);
     }
 #endif	/* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
 }
@@ -1738,10 +1727,13 @@
 
   XSETFRAME (Vmenu_updating_frame, f);
 
+  /* This seems to be unnecessary for Carbon.  */
+#if 0
   if (! menubar_widget)
     deep_p = 1;
   else if (pending_menu_activation && !deep_p)
     deep_p = 1;
+#endif
 
   if (deep_p)
     {
@@ -1978,7 +1970,7 @@
 {
   struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
   FRAME_PTR f = p->pointer;
-  MenuHandle menu = GetMenuHandle (min_menu_id[MAC_MENU_POPUP]);
+  MenuRef menu = GetMenuRef (min_menu_id[MAC_MENU_POPUP]);
 
   BLOCK_INPUT;
 
@@ -2024,8 +2016,7 @@
   int i;
   int menu_item_choice;
   UInt32 menu_item_selection;
-  MenuHandle menu;
-  Point pos;
+  MenuRef menu;
   widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
   widget_value **submenu_stack
     = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
@@ -2231,11 +2222,8 @@
   free_menubar_widget_value_tree (first_wv);
 
   /* Adjust coordinates to be root-window-relative.  */
-  pos.h = x;
-  pos.v = y;
-
-  SetPortWindowPort (FRAME_MAC_WINDOW (f));
-  LocalToGlobal (&pos);
+  x += f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
+  y += f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
 
   /* No selection has been chosen yet.  */
   menu_item_selection = 0;
@@ -2248,13 +2236,13 @@
 
   /* Display the menu.  */
   popup_activated_flag = 1;
-  menu_item_choice = PopUpMenuSelect (menu, pos.v, pos.h, 0);
+  menu_item_choice = PopUpMenuSelect (menu, y, x, 0);
   popup_activated_flag = 0;
 
   /* Get the refcon to find the correct item */
   if (menu_item_choice)
     {
-      MenuHandle sel_menu = GetMenuHandle (HiWord (menu_item_choice));
+      MenuRef sel_menu = GetMenuRef (HiWord (menu_item_choice));
 
       if (sel_menu)
 	GetMenuItemRefCon (sel_menu, LoWord (menu_item_choice),
@@ -2330,6 +2318,14 @@
 
 #if TARGET_API_MAC_CARBON
 
+#define DIALOG_BUTTON_COMMAND_ID_OFFSET 'Bt\0\0'
+#define DIALOG_BUTTON_COMMAND_ID_P(id)			\
+  (((id) & ~0xffff) == DIALOG_BUTTON_COMMAND_ID_OFFSET)
+#define DIALOG_BUTTON_COMMAND_ID_VALUE(id)	\
+  ((id) - DIALOG_BUTTON_COMMAND_ID_OFFSET)
+#define DIALOG_BUTTON_MAKE_COMMAND_ID(value)	\
+  ((value) + DIALOG_BUTTON_COMMAND_ID_OFFSET)
+
 static pascal OSStatus
 mac_handle_dialog_event (next_handler, event, data)
      EventHandlerCallRef next_handler;
@@ -2349,7 +2345,7 @@
 				 typeHICommand, NULL, sizeof (HICommand),
 				 NULL, &command);
 	if (err == noErr)
-	  if ((command.commandID & ~0xffff) == 'Bt\0\0')
+	  if (DIALOG_BUTTON_COMMAND_ID_P (command.commandID))
 	    {
 	      SetWRefCon (window, command.commandID);
 	      err = QuitAppModalLoopForWindow (window);
@@ -2402,7 +2398,10 @@
 	      break;
 	    }
 
-	return err == noErr ? noErr : result;
+	if (err == noErr)
+	  result = noErr;
+
+	return result;
       }
       break;
 
@@ -2518,14 +2517,16 @@
 	    }
 	  if (err == noErr)
 	    {
+	      UInt32 command_id;
+
 	      OffsetRect (&rects[i], -rects[i].left, -rects[i].top);
 	      if (rects[i].right < DIALOG_BUTTON_MIN_WIDTH)
 		rects[i].right = DIALOG_BUTTON_MIN_WIDTH;
 	      else if (rects[i].right > DIALOG_MAX_INNER_WIDTH)
 		rects[i].right = DIALOG_MAX_INNER_WIDTH;
 
-	      err = SetControlCommandID (buttons[i],
-					 'Bt\0\0' + (int) wv->call_data);
+	      command_id = DIALOG_BUTTON_MAKE_COMMAND_ID ((int) wv->call_data);
+	      err = SetControlCommandID (buttons[i], command_id);
 	    }
 	  if (err != noErr)
 	    break;
@@ -2702,8 +2703,8 @@
     {
       UInt32 command_id = GetWRefCon (window);
 
-      if ((command_id & ~0xffff) == 'Bt\0\0')
-	result = command_id - 'Bt\0\0';
+      if (DIALOG_BUTTON_COMMAND_ID_P (command_id))
+	result = DIALOG_BUTTON_COMMAND_ID_VALUE (command_id);
     }
 
   if (window)
@@ -2724,8 +2725,8 @@
   int i;
   int dialog_width;
   Rect rect;
-  WindowPtr window_ptr;
-  ControlHandle ch;
+  WindowRef window_ptr;
+  ControlRef ch;
   int left;
   EventRecord event_record;
   SInt16 part_code;
@@ -2754,7 +2755,7 @@
       wv = wv->next;
     }
 
-  window_ptr = GetNewCWindow (DIALOG_WINDOW_RESOURCE, NULL, (WindowPtr) -1);
+  window_ptr = GetNewCWindow (DIALOG_WINDOW_RESOURCE, NULL, (WindowRef) -1);
 
   SetPortWindowPort (window_ptr);
 
@@ -3031,7 +3032,7 @@
 
 static void
 add_menu_item (menu, pos, wv)
-     MenuHandle menu;
+     MenuRef menu;
      int pos;
      widget_value *wv;
 {
@@ -3108,7 +3109,7 @@
 
 static int
 fill_menu (menu, wv, kind, submenu_id)
-     MenuHandle menu;
+     MenuRef menu;
      widget_value *wv;
      enum mac_menu_kind kind;
      int submenu_id;
@@ -3120,7 +3121,7 @@
       add_menu_item (menu, pos, wv);
       if (wv->contents && submenu_id < min_menu_id[kind + 1])
 	{
-	  MenuHandle submenu = NewMenu (submenu_id, "\pX");
+	  MenuRef submenu = NewMenu (submenu_id, "\pX");
 
 	  InsertMenu (submenu, -1);
 	  SetMenuItemHierarchicalID (menu, pos, submenu_id);
@@ -3139,8 +3140,6 @@
      int deep_p;
 {
   int id, submenu_id;
-  MenuHandle menu;
-  Str255 title;
 #if !TARGET_API_MAC_CARBON
   int title_changed_p = 0;
 #endif
@@ -3162,45 +3161,75 @@
        wv != NULL && id < min_menu_id[MAC_MENU_MENU_BAR + 1];
        wv = wv->next, id++)
     {
+      OSStatus err = noErr;
+      MenuRef menu;
+#if TARGET_API_MAC_CARBON
+      CFStringRef title;
+
+      title = CFStringCreateWithCString (NULL, wv->name,
+					 kCFStringEncodingMacRoman);
+#else
+      Str255 title;
+
       strncpy (title, wv->name, 255);
       title[255] = '\0';
       c2pstr (title);
-
-      menu = GetMenuHandle (id);
+#endif
+
+      menu = GetMenuRef (id);
       if (menu)
 	{
 #if TARGET_API_MAC_CARBON
-	  Str255 old_title;
-
-	  GetMenuTitle (menu, old_title);
-	  if (!EqualString (title, old_title, false, false))
-	    SetMenuTitle (menu, title);
+	  CFStringRef old_title;
+
+	  err = CopyMenuTitleAsCFString (menu, &old_title);
+	  if (err == noErr)
+	    {
+	      if (CFStringCompare (title, old_title, 0) != kCFCompareEqualTo)
+		err = SetMenuTitleWithCFString (menu, title);
+	      CFRelease (old_title);
+	    }
+	  else
+	    err = SetMenuTitleWithCFString (menu, title);
 #else  /* !TARGET_API_MAC_CARBON */
 	  if (!EqualString (title, (*menu)->menuData, false, false))
 	    {
 	      DeleteMenu (id);
 	      DisposeMenu (menu);
 	      menu = NewMenu (id, title);
-	      InsertMenu (menu, GetMenuHandle (id + 1) ? id + 1 : 0);
+	      InsertMenu (menu, GetMenuRef (id + 1) ? id + 1 : 0);
 	      title_changed_p = 1;
 	    }
 #endif  /* !TARGET_API_MAC_CARBON */
 	}
       else
 	{
+#if TARGET_API_MAC_CARBON
+	  err = CreateNewMenu (id, 0, &menu);
+	  if (err == noErr)
+	    err = SetMenuTitleWithCFString (menu, title);
+#else
 	  menu = NewMenu (id, title);
-	  InsertMenu (menu, 0);
+#endif
+	  if (err == noErr)
+	    {
+	      InsertMenu (menu, 0);
 #if !TARGET_API_MAC_CARBON
-	  title_changed_p = 1;
+	      title_changed_p = 1;
 #endif
+	    }
 	}
-
-      if (wv->contents)
-        submenu_id = fill_menu (menu, wv->contents, MAC_MENU_MENU_BAR_SUB,
-				submenu_id);
+#if TARGET_API_MAC_CARBON
+      CFRelease (title);
+#endif
+
+      if (err == noErr)
+	if (wv->contents)
+	  submenu_id = fill_menu (menu, wv->contents, MAC_MENU_MENU_BAR_SUB,
+				  submenu_id);
     }
 
-  if (id < min_menu_id[MAC_MENU_MENU_BAR + 1] && GetMenuHandle (id))
+  if (id < min_menu_id[MAC_MENU_MENU_BAR + 1] && GetMenuRef (id))
     {
       dispose_menus (MAC_MENU_MENU_BAR, id);
 #if !TARGET_API_MAC_CARBON
@@ -3224,7 +3253,7 @@
 {
   for (id = max (id, min_menu_id[kind]); id < min_menu_id[kind + 1]; id++)
     {
-      MenuHandle menu = GetMenuHandle (id);
+      MenuRef menu = GetMenuRef (id);
 
       if (menu == NULL)
 	break;
--- a/src/macselect.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/macselect.c	Mon Jun 11 00:58:11 2007 +0000
@@ -1623,16 +1623,19 @@
 			Services menu support
 ***********************************************************************/
 #ifdef MAC_OSX
-void
-init_service_handler ()
+OSStatus
+install_service_handler ()
 {
   static const EventTypeSpec specs[] =
     {{kEventClassService, kEventServiceGetTypes},
      {kEventClassService, kEventServiceCopy},
      {kEventClassService, kEventServicePaste},
      {kEventClassService, kEventServicePerform}};
-  InstallApplicationEventHandler (NewEventHandlerUPP (mac_handle_service_event),
-				  GetEventTypeCount (specs), specs, NULL, NULL);
+
+  return InstallApplicationEventHandler (NewEventHandlerUPP
+					 (mac_handle_service_event),
+					 GetEventTypeCount (specs),
+					 specs, NULL, NULL);
 }
 
 extern OSStatus mac_store_service_event P_ ((EventRef));
--- a/src/macterm.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/macterm.c	Mon Jun 11 00:58:11 2007 +0000
@@ -35,12 +35,7 @@
 #include <alloca.h>
 #endif
 
-#if TARGET_API_MAC_CARBON
-/* USE_CARBON_EVENTS determines if the Carbon Event Manager is used to
-   obtain events from the event queue.  If set to 0, WaitNextEvent is
-   used instead.  */
-#define USE_CARBON_EVENTS 1
-#else /* not TARGET_API_MAC_CARBON */
+#if !TARGET_API_MAC_CARBON
 #include <Quickdraw.h>
 #include <ToolUtils.h>
 #include <Sound.h>
@@ -265,7 +260,7 @@
 					    Lisp_Object *, Lisp_Object *,
 					    unsigned long *));
 
-static int is_emacs_window P_ ((WindowPtr));
+static int is_emacs_window P_ ((WindowRef));
 static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int));
 static void XSetFont P_ ((Display *, GC, XFontStruct *));
 
@@ -418,7 +413,8 @@
 static RgnHandle saved_port_clip_region = NULL;
 
 static void
-mac_begin_clip (gc)
+mac_begin_clip (f, gc)
+     struct frame *f;
      GC gc;
 {
   static RgnHandle new_region = NULL;
@@ -428,6 +424,11 @@
   if (new_region == NULL)
     new_region = NewRgn ();
 
+#if USE_CG_DRAWING
+  mac_prepare_for_quickdraw (f);
+#endif
+  SetPortWindowPort (FRAME_MAC_WINDOW (f));
+
   if (gc->n_clip_rects)
     {
       GetClip (saved_port_clip_region);
@@ -447,15 +448,6 @@
 
 /* X display function emulation */
 
-void
-XFreePixmap (display, pixmap)
-     Display *display;		/* not used */
-     Pixmap pixmap;
-{
-  DisposeGWorld (pixmap);
-}
-
-
 /* Mac version of XDrawLine.  */
 
 static void
@@ -497,11 +489,8 @@
 	x2--;
     }
 
-  SetPortWindowPort (FRAME_MAC_WINDOW (f));
-
+  mac_begin_clip (f, gc);
   RGBForeColor (GC_FORE_COLOR (gc));
-
-  mac_begin_clip (gc);
   MoveTo (x1, y1);
   LineTo (x2, y2);
   mac_end_clip (gc);
@@ -557,25 +546,25 @@
      unsigned int width, height;
 {
 #if USE_CG_DRAWING
-  CGContextRef context;
-
-  context = mac_begin_cg_clip (f, gc);
-  CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
-  CGContextFillRect (context, CGRectMake (x, y, width, height));
-  mac_end_cg_clip (f);
+    {
+      CGContextRef context;
+
+      context = mac_begin_cg_clip (f, gc);
+      CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
+      CGContextFillRect (context, CGRectMake (x, y, width, height));
+      mac_end_cg_clip (f);
+    }
 #else
-  Rect r;
-
-  SetPortWindowPort (FRAME_MAC_WINDOW (f));
-
-  RGBBackColor (GC_BACK_COLOR (gc));
-  SetRect (&r, x, y, x + width, y + height);
-
-  mac_begin_clip (gc);
-  EraseRect (&r);
-  mac_end_clip (gc);
-
-  RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
+    {
+      Rect r;
+
+      mac_begin_clip (f, gc);
+      RGBBackColor (GC_BACK_COLOR (gc));
+      SetRect (&r, x, y, x + width, y + height);
+      EraseRect (&r);
+      RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
+      mac_end_clip (gc);
+    }
 #endif
 }
 
@@ -598,15 +587,17 @@
      struct frame *f;
 {
 #if USE_CG_DRAWING
-  CGContextRef context;
-  GC gc = FRAME_NORMAL_GC (f);
-
-  context = mac_begin_cg_clip (f, NULL);
-  CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
-  CGContextFillRect (context, CGRectMake (0, 0, FRAME_PIXEL_WIDTH (f),
-					  FRAME_PIXEL_HEIGHT (f)));
-  mac_end_cg_clip (f);
-#else
+  {
+    CGContextRef context;
+    GC gc = FRAME_NORMAL_GC (f);
+
+    context = mac_begin_cg_clip (f, NULL);
+    CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
+    CGContextFillRect (context, CGRectMake (0, 0, FRAME_PIXEL_WIDTH (f),
+					    FRAME_PIXEL_HEIGHT (f)));
+    mac_end_cg_clip (f);
+  }
+#else  /* !USE_CG_DRAWING */
   SetPortWindowPort (FRAME_MAC_WINDOW (f));
 
   RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
@@ -680,13 +671,10 @@
   bitmap.baseAddr = (char *)bits;
   SetRect (&(bitmap.bounds), 0, 0, width, height);
 
-  SetPortWindowPort (FRAME_MAC_WINDOW (f));
-
+  mac_begin_clip (f, gc);
   RGBForeColor (GC_FORE_COLOR (gc));
   RGBBackColor (GC_BACK_COLOR (gc));
   SetRect (&r, x, y, x + width, y + height);
-
-  mac_begin_clip (gc);
 #if TARGET_API_MAC_CARBON
   {
     CGrafPtr port;
@@ -701,9 +689,8 @@
   CopyBits (&bitmap, &(FRAME_MAC_WINDOW (f)->portBits), &(bitmap.bounds), &r,
 	    overlay_p ? srcOr : srcCopy, 0);
 #endif /* not TARGET_API_MAC_CARBON */
+  RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
   mac_end_clip (gc);
-
-  RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
 }
 #endif	/* !USE_CG_DRAWING */
 
@@ -754,8 +741,8 @@
 
 Pixmap
 XCreatePixmap (display, w, width, height, depth)
-     Display *display;		/* not used */
-     WindowPtr w;
+     Display *display;
+     WindowRef w;
      unsigned int width, height;
      unsigned int depth;
 {
@@ -783,8 +770,8 @@
 
 Pixmap
 XCreatePixmapFromBitmapData (display, w, data, width, height, fg, bg, depth)
-     Display *display;		/* not used */
-     WindowPtr w;
+     Display *display;
+     WindowRef w;
      char *data;
      unsigned int width, height;
      unsigned long fg, bg;
@@ -794,7 +781,7 @@
   BitMap bitmap;
   CGrafPtr old_port;
   GDHandle old_gdh;
-  static GC gc = NULL;		/* not reentrant */
+  static GC gc = NULL;
 
   if (gc == NULL)
     gc = XCreateGC (display, w, 0, NULL);
@@ -826,6 +813,15 @@
 }
 
 
+void
+XFreePixmap (display, pixmap)
+     Display *display;
+     Pixmap pixmap;
+{
+  DisposeGWorld (pixmap);
+}
+
+
 /* Mac replacement for XFillRectangle.  */
 
 static void
@@ -845,12 +841,9 @@
 #else
   Rect r;
 
-  SetPortWindowPort (FRAME_MAC_WINDOW (f));
-
+  mac_begin_clip (f, gc);
   RGBForeColor (GC_FORE_COLOR (gc));
   SetRect (&r, x, y, x + width, y + height);
-
-  mac_begin_clip (gc);
   PaintRect (&r); /* using foreground color of gc */
   mac_end_clip (gc);
 #endif
@@ -877,18 +870,34 @@
 #else
   Rect r;
 
-  SetPortWindowPort (FRAME_MAC_WINDOW (f));
-
+  mac_begin_clip (f, gc);
   RGBForeColor (GC_FORE_COLOR (gc));
   SetRect (&r, x, y, x + width + 1, y + height + 1);
-
-  mac_begin_clip (gc);
   FrameRect (&r); /* using foreground color of gc */
   mac_end_clip (gc);
 #endif
 }
 
 
+static void
+mac_invert_rectangle (f, x, y, width, height)
+     struct frame *f;
+     int x, y;
+     unsigned int width, height;
+{
+  Rect r;
+
+#if USE_CG_DRAWING
+  mac_prepare_for_quickdraw (f);
+#endif
+  SetPortWindowPort (FRAME_MAC_WINDOW (f));
+
+  SetRect (&r, x, y, x + width, y + height);
+
+  InvertRect (&r);
+}
+
+
 #if USE_ATSUI
 static OSStatus
 atsu_get_text_layout_with_text_ptr (text, text_length, style, text_layout)
@@ -898,7 +907,7 @@
      ATSUTextLayout *text_layout;
 {
   OSStatus err;
-  static ATSUTextLayout saved_text_layout = NULL; /* not reentrant */
+  static ATSUTextLayout saved_text_layout = NULL;
 
   if (saved_text_layout == NULL)
     {
@@ -925,7 +934,6 @@
 	err = ATSUSetLayoutControls (saved_text_layout,
 				     sizeof (tags) / sizeof (tags[0]),
 				     tags, sizes, values);
-      /* XXX: Should we do this? */
       if (err == noErr)
 	err = ATSUSetTransientFontMatching (saved_text_layout, true);
     }
@@ -944,29 +952,208 @@
     *text_layout = saved_text_layout;
   return err;
 }
-#endif
-
-
-static void
-mac_invert_rectangle (f, x, y, width, height)
+
+
+static void
+mac_draw_image_string_atsui (f, gc, x, y, buf, nchars, bg_width,
+			     overstrike_p, bytes_per_char)
      struct frame *f;
+     GC gc;
      int x, y;
-     unsigned int width, height;
-{
-  Rect r;
+     char *buf;
+     int nchars, bg_width, overstrike_p, bytes_per_char;
+{
+  OSStatus err;
+  ATSUTextLayout text_layout;
+
+  xassert (bytes_per_char == 2);
+
+#ifndef WORDS_BIG_ENDIAN
+  {
+    int i;
+    UniChar *text = (UniChar *)buf;
+
+    for (i = 0; i < nchars; i++)
+      text[i] = EndianU16_BtoN (text[i]);
+  }
+#endif
+  err = atsu_get_text_layout_with_text_ptr ((ConstUniCharArrayPtr)buf,
+					    nchars,
+					    GC_FONT (gc)->mac_style,
+					    &text_layout);
+  if (err != noErr)
+    return;
+#ifdef MAC_OSX
+  if (!mac_use_core_graphics)
+    {
+#endif
+      mac_begin_clip (f, gc);
+      RGBForeColor (GC_FORE_COLOR (gc));
+      if (bg_width)
+	{
+	  Rect r;
+
+	  SetRect (&r, x, y - FONT_BASE (GC_FONT (gc)),
+		   x + bg_width, y + FONT_DESCENT (GC_FONT (gc)));
+	  RGBBackColor (GC_BACK_COLOR (gc));
+	  EraseRect (&r);
+	  RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
+	}
+      MoveTo (x, y);
+      ATSUDrawText (text_layout,
+		    kATSUFromTextBeginning, kATSUToTextEnd,
+		    kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
+      if (overstrike_p)
+	{
+	  MoveTo (x + 1, y);
+	  ATSUDrawText (text_layout,
+			kATSUFromTextBeginning, kATSUToTextEnd,
+			kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
+	}
+      mac_end_clip (gc);
+#ifdef MAC_OSX
+    }
+  else
+    {
+      static CGContextRef context;
+      float port_height = FRAME_PIXEL_HEIGHT (f);
+      static const ATSUAttributeTag tags[] = {kATSUCGContextTag};
+      static const ByteCount sizes[] = {sizeof (CGContextRef)};
+      static const ATSUAttributeValuePtr values[] = {&context};
 
 #if USE_CG_DRAWING
-  mac_prepare_for_quickdraw (f);
-#endif
-  SetPortWindowPort (FRAME_MAC_WINDOW (f));
-
-  SetRect (&r, x, y, x + width, y + height);
-
-  InvertRect (&r);
-}
-
-
-static void
+      context = mac_begin_cg_clip (f, gc);
+#else
+      CGrafPtr port;
+
+      GetPort (&port);
+      QDBeginCGContext (port, &context);
+      if (gc->n_clip_rects || bg_width)
+	{
+	  CGContextTranslateCTM (context, 0, port_height);
+	  CGContextScaleCTM (context, 1, -1);
+	  if (gc->n_clip_rects)
+	    CGContextClipToRects (context, gc->clip_rects,
+				  gc->n_clip_rects);
+#endif
+	  if (bg_width)
+	    {
+	      CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
+	      CGContextFillRect	(context,
+				 CGRectMake (x, y - FONT_BASE (GC_FONT (gc)),
+					     bg_width,
+					     FONT_HEIGHT (GC_FONT (gc))));
+	    }
+	  CGContextScaleCTM (context, 1, -1);
+	  CGContextTranslateCTM (context, 0, -port_height);
+#if !USE_CG_DRAWING
+	}
+#endif
+      CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc);
+      err = ATSUSetLayoutControls (text_layout,
+				   sizeof (tags) / sizeof (tags[0]),
+				   tags, sizes, values);
+      if (err == noErr)
+	{
+	  ATSUDrawText (text_layout,
+			kATSUFromTextBeginning, kATSUToTextEnd,
+			Long2Fix (x), Long2Fix (port_height - y));
+	  if (overstrike_p)
+	    ATSUDrawText (text_layout,
+			  kATSUFromTextBeginning, kATSUToTextEnd,
+			  Long2Fix (x + 1), Long2Fix (port_height - y));
+	}
+#if USE_CG_DRAWING
+      mac_end_cg_clip (f);
+      context = NULL;
+#else
+      CGContextSynchronize (context);
+      QDEndCGContext (port, &context);
+#endif
+#if 0
+      /* This doesn't work on Mac OS X 10.1.  */
+      ATSUClearLayoutControls (text_layout,
+			       sizeof (tags) / sizeof (tags[0]), tags);
+#else
+      ATSUSetLayoutControls (text_layout,
+			     sizeof (tags) / sizeof (tags[0]),
+			     tags, sizes, values);
+#endif
+    }
+#endif	/* MAC_OSX */
+}
+#endif	/* USE_ATSUI */
+
+
+static void
+mac_draw_image_string_qd (f, gc, x, y, buf, nchars, bg_width,
+			  overstrike_p, bytes_per_char)
+     struct frame *f;
+     GC gc;
+     int x, y;
+     char *buf;
+     int nchars, bg_width, overstrike_p, bytes_per_char;
+{
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
+  UInt32 savedFlags;
+#endif
+
+  mac_begin_clip (f, gc);
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
+  if (mac_use_core_graphics)
+    savedFlags = SwapQDTextFlags (kQDUseCGTextRendering);
+#endif
+  RGBForeColor (GC_FORE_COLOR (gc));
+#ifdef MAC_OS8
+  if (bg_width)
+    {
+      RGBBackColor (GC_BACK_COLOR (gc));
+      TextMode (srcCopy);
+    }
+  else
+    TextMode (srcOr);
+#else
+  /* We prefer not to use srcCopy text transfer mode on Mac OS X
+     because:
+     - Screen is double-buffered.  (In srcCopy mode, a text is drawn
+       into an offscreen graphics world first.  So performance gain
+       cannot be expected.)
+     - It lowers rendering quality.
+     - Some fonts leave garbage on cursor movement.  */
+  if (bg_width)
+    {
+      Rect r;
+
+      RGBBackColor (GC_BACK_COLOR (gc));
+      SetRect (&r, x, y - FONT_BASE (GC_FONT (gc)),
+	       x + bg_width, y + FONT_DESCENT (GC_FONT (gc)));
+      EraseRect (&r);
+    }
+  TextMode (srcOr);
+#endif
+  TextFont (GC_FONT (gc)->mac_fontnum);
+  TextSize (GC_FONT (gc)->mac_fontsize);
+  TextFace (GC_FONT (gc)->mac_fontface);
+  MoveTo (x, y);
+  DrawText (buf, 0, nchars * bytes_per_char);
+  if (overstrike_p)
+    {
+      TextMode (srcOr);
+      MoveTo (x + 1, y);
+      DrawText (buf, 0, nchars * bytes_per_char);
+    }
+  if (bg_width)
+    RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
+  mac_end_clip (gc);
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
+  if (mac_use_core_graphics)
+    SwapQDTextFlags(savedFlags);
+#endif
+}
+
+
+static INLINE void
 mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width,
 			overstrike_p, bytes_per_char)
      struct frame *f;
@@ -975,193 +1162,14 @@
      char *buf;
      int nchars, bg_width, overstrike_p, bytes_per_char;
 {
-  SetPortWindowPort (FRAME_MAC_WINDOW (f));
-
 #if USE_ATSUI
   if (GC_FONT (gc)->mac_style)
-    {
-      OSStatus err;
-      ATSUTextLayout text_layout;
-
-      xassert (bytes_per_char == 2);
-
-#ifndef WORDS_BIG_ENDIAN
-      {
-	int i;
-	UniChar *text = (UniChar *)buf;
-
-	for (i = 0; i < nchars; i++)
-	  text[i] = EndianU16_BtoN (text[i]);
-      }
-#endif
-      err = atsu_get_text_layout_with_text_ptr ((ConstUniCharArrayPtr)buf,
-						nchars,
-						GC_FONT (gc)->mac_style,
-						&text_layout);
-      if (err != noErr)
-	return;
-#ifdef MAC_OSX
-      if (!mac_use_core_graphics)
-	{
-#endif
-#if USE_CG_DRAWING
-	  mac_prepare_for_quickdraw (f);
-#endif
-	  mac_begin_clip (gc);
-	  RGBForeColor (GC_FORE_COLOR (gc));
-	  if (bg_width)
-	    {
-	      Rect r;
-
-	      SetRect (&r, x, y - FONT_BASE (GC_FONT (gc)),
-		       x + bg_width, y + FONT_DESCENT (GC_FONT (gc)));
-	      RGBBackColor (GC_BACK_COLOR (gc));
-	      EraseRect (&r);
-	      RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
-	    }
-	  MoveTo (x, y);
-	  ATSUDrawText (text_layout,
-			kATSUFromTextBeginning, kATSUToTextEnd,
-			kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
-	  if (overstrike_p)
-	    {
-	      MoveTo (x + 1, y);
-	      ATSUDrawText (text_layout,
-			    kATSUFromTextBeginning, kATSUToTextEnd,
-			    kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
-	    }
-	  mac_end_clip (gc);
-#ifdef MAC_OSX
-	}
-      else
-	{
-	  CGrafPtr port;
-	  static CGContextRef context;
-	  float port_height = FRAME_PIXEL_HEIGHT (f);
-	  static const ATSUAttributeTag tags[] = {kATSUCGContextTag};
-	  static const ByteCount sizes[] = {sizeof (CGContextRef)};
-	  static const ATSUAttributeValuePtr values[] = {&context};
-
-#if USE_CG_DRAWING
-	  context = mac_begin_cg_clip (f, gc);
-#else
-	  GetPort (&port);
-	  QDBeginCGContext (port, &context);
-	  if (gc->n_clip_rects || bg_width)
-	    {
-	      CGContextTranslateCTM (context, 0, port_height);
-	      CGContextScaleCTM (context, 1, -1);
-	      if (gc->n_clip_rects)
-		CGContextClipToRects (context, gc->clip_rects,
-				      gc->n_clip_rects);
-#endif
-	      if (bg_width)
-		{
-		  CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
-		  CGContextFillRect
-		    (context,
-		     CGRectMake (x, y - FONT_BASE (GC_FONT (gc)),
-				 bg_width, FONT_HEIGHT (GC_FONT (gc))));
-		}
-	      CGContextScaleCTM (context, 1, -1);
-	      CGContextTranslateCTM (context, 0, -port_height);
-#if !USE_CG_DRAWING
-	    }
-#endif
-	  CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc);
-	  err = ATSUSetLayoutControls (text_layout,
-				       sizeof (tags) / sizeof (tags[0]),
-				       tags, sizes, values);
-	  if (err == noErr)
-	    {
-	      ATSUDrawText (text_layout,
-			    kATSUFromTextBeginning, kATSUToTextEnd,
-			    Long2Fix (x), Long2Fix (port_height - y));
-	      if (overstrike_p)
-		ATSUDrawText (text_layout,
-			      kATSUFromTextBeginning, kATSUToTextEnd,
-			      Long2Fix (x + 1), Long2Fix (port_height - y));
-	    }
-#if USE_CG_DRAWING
-	  mac_end_cg_clip (f);
-	  context = NULL;
-#else
-	  CGContextSynchronize (context);
-	  QDEndCGContext (port, &context);
-#endif
-#if 0
-	  /* This doesn't work on Mac OS X 10.1.  */
-	  ATSUClearLayoutControls (text_layout,
-				   sizeof (tags) / sizeof (tags[0]), tags);
-#else
-	  ATSUSetLayoutControls (text_layout,
-				 sizeof (tags) / sizeof (tags[0]),
-				 tags, sizes, values);
-#endif
-	}
-#endif	/* MAC_OSX */
-    }
+    mac_draw_image_string_atsui (f, gc, x, y, buf, nchars, bg_width,
+				 overstrike_p, bytes_per_char);
   else
 #endif	/* USE_ATSUI */
-    {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
-      UInt32 savedFlags;
-
-      if (mac_use_core_graphics)
-	savedFlags = SwapQDTextFlags (kQDUseCGTextRendering);
-#endif
-#if USE_CG_DRAWING
-      mac_prepare_for_quickdraw (f);
-#endif
-      mac_begin_clip (gc);
-      RGBForeColor (GC_FORE_COLOR (gc));
-#ifdef MAC_OS8
-      if (bg_width)
-	{
-	  RGBBackColor (GC_BACK_COLOR (gc));
-	  TextMode (srcCopy);
-	}
-      else
-	TextMode (srcOr);
-#else
-      /* We prefer not to use srcCopy text transfer mode on Mac OS X
-	 because:
-	 - Screen is double-buffered.  (In srcCopy mode, a text is
-	   drawn into an offscreen graphics world first.  So
-	   performance gain cannot be expected.)
-	 - It lowers rendering quality.
-	 - Some fonts leave garbage on cursor movement.  */
-      if (bg_width)
-	{
-	  Rect r;
-
-	  RGBBackColor (GC_BACK_COLOR (gc));
-	  SetRect (&r, x, y - FONT_BASE (GC_FONT (gc)),
-		   x + bg_width, y + FONT_DESCENT (GC_FONT (gc)));
-	  EraseRect (&r);
-	}
-      TextMode (srcOr);
-#endif
-      TextFont (GC_FONT (gc)->mac_fontnum);
-      TextSize (GC_FONT (gc)->mac_fontsize);
-      TextFace (GC_FONT (gc)->mac_fontface);
-      MoveTo (x, y);
-      DrawText (buf, 0, nchars * bytes_per_char);
-      if (overstrike_p)
-	{
-	  TextMode (srcOr);
-	  MoveTo (x + 1, y);
-	  DrawText (buf, 0, nchars * bytes_per_char);
-	}
-      if (bg_width)
-	RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
-      mac_end_clip (gc);
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
-      if (mac_use_core_graphics)
-	SwapQDTextFlags(savedFlags);
-#endif
-    }
+    mac_draw_image_string_qd (f, gc, x, y, buf, nchars, bg_width,
+			      overstrike_p, bytes_per_char);
 }
 
 
@@ -1378,7 +1386,6 @@
      XChar2b *buf;
      int nchars, bg_width, overstrike_p;
 {
-  CGrafPtr port;
   float port_height, gx, gy;
   int i;
   CGContextRef context;
@@ -1388,7 +1395,6 @@
   if (!mac_use_core_graphics || GC_FONT (gc)->cg_font == NULL)
     return 0;
 
-  port = GetWindowPort (FRAME_MAC_WINDOW (f));
   port_height = FRAME_PIXEL_HEIGHT (f);
   gx = x;
   gy = port_height - y;
@@ -1409,7 +1415,7 @@
 #if USE_CG_DRAWING
   context = mac_begin_cg_clip (f, gc);
 #else
-  QDBeginCGContext (port, &context);
+  QDBeginCGContext (GetWindowPort (FRAME_MAC_WINDOW (f)), &context);
   if (gc->n_clip_rects || bg_width)
     {
       CGContextTranslateCTM (context, 0, port_height);
@@ -1449,7 +1455,7 @@
 	}
     }
 #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
-  else
+  else			 /* CGContextShowGlyphsWithAdvances == NULL */
 #endif
 #endif	/* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030  */
 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
@@ -1467,7 +1473,7 @@
   mac_end_cg_clip (f);
 #else
   CGContextSynchronize (context);
-  QDEndCGContext (port, &context);
+  QDEndCGContext (GetWindowPort (FRAME_MAC_WINDOW (f)), &context);
 #endif
 
   return 1;
@@ -1489,7 +1495,7 @@
 {
   Rect src_r, dest_r;
 
-  SetPortWindowPort (FRAME_MAC_WINDOW (f));
+  mac_begin_clip (f, gc);
 
   SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
   SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
@@ -1497,7 +1503,6 @@
   ForeColor (blackColor);
   BackColor (whiteColor);
 
-  mac_begin_clip (gc);
   LockPixels (GetGWorldPixMap (src));
 #if TARGET_API_MAC_CARBON
   {
@@ -1515,9 +1520,10 @@
 	    &src_r, &dest_r, srcCopy, 0);
 #endif /* not TARGET_API_MAC_CARBON */
   UnlockPixels (GetGWorldPixMap (src));
-  mac_end_clip (gc);
 
   RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
+
+  mac_end_clip (gc);
 }
 
 
@@ -1533,7 +1539,7 @@
 {
   Rect src_r, dest_r;
 
-  SetPortWindowPort (FRAME_MAC_WINDOW (f));
+  mac_begin_clip (f, gc);
 
   SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
   SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
@@ -1541,7 +1547,6 @@
   ForeColor (blackColor);
   BackColor (whiteColor);
 
-  mac_begin_clip (gc);
   LockPixels (GetGWorldPixMap (src));
   LockPixels (GetGWorldPixMap (mask));
 #if TARGET_API_MAC_CARBON
@@ -1561,9 +1566,10 @@
 #endif /* not TARGET_API_MAC_CARBON */
   UnlockPixels (GetGWorldPixMap (mask));
   UnlockPixels (GetGWorldPixMap (src));
-  mac_end_clip (gc);
 
   RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
+
+  mac_end_clip (gc);
 }
 #endif	/* !USE_CG_DRAWING */
 
@@ -1592,9 +1598,9 @@
   DisposeRgn (dummy);
 #else /* not TARGET_API_MAC_CARBON */
   Rect src_r, dest_r;
-  WindowPtr w = FRAME_MAC_WINDOW (f);
-
-  SetPort (w);
+  WindowRef w = FRAME_MAC_WINDOW (f);
+
+  mac_begin_clip (f, gc);
 
   SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
   SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
@@ -1603,11 +1609,11 @@
      color mapping in CopyBits.  Otherwise, it will be slow.  */
   ForeColor (blackColor);
   BackColor (whiteColor);
-  mac_begin_clip (gc);
   CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0);
-  mac_end_clip (gc);
 
   RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
+
+  mac_end_clip (gc);
 #endif /* not TARGET_API_MAC_CARBON */
 }
 
@@ -1852,7 +1858,7 @@
 void
 XSetWindowBackground (display, w, color)
      Display *display;
-     WindowPtr w;
+     WindowRef w;
      unsigned long color;
 {
 #if !TARGET_API_MAC_CARBON
@@ -4375,7 +4381,7 @@
 {
   struct frame *frame;
 
-  frame = mac_window_to_frame ((WindowPtr) event->message);
+  frame = mac_window_to_frame ((WindowRef) event->message);
   if (! frame)
     return;
 
@@ -4615,8 +4621,14 @@
 	     the frame are divided into.  */
 	  Point mouse_pos;
 
+#if TARGET_API_MAC_CARBON
+	  GetGlobalMouse (&mouse_pos);
+	  mouse_pos.h -= f1->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f1);
+	  mouse_pos.v -= f1->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f1);
+#else
 	  SetPortWindowPort (FRAME_MAC_WINDOW (f1));
 	  GetMouse (&mouse_pos);
+#endif
 	  remember_mouse_glyph (f1, mouse_pos.h, mouse_pos.v,
 				&last_mouse_glyph);
 	  last_mouse_glyph_frame = f1;
@@ -4646,14 +4658,14 @@
 static int control_part_code_to_scroll_bar_part P_ ((ControlPartCode));
 static void construct_scroll_bar_click P_ ((struct scroll_bar *, int,
 					    struct input_event *));
-static OSStatus get_control_part_bounds P_ ((ControlHandle, ControlPartCode,
+static OSStatus get_control_part_bounds P_ ((ControlRef, ControlPartCode,
 					     Rect *));
 static void x_scroll_bar_handle_press P_ ((struct scroll_bar *,
 					   ControlPartCode, Point,
 					   struct input_event *));
 static void x_scroll_bar_handle_release P_ ((struct scroll_bar *,
 					     struct input_event *));
-static void x_scroll_bar_handle_drag P_ ((WindowPtr, struct scroll_bar *,
+static void x_scroll_bar_handle_drag P_ ((WindowRef, struct scroll_bar *,
 					  Point, struct input_event *));
 static void x_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *,
 						int, int, int));
@@ -4746,7 +4758,7 @@
 
 static OSStatus
 get_control_part_bounds (ch, part_code, rect)
-     ControlHandle ch;
+     ControlRef ch;
      ControlPartCode part_code;
      Rect *rect;
 {
@@ -4776,7 +4788,7 @@
   if (part != scroll_bar_handle)
     {
       construct_scroll_bar_click (bar, part, bufp);
-      HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code);
+      HiliteControl (SCROLL_BAR_CONTROL_REF (bar), part_code);
       set_scroll_bar_timer (SCROLL_BAR_FIRST_DELAY);
       bar->dragging = Qnil;
     }
@@ -4784,7 +4796,7 @@
     {
       Rect r;
 
-      get_control_part_bounds (SCROLL_BAR_CONTROL_HANDLE (bar),
+      get_control_part_bounds (SCROLL_BAR_CONTROL_REF (bar),
 			       kControlIndicatorPart, &r);
       XSETINT (bar->dragging, - (mouse_pos.v - r.top) - 1);
     }
@@ -4802,7 +4814,7 @@
       || (INTEGERP (bar->dragging) && XINT (bar->dragging) >= 0))
     construct_scroll_bar_click (bar, scroll_bar_end_scroll, bufp);
 
-  HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0);
+  HiliteControl (SCROLL_BAR_CONTROL_REF (bar), 0);
   set_scroll_bar_timer (kEventDurationForever);
 
   last_scroll_bar_part = -1;
@@ -4812,19 +4824,19 @@
 
 static void
 x_scroll_bar_handle_drag (win, bar, mouse_pos, bufp)
-     WindowPtr win;
+     WindowRef win;
      struct scroll_bar *bar;
      Point mouse_pos;
      struct input_event *bufp;
 {
-  ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
+  ControlRef ch = SCROLL_BAR_CONTROL_REF (bar);
 
   if (last_scroll_bar_part == scroll_bar_handle)
     {
       int top, top_range;
       Rect r;
 
-      get_control_part_bounds (SCROLL_BAR_CONTROL_HANDLE (bar),
+      get_control_part_bounds (SCROLL_BAR_CONTROL_REF (bar),
 			       kControlIndicatorPart, &r);
 
       if (INTEGERP (bar->dragging) && XINT (bar->dragging) < 0)
@@ -4872,13 +4884,13 @@
 	}
 
       if (unhilite_p)
-	HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0);
+	HiliteControl (SCROLL_BAR_CONTROL_REF (bar), 0);
       else if (part != last_scroll_bar_part
 	       || scroll_bar_timer_event_posted_p)
 	{
 	  construct_scroll_bar_click (bar, part, bufp);
 	  last_scroll_bar_part = part;
-	  HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code);
+	  HiliteControl (SCROLL_BAR_CONTROL_REF (bar), part_code);
 	  set_scroll_bar_timer (SCROLL_BAR_CONTINUOUS_DELAY);
 	}
     }
@@ -4892,7 +4904,7 @@
      struct scroll_bar *bar;
      int portion, position, whole;
 {
-  ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
+  ControlRef ch = SCROLL_BAR_CONTROL_REF (bar);
   int value, viewsize, maximum;
 
   if (XINT (bar->track_height) == 0)
@@ -4951,7 +4963,7 @@
   struct scroll_bar *bar
     = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil));
   Rect r;
-  ControlHandle ch;
+  ControlRef ch;
 
   BLOCK_INPUT;
 
@@ -4975,7 +4987,7 @@
   ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", width < disp_height,
 		   0, 0, 0, scrollBarProc, (long) bar);
 #endif
-  SET_SCROLL_BAR_CONTROL_HANDLE (bar, ch);
+  SET_SCROLL_BAR_CONTROL_REF (bar, ch);
 
   XSETWINDOW (bar->window, w);
   XSETINT (bar->top, top);
@@ -5025,7 +5037,7 @@
      int rebuild;
 {
   int dragging = ! NILP (bar->dragging);
-  ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
+  ControlRef ch = SCROLL_BAR_CONTROL_REF (bar);
   FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
   int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height));
   int length = end - start;
@@ -5094,7 +5106,7 @@
   mac_prepare_for_quickdraw (f);
 #endif
   /* Destroy the Mac scroll bar control  */
-  DisposeControl (SCROLL_BAR_CONTROL_HANDLE (bar));
+  DisposeControl (SCROLL_BAR_CONTROL_REF (bar));
 
   /* Disassociate this scroll bar from its window.  */
   XWINDOW (bar->window)->vertical_scroll_bar = Qnil;
@@ -5172,10 +5184,10 @@
   else
     {
       /* It may just need to be moved and resized.  */
-      ControlHandle ch;
+      ControlRef ch;
 
       bar = XSCROLL_BAR (w->vertical_scroll_bar);
-      ch = SCROLL_BAR_CONTROL_HANDLE (bar);
+      ch = SCROLL_BAR_CONTROL_REF (bar);
 
       BLOCK_INPUT;
 
@@ -5231,7 +5243,7 @@
 	}
       else
 	{
-	  ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
+	  ControlRef ch = SCROLL_BAR_CONTROL_REF (bar);
 	  Rect r0, r1;
 
 	  BLOCK_INPUT;
@@ -5508,19 +5520,24 @@
      unsigned long *time;
 {
   struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
-  ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
+  ControlRef ch = SCROLL_BAR_CONTROL_REF (bar);
 #if TARGET_API_MAC_CARBON
-  WindowPtr wp = GetControlOwner (ch);
+  WindowRef wp = GetControlOwner (ch);
 #else
-  WindowPtr wp = (*ch)->contrlOwner;
+  WindowRef wp = (*ch)->contrlOwner;
 #endif
   Point mouse_pos;
   struct frame *f = mac_window_to_frame (wp);
   int win_y, top_range;
 
+#if TARGET_API_MAC_CARBON
+  GetGlobalMouse (&mouse_pos);
+  mouse_pos.h -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
+  mouse_pos.v -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
+#else
   SetPortWindowPort (wp);
-
   GetMouse (&mouse_pos);
+#endif
 
   win_y = mouse_pos.v - XINT (bar->top);
   top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height));
@@ -6165,9 +6182,7 @@
   ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn,
 			   kWindowConstrainMoveRegardlessOfFit
 			   | kWindowConstrainAllowPartial, NULL, NULL);
-#if USE_CARBON_EVENTS
   if (!NILP (tip_frame) && XFRAME (tip_frame) == f)
-#endif
     mac_handle_origin_change (f);
 #else
   {
@@ -6243,7 +6258,7 @@
 
   SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0);
 
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
   if (!NILP (tip_frame) && f == XFRAME (tip_frame))
 #endif
     mac_handle_size_change (f, pixelwidth, pixelheight);
@@ -6290,17 +6305,11 @@
      int pix_x, pix_y;
 {
 #ifdef MAC_OSX
-  Point p;
-  CGPoint point;
+  pix_x += f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
+  pix_y += f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
 
   BLOCK_INPUT;
-  SetPortWindowPort (FRAME_MAC_WINDOW (f));
-  p.h = pix_x;
-  p.v = pix_y;
-  LocalToGlobal (&p);
-  point.x = p.h;
-  point.y = p.v;
-  CGWarpMouseCursorPosition (point);
+  CGWarpMouseCursorPosition (CGPointMake (pix_x, pix_y));
   UNBLOCK_INPUT;
 #else
 #if 0 /* MAC_TODO: LMSetMouseLocation and CursorDeviceMoveTo are non-Carbon */
@@ -6382,7 +6391,7 @@
 mac_handle_visibility_change (f)
      struct frame *f;
 {
-  WindowPtr wp = FRAME_MAC_WINDOW (f);
+  WindowRef wp = FRAME_MAC_WINDOW (f);
   int visible = 0, iconified = 0;
   struct input_event buf;
 
@@ -6450,32 +6459,7 @@
 	 before the window gets really visible.  */
       if (! FRAME_ICONIFIED_P (f)
 	  && ! f->output_data.mac->asked_for_visible)
-	{
-#if TARGET_API_MAC_CARBON
-	  if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition)))
-	    {
-	      struct frame *sf = SELECTED_FRAME ();
-	      if (!FRAME_MAC_P (sf))
-		RepositionWindow (FRAME_MAC_WINDOW (f), NULL,
-				  kWindowCenterOnMainScreen);
-	      else
-		RepositionWindow (FRAME_MAC_WINDOW (f),
-				  FRAME_MAC_WINDOW (sf),
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
-				  kWindowCascadeStartAtParentWindowScreen
-#else
-				  kWindowCascadeOnParentWindowScreen
-#endif
-				  );
-#if USE_CARBON_EVENTS
-	      if (!NILP (tip_frame) && f == XFRAME (tip_frame))
-#endif
-		mac_handle_origin_change (f);
-	    }
-	  else
-#endif
-	    x_set_offset (f, f->left_pos, f->top_pos, 0);
-	}
+	x_set_offset (f, f->left_pos, f->top_pos, 0);
 
       f->output_data.mac->asked_for_visible = 1;
 
@@ -6549,18 +6533,20 @@
 
   BLOCK_INPUT;
 
+#if !TARGET_API_MAC_CARBON
   /* Before unmapping the window, update the WM_SIZE_HINTS property to claim
      that the current position of the window is user-specified, rather than
      program-specified, so that when the window is mapped again, it will be
      placed at the same location, without forcing the user to position it
      by hand again (they have already done that once for this window.)  */
   x_wm_set_size_hint (f, (long) 0, 1);
+#endif
 
   HideWindow (FRAME_MAC_WINDOW (f));
 
   UNBLOCK_INPUT;
 
-#if !USE_CARBON_EVENTS
+#if !TARGET_API_MAC_CARBON
   mac_handle_visibility_change (f);
 #endif
 }
@@ -6599,7 +6585,7 @@
   if (err != noErr)
     error ("Can't notify window manager of iconification");
 
-#if !USE_CARBON_EVENTS
+#if !TARGET_API_MAC_CARBON
   mac_handle_visibility_change (f);
 #endif
 }
@@ -6612,7 +6598,7 @@
      struct frame *f;
 {
   struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
-  WindowPtr wp = FRAME_MAC_WINDOW (f);
+  WindowRef wp = FRAME_MAC_WINDOW (f);
 
   BLOCK_INPUT;
 
@@ -8749,16 +8735,93 @@
    possible.  */
 static int font_panel_shown_p = 0;
 
+extern Lisp_Object Qfont;
+static Lisp_Object Qpanel_closed, Qselection;
+
+static OSStatus mac_store_event_ref_as_apple_event P_ ((AEEventClass, AEEventID,
+							Lisp_Object,
+							Lisp_Object,
+							EventRef, UInt32,
+							const EventParamName *,
+							const EventParamType *));
+
 int
 mac_font_panel_visible_p ()
 {
   return font_panel_shown_p && FPIsFontPanelVisible ();
 }
 
+static pascal OSStatus
+mac_handle_font_event (next_handler, event, data)
+     EventHandlerCallRef next_handler;
+     EventRef event;
+     void *data;
+{
+  OSStatus result, err;
+  Lisp_Object id_key;
+  int num_params;
+  const EventParamName *names;
+  const EventParamType *types;
+  static const EventParamName names_sel[] = {kEventParamATSUFontID,
+					     kEventParamATSUFontSize,
+					     kEventParamFMFontFamily,
+					     kEventParamFMFontSize,
+					     kEventParamFontColor};
+  static const EventParamType types_sel[] = {typeATSUFontID,
+					     typeATSUSize,
+					     typeFMFontFamily,
+					     typeFMFontSize,
+					     typeFontColor};
+
+  result = CallNextEventHandler (next_handler, event);
+  if (result != eventNotHandledErr)
+    return result;
+
+  switch (GetEventKind (event))
+    {
+    case kEventFontPanelClosed:
+      id_key = Qpanel_closed;
+      num_params = 0;
+      names = NULL;
+      types = NULL;
+      break;
+
+    case kEventFontSelection:
+      id_key = Qselection;
+      num_params = sizeof (names_sel) / sizeof (names_sel[0]);
+      names = names_sel;
+      types = types_sel;
+      break;
+    }
+
+  err = mac_store_event_ref_as_apple_event (0, 0, Qfont, id_key,
+					    event, num_params,
+					    names, types);
+  if (err == noErr)
+    result = noErr;
+
+  return result;
+}
+
 OSStatus
 mac_show_hide_font_panel ()
 {
-  font_panel_shown_p = 1;
+  if (!font_panel_shown_p)
+    {
+      OSStatus err;
+
+      static const EventTypeSpec specs[] =
+	{{kEventClassFont, kEventFontPanelClosed},
+	 {kEventClassFont, kEventFontSelection}};
+
+      err = InstallApplicationEventHandler (mac_handle_font_event,
+					    GetEventTypeCount (specs),
+					    specs, NULL, NULL);
+      if (err != noErr)
+	return err;
+
+      font_panel_shown_p = 1;
+    }
 
   return FPShowHideFontPanel ();
 }
@@ -8874,7 +8937,7 @@
    a three button mouse */
 Lisp_Object Vmac_emulate_three_button_mouse;
 
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
 /* Non-zero if the mouse wheel button (i.e. button 4) should map to
    mouse-2, instead of mouse-3.  */
 int mac_wheel_button_is_mouse_2;
@@ -8899,16 +8962,12 @@
 Point saved_menu_event_location;
 
 /* Apple Events */
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
 static Lisp_Object Qhi_command;
 #ifdef MAC_OSX
 extern Lisp_Object Qwindow;
 static Lisp_Object Qtoolbar_switch_mode;
 #endif
-#if USE_MAC_FONT_PANEL
-extern Lisp_Object Qfont;
-static Lisp_Object Qpanel_closed, Qselection;
-#endif
 #if USE_MAC_TSM
 static TSMDocumentID tsm_document_id;
 static Lisp_Object Qtext_input;
@@ -8920,7 +8979,7 @@
 static ScriptLanguageRecord saved_ts_language;
 static Component saved_ts_component;
 #endif
-#endif
+#endif	/* TARGET_API_MAC_CARBON */
 extern int mac_ready_for_apple_events;
 extern Lisp_Object Qundefined;
 extern void init_apple_event_handler P_ ((void));
@@ -8933,20 +8992,15 @@
 extern OSErr install_drag_handler P_ ((WindowRef));
 extern void remove_drag_handler P_ ((WindowRef));
 
+#if TARGET_API_MAC_CARBON
 /* Showing help echo string during menu tracking  */
-extern OSStatus install_menu_target_item_handler P_ ((WindowPtr));
-
-#if USE_CARBON_EVENTS
+extern OSStatus install_menu_target_item_handler P_ ((void));
+
 #ifdef MAC_OSX
-extern void init_service_handler ();
+extern OSStatus install_service_handler ();
 static Lisp_Object Qservice, Qpaste, Qperform;
 #endif
-
-/* Window Event Handler */
-static pascal OSStatus mac_handle_window_event (EventHandlerCallRef,
-						EventRef, void *);
-#endif
-OSStatus install_window_handler (WindowPtr);
+#endif
 
 extern void init_emacs_passwd_dir ();
 extern int emacs_main (int, char **, char **);
@@ -9030,7 +9084,7 @@
 #endif	/* MAC_OSX */
 
 static int
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
 mac_to_emacs_modifiers (UInt32 mods)
 #else
 mac_to_emacs_modifiers (EventModifiers mods)
@@ -9139,17 +9193,19 @@
 }
 #endif
 
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
 /* Obtains the event modifiers from the event ref and then calls
    mac_to_emacs_modifiers.  */
 static int
 mac_event_to_emacs_modifiers (EventRef eventRef)
 {
-  UInt32 mods = 0;
+  UInt32 mods = 0, class;
+
   GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL,
 		    sizeof (UInt32), NULL, &mods);
+  class = GetEventClass (eventRef);
   if (!NILP (Vmac_emulate_three_button_mouse) &&
-      GetEventClass(eventRef) == kEventClassMouse)
+      (class == kEventClassMouse || class == kEventClassCommand))
     {
       mods &= ~(optionKey | cmdKey);
     }
@@ -9288,7 +9344,7 @@
 do_get_menus (void)
 {
   Handle menubar_handle;
-  MenuHandle menu_handle;
+  MenuRef menu;
 
   menubar_handle = GetNewMBar (128);
   if(menubar_handle == NULL)
@@ -9297,9 +9353,9 @@
   DrawMenuBar ();
 
 #if !TARGET_API_MAC_CARBON
-  menu_handle = GetMenuHandle (M_APPLE);
-  if(menu_handle != NULL)
-    AppendResMenu (menu_handle,'DRVR');
+  menu = GetMenuRef (M_APPLE);
+  if (menu != NULL)
+    AppendResMenu (menu, 'DRVR');
   else
     abort ();
 #endif
@@ -9348,7 +9404,7 @@
 #endif /* MAC_OS8 */
 
 static void
-do_window_update (WindowPtr win)
+do_window_update (WindowRef win)
 {
   struct frame *f = mac_window_to_frame (win);
 
@@ -9393,7 +9449,7 @@
 }
 
 static int
-is_emacs_window (WindowPtr win)
+is_emacs_window (WindowRef win)
 {
   Lisp_Object tail, frame;
 
@@ -9506,7 +9562,7 @@
     NoteAlert (ABOUT_ALERT_ID, NULL);
   else
     {
-      GetMenuItemText (GetMenuHandle (M_APPLE), menu_item, item_name);
+      GetMenuItemText (GetMenuRef (M_APPLE), menu_item, item_name);
       da_driver_refnum = OpenDeskAcc (item_name);
     }
 }
@@ -9517,7 +9573,7 @@
 
 static void
 do_grow_window (w, e)
-     WindowPtr w;
+     WindowRef w;
      const EventRecord *e;
 {
   Rect limit_rect;
@@ -9569,7 +9625,7 @@
      struct frame *f;
 {
   struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
-  WindowPtr w = FRAME_MAC_WINDOW (f);
+  WindowRef w = FRAME_MAC_WINDOW (f);
   Point ideal_size;
   Rect standard_rect;
   int height, width, columns, rows;
@@ -9595,7 +9651,7 @@
    wide (DEFAULT_NUM_COLS) and as tall as will fit on the screen.  */
 
 static void
-do_zoom_window (WindowPtr w, int zoom_in_or_out)
+do_zoom_window (WindowRef w, int zoom_in_or_out)
 {
   Rect zoom_rect, port_rect;
   int width, height;
@@ -9658,13 +9714,9 @@
   SetPort (save_port);
 #endif /* not TARGET_API_MAC_CARBON */
 
-#if !USE_CARBON_EVENTS
+#if !TARGET_API_MAC_CARBON
   /* retrieve window size and update application values */
-#if TARGET_API_MAC_CARBON
-  GetWindowPortBounds (w, &port_rect);
-#else
   port_rect = w->portRect;
-#endif
   height = port_rect.bottom - port_rect.top;
   width = port_rect.right - port_rect.left;
 
@@ -9673,6 +9725,210 @@
 #endif
 }
 
+static void
+mac_set_unicode_keystroke_event (code, buf)
+     UniChar code;
+     struct input_event *buf;
+{
+  int charset_id, c1, c2;
+
+  if (code < 0x80)
+    {
+      buf->kind = ASCII_KEYSTROKE_EVENT;
+      buf->code = code;
+    }
+  else if (code < 0x100)
+    {
+      if (code < 0xA0)
+	charset_id = CHARSET_8_BIT_CONTROL;
+      else
+	charset_id = charset_latin_iso8859_1;
+      buf->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
+      buf->code = MAKE_CHAR (charset_id, code, 0);
+    }
+  else
+    {
+      if (code < 0x2500)
+	charset_id = charset_mule_unicode_0100_24ff,
+	  code -= 0x100;
+      else if (code < 0x33FF)
+	charset_id = charset_mule_unicode_2500_33ff,
+	  code -= 0x2500;
+      else if (code >= 0xE000)
+	charset_id = charset_mule_unicode_e000_ffff,
+	  code -= 0xE000;
+      c1 = (code / 96) + 32, c2 = (code % 96) + 32;
+      buf->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
+      buf->code = MAKE_CHAR (charset_id, c1, c2);
+    }
+}
+
+static void
+do_keystroke (action, char_code, key_code, modifiers, timestamp, buf)
+     EventKind action;
+     unsigned char char_code;
+     UInt32 key_code, modifiers;
+     unsigned long timestamp;
+     struct input_event *buf;
+{
+  static SInt16 last_key_script = -1;
+  SInt16 current_key_script = GetScriptManagerVariable (smKeyScript);
+  UInt32 mapped_modifiers = mac_mapped_modifiers (modifiers);
+
+#ifdef MAC_OSX
+  if (mapped_modifiers & kEventKeyModifierFnMask
+      && key_code <= 0x7f
+      && fn_keycode_to_keycode_table[key_code])
+    key_code = fn_keycode_to_keycode_table[key_code];
+#endif
+
+  if (key_code <= 0x7f && keycode_to_xkeysym_table[key_code])
+    {
+      buf->kind = NON_ASCII_KEYSTROKE_EVENT;
+      buf->code = 0xff00 | keycode_to_xkeysym_table[key_code];
+#ifdef MAC_OSX
+      if (modifiers & kEventKeyModifierFnMask
+	  && key_code <= 0x7f
+	  && fn_keycode_to_keycode_table[key_code] == key_code)
+	modifiers &= ~kEventKeyModifierFnMask;
+#endif
+    }
+  else if (mapped_modifiers)
+    {
+      /* translate the keycode back to determine the original key */
+#ifdef MAC_OSX
+      UCKeyboardLayout *uchr_ptr = NULL;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
+      OSStatus err;
+      KeyboardLayoutRef layout;
+
+      err = KLGetCurrentKeyboardLayout (&layout);
+      if (err == noErr)
+	err = KLGetKeyboardLayoutProperty (layout, kKLuchrData,
+					   (const void **) &uchr_ptr);
+#else
+      static SInt16 last_key_layout_id = 0;
+      static Handle uchr_handle = (Handle)-1;
+      SInt16 current_key_layout_id =
+	GetScriptVariable (current_key_script, smScriptKeys);
+
+      if (uchr_handle == (Handle)-1
+	  || last_key_layout_id != current_key_layout_id)
+	{
+	  uchr_handle = GetResource ('uchr', current_key_layout_id);
+	  last_key_layout_id = current_key_layout_id;
+	}
+      if (uchr_handle)
+	uchr_ptr = (UCKeyboardLayout *)*uchr_handle;
+#endif
+
+      if (uchr_ptr)
+	{
+	  OSStatus status;
+	  UInt16 key_action = action - keyDown;
+	  UInt32 modifier_key_state = (modifiers & ~mapped_modifiers) >> 8;
+	  UInt32 keyboard_type = LMGetKbdType ();
+	  SInt32 dead_key_state = 0;
+	  UniChar code;
+	  UniCharCount actual_length;
+
+	  status = UCKeyTranslate (uchr_ptr, key_code, key_action,
+				   modifier_key_state, keyboard_type,
+				   kUCKeyTranslateNoDeadKeysMask,
+				   &dead_key_state,
+				   1, &actual_length, &code);
+	  if (status == noErr && actual_length == 1)
+	    mac_set_unicode_keystroke_event (code, buf);
+	}
+#endif	/* MAC_OSX */
+
+      if (buf->kind == NO_EVENT)
+	{
+	  /* This code comes from Keyboard Resource, Appendix C of IM
+	     - Text.  This is necessary since shift is ignored in KCHR
+	     table translation when option or command is pressed.  It
+	     also does not translate correctly control-shift chars
+	     like C-% so mask off shift here also.  */
+	  /* Mask off modifier keys that are mapped to some Emacs
+	     modifiers.  */
+	  int new_modifiers = modifiers & ~mapped_modifiers;
+	  /* set high byte of keycode to modifier high byte*/
+	  int new_key_code = key_code | new_modifiers;
+	  Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
+	  unsigned long some_state = 0;
+	  UInt32 new_char_code;
+
+	  new_char_code = KeyTranslate (kchr_ptr, new_key_code, &some_state);
+	  if (new_char_code == 0)
+	    /* Seems like a dead key.  Append up-stroke.  */
+	    new_char_code = KeyTranslate (kchr_ptr, new_key_code | 0x80,
+					  &some_state);
+	  if (new_char_code)
+	    {
+	      buf->kind = ASCII_KEYSTROKE_EVENT;
+	      buf->code = new_char_code & 0xff;
+	    }
+	}
+    }
+
+  if (buf->kind == NO_EVENT)
+    {
+      buf->kind = ASCII_KEYSTROKE_EVENT;
+      buf->code = char_code;
+    }
+
+  buf->modifiers = mac_to_emacs_modifiers (modifiers);
+  buf->modifiers |= (extra_keyboard_modifiers
+		     & (meta_modifier | alt_modifier
+			| hyper_modifier | super_modifier));
+
+#if TARGET_API_MAC_CARBON
+  if (buf->kind == ASCII_KEYSTROKE_EVENT
+      && buf->code >= 0x80 && buf->modifiers)
+    {
+      OSStatus err;
+      TextEncoding encoding = kTextEncodingMacRoman;
+      TextToUnicodeInfo ttu_info;
+
+      UpgradeScriptInfoToTextEncoding (current_key_script,
+				       kTextLanguageDontCare,
+				       kTextRegionDontCare,
+				       NULL, &encoding);
+      err = CreateTextToUnicodeInfoByEncoding (encoding, &ttu_info);
+      if (err == noErr)
+	{
+	  UniChar code;
+	  Str255 pstr;
+	  ByteCount unicode_len;
+
+	  pstr[0] = 1;
+	  pstr[1] = buf->code;
+	  err = ConvertFromPStringToUnicode (ttu_info, pstr,
+					     sizeof (UniChar),
+					     &unicode_len, &code);
+	  if (err == noErr && unicode_len == sizeof (UniChar))
+	    mac_set_unicode_keystroke_event (code, buf);
+	  DisposeTextToUnicodeInfo (&ttu_info);
+	}
+    }
+#endif
+
+  if (buf->kind == ASCII_KEYSTROKE_EVENT
+      && buf->code >= 0x80
+      && last_key_script != current_key_script)
+    {
+      struct input_event event;
+
+      EVENT_INIT (event);
+      event.kind = LANGUAGE_CHANGE_EVENT;
+      event.arg = Qnil;
+      event.code = current_key_script;
+      event.timestamp = timestamp;
+      kbd_buffer_store_event (&event);
+      last_key_script = current_key_script;
+    }
+}
+
 void
 mac_store_apple_event (class, id, desc)
      Lisp_Object class, id;
@@ -9751,54 +10007,49 @@
   buf.arg = mac_aedesc_to_lisp (desc);
   kbd_buffer_store_event (&buf);
 }
-#endif
-
-#if USE_CARBON_EVENTS
-static pascal OSStatus
-mac_handle_command_event (next_handler, event, data)
-     EventHandlerCallRef next_handler;
+
+#ifdef MAC_OSX
+OSStatus
+mac_store_service_event (event)
      EventRef event;
-     void *data;
-{
-  OSStatus result, err;
-  HICommand command;
-  static const EventParamName names[] =
-    {kEventParamDirectObject, kEventParamKeyModifiers};
-  static const EventParamType types[] =
-    {typeHICommand, typeUInt32};
-  int num_params = sizeof (names) / sizeof (names[0]);
-
-  result = CallNextEventHandler (next_handler, event);
-  if (result != eventNotHandledErr)
-    return result;
-
-  err = GetEventParameter (event, kEventParamDirectObject, typeHICommand,
-			   NULL, sizeof (HICommand), NULL, &command);
-
-  if (err != noErr || command.commandID == 0)
-    return eventNotHandledErr;
-
-  /* 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,
-					    Qhi_command, Qnil,
-					    event, num_params, names, types);
-  return err == noErr ? noErr : eventNotHandledErr;
-}
-
-static OSStatus
-init_command_handler ()
-{
-  static const EventTypeSpec specs[] =
-    {{kEventClassCommand, kEventCommandProcess}};
-  static EventHandlerUPP handle_command_eventUPP = NULL;
-
-  if (handle_command_eventUPP == NULL)
-    handle_command_eventUPP = NewEventHandlerUPP (mac_handle_command_event);
-  return InstallApplicationEventHandler (handle_command_eventUPP,
-					 GetEventTypeCount (specs), specs,
-					 NULL, NULL);
-}
+{
+  OSStatus err;
+  Lisp_Object id_key;
+  int num_params;
+  const EventParamName *names;
+  const EventParamType *types;
+  static const EventParamName names_pfm[] =
+    {kEventParamServiceMessageName, kEventParamServiceUserData};
+  static const EventParamType types_pfm[] =
+    {typeCFStringRef, typeCFStringRef};
+
+  switch (GetEventKind (event))
+    {
+    case kEventServicePaste:
+      id_key = Qpaste;
+      num_params = 0;
+      names = NULL;
+      types = NULL;
+      break;
+
+    case kEventServicePerform:
+      id_key = Qperform;
+      num_params = sizeof (names_pfm) / sizeof (names_pfm[0]);
+      names = names_pfm;
+      types = types_pfm;
+      break;
+
+    default:
+      abort ();
+    }
+
+  err = mac_store_event_ref_as_apple_event (0, 0, Qservice, id_key,
+					    event, num_params,
+					    names, types);
+
+  return err;
+}
+#endif	/* MAC_OSX */
 
 static pascal OSStatus
 mac_handle_window_event (next_handler, event, data)
@@ -9806,47 +10057,78 @@
      EventRef event;
      void *data;
 {
-  WindowPtr wp;
-  OSStatus result, err;
+  WindowRef wp;
+  OSStatus err, result = eventNotHandledErr;
   struct frame *f;
   UInt32 attributes;
   XSizeHints *size_hints;
 
   err = GetEventParameter (event, kEventParamDirectObject, typeWindowRef,
-			   NULL, sizeof (WindowPtr), NULL, &wp);
+			   NULL, sizeof (WindowRef), NULL, &wp);
   if (err != noErr)
     return eventNotHandledErr;
 
   f = mac_window_to_frame (wp);
   switch (GetEventKind (event))
     {
+      /* -- window refresh events -- */
+
     case kEventWindowUpdate:
       result = CallNextEventHandler (next_handler, event);
       if (result != eventNotHandledErr)
-	return result;
+	break;
 
       do_window_update (wp);
-      return noErr;
-
-    case kEventWindowGetIdealSize:
-      result = CallNextEventHandler (next_handler, event);
-      if (result != eventNotHandledErr)
-	return result;
-
-      {
-	Point ideal_size = mac_get_ideal_size (f);
-
-	err = SetEventParameter (event, kEventParamDimensions,
-				 typeQDPoint, sizeof (Point), &ideal_size);
-	if (err == noErr)
-	  return noErr;
-      }
+      result = noErr;
+      break;
+
+      /* -- window state change events -- */
+
+    case kEventWindowShowing:
+      size_hints = FRAME_SIZE_HINTS (f);
+      if (!(size_hints->flags & (USPosition | PPosition)))
+	{
+	  struct frame *sf = SELECTED_FRAME ();
+
+	  if (!(FRAME_MAC_P (sf)))
+	    RepositionWindow (wp, NULL, kWindowCenterOnMainScreen);
+	  else
+	    {
+	      RepositionWindow (wp, FRAME_MAC_WINDOW (sf),
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
+				kWindowCascadeStartAtParentWindowScreen
+#else
+				kWindowCascadeOnParentWindowScreen
+#endif
+				);
+	    }
+	  result = noErr;
+	}
+      break;
+
+    case kEventWindowHiding:
+      /* Before unmapping the window, update the WM_SIZE_HINTS
+	 property to claim that the current position of the window is
+	 user-specified, rather than program-specified, so that when
+	 the window is mapped again, it will be placed at the same
+	 location, without forcing the user to position it by hand
+	 again (they have already done that once for this window.)  */
+      x_wm_set_size_hint (f, (long) 0, 1);
+      result = noErr;
+      break;
+
+    case kEventWindowShown:
+    case kEventWindowHidden:
+    case kEventWindowCollapsed:
+    case kEventWindowExpanded:
+      mac_handle_visibility_change (f);
+      result = noErr;
       break;
 
     case kEventWindowBoundsChanging:
       result = CallNextEventHandler (next_handler, event);
       if (result != eventNotHandledErr)
-	return result;
+	break;
 
       err = GetEventParameter (event, kEventParamAttributes, typeUInt32,
 			       NULL, sizeof (UInt32), NULL, &attributes);
@@ -9890,7 +10172,7 @@
 	  bounds.bottom = bounds.top + height;
 	  SetEventParameter (event, kEventParamCurrentBounds,
 			     typeQDRectangle, sizeof (Rect), &bounds);
-	  return noErr;
+	  result = noErr;
 	}
       break;
 
@@ -9921,21 +10203,12 @@
       if (attributes & kWindowBoundsChangeOriginChanged)
 	mac_handle_origin_change (f);
 
-      return noErr;
-
-    case kEventWindowShown:
-    case kEventWindowHidden:
-    case kEventWindowExpanded:
-    case kEventWindowCollapsed:
-      result = CallNextEventHandler (next_handler, event);
-
-      mac_handle_visibility_change (f);
-      return noErr;
-
+      result = noErr;
       break;
 
+      /* -- window action events -- */
+
     case kEventWindowClose:
-      result = CallNextEventHandler (next_handler, event);
       {
 	struct input_event buf;
 
@@ -9945,11 +10218,26 @@
 	buf.arg = Qnil;
 	kbd_buffer_store_event (&buf);
       }
-      return noErr;
+      result = noErr;
+      break;
+
+    case kEventWindowGetIdealSize:
+      result = CallNextEventHandler (next_handler, event);
+      if (result != eventNotHandledErr)
+	break;
+
+      {
+	Point ideal_size = mac_get_ideal_size (f);
+
+	err = SetEventParameter (event, kEventParamDimensions,
+				 typeQDPoint, sizeof (Point), &ideal_size);
+	if (err == noErr)
+	  result = noErr;
+      }
+      break;
 
 #ifdef MAC_OSX
     case kEventWindowToolbarSwitchMode:
-      result = CallNextEventHandler (next_handler, event);
       {
 	static const EventParamName names[] = {kEventParamDirectObject,
 					       kEventParamWindowMouseLocation,
@@ -9971,23 +10259,195 @@
 						  event, num_params,
 						  names, types);
       }
-      return err == noErr ? noErr : result;
+      if (err == noErr)
+	result = noErr;
+      break;
 #endif
 
 #if USE_MAC_TSM
+      /* -- window focus events -- */
+
     case kEventWindowFocusAcquired:
-      result = CallNextEventHandler (next_handler, event);
       err = mac_tsm_resume ();
-      return err == noErr ? noErr : result;
+      if (err == noErr)
+	result = noErr;
+      break;
 
     case kEventWindowFocusRelinquish:
-      result = CallNextEventHandler (next_handler, event);
+      err = mac_tsm_suspend ();
+      if (err == noErr)
+	result = noErr;
+      break;
+#endif
+
+    default:
+      abort ();
+    }
+
+  return result;
+}
+
+static pascal OSStatus
+mac_handle_application_event (next_handler, event, data)
+     EventHandlerCallRef next_handler;
+     EventRef event;
+     void *data;
+{
+  OSStatus err, result = eventNotHandledErr;
+
+  switch (GetEventKind (event))
+    {
+#if USE_MAC_TSM
+    case kEventAppActivated:
+      err = mac_tsm_resume ();
+      break;
+
+    case kEventAppDeactivated:
       err = mac_tsm_suspend ();
-      return err == noErr ? noErr : result;
-#endif
-    }
-
-  return eventNotHandledErr;
+      break;
+#endif
+
+    default:
+      abort ();
+    }
+
+  if (err == noErr)
+    result = noErr;
+
+  return result;
+}
+
+static pascal OSStatus
+mac_handle_keyboard_event (next_handler, event, data)
+     EventHandlerCallRef next_handler;
+     EventRef event;
+     void *data;
+{
+  OSStatus err, result = eventNotHandledErr;
+  UInt32 event_kind, key_code, modifiers, mapped_modifiers;
+  unsigned char char_code;
+
+  event_kind = GetEventKind (event);
+  switch (event_kind)
+    {
+    case kEventRawKeyDown:
+    case kEventRawKeyRepeat:
+    case kEventRawKeyUp:
+      if (read_socket_inev == NULL)
+	{
+	  result = CallNextEventHandler (next_handler, event);
+	  break;
+	}
+
+      err = GetEventParameter (event, kEventParamKeyModifiers,
+			       typeUInt32, NULL,
+			       sizeof (UInt32), NULL, &modifiers);
+      if (err != noErr)
+	break;
+
+      mapped_modifiers = mac_mapped_modifiers (modifiers);
+
+      /* When using Carbon Events, we need to pass raw keyboard events
+	 to the TSM ourselves.  If TSM handles it, it will pass back
+	 noErr, otherwise it will pass back "eventNotHandledErr" and
+	 we can process it normally.  */
+      if (!(mapped_modifiers
+	    & ~(mac_pass_command_to_system ? cmdKey : 0)
+	    & ~(mac_pass_control_to_system ? controlKey : 0)))
+	{
+	  result = CallNextEventHandler (next_handler, event);
+	  if (result != eventNotHandledErr)
+	    break;
+	}
+
+#if USE_MAC_TSM
+      if (read_socket_inev->kind != NO_EVENT)
+	{
+	  result = noErr;
+	  break;
+	}
+#endif
+
+      if (event_kind == kEventRawKeyUp)
+	break;
+
+      err = GetEventParameter (event, kEventParamKeyMacCharCodes,
+			       typeChar, NULL,
+			       sizeof (char), NULL, &char_code);
+      if (err != noErr)
+	break;
+
+      err = GetEventParameter (event, kEventParamKeyCode,
+			       typeUInt32, NULL,
+			       sizeof (UInt32), NULL, &key_code);
+      if (err != noErr)
+	break;
+
+      do_keystroke ((GetEventKind (event) == kEventRawKeyDown
+		     ? keyDown : autoKey),
+		    char_code, key_code, modifiers,
+		    ((unsigned long)
+		     (GetEventTime (event) / kEventDurationMillisecond)),
+		    read_socket_inev);
+      result = noErr;
+      break;
+
+    default:
+      abort ();
+    }
+
+  return result;
+}
+
+static pascal OSStatus
+mac_handle_command_event (next_handler, event, data)
+     EventHandlerCallRef next_handler;
+     EventRef event;
+     void *data;
+{
+  OSStatus err, result = eventNotHandledErr;
+  HICommand command;
+  static const EventParamName names[] =
+    {kEventParamDirectObject, kEventParamKeyModifiers};
+  static const EventParamType types[] =
+    {typeHICommand, typeUInt32};
+  int num_params = sizeof (names) / sizeof (names[0]);
+
+  err = GetEventParameter (event, kEventParamDirectObject, typeHICommand,
+			   NULL, sizeof (HICommand), NULL, &command);
+  if (err != noErr)
+    return eventNotHandledErr;
+
+  switch (GetEventKind (event))
+    {
+    case kEventCommandProcess:
+      result = CallNextEventHandler (next_handler, event);
+      if (result != eventNotHandledErr)
+	break;
+
+      err = GetEventParameter (event, kEventParamDirectObject,
+			       typeHICommand, NULL,
+			       sizeof (HICommand), NULL, &command);
+
+      if (err != noErr || command.commandID == 0)
+	break;
+
+      /* 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,
+						Qhi_command, Qnil,
+						event, num_params,
+						names, types);
+      if (err == noErr)
+	result = noErr;
+      break;
+
+    default:
+      abort ();
+    }
+
+  return result;
 }
 
 static pascal OSStatus
@@ -9996,13 +10456,13 @@
      EventRef event;
      void *data;
 {
-  OSStatus result, err;
+  OSStatus err, result = eventNotHandledErr;
 
   switch (GetEventKind (event))
     {
     case kEventMouseWheelMoved:
       {
-	WindowPtr wp;
+	WindowRef wp;
 	struct frame *f;
 	EventMouseWheelAxis axis;
 	SInt32 delta;
@@ -10010,15 +10470,14 @@
 
 	result = CallNextEventHandler (next_handler, event);
 	if (result != eventNotHandledErr || read_socket_inev == NULL)
-	  return result;
+	  break;
+
+	f = mac_focus_frame (&one_mac_display_info);
 
 	err = GetEventParameter (event, kEventParamWindowRef, typeWindowRef,
 				 NULL, sizeof (WindowRef), NULL, &wp);
-	if (err != noErr)
-	  break;
-
-	f = mac_window_to_frame (wp);
-	if (f != mac_focus_frame (&one_mac_display_info))
+	if (err != noErr
+	    || wp != FRAME_MAC_WINDOW (f))
 	  break;
 
 	err = GetEventParameter (event, kEventParamMouseWheelAxis,
@@ -10033,8 +10492,8 @@
 	if (err != noErr)
 	  break;
 
-	SetPortWindowPort (wp);
-	GlobalToLocal (&point);
+	point.h -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
+	point.v -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
 	if (point.h < 0 || point.v < 0
 	    || EQ (window_from_coordinates (f, point.h, point.v, 0, 0, 0, 1),
 		   f->tool_bar_window))
@@ -10055,68 +10514,16 @@
 	XSETINT (read_socket_inev->y, point.v);
 	XSETFRAME (read_socket_inev->frame_or_window, f);
 
-	return noErr;
+	result = noErr;
       }
       break;
 
     default:
-      break;
-    }
-
-  return eventNotHandledErr;
-}
-
-#if USE_MAC_FONT_PANEL
-static pascal OSStatus
-mac_handle_font_event (next_handler, event, data)
-     EventHandlerCallRef next_handler;
-     EventRef event;
-     void *data;
-{
-  OSStatus result, err;
-  Lisp_Object id_key;
-  int num_params;
-  const EventParamName *names;
-  const EventParamType *types;
-  static const EventParamName names_sel[] = {kEventParamATSUFontID,
-					     kEventParamATSUFontSize,
-					     kEventParamFMFontFamily,
-					     kEventParamFMFontSize,
-					     kEventParamFontColor};
-  static const EventParamType types_sel[] = {typeATSUFontID,
-					     typeATSUSize,
-					     typeFMFontFamily,
-					     typeFMFontSize,
-					     typeFontColor};
-
-  result = CallNextEventHandler (next_handler, event);
-  if (result != eventNotHandledErr)
-    return result;
-
-  switch (GetEventKind (event))
-    {
-    case kEventFontPanelClosed:
-      id_key = Qpanel_closed;
-      num_params = 0;
-      names = NULL;
-      types = NULL;
-      break;
-
-    case kEventFontSelection:
-      id_key = Qselection;
-      num_params = sizeof (names_sel) / sizeof (names_sel[0]);
-      names = names_sel;
-      types = types_sel;
-      break;
-    }
-
-  err = mac_store_event_ref_as_apple_event (0, 0, Qfont, id_key,
-					    event, num_params,
-					    names, types);
-
-  return err == noErr ? noErr : eventNotHandledErr;
-}
-#endif
+      abort ();
+    }
+
+  return result;
+}
 
 #if USE_MAC_TSM
 static pascal OSStatus
@@ -10173,6 +10580,8 @@
      typeUnicodeText};
 
   result = CallNextEventHandler (next_handler, event);
+  if (result != eventNotHandledErr)
+    return result;
 
   switch (GetEventKind (event))
     {
@@ -10200,7 +10609,7 @@
 				   sizeof (UInt32), NULL, &modifiers);
 	if (err == noErr && mac_mapped_modifiers (modifiers))
 	  /* There're mapped modifier keys.  Process it in
-	     XTread_socket.  */
+	     do_keystroke.  */
 	  return eventNotHandledErr;
 	if (err == noErr)
 	  err = GetEventParameter (kbd_event, kEventParamKeyUnicodes,
@@ -10215,7 +10624,7 @@
 				     sizeof (UniChar), NULL, &code);
 	    if (err == noErr && code < 0x80)
 	      {
-		/* ASCII character.  Process it in XTread_socket.  */
+		/* ASCII character.  Process it in do_keystroke.  */
 		if (read_socket_inev && code >= 0x20 && code <= 0x7e)
 		  {
 		    UInt32 key_code;
@@ -10277,11 +10686,11 @@
 	  }
 
 	p.h = (WINDOW_TO_FRAME_PIXEL_X (w, w->cursor.x)
-	       + WINDOW_LEFT_FRINGE_WIDTH (w));
+	       + WINDOW_LEFT_FRINGE_WIDTH (w)
+	       + f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f));
 	p.v = (WINDOW_TO_FRAME_PIXEL_Y (w, w->cursor.y)
-	       + FONT_BASE (FRAME_FONT (f)));
-	SetPortWindowPort (FRAME_MAC_WINDOW (f));
-	LocalToGlobal (&p);
+	       + FONT_BASE (FRAME_FONT (f))
+	       + f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f));
 	err = SetEventParameter (event, kEventParamTextInputReplyPoint,
 				 typeQDPoint, sizeof (typeQDPoint), &p);
       }
@@ -10295,146 +10704,155 @@
     err = mac_store_event_ref_as_apple_event (0, 0, Qtext_input, id_key,
 					      event, num_params,
 					      names, types);
-
-  return err == noErr ? noErr : result;
-}
-#endif
-
-#ifdef MAC_OSX
-OSStatus
-mac_store_service_event (event)
-     EventRef event;
-{
-  OSStatus err;
-  Lisp_Object id_key;
-  int num_params;
-  const EventParamName *names;
-  const EventParamType *types;
-  static const EventParamName names_pfm[] =
-    {kEventParamServiceMessageName, kEventParamServiceUserData};
-  static const EventParamType types_pfm[] =
-    {typeCFStringRef, typeCFStringRef};
-
-  switch (GetEventKind (event))
-    {
-    case kEventServicePaste:
-      id_key = Qpaste;
-      num_params = 0;
-      names = NULL;
-      types = NULL;
-      break;
-
-    case kEventServicePerform:
-      id_key = Qperform;
-      num_params = sizeof (names_pfm) / sizeof (names_pfm[0]);
-      names = names_pfm;
-      types = types_pfm;
-      break;
-
-    default:
-      abort ();
-    }
-
-  err = mac_store_event_ref_as_apple_event (0, 0, Qservice, id_key,
-					    event, num_params,
-					    names, types);
-
-  return err;
-}
-#endif	/* MAC_OSX */
-#endif	/* USE_CARBON_EVENTS */
+  if (err == noErr)
+    result = noErr;
+
+  return result;
+}
+#endif
+#endif	/* TARGET_API_MAC_CARBON */
 
 
 OSStatus
 install_window_handler (window)
-     WindowPtr window;
+     WindowRef window;
 {
   OSStatus err = noErr;
-#if USE_CARBON_EVENTS
-  static const EventTypeSpec specs_window[] =
-    {{kEventClassWindow, kEventWindowUpdate},
-     {kEventClassWindow, kEventWindowGetIdealSize},
-     {kEventClassWindow, kEventWindowBoundsChanging},
-     {kEventClassWindow, kEventWindowBoundsChanged},
-     {kEventClassWindow, kEventWindowShown},
-     {kEventClassWindow, kEventWindowHidden},
-     {kEventClassWindow, kEventWindowExpanded},
-     {kEventClassWindow, kEventWindowCollapsed},
-     {kEventClassWindow, kEventWindowClose},
+
+#if TARGET_API_MAC_CARBON
+  if (err == noErr)
+    {
+      static const EventTypeSpec specs[] =
+	{
+	  /* -- window refresh events -- */
+	  {kEventClassWindow, kEventWindowUpdate},
+	  /* -- window state change events -- */
+	  {kEventClassWindow, kEventWindowShowing},
+	  {kEventClassWindow, kEventWindowHiding},
+	  {kEventClassWindow, kEventWindowShown},
+	  {kEventClassWindow, kEventWindowHidden},
+	  {kEventClassWindow, kEventWindowCollapsed},
+	  {kEventClassWindow, kEventWindowExpanded},
+	  {kEventClassWindow, kEventWindowBoundsChanging},
+	  {kEventClassWindow, kEventWindowBoundsChanged},
+	  /* -- window action events -- */
+	  {kEventClassWindow, kEventWindowClose},
+	  {kEventClassWindow, kEventWindowGetIdealSize},
 #ifdef MAC_OSX
-     {kEventClassWindow, kEventWindowToolbarSwitchMode},
-#endif
-#if USE_MAC_TSM
-     {kEventClassWindow, kEventWindowFocusAcquired},
-     {kEventClassWindow, kEventWindowFocusRelinquish},
-#endif
-  };
-  static const EventTypeSpec specs_mouse[] =
-    {{kEventClassMouse, kEventMouseWheelMoved}};
-  static EventHandlerUPP handle_window_eventUPP = NULL;
-  static EventHandlerUPP handle_mouse_eventUPP = NULL;
-#if USE_MAC_FONT_PANEL
-  static const EventTypeSpec specs_font[] =
-    {{kEventClassFont, kEventFontPanelClosed},
-     {kEventClassFont, kEventFontSelection}};
-  static EventHandlerUPP handle_font_eventUPP = NULL;
+	  {kEventClassWindow, kEventWindowToolbarSwitchMode},
 #endif
 #if USE_MAC_TSM
-  static const EventTypeSpec specs_text_input[] =
-    {{kEventClassTextInput, kEventTextInputUpdateActiveInputArea},
-     {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent},
-     {kEventClassTextInput, kEventTextInputOffsetToPos}};
-  static EventHandlerUPP handle_text_input_eventUPP = NULL;
-#endif
-
-  if (handle_window_eventUPP == NULL)
-    handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event);
-  if (handle_mouse_eventUPP == NULL)
-    handle_mouse_eventUPP = NewEventHandlerUPP (mac_handle_mouse_event);
-#if USE_MAC_FONT_PANEL
-  if (handle_font_eventUPP == NULL)
-    handle_font_eventUPP = NewEventHandlerUPP (mac_handle_font_event);
-#endif
-#if USE_MAC_TSM
-  if (handle_text_input_eventUPP == NULL)
-    handle_text_input_eventUPP =
-      NewEventHandlerUPP (mac_handle_text_input_event);
-#endif
-  err = InstallWindowEventHandler (window, handle_window_eventUPP,
-				   GetEventTypeCount (specs_window),
-				   specs_window, NULL, NULL);
-  if (err == noErr)
-    err = InstallWindowEventHandler (window, handle_mouse_eventUPP,
-				     GetEventTypeCount (specs_mouse),
-				     specs_mouse, NULL, NULL);
-#if USE_MAC_FONT_PANEL
-  if (err == noErr)
-    err = InstallWindowEventHandler (window, handle_font_eventUPP,
-				     GetEventTypeCount (specs_font),
-				     specs_font, NULL, NULL);
-#endif
-#if USE_MAC_TSM
-  if (err == noErr)
-    err = InstallWindowEventHandler (window, handle_text_input_eventUPP,
-				     GetEventTypeCount (specs_text_input),
-				     specs_text_input, window, NULL);
-#endif
-#endif
+	  /* -- window focus events -- */
+	  {kEventClassWindow, kEventWindowFocusAcquired},
+	  {kEventClassWindow, kEventWindowFocusRelinquish},
+#endif
+	};
+      static EventHandlerUPP handle_window_eventUPP = NULL;
+
+      if (handle_window_eventUPP == NULL)
+	handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event);
+
+      err = InstallWindowEventHandler (window, handle_window_eventUPP,
+				       GetEventTypeCount (specs),
+				       specs, NULL, NULL);
+    }
+#endif
+
   if (err == noErr)
     err = install_drag_handler (window);
-  if (err == noErr)
-    err = install_menu_target_item_handler (window);
 
   return err;
 }
 
 void
 remove_window_handler (window)
-     WindowPtr window;
+     WindowRef window;
 {
   remove_drag_handler (window);
 }
 
+#if TARGET_API_MAC_CARBON
+static OSStatus
+install_application_handler ()
+{
+  OSStatus err = noErr;
+
+  if (err == noErr)
+    {
+      static const EventTypeSpec specs[] = {
+#if USE_MAC_TSM
+	{kEventClassApplication, kEventAppActivated},
+	{kEventClassApplication, kEventAppDeactivated},
+#endif
+      };
+
+      err = InstallApplicationEventHandler (NewEventHandlerUPP
+					    (mac_handle_application_event),
+					    GetEventTypeCount (specs),
+					    specs, NULL, NULL);
+    }
+
+  if (err == noErr)
+    {
+      static const EventTypeSpec specs[] =
+	{{kEventClassKeyboard, kEventRawKeyDown},
+	 {kEventClassKeyboard, kEventRawKeyRepeat},
+	 {kEventClassKeyboard, kEventRawKeyUp}};
+
+      err = InstallApplicationEventHandler (NewEventHandlerUPP
+					    (mac_handle_keyboard_event),
+					    GetEventTypeCount (specs),
+					    specs, NULL, NULL);
+    }
+
+  if (err == noErr)
+    {
+      static const EventTypeSpec specs[] =
+	{{kEventClassCommand, kEventCommandProcess}};
+
+      err = InstallApplicationEventHandler (NewEventHandlerUPP
+					    (mac_handle_command_event),
+					    GetEventTypeCount (specs),
+					    specs, NULL, NULL);
+    }
+
+  if (err == noErr)
+    {
+      static const EventTypeSpec specs[] =
+	{{kEventClassMouse, kEventMouseWheelMoved}};
+
+      err = InstallApplicationEventHandler (NewEventHandlerUPP
+					    (mac_handle_mouse_event),
+					    GetEventTypeCount (specs),
+					    specs, NULL, NULL);
+    }
+
+#if USE_MAC_TSM
+  if (err == noErr)
+    {
+      static const EventTypeSpec spec[] =
+	{{kEventClassTextInput, kEventTextInputUpdateActiveInputArea},
+	 {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent},
+	 {kEventClassTextInput, kEventTextInputOffsetToPos}};
+
+      err = InstallApplicationEventHandler (NewEventHandlerUPP
+					    (mac_handle_text_input_event),
+					    GetEventTypeCount (spec),
+					    spec, NULL, NULL);
+    }
+#endif
+
+  if (err == noErr)
+    err = install_menu_target_item_handler ();
+
+#ifdef MAC_OSX
+  if (err == noErr)
+    err = install_service_handler ();
+#endif
+
+  return err;
+}
+#endif
 
 static pascal void
 mac_handle_dm_notification (event)
@@ -10443,20 +10861,48 @@
   mac_screen_config_changed = 1;
 }
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+static void
+mac_handle_cg_display_reconfig (display, flags, user_info)
+     CGDirectDisplayID display;
+     CGDisplayChangeSummaryFlags flags;
+     void *user_info;
+{
+  mac_screen_config_changed = 1;
+}
+#endif
+
 static OSErr
 init_dm_notification_handler ()
 {
-  OSErr err;
-  static DMNotificationUPP handle_dm_notificationUPP = NULL;
-  ProcessSerialNumber psn;
-
-  if (handle_dm_notificationUPP == NULL)
-    handle_dm_notificationUPP =
-      NewDMNotificationUPP (mac_handle_dm_notification);
-
-  err = GetCurrentProcess (&psn);
-  if (err == noErr)
-    err = DMRegisterNotifyProc (handle_dm_notificationUPP, &psn);
+  OSErr err = noErr;
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+  if (CGDisplayRegisterReconfigurationCallback != NULL)
+#endif
+    {
+      CGDisplayRegisterReconfigurationCallback (mac_handle_cg_display_reconfig,
+						NULL);
+    }
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+  else		/* CGDisplayRegisterReconfigurationCallback == NULL */
+#endif
+#endif	/* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+    {
+      static DMNotificationUPP handle_dm_notificationUPP = NULL;
+      ProcessSerialNumber psn;
+
+      if (handle_dm_notificationUPP == NULL)
+	handle_dm_notificationUPP =
+	  NewDMNotificationUPP (mac_handle_dm_notification);
+
+      err = GetCurrentProcess (&psn);
+      if (err == noErr)
+	err = DMRegisterNotifyProc (handle_dm_notificationUPP, &psn);
+    }
+#endif
 
   return err;
 }
@@ -10601,7 +11047,7 @@
 }
 #endif
 
-#if !USE_CARBON_EVENTS
+#if !TARGET_API_MAC_CARBON
 static RgnHandle mouse_region = NULL;
 
 Boolean
@@ -10638,7 +11084,7 @@
     er_buf.what = nullEvent;
   return true;
 }
-#endif /* not USE_CARBON_EVENTS */
+#endif /* not TARGET_API_MAC_CARBON */
 
 #if TARGET_API_MAC_CARBON
 OSStatus
@@ -10672,20 +11118,6 @@
 
   return err;
 }
-
-static void
-mac_set_unicode_keystroke_event (code, buf)
-     UniChar code;
-     struct input_event *buf;
-{
-  int charset_id, c1, c2;
-
-  if (code < 0x80)
-    buf->kind = ASCII_KEYSTROKE_EVENT;
-  else
-    buf->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
-  buf->code = code;
-}
 #endif
 
 /* Emacs calls this whenever it wants to read an input event from the
@@ -10697,7 +11129,7 @@
 {
   struct input_event inev;
   int count = 0;
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
   EventRef eventRef;
   EventTargetRef toolbox_dispatcher;
 #endif
@@ -10718,7 +11150,7 @@
 
   ++handling_signal;
 
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
   toolbox_dispatcher = GetEventDispatcherTarget ();
 
   while (
@@ -10727,9 +11159,9 @@
 #endif
 	 !ReceiveNextEvent (0, NULL, kEventDurationNoWait,
 			    kEventRemoveFromQueue, &eventRef))
-#else /* !USE_CARBON_EVENTS */
+#else /* !TARGET_API_MAC_CARBON */
   while (mac_wait_next_event (&er, 0, true))
-#endif /* !USE_CARBON_EVENTS */
+#endif /* !TARGET_API_MAC_CARBON */
     {
       int do_help = 0;
       struct frame *f;
@@ -10739,44 +11171,33 @@
       inev.kind = NO_EVENT;
       inev.arg = Qnil;
 
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
       timestamp = GetEventTime (eventRef) / kEventDurationMillisecond;
-#else
-      timestamp = er.when * (1000 / 60); /* ticks to milliseconds */
-#endif
-
-#if USE_CARBON_EVENTS
-      /* Handle new events */
+
       if (!mac_convert_event_ref (eventRef, &er))
-	{
-	  /* There used to be a handler for the kEventMouseWheelMoved
-	     event here.  But as of Mac OS X 10.4, this kind of event
-	     is not directly posted to the main event queue by
-	     two-finger scrolling on the trackpad.  Instead, some
-	     private event is posted and it is converted to a wheel
-	     event by the default handler for the application target.
-	     The converted one can be received by a Carbon event
-	     handler installed on a window target.  */
-	  read_socket_inev = &inev;
-	  SendEventToEventTarget (eventRef, toolbox_dispatcher);
-	  read_socket_inev = NULL;
-	}
-      else
-#endif /* USE_CARBON_EVENTS */
+	goto OTHER;
+#else  /* !TARGET_API_MAC_CARBON */
+      timestamp = er.when * (1000 / 60); /* ticks to milliseconds */
+#endif  /* !TARGET_API_MAC_CARBON */
+
       switch (er.what)
 	{
 	case mouseDown:
 	case mouseUp:
 	  {
-	    WindowPtr window_ptr;
+	    WindowRef window_ptr;
 	    ControlPartCode part_code;
 	    int tool_bar_p = 0;
 
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
+	    OSStatus err;
+
 	    /* This is needed to send mouse events like aqua window
 	       buttons to the correct handler.  */
-	    if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
-		!= eventNotHandledErr)
+	    read_socket_inev = &inev;
+	    err = SendEventToEventTarget (eventRef, toolbox_dispatcher);
+	    read_socket_inev = NULL;
+	    if (err != eventNotHandledErr)
 	      break;
 #endif
 	    last_mouse_glyph_frame = 0;
@@ -10824,17 +11245,20 @@
 		else
 		  {
 		    ControlPartCode control_part_code;
-		    ControlHandle ch;
-		    Point mouse_loc = er.where;
+		    ControlRef ch;
+		    Point mouse_loc;
 #ifdef MAC_OSX
 		    ControlKind control_kind;
 #endif
 
 		    f = mac_window_to_frame (window_ptr);
 		    /* convert to local coordinates of new window */
-		    SetPortWindowPort (window_ptr);
-
-		    GlobalToLocal (&mouse_loc);
+		    mouse_loc.h = (er.where.h
+				   - (f->left_pos
+				      + FRAME_OUTER_TO_INNER_DIFF_X (f)));
+		    mouse_loc.v = (er.where.v
+				   - (f->top_pos
+				      + FRAME_OUTER_TO_INNER_DIFF_Y (f)));
 #if TARGET_API_MAC_CARBON
 		    ch = FindControlUnderMouse (mouse_loc, window_ptr,
 						&control_part_code);
@@ -10847,7 +11271,7 @@
 						     &ch);
 #endif
 
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
 		    inev.code = mac_get_mouse_btn (eventRef);
 		    inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
 #else
@@ -10983,16 +11407,14 @@
 		DragWindow (window_ptr, er.where, NULL);
 #else /* not TARGET_API_MAC_CARBON */
 		DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
-#endif /* not TARGET_API_MAC_CARBON */
 		/* Update the frame parameters.  */
-#if !USE_CARBON_EVENTS
 		{
 		  struct frame *f = mac_window_to_frame (window_ptr);
 
 		  if (f && !f->async_iconified)
 		    mac_handle_origin_change (f);
 		}
-#endif
+#endif /* not TARGET_API_MAC_CARBON */
 		break;
 
 	      case inGoAway:
@@ -11022,35 +11444,17 @@
 	  }
 	  break;
 
+#if !TARGET_API_MAC_CARBON
 	case updateEvt:
-#if USE_CARBON_EVENTS
-	  if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
-	      != eventNotHandledErr)
-	    break;
-#else
-	  do_window_update ((WindowPtr) er.message);
-#endif
+	  do_window_update ((WindowRef) er.message);
 	  break;
+#endif
 
 	case osEvt:
-#if USE_CARBON_EVENTS
-	  if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
-	      != eventNotHandledErr)
-	    break;
-#endif
 	  switch ((er.message >> 24) & 0x000000FF)
 	    {
-	    case suspendResumeMessage:
-#if USE_MAC_TSM
-	      if (er.message & resumeFlag)
-		mac_tsm_resume ();
-	      else
-		mac_tsm_suspend ();
-#endif
-	      break;
-
 	    case mouseMovedMessage:
-#if !USE_CARBON_EVENTS
+#if !TARGET_API_MAC_CARBON
 	      SetRectRgn (mouse_region, er.where.h, er.where.v,
 			  er.where.h + 1, er.where.v + 1);
 #endif
@@ -11071,13 +11475,15 @@
 
 	      if (f)
 		{
-		  WindowPtr wp = FRAME_MAC_WINDOW (f);
-		  Point mouse_pos = er.where;
-
-		  SetPortWindowPort (wp);
-
-		  GlobalToLocal (&mouse_pos);
-
+		  WindowRef wp = FRAME_MAC_WINDOW (f);
+		  Point mouse_pos;
+
+		  mouse_pos.h = (er.where.h
+				 - (f->left_pos
+				    + FRAME_OUTER_TO_INNER_DIFF_X (f)));
+		  mouse_pos.v = (er.where.v
+				 - (f->top_pos
+				    + FRAME_OUTER_TO_INNER_DIFF_Y (f)));
 		  if (dpyinfo->grabbed && tracked_scroll_bar)
 #ifdef USE_TOOLKIT_SCROLL_BARS
 		    x_scroll_bar_handle_drag (wp, tracked_scroll_bar,
@@ -11125,18 +11531,16 @@
 	      if (!NILP (help_echo_string) || !NILP (previous_help_echo_string))
 		do_help = 1;
 	      break;
+
+	    default:
+	      goto OTHER;
 	    }
 	  break;
 
 	case activateEvt:
 	  {
-	    WindowPtr window_ptr = (WindowPtr) er.message;
-
-#if USE_CARBON_EVENTS
-	    if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
-		!= eventNotHandledErr)
-	      break;
-#endif
+	    WindowRef window_ptr = (WindowRef) er.message;
+
 	    if (window_ptr == tip_window)
 	      {
 		HideWindow (tip_window);
@@ -11144,21 +11548,26 @@
 	      }
 
 	    if (!is_emacs_window (window_ptr))
-	      break;
+	      goto OTHER;
+
+	    f = mac_window_to_frame (window_ptr);
 
 	    if ((er.modifiers & activeFlag) != 0)
 	      {
 		/* A window has been activated */
-		Point mouse_loc = er.where;
+		Point mouse_loc;
 
 		x_detect_focus_change (dpyinfo, &er, &inev);
 
-		SetPortWindowPort (window_ptr);
-		GlobalToLocal (&mouse_loc);
+		mouse_loc.h = (er.where.h
+			       - (f->left_pos
+				  + FRAME_OUTER_TO_INNER_DIFF_X (f)));
+		mouse_loc.v = (er.where.v
+			       - (f->top_pos
+				  + FRAME_OUTER_TO_INNER_DIFF_Y (f)));
 		/* Window-activated event counts as mouse movement,
 		   so update things that depend on mouse position.  */
-		note_mouse_movement (mac_window_to_frame (window_ptr),
-				     &mouse_loc);
+		note_mouse_movement (f, &mouse_loc);
 	      }
 	    else
 	      {
@@ -11183,7 +11592,6 @@
 
 		x_detect_focus_change (dpyinfo, &er, &inev);
 
-		f = mac_window_to_frame (window_ptr);
 		if (f == dpyinfo->mouse_face_mouse_frame)
 		  {
 		    /* If we move outside the frame, then we're
@@ -11206,218 +11614,26 @@
 	case keyDown:
 	case keyUp:
 	case autoKey:
-	  {
-	    int keycode = (er.message & keyCodeMask) >> 8;
-	    static SInt16 last_key_script = -1;
-	    SInt16 current_key_script;
-	    UInt32 modifiers = er.modifiers, mapped_modifiers;
-
-#if USE_CARBON_EVENTS && defined (MAC_OSX)
-	    GetEventParameter (eventRef, kEventParamKeyModifiers,
-			       typeUInt32, NULL,
-			       sizeof (UInt32), NULL, &modifiers);
-#endif
-	    mapped_modifiers = mac_mapped_modifiers (modifiers);
-
-#if USE_CARBON_EVENTS && (defined (MAC_OSX) || USE_MAC_TSM)
-	    /* When using Carbon Events, we need to pass raw keyboard
-	       events to the TSM ourselves.  If TSM handles it, it
-	       will pass back noErr, otherwise it will pass back
-	       "eventNotHandledErr" and we can process it
-	       normally.  */
-	    if (!(mapped_modifiers
-		  & ~(mac_pass_command_to_system ? cmdKey : 0)
-		  & ~(mac_pass_control_to_system ? controlKey : 0)))
-	      {
-		OSStatus err;
-
-		read_socket_inev = &inev;
-		err = SendEventToEventTarget (eventRef, toolbox_dispatcher);
-		read_socket_inev = NULL;
-		if (err != eventNotHandledErr)
-		  break;
-	      }
-#endif
-	    if (er.what == keyUp)
-	      break;
-
-	    ObscureCursor ();
-
-	    f = mac_focus_frame (dpyinfo);
-
-	    if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
-		&& !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))
-	      {
-		clear_mouse_face (dpyinfo);
-		dpyinfo->mouse_face_hidden = 1;
-	      }
-
-	    current_key_script = GetScriptManagerVariable (smKeyScript);
-	    if (last_key_script != current_key_script)
-	      {
-		struct input_event event;
-
-		EVENT_INIT (event);
-		event.kind = LANGUAGE_CHANGE_EVENT;
-		event.arg = Qnil;
-		event.code = current_key_script;
-		event.timestamp = timestamp;
-		kbd_buffer_store_event (&event);
-		count++;
-		last_key_script = current_key_script;
-	      }
-
-#if USE_MAC_TSM
-	    if (inev.kind != NO_EVENT)
-	      break;
-#endif
-
-#ifdef MAC_OSX
-	    if (mapped_modifiers & kEventKeyModifierFnMask
-		&& keycode <= 0x7f
-		&& fn_keycode_to_keycode_table[keycode])
-	      keycode = fn_keycode_to_keycode_table[keycode];
-#endif
-	    if (keycode <= 0x7f && keycode_to_xkeysym_table [keycode])
-	      {
-		inev.kind = NON_ASCII_KEYSTROKE_EVENT;
-		inev.code = 0xff00 | keycode_to_xkeysym_table [keycode];
-#ifdef MAC_OSX
-		if (modifiers & kEventKeyModifierFnMask
-		    && keycode <= 0x7f
-		    && fn_keycode_to_keycode_table[keycode] == keycode)
-		  modifiers &= ~kEventKeyModifierFnMask;
-#endif
-	      }
-	    else if (mapped_modifiers)
-	      {
-		/* translate the keycode back to determine the
-		   original key */
-#ifdef MAC_OSX
-		UCKeyboardLayout *uchr_ptr = NULL;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
-		OSStatus err;
-		KeyboardLayoutRef layout;
-
-		err = KLGetCurrentKeyboardLayout (&layout);
-		if (err == noErr)
-		  KLGetKeyboardLayoutProperty (layout, kKLuchrData,
-					       (const void **) &uchr_ptr);
+	  ObscureCursor ();
+
+	  f = mac_focus_frame (dpyinfo);
+	  XSETFRAME (inev.frame_or_window, f);
+
+	  /* If mouse-highlight is an integer, input clears out mouse
+	     highlighting.  */
+	  if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
+	      && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))
+	    {
+	      clear_mouse_face (dpyinfo);
+	      dpyinfo->mouse_face_hidden = 1;
+	    }
+#if TARGET_API_MAC_CARBON
+	  goto OTHER;
 #else
-		static SInt16 last_key_layout_id = 0;
-		static Handle uchr_handle = (Handle)-1;
-		SInt16 current_key_layout_id =
-		  GetScriptVariable (current_key_script, smScriptKeys);
-
-		if (uchr_handle == (Handle)-1
-		    || last_key_layout_id != current_key_layout_id)
-		  {
-		    uchr_handle = GetResource ('uchr', current_key_layout_id);
-		    last_key_layout_id = current_key_layout_id;
-		  }
-		if (uchr_handle)
-		  uchr_ptr = (UCKeyboardLayout *)*uchr_handle;
-#endif
-
-		if (uchr_ptr)
-		  {
-		    OSStatus status;
-		    UInt16 key_action = er.what - keyDown;
-		    UInt32 modifier_key_state =
-		      (modifiers & ~mapped_modifiers) >> 8;
-		    UInt32 keyboard_type = LMGetKbdType ();
-		    SInt32 dead_key_state = 0;
-		    UniChar code;
-		    UniCharCount actual_length;
-
-		    status = UCKeyTranslate (uchr_ptr,
-					     keycode, key_action,
-					     modifier_key_state,
-					     keyboard_type,
-					     kUCKeyTranslateNoDeadKeysMask,
-					     &dead_key_state,
-					     1, &actual_length, &code);
-		    if (status == noErr && actual_length == 1)
-		      mac_set_unicode_keystroke_event (code, &inev);
-		  }
-#endif	/* MAC_OSX */
-
-		if (inev.kind == NO_EVENT)
-		  {
-		    /* This code comes from Keyboard Resource,
-		       Appendix C of IM - Text.  This is necessary
-		       since shift is ignored in KCHR table
-		       translation when option or command is pressed.
-		       It also does not translate correctly
-		       control-shift chars like C-% so mask off shift
-		       here also.  */
-		    /* Mask off modifier keys that are mapped to some
-		       Emacs modifiers.  */
-		    int new_modifiers = er.modifiers & ~mapped_modifiers;
-		    /* set high byte of keycode to modifier high byte*/
-		    int new_keycode = keycode | new_modifiers;
-		    Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
-		    unsigned long some_state = 0;
-		    UInt32 new_char_code;
-
-		    new_char_code = KeyTranslate (kchr_ptr, new_keycode,
-						  &some_state);
-		    if (new_char_code == 0)
-		      /* Seems like a dead key.  Append up-stroke.  */
-		      new_char_code = KeyTranslate (kchr_ptr,
-						    new_keycode | 0x80,
-						    &some_state);
-		    if (new_char_code)
-		      {
-			inev.kind = ASCII_KEYSTROKE_EVENT;
-			inev.code = new_char_code & 0xff;
-		      }
-		  }
-	      }
-
-	    if (inev.kind == NO_EVENT)
-	      {
-		inev.kind = ASCII_KEYSTROKE_EVENT;
-		inev.code = er.message & charCodeMask;
-	      }
-
-	    inev.modifiers = mac_to_emacs_modifiers (modifiers);
-	    inev.modifiers |= (extra_keyboard_modifiers
-			       & (meta_modifier | alt_modifier
-				  | hyper_modifier | super_modifier));
-	    XSETFRAME (inev.frame_or_window, f);
-
-#if TARGET_API_MAC_CARBON
-	    if (inev.kind == ASCII_KEYSTROKE_EVENT
-		&& inev.code >= 0x80 && inev.modifiers)
-	      {
-		OSStatus err;
-		TextEncoding encoding = kTextEncodingMacRoman;
-		TextToUnicodeInfo ttu_info;
-
-		UpgradeScriptInfoToTextEncoding (current_key_script,
-						 kTextLanguageDontCare,
-						 kTextRegionDontCare,
-						 NULL, &encoding);
-		err = CreateTextToUnicodeInfoByEncoding (encoding, &ttu_info);
-		if (err == noErr)
-		  {
-		    UniChar code;
-		    Str255 pstr;
-		    ByteCount unicode_len;
-
-		    pstr[0] = 1;
-		    pstr[1] = inev.code;
-		    err = ConvertFromPStringToUnicode (ttu_info, pstr,
-						       sizeof (UniChar),
-						       &unicode_len, &code);
-		    if (err == noErr && unicode_len == sizeof (UniChar))
-		      mac_set_unicode_keystroke_event (code, &inev);
-		    DisposeTextToUnicodeInfo (&ttu_info);
-		  }
-	      }
-#endif
-	  }
+	  do_keystroke (er.what, er.message & charCodeMask,
+			(er.message & keyCodeMask) >> 8,
+			er.modifiers, timestamp, &inev);
+#endif
 	  break;
 
 	case kHighLevelEvent:
@@ -11425,9 +11641,19 @@
 	  break;
 
 	default:
+	OTHER:
+#if TARGET_API_MAC_CARBON
+	  {
+	    OSStatus err;
+
+	    read_socket_inev = &inev;
+	    err = SendEventToEventTarget (eventRef, toolbox_dispatcher);
+	    read_socket_inev = NULL;
+	  }
+#endif
 	  break;
 	}
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
       ReleaseEvent (eventRef);
 #endif
 
@@ -11479,7 +11705,7 @@
       mac_screen_config_changed = 0;
     }
 
-#if !USE_CARBON_EVENTS
+#if !TARGET_API_MAC_CARBON
   /* Check which frames are still visible.  We do this here because
      there doesn't seem to be any direct notification from the Window
      Manager that the visibility of a window has changed (at least,
@@ -11584,7 +11810,7 @@
 
   if (!(FRAME_MAC_WINDOW (f) =
 	NewCWindow (NULL, &r, "\p", true, dBoxProc,
-		    (WindowPtr) -1, 1, (long) f->output_data.mac)))
+		    (WindowRef) -1, 1, (long) f->output_data.mac)))
     abort ();
   /* so that update events can find this mac_output struct */
   f->output_data.mac->mFP = f;  /* point back to emacs frame */
@@ -11774,7 +12000,6 @@
 				     &menu, &menu_index);
   if (err == noErr)
     SetMenuItemCommandKey (menu, menu_index, false, 0);
-#if USE_CARBON_EVENTS
   EnableMenuCommand (NULL, kHICommandPreferences);
   err = GetIndMenuItemWithCommandID (NULL, kHICommandPreferences, 1,
 				     &menu, &menu_index);
@@ -11786,10 +12011,9 @@
       InsertMenuItemTextWithCFString (menu, CFSTR ("About Emacs"),
 				      0, 0, kHICommandAbout);
     }
-#endif	/* USE_CARBON_EVENTS */
 #else	/* !MAC_OSX */
-#if USE_CARBON_EVENTS
-  SetMenuItemCommandID (GetMenuHandle (M_APPLE), I_ABOUT, kHICommandAbout);
+#if TARGET_API_MAC_CARBON
+  SetMenuItemCommandID (GetMenuRef (M_APPLE), I_ABOUT, kHICommandAbout);
 #endif
 #endif
 }
@@ -11896,19 +12120,13 @@
 
 #if TARGET_API_MAC_CARBON
 
-#if USE_CARBON_EVENTS
-#ifdef MAC_OSX
-  init_service_handler ();
-#endif	/* MAC_OSX */
-
-  init_command_handler ();
+  install_application_handler ();
 
   init_menu_bar ();
 
 #if USE_MAC_TSM
   init_tsm ();
 #endif
-#endif	/* USE_CARBON_EVENTS */
 
 #ifdef MAC_OSX
   init_coercion_handler ();
@@ -11958,7 +12176,7 @@
   Fput (Qhyper,   Qmodifier_value, make_number (hyper_modifier));
   Fput (Qsuper,   Qmodifier_value, make_number (super_modifier));
 
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
   Qhi_command   = intern ("hi-command");    staticpro (&Qhi_command);
 #ifdef MAC_OSX
   Qtoolbar_switch_mode = intern ("toolbar-switch-mode");
@@ -12083,7 +12301,7 @@
 mouse-3 and the command-key will register for mouse-2.  */);
   Vmac_emulate_three_button_mouse = Qnil;
 
-#if USE_CARBON_EVENTS
+#if TARGET_API_MAC_CARBON
   DEFVAR_BOOL ("mac-wheel-button-is-mouse-2", &mac_wheel_button_is_mouse_2,
     doc: /* *Non-nil if the wheel button is mouse-2 and the right click mouse-3.
 Otherwise, the right click will be treated as mouse-2 and the wheel
--- a/src/macterm.h	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/macterm.h	Mon Jun 11 00:58:11 2007 +0000
@@ -369,6 +369,12 @@
 /* This is the 'font_info *' which frame F has.  */
 #define FRAME_MAC_FONT_TABLE(f) (FRAME_MAC_DISPLAY_INFO (f)->font_table)
 
+/* The difference in pixels between the top left corner of the
+   Emacs window (including possible window manager decorations)
+   and FRAME_MAC_WINDOW (f).  */
+#define FRAME_OUTER_TO_INNER_DIFF_X(f) ((f)->x_pixels_diff)
+#define FRAME_OUTER_TO_INNER_DIFF_Y(f) ((f)->y_pixels_diff)
+
 /* Value is the smallest width of any character in any font on frame F.  */
 
 #define FRAME_SMALLEST_CHAR_WIDTH(F) \
@@ -406,9 +412,9 @@
   /* The next and previous in the chain of scroll bars in this frame.  */
   Lisp_Object next, prev;
 
-  /* The Mac control handle of this scroll bar.  Since this is a
+  /* The Mac control reference of this scroll bar.  Since this is a
      pointer value, we store it split into two Lisp integers.  */
-  Lisp_Object control_handle_low, control_handle_high;
+  Lisp_Object control_ref_low, control_ref_high;
 
   /* The position and size of the scroll bar in pixels, relative to the
      frame.  */
@@ -466,14 +472,14 @@
 
 /* Extract the Mac control handle of the scroll bar from a struct
    scroll_bar.  */
-#define SCROLL_BAR_CONTROL_HANDLE(ptr) \
-  ((ControlHandle) SCROLL_BAR_PACK ((ptr)->control_handle_low, \
-                                    (ptr)->control_handle_high))
+#define SCROLL_BAR_CONTROL_REF(ptr)				\
+  ((ControlRef) SCROLL_BAR_PACK ((ptr)->control_ref_low,	\
+				 (ptr)->control_ref_high))
 
 /* Store a Mac control handle in a struct scroll_bar.  */
-#define SET_SCROLL_BAR_CONTROL_HANDLE(ptr, handle) \
-  (SCROLL_BAR_UNPACK ((ptr)->control_handle_low, \
-                      (ptr)->control_handle_high, (unsigned long) (handle)))
+#define SET_SCROLL_BAR_CONTROL_REF(ptr, ref)				\
+  (SCROLL_BAR_UNPACK ((ptr)->control_ref_low,				\
+                      (ptr)->control_ref_high, (unsigned long) (ref)))
 
 /* Return the inside width of a vertical scroll bar, given the outside
    width.  */
@@ -615,9 +621,9 @@
 extern void x_wm_set_size_hint P_ ((struct frame *, long, int));
 extern void x_delete_display P_ ((struct x_display_info *));
 extern void mac_initialize P_ ((void));
-extern Pixmap XCreatePixmap P_ ((Display *, WindowPtr, unsigned int,
+extern Pixmap XCreatePixmap P_ ((Display *, WindowRef, unsigned int,
 				 unsigned int, unsigned int));
-extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowPtr, char *,
+extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowRef, char *,
 					       unsigned int, unsigned int,
 					       unsigned long, unsigned long,
 					       unsigned int));
@@ -626,7 +632,7 @@
 extern void XFreeGC P_ ((Display *, GC));
 extern void XSetForeground P_ ((Display *, GC, unsigned long));
 extern void XSetBackground P_ ((Display *, GC, unsigned long));
-extern void XSetWindowBackground P_ ((Display *, WindowPtr, unsigned long));
+extern void XSetWindowBackground P_ ((Display *, WindowRef, unsigned long));
 extern void XDrawLine P_ ((Display *, Pixmap, GC, int, int, int, int));
 extern void mac_clear_area P_ ((struct frame *, int, int,
 				unsigned int, unsigned int));
@@ -634,8 +640,8 @@
 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 OSStatus install_window_handler P_ ((WindowPtr));
-extern void remove_window_handler P_ ((WindowPtr));
+extern OSStatus install_window_handler P_ ((WindowRef));
+extern void remove_window_handler P_ ((WindowRef));
 extern OSStatus mac_post_mouse_moved_event P_ ((void));
 #if !TARGET_API_MAC_CARBON
 extern void do_apple_menu P_ ((SInt16));
@@ -643,6 +649,7 @@
 #if USE_CG_DRAWING
 extern void mac_prepare_for_quickdraw P_ ((struct frame *));
 #endif
+extern void mac_get_window_bounds P_ ((struct frame *, Rect *, Rect *));
 extern int mac_quit_char_key_p P_ ((UInt32, UInt32));
 
 #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0
--- a/src/minibuf.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/minibuf.c	Mon Jun 11 00:58:11 2007 +0000
@@ -529,7 +529,7 @@
   GCPRO5 (map, initial, val, ambient_dir, input_method);
 
   if (!STRINGP (prompt))
-    prompt = empty_string;
+    prompt = empty_unibyte_string;
 
   if (!enable_recursive_minibuffers
       && minibuf_level > 0)
--- a/src/s/ms-w32.h	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/s/ms-w32.h	Mon Jun 11 00:58:11 2007 +0000
@@ -255,7 +255,6 @@
 
 #undef  TM_IN_SYS_TIME
 #undef  HAVE_TM_ZONE
-#define HAVE_TZNAME 1
 
 #define HAVE_LONG_FILE_NAMES 1
 
--- a/src/search.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/search.c	Mon Jun 11 00:58:11 2007 +0000
@@ -2076,7 +2076,7 @@
   if (SYNTAX (prev_c) == Sword)
     word_count++;
   if (!word_count)
-    return empty_string;
+    return empty_unibyte_string;
 
   adjust = - punct_count + 5 * (word_count - 1) + 4;
   if (STRING_MULTIBYTE (string))
--- a/src/sunfns.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/sunfns.c	Mon Jun 11 00:58:11 2007 +0000
@@ -287,7 +287,7 @@
   register int i, n;
   register char *cp;
 
-  Current_Selection = make_string ("", 0);
+  Current_Selection = empty_unibyte_string;
   if (sel->sel_items <= 0)
     return (0);
   cp = (char *) malloc(sel->sel_items);
--- a/src/term.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/term.c	Mon Jun 11 00:58:11 2007 +0000
@@ -430,11 +430,6 @@
 static Lisp_Object Qmouse_face_window;
 static int mouse_face_face_id;
 
-/* FRAME and X, Y position of mouse when last checked for
-   highlighting.  X and Y can be negative or out of range for the frame.  */
-struct frame *mouse_face_mouse_frame;
-int mouse_face_mouse_x, mouse_face_mouse_y;
-
 static int pos_x, pos_y;
 static int last_mouse_x, last_mouse_y;
 #endif /* HAVE_GPM */
@@ -2494,17 +2489,18 @@
  ***********************************************************************/
 
 #ifdef HAVE_GPM
-void term_mouse_moveto (int x, int y)
+void
+term_mouse_moveto (int x, int y)
 {
   const char *name;
   int fd;
+  /* TODO: how to set mouse position?
   name = (const char *) ttyname (0);
   fd = open (name, O_WRONLY);
-  /* TODO: how to set mouse position?
-     SOME_FUNCTION (x, y, fd);  */
+     SOME_FUNCTION (x, y, fd);
   close (fd);
   last_mouse_x = x;
-  last_mouse_y = y;
+  last_mouse_y = y;  */
 }
 
 static void
@@ -2681,10 +2677,6 @@
       || !f->glyphs_initialized_p)
     return;
 
-  mouse_face_mouse_x = x;
-  mouse_face_mouse_y = y;
-  mouse_face_mouse_frame = f;
-
   /* Which window is that in?  */
   window = window_from_coordinates (f, x, y, &part, &x, &y, 0);
 
@@ -2926,7 +2918,7 @@
   if (event->x != last_mouse_x || event->y != last_mouse_y)
     {
       frame->mouse_moved = 1;
-      term_mouse_highlight (frame, event->x - 1, event->y - 1);
+      term_mouse_highlight (frame, event->x, event->y);
       /* Remember which glyph we're now on.  */
       last_mouse_x = event->x;
       last_mouse_y = event->y;
@@ -2946,7 +2938,7 @@
 
    Set *time to the time the mouse was at the returned position.
 
-   This should clear mouse_moved until the next motion
+   This clears mouse_moved until the next motion
    event arrives.  */
 static void
 term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
@@ -2954,8 +2946,6 @@
 		     Lisp_Object *y, unsigned long *time)
 {
   struct timeval now;
-  Lisp_Object frame, window;
-  struct window *w;
 
   *fp = SELECTED_FRAME ();
   (*fp)->mouse_moved = 0;
@@ -2963,13 +2953,8 @@
   *bar_window = Qnil;
   *part = 0;
 
-  XSETINT (*x, last_mouse_x); 
+  XSETINT (*x, last_mouse_x);
   XSETINT (*y, last_mouse_y);
-  XSETFRAME (frame, *fp);
-  window = Fwindow_at (*x, *y, frame);
-
-  XSETINT (*x, last_mouse_x - WINDOW_LEFT_EDGE_COL (XWINDOW (window)));
-  XSETINT (*y, last_mouse_y - WINDOW_TOP_EDGE_LINE (XWINDOW (window)));
   gettimeofday(&now, 0);
   *time = (now.tv_sec * 1000) + (now.tv_usec / 1000);
 }
@@ -3016,7 +3001,7 @@
   if (event->type & GPM_DRAG)
     result->modifiers |= drag_modifier;
 
-  if (!(event->type & (GPM_MOVE|GPM_DRAG))) {
+  if (!(event->type & (GPM_MOVE | GPM_DRAG))) {
 
     /* 1 << KG_SHIFT */
     if (event->modifiers & (1 << 0))
@@ -3032,8 +3017,8 @@
       result->modifiers |= meta_modifier;
   }
 
-  XSETINT (result->x, event->x - 1);
-  XSETINT (result->y, event->y - 1);
+  XSETINT (result->x, event->x);
+  XSETINT (result->y, event->y);
   XSETFRAME (result->frame_or_window, f);
   result->arg = Qnil;
   return Qnil;
@@ -3052,7 +3037,7 @@
   ie.kind = NO_EVENT;
   ie.arg = Qnil;
 
-  if (event->type & GPM_MOVE) {
+  if (event->type & (GPM_MOVE | GPM_DRAG)) {
     unsigned char buf[6 * sizeof (short)];
     unsigned short *arg = (unsigned short *) buf + 1;
     const char *name;
@@ -3063,8 +3048,8 @@
     /* Display mouse pointer */
     buf[sizeof(short) - 1] = 2;  /* set selection */
 
-    arg[0] = arg[2] = (unsigned short) event->x;
-    arg[1] = arg[3] = (unsigned short) event->y;
+    arg[0] = arg[2] = (unsigned short) event->x + gpm_zerobased;
+    arg[1] = arg[3] = (unsigned short) event->y + gpm_zerobased;
     arg[4] = (unsigned short) 3;
     
     name = (const char *) ttyname (0);
@@ -3072,7 +3057,8 @@
     ioctl (fd, TIOCLINUX, buf + sizeof (short) - 1);
     close (fd);
 
-    term_mouse_movement (f, event);
+    if (!term_mouse_movement (f, event))
+      help_echo_string = previous_help_echo_string;
 
     /* If the contents of the global variable help_echo_string
        has changed, generate a HELP_EVENT.  */
@@ -3123,6 +3109,7 @@
   connection.defaultMask = ~GPM_HARD;
   connection.maxMod = ~0;
   connection.minMod = 0;
+  gpm_zerobased = 1;
 
   if (Gpm_Open (&connection, 0) < 0)
     return Qnil;
--- a/src/w32fns.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/w32fns.c	Mon Jun 11 00:58:11 2007 +0000
@@ -8043,9 +8043,9 @@
     /* Apparently NT4 crashes if you give it an unexpected size.
        I'm not sure about Windows 9x, so play it safe.  */
     if (w32_major_version > 4 && w32_major_version < 95)
-      file_details->lStructSize = sizeof (new_file_details);
+      file_details->lStructSize = sizeof (NEWOPENFILENAME);
     else
-      file_details->lStructSize = sizeof (file_details);
+      file_details->lStructSize = sizeof (OPENFILENAME);
 
     file_details->hwndOwner = FRAME_W32_WINDOW (f);
     /* Undocumented Bug in Common File Dialog:
--- a/src/window.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/window.c	Mon Jun 11 00:58:11 2007 +0000
@@ -4110,8 +4110,8 @@
 DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p",
        doc: /* Make current window ARG lines smaller.
 From program, optional second arg non-nil means shrink sideways arg columns.
-Interactively, if an argument is not given, make the window one line smaller.  Only
-siblings to the right or below are changed.  */)
+Interactively, if an argument is not given, make the window one line smaller.
+Only siblings to the right or below are changed.  */)
      (arg, side)
      Lisp_Object arg, side;
 {
--- a/src/xdisp.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/xdisp.c	Mon Jun 11 00:58:11 2007 +0000
@@ -17491,7 +17491,7 @@
   CHECK_BUFFER (buffer);
 
   if (NILP (format))
-    return build_string ("");
+    return empty_unibyte_string;
 
   if (no_props)
     face = Qnil;
@@ -17549,7 +17549,7 @@
     {
       mode_line_string_list = Fnreverse (mode_line_string_list);
       str = Fmapconcat (intern ("identity"), mode_line_string_list,
-			make_string ("", 0));
+			empty_unibyte_string);
     }
 
   unbind_to (count, Qnil);
@@ -24387,7 +24387,7 @@
     = Vframe_title_format
     = Fcons (intern ("multiple-frames"),
 	     Fcons (build_string ("%b"),
-		    Fcons (Fcons (empty_string,
+		    Fcons (Fcons (empty_unibyte_string,
 				  Fcons (intern ("invocation-name"),
 					 Fcons (build_string ("@"),
 						Fcons (intern ("system-name"),
--- a/src/xfaces.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/xfaces.c	Mon Jun 11 00:58:11 2007 +0000
@@ -4160,6 +4160,8 @@
 {
   Lisp_Object lface;
 
+  face = resolve_face_name (face, 1);
+
   if (!NILP (frame))
     {
       CHECK_LIVE_FRAME (frame);
--- a/src/xfns.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/xfns.c	Mon Jun 11 00:58:11 2007 +0000
@@ -1523,6 +1523,8 @@
 /* Encode Lisp string STRING as a text in a format appropriate for
    XICCC (X Inter Client Communication Conventions).
 
+   This can call Lisp code, so callers must GCPRO.
+
    If STRING contains only ASCII characters, do no conversion and
    return the string data of STRING.  Otherwise, encode the text by
    CODING_SYSTEM, and return a newly allocated memory area which
@@ -1591,6 +1593,16 @@
 	int bytes, stringp;
         int do_free_icon_value = 0, do_free_text_value = 0;
 	Lisp_Object coding_system;
+#ifdef USE_GTK
+	Lisp_Object encoded_name;
+	struct gcpro gcpro1;
+
+	/* As ENCODE_UTF_8 may cause GC and relocation of string data,
+	   we use it before x_encode_text that may return string data.  */
+	GCPRO1 (name);
+	encoded_name = ENCODE_UTF_8 (name);
+	UNGCPRO;
+#endif
 
 	coding_system = Qcompound_text;
 	/* Note: Encoding strategy
@@ -1631,7 +1643,7 @@
 
 #ifdef USE_GTK
         gtk_window_set_title (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
-                              (char *) SDATA (ENCODE_UTF_8 (name)));
+                              (char *) SDATA (encoded_name));
 #else /* not USE_GTK */
 	XSetWMName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &text);
 #endif /* not USE_GTK */
@@ -1817,9 +1829,9 @@
 				    build_string (foreground_p
 						  ? "foreground"
 						  : "background"),
-				    empty_string,
+				    empty_unibyte_string,
 				    build_string ("verticalScrollBar"),
-				    empty_string);
+				    empty_unibyte_string);
       if (!STRINGP (tem))
 	{
 	  /* If nothing has been specified, scroll bars will use a
--- a/src/xmenu.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/xmenu.c	Mon Jun 11 00:58:11 2007 +0000
@@ -325,7 +325,7 @@
   menu_items_used = XINT (XCAR (saved));
   saved = XCDR (saved);
   menu_items_n_panes = XINT (XCAR (saved));
-  saved = XCDR (saved);  
+  saved = XCDR (saved);
   menu_items_submenu_depth = XINT (XCAR (saved));
   return Qnil;
 }
@@ -3428,7 +3428,7 @@
     pane_name = first_item[MENU_ITEMS_PANE_NAME];
   else if (EQ (first_item[0], Qquote))
     /* This shouldn't happen, see xmenu_show.  */
-    pane_name = empty_string;
+    pane_name = empty_unibyte_string;
   else
     pane_name = first_item[MENU_ITEMS_ITEM_NAME];
 
--- a/src/xselect.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/xselect.c	Mon Jun 11 00:58:11 2007 +0000
@@ -2678,7 +2678,7 @@
     ret = make_string (name, strlen (name));
 
   if (atom && name) XFree (name);
-  if (NILP (ret)) ret = make_string ("", 0);
+  if (NILP (ret)) ret = empty_unibyte_string;
 
   UNBLOCK_INPUT;
 
--- a/src/xterm.c	Fri Jun 08 12:41:25 2007 +0000
+++ b/src/xterm.c	Mon Jun 11 00:58:11 2007 +0000
@@ -8652,7 +8652,7 @@
                            prop_atom, 0, max_len, False, target_type,
                            &actual_type, &actual_format, &actual_size,
                            &bytes_remaining, &tmp_data);
-  
+
   if (rc != Success || actual_type != XA_WINDOW || x_had_errors_p (dpy))
     {
       if (tmp_data) XFree (tmp_data);
@@ -8707,7 +8707,7 @@
   rc = 0;
   want_atom = XInternAtom (dpy, atomname, False);
 
-  for (i = 0; rc == 0 && i < dpyinfo->nr_net_supported_atoms; ++i) 
+  for (i = 0; rc == 0 && i < dpyinfo->nr_net_supported_atoms; ++i)
     rc = dpyinfo->net_supported_atoms[i] == want_atom;
 
   x_uncatch_errors ();
@@ -11108,7 +11108,7 @@
 	    UNBLOCK_INPUT;
 	    dpyinfo->kboard->Vsystem_key_alist
 	      = call1 (Qvendor_specific_keysyms,
-		       build_string (vendor ? vendor : ""));
+		       vendor ? build_string (vendor) : empty_unibyte_string);
 	    BLOCK_INPUT;
 	  }