changeset 90384:c156f6a9e7b5

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-56 Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 204-225) - Update from CVS - Sync from erc--emacs--0 - Merge from gnus--rel--5.10 - Improve tq.el. - Update from CVS: src/puresize.h (PURESIZE_RATIO): Reduce to 10/6. * gnus--rel--5.10 (patch 81-85) - Update from CVS - Merge from emacs--devo--0
author Miles Bader <miles@gnu.org>
date Mon, 17 Apr 2006 08:41:12 +0000
parents ab20fb198dda (current diff) 027c07dcdee5 (diff)
children 72dea2ff0142
files admin/FOR-RELEASE etc/ChangeLog etc/NEWS etc/PROBLEMS etc/TODO leim/Makefile.in leim/quail/croatian.el leim/quail/cyril-jis.el leim/quail/cyrillic.el leim/quail/hangul3.el leim/quail/hanja.el leim/quail/japanese.el leim/quail/latin-alt.el leim/quail/latin-ltx.el leim/quail/latin-post.el leim/quail/latin-pre.el leim/quail/pypunct-b5.el leim/quail/tibetan.el lisp/ChangeLog lisp/allout.el lisp/calendar/appt.el lisp/cus-edit.el lisp/custom.el lisp/emacs-lisp/bytecomp.el lisp/emacs-lisp/edebug.el lisp/emacs-lisp/find-func.el lisp/emacs-lisp/tq.el lisp/emulation/cua-base.el lisp/emulation/cua-gmrk.el lisp/emulation/cua-rect.el lisp/files.el lisp/finder.el lisp/gnus/ChangeLog lisp/gnus/flow-fill.el lisp/gnus/gnus-art.el lisp/gnus/gnus-sum.el lisp/gnus/gnus-uu.el lisp/gnus/message.el lisp/gnus/mm-decode.el lisp/gnus/nnslashdot.el lisp/gnus/rfc2047.el lisp/hexl.el lisp/international/mule-cmds.el lisp/loadhist.el lisp/mail/rmail.el lisp/mh-e/ChangeLog lisp/mh-e/mh-comp.el lisp/mh-e/mh-compat.el lisp/mh-e/mh-e.el lisp/mh-e/mh-funcs.el lisp/mh-e/mh-mime.el lisp/mh-e/mh-seq.el lisp/mh-e/mh-utils.el lisp/net/tramp.el lisp/newcomment.el lisp/pcvs-parse.el lisp/play/landmark.el lisp/progmodes/cc-langs.el lisp/progmodes/gdb-ui.el lisp/progmodes/perl-mode.el lisp/simple.el lisp/startup.el lisp/subr.el lisp/textmodes/bibtex.el lisp/textmodes/org.el lisp/textmodes/picture.el lisp/time-stamp.el lisp/vc.el lispref/ChangeLog lispref/customize.texi lispref/os.texi lispref/processes.texi lispref/text.texi mac/ChangeLog mac/inc/config.h man/ChangeLog man/building.texi man/cmdargs.texi man/custom.texi man/emacs.texi man/files.texi man/frames.texi man/gnu.texi man/gnus-faq.texi man/gnus.texi man/macos.texi man/msdog.texi man/mule.texi man/search.texi man/sending.texi man/trouble.texi src/ChangeLog src/data.c src/dispnew.c src/fns.c src/image.c src/keyboard.c src/lisp.h src/mac.c src/macfns.c src/macmenu.c src/macterm.c src/macterm.h src/print.c src/process.c src/puresize.h src/s/ms-w32.h src/search.c src/unexmacosx.c src/window.c src/xdisp.c src/xfaces.c src/xrdb.c
diffstat 131 files changed, 7395 insertions(+), 5169 deletions(-) [+]
line wrap: on
line diff
--- a/admin/FOR-RELEASE	Sun Apr 09 01:43:22 2006 +0000
+++ b/admin/FOR-RELEASE	Mon Apr 17 08:41:12 2006 +0000
@@ -33,6 +33,10 @@
 
 * BUGS
 
+** Stefan Monnier's March 20 bug report about 3d boxes in header line.
+
+** Is there a basic problem with cl-byte-compile-compiler-macro?
+
 ** Markus Gritsch's report about Emacs looping on Windoze with the following
 .emacs file, and then reduce Emacs frame width to "something quite narrow":
 	(setq-default truncate-lines t)
@@ -72,7 +76,7 @@
 DIRECTORY		STATUS		IN CHARGE
 ---------		------		---------
 etc (and subdirs)	done		Thien-Thi Nguyen (ttn(@gnu.org))
-leim			working		Kenichi Handa
+leim			done		Kenichi Handa
 lib-src			done		ttn
 lisp			done		ttn
 lisp/calc		done		Jay Belanger
@@ -81,8 +85,8 @@
 lisp/emulation		done		ttn
 lisp/eshell		done		ttn
 lisp/gnus		done		Romain Francoise
-lisp/international	working		Kenichi Handa
-lisp/language		working		Kenichi Handa
+lisp/international	done		Kenichi Handa
+lisp/language		done		Kenichi Handa
 lisp/mail		done		ttn
 lisp/mh-e		done		Bill Wohler
 lisp/net		done		ttn
--- a/etc/ChangeLog	Sun Apr 09 01:43:22 2006 +0000
+++ b/etc/ChangeLog	Mon Apr 17 08:41:12 2006 +0000
@@ -1,3 +1,21 @@
+2006-04-12  Kenichi Handa  <handa@m17n.org>
+
+	* PROBLEMS (C-SPC fails ...): Explicitly say fcitx in the header.
+
+2006-04-11  Carsten Dominik  <dominik@science.uva.nl>
+
+	* orgcard.tex: (section{Tables}): Document column narrowing.
+	(section{Links}): Document bracket links.
+
+2006-04-11  Kenichi Handa  <handa@m17n.org>
+
+	* PROBLEMS (C-SPC fails ...): Add description for fcitx.
+
+2006-04-10  Bill Wohler  <wohler@newt.com>
+
+	* NEWS: Add package-version keyword to `defcustom' and mention
+	associated variable `customize-package-emacs-version-alist'.
+
 2006-04-07  Reiner Steib  <Reiner.Steib@gmx.de>
 
 	* NEWS: Add string-or-null-p.
--- a/etc/NEWS	Sun Apr 09 01:43:22 2006 +0000
+++ b/etc/NEWS	Mon Apr 17 08:41:12 2006 +0000
@@ -3767,6 +3767,12 @@
 ** defcustom changes:
 
 +++
+*** The package-version keyword has been added to provide
+`customize-changed-options' functionality to packages in the future.
+Developers who make use of this keyword must also update the new
+variable `customize-package-emacs-version-alist'.
+
++++
 *** The new customization type `float' requires a floating point number.
 
 ** String changes:
@@ -4036,6 +4042,12 @@
 properties--any specified text properties are discarded.
 
 +++
+*** The variable `enable-local-variables' controls how local variable
+lists are handled.  t, the default, specifies the standard querying
+behavior.  :safe means use only safe values, and ignore the rest.
+nil means ignore them all.  Anything else means always query.
+
++++
 *** The variable `safe-local-eval-forms' specifies a list of forms that
 are ok to evaluate when they appear in an `eval' local variables
 specification.  Normally Emacs asks for confirmation before evaluating
@@ -10859,9 +10871,6 @@
 editing SQL files, and M-x sql-interactive-mode for interacting with
 SQL interpreters.  It has an entry on `auto-mode-alist'.
 
-*** M-x highlight-changes-mode provides a minor mode displaying buffer
-changes with a special face.
-
 *** ispell4.el has been deleted.  It got in the way of ispell.el and
 this was hard to fix reliably.  It has long been obsolete -- use
 Ispell 3.1 and ispell.el.
--- a/etc/PROBLEMS	Sun Apr 09 01:43:22 2006 +0000
+++ b/etc/PROBLEMS	Mon Apr 17 08:41:12 2006 +0000
@@ -995,7 +995,7 @@
 
 Use the shell command `xset bc' to make the old X Menu package work.
 
-*** C-SPC fails to work on Fedora GNU/Linux.
+*** C-SPC fails to work on Fedora GNU/Linux (or with fcitx input method).
 
 Fedora Core 4 steals the C-SPC key by default for the `iiimx' program
 which is the input method for some languages.  It blocks Emacs users
@@ -1009,6 +1009,12 @@
 
 Another is to build Emacs with the `--without-xim' configure option.
 
+The same problem happens on any other system if you are using fcitx
+(Chinese input method) which by default use C-SPC for toggling.  If
+you want to use fcitx with Emacs, you have two choices.  Toggle fcitx
+by another key (e.g. C-\) by modifying ~/.fcitx/config, or be
+accustomed to use C-@ for `set-mark-command'.
+
 *** M-SPC seems to be ignored as input.
 
 See if your X server is set up to use this as a command
--- a/etc/TODO	Sun Apr 09 01:43:22 2006 +0000
+++ b/etc/TODO	Mon Apr 17 08:41:12 2006 +0000
@@ -9,10 +9,13 @@
 
 * Small but important fixes needed in existing features:
 
+** Distribute a bar cursor of width > 1 evenly between the two glyphs
+   on each side of the bar (what to do at the edges?).
+
 ** Make vc-checkin avoid reverting the buffer if has not changed after
    the checkin. Comparing (md5 BUFFER) to (md5 FILE) should be enough.
 
-** Make vc-annotate show place the cursor in the annotate buffer at the 
+** Make vc-annotate show place the cursor in the annotate buffer at the
    same line as the current buffer.
 
 ** buffer-offer-save should be a permanent local.
@@ -69,7 +72,7 @@
 ** Redesign the load-history data structure so it can cope better
   with evaluating definitions of the same function from different files,
   recording which file the latest definition came from.
-  
+
 * Important features:
 
 ** Provide user-friendly ways to list all available font families,
@@ -158,7 +161,7 @@
 ** Emacs Lisp mode could put an overlay on the defun for every
   function that has advice.  The overlay could have `after-text' like "
   [Function has advice]".  It might look like
-     (defun foo [Function has advice] (x y) 
+     (defun foo [Function has advice] (x y)
   The overlay could also be a button that you could use to view the advice.
 
 ** ange-ftp
@@ -261,7 +264,7 @@
 ** Highlight rectangles (`mouse-track-rectangle-p' in XEmacs).  Already in CUA,
   but it's a valuable feature worth making more general.
 
-** Support simultaneous tty and X frames.  [See the multi-tty branch of Emacs 
+** Support simultaneous tty and X frames.  [See the multi-tty branch of Emacs
   at http://lorentey.hu/project/emacs.]
 
 ** Provide MIME support for Rmail using the Gnus MIME library.  [Maybe
--- a/etc/orgcard.tex	Sun Apr 09 01:43:22 2006 +0000
+++ b/etc/orgcard.tex	Mon Apr 17 08:41:12 2006 +0000
@@ -1,4 +1,6 @@
-% Reference Card for Org Mode 4.10
+% Reference Card for Org Mode
+\def\orgversionnumber{4.23}
+\def\year{2006}
 %
 %**start of header
 \newcount\columnsperpage
@@ -58,9 +60,6 @@
 % Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
 % for their many good ideas.
 
-\def\orgversionnumber{4.10}
-\def\year{2006}
-
 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
   \centerline{\small \copyright\ 2004, 2005, 2006\ Free Software Foundation, Inc.
   Permissions on back.  v\orgversionnumber}}
@@ -367,10 +366,8 @@
 \key{insert SCHEDULED timestamp}{C-c C-s}
 \key{create sparse tree with all deadlines due}{C-c C-w}
 \key{the time between 2 dates in a time range}{C-c C-y}
-\key{change timestamp at cursor by $-1$ day}{S-LEFT$^4$}
-\key{change timestamp at cursor by $+1$ day}{S-RIGHT$^4$}
-\key{change year/month/day at cursor by $-1$}{S-DOWN$^4$}
-\key{change year/month/day at cursor by $+1$}{S-UP$^4$}
+\key{change timestamp at cursor by $\pm 1$ day}{S-RIGHT/LEFT$^4$}
+\key{change year/month/day at cursor by $\pm 1$}{S-UP/DOWN$^4$}
 \key{access the calendar for the current date}{C-c >}
 \key{insert timestamp matching date in calendar}{C-c <}
 \key{access agenda for current date}{C-c C-o}
@@ -386,6 +383,7 @@
 \key{globally store link to the current location}{C-c l$^2$}
 \key{insert a link (TAB completes stored links)}{C-c C-l}
 \key{insert file link with file name completion}{C-u C-c C-l}
+\key{edit (also hidden part of) link at point}{C-c C-l}
 
 \key{open file links in emacs (\kbd{C-u} : in emacs)}{C-c C-o}
 \key{open link at point (3: in emacs)}{mouse-2/3}
@@ -399,24 +397,26 @@
 \key{\kbd{<<<My Target>>>}}{\rm radio target$^3$}
 \key{\kbd{[[*this text]]}}{\rm find headline}
 \metax{\kbd{[[this text]]}}{\rm find target or text in buffer}
+\metax{\kbd{[[this text][description]]}}{\rm optional link text}
 
 {\bf External Links}
 
-\key{\kbd{<file:/home/dominik/img/mars.jpg>}}{\rm file, absolute}
-\key{\kbd{<file:papers/last.pdf>}}{\rm file, relative}
-\key{\kbd{<file:projects.org::*that text>}}{\rm find headline}
-\key{\kbd{<file:projects.org::find me>}}{\rm find tgt/string}
-\key{\kbd{<file:projects.org::/regexp/>}}{\rm regexp search}
-\key{\kbd{<http://www.astro.uva.nl/~dominik>}}{\rm on the web}
-\key{\kbd{<mailto:adent@galaxy.net>}}{\rm EMail address}
-\key{\kbd{<news:comp.emacs>}}{\rm Usenet group}
-\key{\kbd{<bbdb:Richard Stallman>}}{\rm BBDB person}
-\key{\kbd{<shell:ls *.org>}}{\rm shell command}
-\key{\kbd{<gnus:group>}}{\rm GNUS group}
-\key{\kbd{<gnus:group\#id>}}{\rm GNUS message}
-\key{\kbd{<vm|wl|mhe|rmail:folder>}}{\rm Mail folder}
-\key{\kbd{<vm|wl|mhe|rmail:folder\#id>}}{\rm Mail message}
-%\key{\kbd{<vm://myself@some.where.org/folder\#id>}}{\rm VM remote}
+\key{\kbd{file:/home/dominik/img/mars.jpg}}{\rm file, absolute}
+\key{\kbd{file:papers/last.pdf}}{\rm file, relative}
+\key{\kbd{file:projects.org::*that text}}{\rm find headline}
+\key{\kbd{file:projects.org::find me}}{\rm find tgt/string}
+\key{\kbd{file:projects.org::/regexp/}}{\rm regexp search}
+\key{\kbd{http://www.astro.uva.nl/~dominik}}{\rm on the web}
+\key{\kbd{mailto:adent@galaxy.net}}{\rm EMail address}
+\key{\kbd{news:comp.emacs}}{\rm Usenet group}
+\key{\kbd{bbdb:Richard Stallman}}{\rm BBDB person}
+\key{\kbd{shell:ls *.org}}{\rm shell command}
+\key{\kbd{gnus:group}}{\rm GNUS group}
+\key{\kbd{gnus:group\#id}}{\rm GNUS message}
+\key{\kbd{vm|wl|mhe|rmail:folder}}{\rm Mail folder}
+\key{\kbd{vm|wl|mhe|rmail:folder\#id}}{\rm Mail message}
+\metax{\kbd{[[external link][description]]}}{\rm optional link text}
+%\key{\kbd{vm://myself@some.where.org/folder\#id}}{\rm VM remote}
 
 \section{Tables}
 
@@ -425,11 +425,10 @@
 
 {\bf Creating a table}
 
-\metax{insert a new Org-mode table}{M-x org-table-create}
-\metax{... or just start typing, e.g.}{|Name|Phone|Age RET |- TAB}
-\key{convert region to table}{C-c C-c}
-\key{... separator at least 3 spaces}{C-3 C-c C-c}
-%\key{... prompt for separator regexp}{C-u C-c C-c}
+%\metax{insert a new Org-mode table}{M-x org-table-create}
+\metax{just start typing, e.g.}{|Name|Phone|Age RET |- TAB}
+\key{convert region to table}{C-c |}
+\key{... separator at least 3 spaces}{C-3 C-c |}
 
 {\bf Commands available inside tables}
 
@@ -465,9 +464,7 @@
 \key{paste rectangular region}{C-c C-x C-y}
 \key{fill paragraph across selected cells}{C-c C-q}
 
-{\bf Calculations}
-
-These need the Emacs calc package installed.
+{\bf Calculations} (in combination with Emacs \kbd{calc} package)
 
 \key{set and eval column formula}{C-c =}
 \key{set and eval named-field formula}{C-u C-c =}
@@ -475,8 +472,8 @@
 \key{re-apply all stored equations to current line}{C-c *}
 \key{re-apply all stored equations to entire table}{C-u C-c *}
 
-\kbd{TAB}, \kbd{RET} and \kbd{C-c C-c} trigger automatic recalculation
-in lines starting with: {\tt | \# |}.
+%\kbd{TAB}, \kbd{RET} and \kbd{C-c C-c} trigger automatic recalculation
+%in lines starting with: {\tt | \# |}.
 
 \key{rotate calculation mark through \# * ! \^ \_ \$}{C-\#}
 
@@ -484,9 +481,9 @@
 \key{sum numbers in current column/rectangle}{C-c +}
 \key{copy down with increment}{S-RET$^4$}
 
-A formula can also be typed directly into into a field and will
-executed by \kbd{TAB}, \kbd{RET} and \kbd{C-c C-c}.  A leading \kbd{=}
-introduces a column formula, \kbd{:=} a named-field formula.
+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}
@@ -496,7 +493,9 @@
 
 {\bf Miscellaneous}
 
-\key{toggle visibility of vertical lines}{C-c |}
+\key{to limit column width to \kbd{N} characters, use}{...| <N> |...}
+\key{edit the current field in a separate window}{C-c `}
+\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}
 
--- a/leim/Makefile.in	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/Makefile.in	Mon Apr 17 08:41:12 2006 +0000
@@ -1,5 +1,5 @@
 # Makefile for leim subdirectory in GNU Emacs.
-# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
 #   Free Software Foundation, Inc.
 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 #   National Institute of Advanced Industrial Science and Technology (AIST)
--- a/leim/quail/croatian.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/quail/croatian.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1,6 +1,6 @@
 ;;; quail/croatian.el -- Quail package for inputing Croatian  -*-coding: iso-8859-2;-*-
 
-;; Copyright (C) 2002 Free Software Foundation, Inc.
+;; Copyright (C) 2003 Free Software Foundation, Inc.
 
 ;; Author: Hrvoje Nik¹iæ <hniksic@xemacs.org>,
 ;;         modeled after czech.el by Milan Zamazal.
--- a/leim/quail/cyril-jis.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/quail/cyril-jis.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1,7 +1,7 @@
 ;;; cyril-jis.el --- Quail package for inputting JISX0208 Cyrillic letters
 
 ;; Copyright (C) 2001  Free Software Foundation, Inc.
-;; Copyright (C) 1997, 2005
+;; Copyright (C) 1997
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
--- a/leim/quail/cyrillic.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/quail/cyrillic.el	Mon Apr 17 08:41:12 2006 +0000
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 1997, 1998, 2001, 2002, 2003, 2004, 2005
 ;;   Free Software Foundation, Inc.
-;; Copyright (C) 1997, 2005
+;; Copyright (C) 1997, 2003
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
--- a/leim/quail/hangul3.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/quail/hangul3.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1,6 +1,6 @@
 ;;; hangul3.el --- Quail package for inputting Korean Hangul characters  -*-coding: iso-2022-7bit;-*-
 
-;; Copyright (C) 1997, 1998, 2001  Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1998, 2001, 2002  Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 2002
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
--- a/leim/quail/hanja.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/quail/hanja.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1,5 +1,6 @@
 ;;; hanja.el --- Quail-package for Korean Hanja (KSC5601)  -*-coding: iso-2022-7bit;-*-
 
+;; Copyright (C) 1997 Free Software Foundation, Inc.
 ;; Copyright (C) 1997
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
--- a/leim/quail/japanese.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/quail/japanese.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1,5 +1,6 @@
 ;;; japanese.el --- Quail package for inputting Japanese  -*-coding: iso-2022-7bit;-*-
 
+;; Copyright (C) 2001  Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2005
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
--- a/leim/quail/latin-alt.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/quail/latin-alt.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1,7 +1,7 @@
 ;;; latin-alt.el --- Quail package for inputting various European characters -*-coding: utf-8;-*-
 
 ;; Copyright (C) 1997, 1998, 2001, 2002  Free Software Foundation, Inc.
-;; Copyright (C) 1997, 1999
+;; Copyright (C) 1999
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
--- a/leim/quail/latin-ltx.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/quail/latin-ltx.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1,7 +1,7 @@
 ;;; latin-ltx.el --- Quail package for TeX-style input -*-coding: utf-8;-*-
 
 ;; Copyright (C) 2001, 2003, 2004, 2005  Free Software Foundation, Inc.
-;; Copyright (C) 2001
+;; Copyright (C) 2001, 2005
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
--- a/leim/quail/latin-post.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/quail/latin-post.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1,7 +1,7 @@
 ;;; latin-post.el --- Quail packages for inputting various European characters  -*-coding: utf-8;-*-
 
 ;; Copyright (C) 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
-;; Copyright (C) 1997
+;; Copyright (C) 1997, 1999
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 ;; Copyright (C) 2003
--- a/leim/quail/latin-pre.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/quail/latin-pre.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1,8 +1,8 @@
 ;;; latin-pre.el --- Quail packages for inputting various European characters  -*-coding: utf-8;-*-
 
-;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
 ;;   Free Software Foundation, Inc.
-;; Copyright (C) 1997, 1999, 2005
+;; Copyright (C) 1997, 1998, 1999, 2000, 2005
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
--- a/leim/quail/pypunct-b5.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/quail/pypunct-b5.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1,6 +1,6 @@
 ;;; pypunct-b5.el --- Quail packages for Chinese (pinyin + extra symbols) -*-coding: iso-2022-7bit;-*-
 
-;; Copyright (C) 1997, 2000
+;; Copyright (C) 1997, 2000, 2003
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
--- a/leim/quail/tibetan.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/leim/quail/tibetan.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1,7 +1,7 @@
 ;;; tibetan.el --- Quail package for inputting Tibetan characters -*-coding: iso-2022-7bit;-*-
 
-;; Copyright (C) 1995  Free Software Foundation, Inc.
-;; Copyright (C) 1995, 1998, 1999, 2000
+;; Copyright (C) 1997  Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1998, 1999, 2000
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
--- a/lisp/ChangeLog	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/ChangeLog	Mon Apr 17 08:41:12 2006 +0000
@@ -1,3 +1,282 @@
+2006-04-16  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* newcomment.el (comment-add): New function.
+	(comment-region-default, comment-dwim): Use it.
+
+2006-04-15  Michael Olson  <mwolson@gnu.org>
+
+	* emacs-lisp/tq.el: Improve comments.
+	(tq-queue-head-question): New accessor function.
+	(tq-queue-head-regexp, tq-queue-head-closure, tq-queue-head-fn):
+	Update for modified queue structure.
+	(tq-queue-add): Accept `question' argument.
+	(tq-queue-pop): If a question is pending, send it.
+	(tq-enqueue): Accept new optional argument `delay-question'.
+	If this is non-nil, and at least one other question is pending a
+	response, queue the question rather than sending it immediately.
+
+2006-04-15  Roland Winkler  <Roland.Winkler@physik.uni-erlangen.de>
+
+	* calendar/appt.el (appt-add): Check whether an appointment is
+	already present in appt-time-msg-list.  Simplify code.
+
+2006-04-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/cc-langs.el (c-mode-menu):
+	Don't presume c-subword-mode is bound.
+
+2006-04-13  Bill Wohler  <wohler@newt.com>
+
+	* cus-edit.el (customize-package-emacs-version-alist): Update docstring.
+	(customize-package-emacs-version): Use cdr instead of cadr now
+	that alists use dotted pairs.
+
+	* custom.el (defcustom): Fix docstring for :package-version.
+
+2006-04-13  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-display-shell-command-buffer): New defvar.
+	(tramp-handle-shell-command): Display output buffer only when
+	`tramp-display-shell-command-buffer' is true.
+	(tramp-handle-process-file): Set `tramp-display-shell-command-buffer'.
+
+2006-04-13  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el (org-set-autofill-regexps): Set only the local
+	values of `adaptive-fill-regexp' and `adaptive-fill-function'.
+
+2006-04-13  Romain Francoise  <romain@orebokech.com>
+
+	* pcvs-parse.el (cvs-parse-table): Use `with-temp-buffer' to avoid
+	leaving temporary .cvsignore buffers behind.
+
+2006-04-13  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el: (org-set-regexps-and-options)
+	(org-get-current-options): Better names for the startup folding
+	options.
+
+2006-04-13  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* vc.el (vc-annotate): Arrange for point to end up at the same
+	line number as in the original, but only when using a new buffer.
+
+2006-04-12  Davis Herring  <herring@lanl.gov>  (tiny change)
+
+	* files.el (hack-one-local-variable-eval-safep):
+	Recognize `edebug-form-spec' for `put', but only if it passes
+	`edebug-basic-spec'.  Generalize `put' handling.
+
+	* emacs-lisp/edebug.el (edebug-basic-spec): New function for
+	vetting file-local form specs.
+
+	* allout.el (allout-layout): Autoload its `safe-local-variable'
+	property.
+
+2006-04-13  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el: (org-ctrl-c-ctrl-c): Improve documentation string.
+	(org-agenda-mouse-1-follows-link)
+	(org-mouse-1-follows-link): New options.
+	(org-format-agenda-item): Fix bug if TAGS is nil.
+	(org-agenda-get-scheduled): Quote `priority' symbol in plist.
+
+2006-04-13  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-set-gud-minor-mode-existing-buffers):
+	GDB 6.1+ gives full filename for "info sources" so use
+	file-name-nondirectory.
+
+2006-04-12  Romain Francoise  <romain@orebokech.com>
+
+	* subr.el (read-passwd): Bind `message-log-max' to nil.
+
+2006-04-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/perl-mode.el (perl-indent-new-calculate):
+	Recompute parse-start after jumping backward by a whole sexp.
+
+2006-04-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc.el (vc-ensure-vc-buffer): Only change current-buffer, not the
+	window configuration.
+	(vc-annotate-display-select): Select the buffer so that current-buffer
+	(and selected-window) is the output buffer at the end of vc-annotate.
+
+2006-04-11  J.D. Smith  <jdsmith@as.arizona.edu>
+
+	* vc.el (vc-annotate-color-map): Add custom TTY color map for
+	8-color terminals, to use all of the colors in a sensible order.
+	256-color terminals work well with the standard map.
+	(vc-annotate-lines): Only strip the first color character if it
+	is "#", to allow for terminal-style named colors.
+	(vc-annotate-warp-version): Pass buf to `goto-line' to ensure
+	the correct buffer is scrolled.
+
+2006-04-11  Richard Stallman  <rms@gnu.org>
+
+	* emacs-lisp/bytecomp.el (byte-compile-file):
+	Bind enable-local-variables to :safe, and make normal-mode obey it.
+
+	* files.el (enable-local-variables): Allow value :safe.
+	(normal-mode): Doc fix.
+	(hack-local-variables): Implement enable-local-variables = :safe.
+	(hack-local-variables-confirm): Don't prevent quitting.
+
+2006-04-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* loadhist.el (unload-feature): A bit of sanity check of
+	load-history entries.  Cancel timer-vars before unbinding them.
+
+	* hexl.el (hexl-isearch-search-function): Fix regexp-building code to
+	quote special chars, and make the trick work on the hex part of the
+	buffer as well.
+	(hexl-mode, hexl-save-buffer, hexl-mode-exit)
+	(hexl-maybe-dehexlify-buffer): Use restore-buffer-modified-p.
+
+	* startup.el (normal-splash-screen): Fix last change so we don't wait
+	2 minutes if we don't show the splash screen.
+
+2006-04-11  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el (org-export-plain-list-max-depth)
+	(org-table-spaces-around-separators)
+	(org-radio-targets, org-activate-camels)
+	(org-table-spaces-around-invisible-separators): Options removed.
+	(org-time-stamp-rounding-minutes, org-remember-templates)
+	(org-ellipsis, org-activate-links, org-descriptive-links):
+	New options.
+	(org-remember-apply-template, org-current-time)
+	(org-finish-edit-table-field)
+	(org-link-unescape, org-link-escape)
+	(org-string-width, org-table-clean-line, org-html-do-expand)
+	(org-edit-agenda-file-list, org-store-new-agenda-file-list)
+	(org-read-agenda-file-list): New functions.
+	(org-table-edit-field)
+	(org-table-create-or-convert-from-region): New commands
+	(org-table-toggle-vline-visibility): Command removed.
+	(org-table-convert-region): Made a command.
+	(orgtbl-deleta-backward-char,orgtbl-delete-char): Remove commands.
+	Replace with the normal org- functions.
+	(org-self-insert-command): Don't trigger realign unnecessarily
+	when blanking a field that is not full.
+	(org-mode): `Set buffer-invisibility-spec' for links.
+	(org-activate-links2): Hide link part and only show descriptive
+	part of the link.
+	(org-insert-link): Modify for new linking system.
+	(org-store-link): Store description separately, for use by
+	`org-insert-link'.
+	(org-table-align): Use `org-string-width'.
+	(defgroup): Completely new group structure for custom variables.
+	(org-agenda-files): Option: Single file name allowed.  Function:
+	Optional argument unrestrited means ignore any restricitons.
+	(org-install-agenda-files-menu): Find a buffer in Org-mode before
+	trying to modify the menu.  Use generalized access to
+	`org-agenda-files.'
+	(org-agenda-list, org-todo-list, org-cycle-agenda-files)
+	(org-agenda-file-to-front, org-remove-file, org-diary)
+	(org-tags-view, org-export-icalendar-all-agenda-files)
+	(org-export-icalendar-combine-agenda-files): Use generalized
+	access to `org-agenda-files'.
+	(org-remember-handler): Correctly preserve heading if present.
+	(org-table-insert-row, org-table-insert-hline): Deal with
+	invisible characters.
+
+2006-04-10  J.D. Smith  <jdsmith@as.arizona.edu>
+
+	* vc.el (vc-annotate-display-mode): Made default 'fullscale.
+	(vc-annotate-color-map): New 18 element constant
+	value/saturation, rotating hue colormap, from red->blue.
+	(vc-annotate-mode-menu): "Default" -> "By Color Map Range".
+	(vc-annotate-display-select): Switch to annotate-mode elsewhere.
+	(vc-annotate): To avoid killing the required local variables,
+	set them before the end of `with-output-to-temp-buffer', and
+	after first switching to annotate-mode.
+	(vc-annotate-warp-version): Add buffer argument in goto-line to
+	ensure annotation, not source, is scrolled.
+
+2006-04-10  Bill Wohler  <wohler@newt.com>
+
+	* custom.el (defcustom, custom-handle-keyword):
+	Add :package-version keyword.
+	(custom-add-package-version): New function.  Sets value of new
+	property 'custom-package-version from :package-version keyword.
+	(defcustom): Create Common Keywords section in docstring.
+	(defface, defgroup): Replace definitions of a select few keywords
+	with a reference to the Common Keywords in defcustom.
+	(defcustom, defface, defgroup): Replace reference to Customization
+	chapter in manual with hyperlink.
+
+	* cus-edit.el (customize-package-emacs-version-alist):
+	New variable.
+	(customize-changed-options): Add check for custom-package-version.
+	(customize-package-emacs-version): New function to look up Emacs
+	version corresponding to the given package version.
+
+	* emacs-lisp/find-func.el (find-function-regexp): Allow dashes in
+	defun name, in similar fashion to find-variable-regexp.
+
+2006-04-10  Eli Zaretskii  <eliz@gnu.org>
+
+	* international/mule-cmds.el (set-locale-environment): Fix last
+	change for when the locale's preferences don't specify any encoding.
+
+2006-04-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/find-func.el (find-function-search-for-symbol): Fix regexp
+	so the defined var/fun doesn't need to be quoted.
+
+2006-04-10  Richard Stallman  <rms@gnu.org>
+
+	* finder.el (finder-mode-map): Add n and p bindings.
+
+2006-04-10  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-init-1): Re-initialise gdb-main-file to nil.
+	(gdb-get-version): Make it work for pre "interpreter mi" (GDB 5.3?).
+	(gdb-setup-windows): Put something in source window if we can't find
+	the source file.
+	(gdb-frame-handler): Make it work again with just assembly.
+	(gdb-data-list-register-values-handler): Make it work when there is
+	no stack.
+
+2006-04-09  Richard Stallman  <rms@gnu.org>
+
+	* mail/rmail.el (rmail-mime-charset-pattern): Ignore format and delsp
+	specs while looking for charset.
+
+	* textmodes/picture.el (picture-mode-exit): Run picture-mode-exit-hook.
+
+	* play/landmark.el (lm-font-lock-face-O, lm-font-lock-face-X):
+	Make them faces.
+	(lm-font-lock-keywords): Update appropriately.
+
+2006-04-10  Kim F. Storm  <storm@cua.dk>
+
+	* simple.el (filter-buffer-substring): Add NOPROPS arg, so
+	it can also replace buffer-substring-no-properties.
+
+	* emulation/cua-base.el (cua-delete-region, cua-paste)
+	(cua-repeat-replace-region): Use filter-buffer-substring.
+
+	* emulation/cua-gmrk.el (cua-copy-region-to-global-mark)
+	(cua-cut-region-to-global-mark): Likewise.
+
+	* emulation/cua-rect.el (cua--extract-rectangle)
+	(cua-incr-rectangle, cua--rectangle-aux-replace): Likewise.
+
+2006-04-09  Roland Winkler  <Roland.Winkler@physik.uni-erlangen.de>
+
+	* textmodes/bibtex.el (bibtex-entry-update): New optional arg
+	entry-type.  Add field delimiters to numerical fields if they are
+	not present.
+
+2006-04-09  Roland Winkler  <Roland.Winkler@physik.uni-erlangen.de>
+
+	* textmodes/bibtex.el (bibtex-find-text-internal): Add new element
+	string-const to return value.
+	(bibtex-remove-delimiters): Use it.
+
 2006-04-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* emacs-lisp/bytecomp.el (byte-compile-form): Don't call
@@ -57,12 +336,11 @@
 	(rcirc-multiline-minor-mode-map): New mode map.
 	(rcirc-edit-multiline): Put multiline-edit buffer in
 	rcirc-multiline-major-mode along with rcirc-multiline-minor-mode.
-	(rcirc-print): Any line starting with an ignored nick will be
-	ignored.
+	(rcirc-print): Ignore any line starting with an ignored nick.
 	(rcirc-print): Decode using rcirc-decode-coding-system.
 	(rcirc-track-minor-mode): Update global-mode-string when disabling
 	this mode.
-	(minor-mode-alist): add LowPri indicator.
+	(minor-mode-alist): Add LowPri indicator.
 	(rcirc-toggle-low-priority): New function.
 	(rcirc-last-non-irc-buffer): Prefix arg now no means switch to
 	next lowpriority buffer with activity.
@@ -95,8 +373,7 @@
 
 2006-04-07  Reiner Steib  <Reiner.Steib@gmx.de>
 
-	* pgg-gpg.el: Revert to revision 1.8 to allow the use of
-	gpg-agent.
+	* pgg-gpg.el: Revert to revision 1.8 to allow the use of gpg-agent.
 
 2006-04-07  Nick Roberts  <nickrob@snap.net.nz>
 
@@ -109,21 +386,20 @@
 
 	* textmodes/paragraphs.el (sentence-end): Use string-or-null-p.
 
-	* textmodes/ispell.el (ispell-local-dictionary): Use
-	string-or-null-p.
+	* textmodes/ispell.el (ispell-local-dictionary): Use string-or-null-p.
 
 	* files.el: Update comment about safe-local-variable declarations.
 
 2006-04-06  J.D. Smith  <jdsmith@as.arizona.edu>
 
-	* progmodes/idlwave.el: Updated to IDLWAVE version 6.0.  See
-	idlwave.org.
-
-	* progmodes/idlw-shell.el: Updated to IDLWAVE version 6.0.  See
-	idlwave.org.  Includes code to obsolete idlw-rinfo.el.
-
-	* progmodes/idlw-help.el: Updated to IDLWAVE version 6.0.  See
-	idlwave.org.
+	* progmodes/idlwave.el: Updated to IDLWAVE version 6.0.
+	See idlwave.org.
+
+	* progmodes/idlw-shell.el: Updated to IDLWAVE version 6.0.
+	See idlwave.org.  Includes code to obsolete idlw-rinfo.el.
+
+	* progmodes/idlw-help.el: Updated to IDLWAVE version 6.0.
+	See idlwave.org.
 
 	* progmodes/idlw-complete-structtag.el: Updated to IDLWAVE
 	version 6.0 (minimal changes).  See idlwave.org.
@@ -194,8 +470,8 @@
 
 2006-04-05  Daiki Ueno  <ueno@unixuser.org>
 
-	* pgg-gpg.el (pgg-gpg-encrypt-region, pgg-gpg-sign-region): Wait
-	for BEGIN_SIGNING too, new in GnuPG 1.4.3.
+	* pgg-gpg.el (pgg-gpg-encrypt-region, pgg-gpg-sign-region):
+	Wait for BEGIN_SIGNING too, new in GnuPG 1.4.3.
 
 2006-04-05  Kenichi Handa  <handa@m17n.org>
 
@@ -208,8 +484,7 @@
 	default-enable-multibyte-characters.  This reverts the change from
 	revision 6.17 which is no longer necessary because the passphrase
 	is sent separately now.  GnuPG messages are unreadable under
-	multibyte locales with default-enable-multibyte-characters set to
-	nil.
+	multibyte locales with default-enable-multibyte-characters set to nil.
 
 2006-04-04  Andreas Schwab  <schwab@suse.de>
 
--- a/lisp/allout.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/allout.el	Mon Apr 17 08:41:12 2006 +0000
@@ -666,6 +666,7 @@
 `allout-layout' can additionally have the value `t', in which
 case the value of `allout-default-layout' is used.")
 (make-variable-buffer-local 'allout-layout)
+;;;###autoload
 (put 'allout-layout 'safe-local-variable t)
 
 ;;;_  : Topic header format
--- a/lisp/calendar/appt.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/calendar/appt.el	Mon Apr 17 08:41:12 2006 +0000
@@ -498,11 +498,11 @@
   (interactive "sTime (hh:mm[am/pm]): \nsMessage: ")
   (unless (string-match appt-time-regexp new-appt-time)
     (error "Unacceptable time-string"))
-  (let* ((appt-time-string (concat new-appt-time " " new-appt-msg))
-         (appt-time (list (appt-convert-time new-appt-time)))
-         (time-msg (list appt-time appt-time-string t)))
-    (setq appt-time-msg-list (nconc appt-time-msg-list (list time-msg)))
-    (setq appt-time-msg-list (appt-sort-list appt-time-msg-list))))
+  (let ((time-msg (list (list (appt-convert-time new-appt-time))
+                        (concat new-appt-time " " new-appt-msg) t)))
+    (unless (member time-msg appt-time-msg-list)
+      (setq appt-time-msg-list
+            (appt-sort-list (nconc appt-time-msg-list (list time-msg)))))))
 
 ;;;###autoload
 (defun appt-delete ()
--- a/lisp/cus-edit.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/cus-edit.el	Mon Apr 17 08:41:12 2006 +0000
@@ -786,7 +786,7 @@
     (if (or (and (= 1 (length children))
 		 (memq (widget-type (car children))
 		       '(custom-variable custom-face)))
-	    (y-or-n-p "Reset all settings' buffer text to show current values?  "))
+	    (y-or-n-p "Reset all settings' buffer text to show current values? "))
 	(mapc (lambda (widget)
 		(if (memq (widget-get widget :custom-state)
 			  '(modified changed))
@@ -1079,6 +1079,33 @@
 (defvar customize-changed-options-previous-release "21.1"
   "Version for `customize-changed-options' to refer back to by default.")
 
+;; Packages will update this variable, so make it available.
+;;;###autoload
+(defvar customize-package-emacs-version-alist nil
+  "Alist mapping versions of Emacs to versions of a package.
+These package versions are listed in the :package-version
+keyword used in `defcustom', `defgroup', and `defface'. Its
+elements look like this:
+
+     (PACKAGE (PVERSION . EVERSION)...)
+
+For each PACKAGE, which is a symbol, there are one or more
+elements that contain a package version PVERSION with an
+associated Emacs version EVERSION.  These versions are strings.
+For example, the MH-E package updates this alist with the
+following:
+
+     (add-to-list 'customize-package-emacs-version-alist
+                  '(MH-E (\"6.0\" . \"22.1\") (\"6.1\" . \"22.1\")
+                         (\"7.0\" . \"22.1\") (\"7.1\" . \"22.1\")
+                         (\"7.2\" . \"22.1\") (\"7.3\" . \"22.1\")
+                         (\"7.4\" . \"22.1\") (\"8.0\" . \"22.1\")))
+
+The value of PACKAGE needs to be unique and it needs to match the
+PACKAGE value appearing in the :package-version keyword.  Since
+the user might see the value in a error message, a good choice is
+the official name of the package, such as MH-E or Gnus.")
+
 ;;;###autoload
 (defalias 'customize-changed 'customize-changed-options)
 
@@ -1119,7 +1146,12 @@
   (let (found)
     (mapatoms
      (lambda (symbol)
-       (let ((version (get symbol 'custom-version)))
+        (let* ((package-version (get symbol 'custom-package-version))
+               (version
+                (or (and package-version
+                         (customize-package-emacs-version symbol
+                                                          package-version))
+                    (get symbol 'custom-version))))
 	 (if version
 	     (when (customize-version-lessp since-version version)
 	       (if (or (get symbol 'custom-group)
@@ -1135,6 +1167,32 @@
       (error "No user option defaults have been changed since Emacs %s"
 	     since-version))))
 
+(defun customize-package-emacs-version (symbol package-version)
+  "Return Emacs version of SYMBOL.
+PACKAGE-VERSION has the form (PACKAGE . VERSION).  The VERSION of
+PACKAGE is looked up in the associated list
+`customize-package-emacs-version-alist' to find the version of
+Emacs that is associated with it."
+  (let (package-versions emacs-version)
+    ;; Use message instead of error since we want user to be able to
+    ;; see the rest of the symbols even if a package author has
+    ;; botched things up.
+    (cond ((not (listp package-version))
+           (message "Invalid package-version value for %s" symbol))
+          ((setq package-versions (assq (car package-version)
+                                        customize-package-emacs-version-alist))
+           (setq emacs-version
+                 (cdr (assoc (cdr package-version) package-versions)))
+           (unless emacs-version
+             (message "%s version %s not found in %s" symbol
+                      (cdr package-version)
+                      "customize-package-emacs-version-alist")))
+          (t
+           (message "Package %s neglected to update %s"
+                    (car package-version)
+                    "customize-package-emacs-version-alist")))
+    emacs-version))
+
 (defun customize-version-lessp (version1 version2)
   ;; Why are the versions strings, and given that they are, why aren't
   ;; they converted to numbers and compared as such here?  -- fx
--- a/lisp/custom.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/custom.el	Mon Apr 17 08:41:12 2006 +0000
@@ -203,8 +203,27 @@
 
 :type	VALUE should be a widget type for editing the symbol's value.
 :options VALUE should be a list of valid members of the widget type.
+:initialize
+	VALUE should be a function used to initialize the
+	variable.  It takes two arguments, the symbol and value
+	given in the `defcustom' call.  The default is
+	`custom-initialize-reset'.
+:set	VALUE should be a function to set the value of the symbol.
+	It takes two arguments, the symbol to set and the value to
+	give it.  The default choice of function is `custom-set-default'.
+:get	VALUE should be a function to extract the value of symbol.
+	The function takes one argument, a symbol, and should return
+	the current value for that symbol.  The default choice of function
+	is `custom-default-value'.
+:require
+	VALUE should be a feature symbol.  If you save a value
+	for this option, then when your `.emacs' file loads the value,
+	it does (require VALUE) first.
+
+The following common keywords are also meaningful.
+
 :group  VALUE should be a customization group.
-        Add SYMBOL to that group.
+        Add SYMBOL (or FACE with `defface') to that group.
 :link LINK-DATA
         Include an external link after the documentation string for this
         item.  This is a sentence containing an active field which
@@ -248,26 +267,19 @@
 
         An item can have more than one external link; however, most items
         have none at all.
-:initialize
-	VALUE should be a function used to initialize the
-	variable.  It takes two arguments, the symbol and value
-	given in the `defcustom' call.  The default is
-	`custom-initialize-reset'.
-:set	VALUE should be a function to set the value of the symbol.
-	It takes two arguments, the symbol to set and the value to
-	give it.  The default choice of function is `custom-set-default'.
-:get	VALUE should be a function to extract the value of symbol.
-	The function takes one argument, a symbol, and should return
-	the current value for that symbol.  The default choice of function
-	is `custom-default-value'.
-:require
-	VALUE should be a feature symbol.  If you save a value
-	for this option, then when your `.emacs' file loads the value,
-	it does (require VALUE) first.
 :version
         VALUE should be a string specifying that the variable was
         first introduced, or its default value was changed, in Emacs
         version VERSION.
+:package-version
+        VALUE should be a list with the form (PACKAGE . VERSION)
+        specifying that the variable was first introduced, or its
+        default value was changed, in PACKAGE version VERSION.  This
+        keyword takes priority over :version.  The PACKAGE and VERSION
+        must appear in the alist `customize-package-emacs-version-alist'.
+        Since PACKAGE must be unique and the user might see it in an
+        error message, a good choice is the official name of the
+        package, such as MH-E or Gnus.
 :tag LABEL
         Use LABEL, a string, instead of the item's name, to label the item
         in customization menus and buffers.
@@ -286,8 +298,8 @@
 _outside_ any bindings for these variables.  \(`defvar' and
 `defconst' behave similarly in this respect.)
 
-Read the section about customization in the Emacs Lisp manual for more
-information."
+See Info node `(elisp) Customization' in the Emacs Lisp manual
+for more information."
   (declare (doc-string 3))
   ;; It is better not to use backquote in this file,
   ;; because that makes a bootstrapping problem
@@ -314,10 +326,8 @@
 
    [KEYWORD VALUE]...
 
-The following KEYWORDs are defined:
-
-:group  VALUE should be a customization group.
-        Add FACE to that group.
+For a list of valid keywords, see the common keywords listed in
+`defcustom'.
 
 SPEC should be an alist of the form ((DISPLAY ATTS)...).
 
@@ -368,8 +378,8 @@
   the function `display-supports-face-attributes-p' for more
   information on exactly how testing is done.
 
-Read the section about customization in the Emacs Lisp manual for more
-information."
+See Info node `(elisp) Customization' in the Emacs Lisp manual
+for more information."
   (declare (doc-string 3))
   ;; It is better not to use backquote in this file,
   ;; because that makes a bootstrapping problem
@@ -426,16 +436,11 @@
 
    [KEYWORD VALUE]...
 
-The following KEYWORDs are defined:
-
-:group   VALUE should be a customization group.
-         Add SYMBOL to that group.
+For a list of valid keywords, see the common keywords listed in
+`defcustom'.
 
-:version VALUE should be a string specifying that the group was introduced
-         in Emacs version VERSION.
-
-Read the section about customization in the Emacs Lisp manual for more
-information."
+See Info node `(elisp) Customization' in the Emacs Lisp manual
+for more information."
   (declare (doc-string 3))
   ;; It is better not to use backquote in this file,
   ;; because that makes a bootstrapping problem
@@ -489,6 +494,8 @@
 	 (custom-add-to-group value symbol type))
 	((eq keyword :version)
 	 (custom-add-version symbol value))
+	((eq keyword :package-version)
+	 (custom-add-package-version symbol value))
 	((eq keyword :link)
 	 (custom-add-link symbol value))
 	((eq keyword :load)
@@ -540,6 +547,10 @@
   "To the custom option SYMBOL add the version VERSION."
   (put symbol 'custom-version (purecopy version)))
 
+(defun custom-add-package-version (symbol version)
+  "To the custom option SYMBOL add the package version VERSION."
+  (put symbol 'custom-package-version (purecopy version)))
+
 (defun custom-add-load (symbol load)
   "To the custom option SYMBOL add the dependency LOAD.
 LOAD should be either a library file name, or a feature name."
--- a/lisp/emacs-lisp/bytecomp.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1650,8 +1650,12 @@
       ;; If they change the file name, then change it for the output also.
       (let ((buffer-file-name filename)
 	    (default-major-mode 'emacs-lisp-mode)
+	    ;; Ignore unsafe local variables.
+	    ;; We only care about a few of them for our purposes.
+	    (enable-local-variables :safe)
 	    (enable-local-eval nil))
-        (normal-mode)
+	;; Arg of t means don't alter enable-local-variables.
+        (normal-mode t)
         (setq filename buffer-file-name))
       ;; Set the default directory, in case an eval-when-compile uses it.
       (setq default-directory (file-name-directory filename)))
--- a/lisp/emacs-lisp/edebug.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/emacs-lisp/edebug.el	Mon Apr 17 08:41:12 2006 +0000
@@ -258,6 +258,20 @@
     edebug-form-spec
     ))
 
+;;;###autoload
+(defun edebug-basic-spec (spec)
+  "Return t if SPEC uses only extant spec symbols.
+An extant spec symbol is a symbol that is not a function and has a
+`edebug-form-spec' property."
+  (cond ((listp spec)
+	 (catch 'basic
+	   (while spec
+	     (unless (edebug-basic-spec (car spec)) (throw 'basic nil))
+	     (setq spec (cdr spec)))
+	   t))
+	((symbolp spec)
+	 (unless (functionp spec) (get spec 'edebug-form-spec)))))
+
 ;;; Utilities
 
 ;; Define edebug-gensym - from old cl.el
--- a/lisp/emacs-lisp/find-func.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/emacs-lisp/find-func.el	Mon Apr 17 08:41:12 2006 +0000
@@ -64,7 +64,7 @@
   (concat
    "^\\s-*(\\(def\\(ine-skeleton\\|ine-generic-mode\\|ine-derived-mode\\|\
 ine\\(?:-global\\)?-minor-mode\\|ine-compilation-mode\\|un-cvs-mode\\|\
-foo\\|[^cfgv]\\w+\\*?\\)\\|easy-mmode-define-[a-z-]+\\|easy-menu-define\\|\
+foo\\|[^cfgv]\\(\\w\\|\\s_\\)+\\*?\\)\\|easy-mmode-define-[a-z-]+\\|easy-menu-define\\|\
 menu-bar-make-toggle\\)"
    find-function-space-re
    "\\('\\|\(quote \\)?%s\\(\\s-\\|$\\|\(\\|\)\\)")
@@ -228,8 +228,16 @@
 	  (with-syntax-table emacs-lisp-mode-syntax-table
 	    (goto-char (point-min))
 	    (if (or (re-search-forward regexp nil t)
+                    ;; `regexp' matches definitions using known forms like
+                    ;; `defun', or `defvar'.  But some functions/variables
+                    ;; are defined using special macros (or functions), so
+                    ;; if `regexp' can't find the definition, we look for
+                    ;; something of the form "(SOMETHING <symbol> ...)".
+                    ;; This fails to distinguish function definitions from
+                    ;; variable declarations (or even uses thereof), but is
+                    ;; a good pragmatic fallback.
 		    (re-search-forward
-		     (concat "^([^ ]+" find-function-space-re "['(]"
+		     (concat "^([^ ]+" find-function-space-re "['(]?"
 			     (regexp-quote (symbol-name symbol))
 			     "\\_>")
 		     nil t))
--- a/lisp/emacs-lisp/tq.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/emacs-lisp/tq.el	Mon Apr 17 08:41:12 2006 +0000
@@ -27,18 +27,56 @@
 
 ;;; Commentary:
 
-;; manages receiving a stream asynchronously,
-;; parsing it into transactions, and then calling
-;; handler functions
+;; This file manages receiving a stream asynchronously, parsing it
+;; into transactions, and then calling the associated handler function
+;; upon the completion of each transaction.
 
 ;; Our basic structure is the queue/process/buffer triple.  Each entry
-;; of the queue is a regexp/closure/function triple.  We buffer
-;; bytes from the process until we see the regexp at the head of the
-;; queue.  Then we call the function with the closure and the
-;; collected bytes.
+;; of the queue part is a list of question, regexp, closure, and
+;; function that is consed to the last element.
+
+;; A transaction queue may be created by calling `tq-create'.
+
+;; A request may be added to the queue by calling `tq-enqueue'.  If
+;; the `delay-question' argument is non-nil, we will wait to send the
+;; question to the process until it has finished sending other input.
+;; Otherwise, once a request is enqueued, we send the given question
+;; immediately to the process.
+
+;; We then buffer bytes from the process until we see the regexp that
+;; was provided in the call to `tq-enqueue'.  Then we call the
+;; provided function with the closure and the collected bytes.  If we
+;; have indicated that the question from the next transaction was not
+;; sent immediately, send it at this point, awaiting the response.
 
 ;;; Code:
 
+;;; Accessors
+
+;; This part looks like (queue . (process . buffer))
+(defun tq-queue               (tq) (car tq))
+(defun tq-process             (tq) (car (cdr tq)))
+(defun tq-buffer              (tq) (cdr (cdr tq)))
+
+;; The structure of `queue' is as follows
+;; ((question regexp closure . fn)
+;;  <other queue entries>)
+;; question: string to send to the process
+(defun tq-queue-head-question (tq) (car (car (tq-queue tq))))
+;; regexp: regular expression that matches the end of a response from
+;; the process
+(defun tq-queue-head-regexp   (tq) (car (cdr (car (tq-queue tq)))))
+;; closure: additional data to pass to function
+(defun tq-queue-head-closure  (tq) (car (cdr (cdr (car (tq-queue tq))))))
+;; fn: function to call upon receiving a complete response from the
+;; process
+(defun tq-queue-head-fn       (tq) (cdr (cdr (cdr (car (tq-queue tq))))))
+
+;; Determine whether queue is empty
+(defun tq-queue-empty         (tq) (not (tq-queue tq)))
+
+;;; Core functionality
+
 ;;;###autoload
 (defun tq-create (process)
   "Create and return a transaction queue communicating with PROCESS.
@@ -54,33 +92,37 @@
 			   (tq-filter ',tq string)))
     tq))
 
-;;; accessors
-(defun tq-queue   (tq) (car tq))
-(defun tq-process (tq) (car (cdr tq)))
-(defun tq-buffer  (tq) (cdr (cdr tq)))
-
-(defun tq-queue-add (tq re closure fn)
+(defun tq-queue-add (tq question re closure fn)
   (setcar tq (nconc (tq-queue tq)
-		    (cons (cons re (cons closure fn)) nil)))
+		    (cons (cons question (cons re (cons closure fn))) nil)))
   'ok)
 
-(defun tq-queue-head-regexp  (tq) (car (car (tq-queue tq))))
-(defun tq-queue-head-fn      (tq) (cdr (cdr (car (tq-queue tq)))))
-(defun tq-queue-head-closure (tq) (car (cdr (car (tq-queue tq)))))
-(defun tq-queue-empty        (tq) (not (tq-queue tq)))
-(defun tq-queue-pop          (tq) (setcar tq (cdr (car tq))) (null (car tq)))
+(defun tq-queue-pop (tq)
+  (setcar tq (cdr (car tq)))
+  (let ((question (tq-queue-head-question tq)))
+    (when question
+      (process-send-string (tq-process tq) question)))
+  (null (car tq)))
 
-
-;;; must add to queue before sending!
-(defun tq-enqueue (tq question regexp closure fn)
+(defun tq-enqueue (tq question regexp closure fn &optional delay-question)
   "Add a transaction to transaction queue TQ.
 This sends the string QUESTION to the process that TQ communicates with.
-When the corresponding answer comes back, we call FN
-with two arguments: CLOSURE, and the answer to the question.
+
+When the corresponding answer comes back, we call FN with two
+arguments: CLOSURE, which may contain additional data that FN
+needs, and the answer to the question.
+
 REGEXP is a regular expression to match the entire answer;
-that's how we tell where the answer ends."
-  (tq-queue-add tq regexp closure fn)
-  (process-send-string (tq-process tq) question))
+that's how we tell where the answer ends.
+
+If DELAY-QUESTION is non-nil, delay sending this question until
+the process has finished replying to any previous questions.
+This produces more reliable results with some processes."
+  (let ((sendp (or (not delay-question)
+		   (not (tq-queue-head-question tq)))))
+    (tq-queue-add tq (unless sendp question) regexp closure fn)
+    (when sendp
+      (process-send-string (tq-process tq) question))))
 
 (defun tq-close (tq)
   "Shut down transaction queue TQ, terminating the process."
--- a/lisp/emulation/cua-base.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/emulation/cua-base.el	Mon Apr 17 08:41:12 2006 +0000
@@ -769,7 +769,7 @@
   (let ((start (mark)) (end (point)))
     (or (<= start end)
 	(setq start (prog1 end (setq end start))))
-    (setq cua--last-deleted-region-text (buffer-substring start end))
+    (setq cua--last-deleted-region-text (filter-buffer-substring start end))
     (if cua-delete-copy-to-register-0
 	(set-register ?0 cua--last-deleted-region-text))
     (delete-region start end)
@@ -858,7 +858,7 @@
       (if regtxt
 	  (cua--insert-at-global-mark regtxt)
 	(when (not (eobp))
-	  (cua--insert-at-global-mark (buffer-substring (point) (+ (point) count)))
+	  (cua--insert-at-global-mark (filter-buffer-substring (point) (+ (point) count)))
 	  (forward-char count))))
      (buffer-read-only
       (message "Cannot paste into a read-only buffer"))
@@ -875,7 +875,7 @@
 		(setq paste-lines (cua--delete-rectangle))
 		(if (= paste-lines 1)
 		    (setq paste-lines nil))) ;; paste all
-	    (if (string= (buffer-substring (point) (mark))
+	    (if (string= (filter-buffer-substring (point) (mark))
 			 (car kill-ring))
 		(current-kill 1))
 	    (cua-delete-region)))
@@ -950,7 +950,7 @@
 		  (setq s (car u) e (cdr u)))))))
 	  (setq cua--repeat-replace-text
 		(cond ((and s e (<= s e) (= s (mark t)))
-		       (buffer-substring-no-properties s e))
+		       (filter-buffer-substring s e nil t))
 		      ((and (null s) (eq u elt)) ;; nothing inserted
 		       "")
 		      (t
--- a/lisp/emulation/cua-gmrk.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/emulation/cua-gmrk.el	Mon Apr 17 08:41:12 2006 +0000
@@ -143,7 +143,7 @@
       (let ((src-buf (current-buffer)))
 	(save-excursion
 	  (if (equal (marker-buffer cua--global-mark-marker) src-buf)
-	      (let ((text (buffer-substring-no-properties start end)))
+	      (let ((text (filter-buffer-substring start end nil t)))
 		(goto-char (marker-position cua--global-mark-marker))
 		(insert text))
 	    (set-buffer (marker-buffer cua--global-mark-marker))
@@ -167,7 +167,7 @@
 	      (if (and (< start (marker-position cua--global-mark-marker))
 		       (< (marker-position cua--global-mark-marker) end))
 		  (message "Can't move region into itself")
-		(let ((text (buffer-substring-no-properties start end))
+		(let ((text (filter-buffer-substring start end nil t))
 		      (p1 (copy-marker start))
 		      (p2 (copy-marker end)))
 		  (goto-char (marker-position cua--global-mark-marker))
--- a/lisp/emulation/cua-rect.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/emulation/cua-rect.el	Mon Apr 17 08:41:12 2006 +0000
@@ -631,7 +631,7 @@
     (if (not (cua--rectangle-virtual-edges))
 	(cua--rectangle-operation nil nil nil nil nil ; do not tabify
 	  '(lambda (s e l r)
-	     (setq rect (cons (buffer-substring-no-properties s e) rect))))
+	     (setq rect (cons (filter-buffer-substring s e nil t) rect))))
       (cua--rectangle-operation nil 1 nil nil nil ; do not tabify
 	'(lambda (s e l r v)
 	   (let ((copy t) (bs 0) (as 0) row)
@@ -649,7 +649,7 @@
 	       (setq as (- r (max (current-column) l))
 		     e (point)))
        	     (setq row (if (and copy (> e s))
-			   (buffer-substring-no-properties s e)
+			   (filter-buffer-substring s e nil t)
 			 ""))
     	     (when (> bs 0)
     	       (setq row (concat (make-string bs ?\s) row)))
@@ -1127,12 +1127,12 @@
      '(lambda (s e l r)
         (cond
          ((re-search-forward "0x\\([0-9a-fA-F]+\\)" e t)
-          (let* ((txt (buffer-substring-no-properties (match-beginning 1) (match-end 1)))
+          (let* ((txt (filter-buffer-substring (match-beginning 1) (match-end 1) nil t))
                  (n (string-to-number txt 16))
                  (fmt (format "0x%%0%dx" (length txt))))
             (replace-match (format fmt (+ n increment)))))
          ((re-search-forward "\\( *-?[0-9]+\\)" e t)
-          (let* ((txt (buffer-substring-no-properties (match-beginning 1) (match-end 1)))
+          (let* ((txt (filter-buffer-substring (match-beginning 1) (match-end 1) nil t))
                  (prefix (if (= (aref txt 0) ?0) "0" ""))
                  (n (string-to-number txt 10))
                  (fmt (format "%%%s%dd" prefix (length txt))))
@@ -1213,7 +1213,7 @@
       (when replace
         (goto-char (point-min))
         (while (not (eobp))
-          (setq z (cons (buffer-substring (point) (line-end-position)) z))
+          (setq z (cons (filter-buffer-substring (point) (line-end-position)) z))
           (forward-line 1))))
     (if (not cua--debug)
 	(kill-buffer auxbuf))
--- a/lisp/erc/ChangeLog	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/erc/ChangeLog	Mon Apr 17 08:41:12 2006 +0000
@@ -1,3 +1,23 @@
+2006-04-05  Diane Murray  <disumu@x3y2z1.net>
+
+	* erc.el (erc-cmd-SV): Removed the exclamation point.  Show the
+	build date as it's shown in `emacs-version'.
+
+	* erc-capab.el (erc-capab-identify-add-prefix): Insert the prefix
+	with the same face property as the previous character.
+
+2006-04-02  Michael Olson  <mwolson@gnu.org>
+
+	* erc-backend.el, erc-ezbounce.el, erc-join.el, erc-netsplit.el,
+	erc.el: Make sure to include a newline inside of negated classes,
+	so that a newline is not matched.
+
+2006-04-01  Michael Olson  <mwolson@gnu.org>
+
+	* erc-backend.el (erc-server-connect-function): Don't try to
+	detect the existence of the `open-network-stream-nowait' function,
+	since I can't find it in Emacs21, XEmacs21, or Emacs22.
+
 2006-03-26  Michael Olson  <mwolson@gnu.org>
 
 	* erc.el (erc-header-line): New face that will be used to colorize
--- a/lisp/erc/erc-backend.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/erc/erc-backend.el	Mon Apr 17 08:41:12 2006 +0000
@@ -312,13 +312,7 @@
   :type '(repeat (cons (string :tag "Target")
                        coding-system)))
 
-(defcustom erc-server-connect-function
-  (if (and (fboundp 'open-network-stream-nowait)
-           ;; CVS Emacs claims to define open-network-stream-nowait on
-           ;; windows, however, it does, in fact, not work.
-           (not (memq system-type '(windows-nt cygwin ms-dos darwin))))
-      'open-network-stream-nowait
-    'open-network-stream)
+(defcustom erc-server-connect-function 'open-network-stream
   "Function used to initiate a connection.
 It should take same arguments as `open-network-stream' does."
   :group 'erc-server
@@ -762,10 +756,10 @@
                 (substring string 1 posn)))
 
         (setf (erc-response.command msg)
-              (let* ((bposn (string-match "[^ ]" string posn))
+              (let* ((bposn (string-match "[^ \n]" string posn))
                      (eposn (string-match " " string bposn)))
                 (setq posn (and eposn
-                                (string-match "[^ ]" string eposn)))
+                                (string-match "[^ \n]" string eposn)))
                 (substring string bposn eposn)))
 
         (while (and posn
@@ -773,7 +767,7 @@
           (push (let* ((bposn posn)
                        (eposn (string-match " " string bposn)))
                   (setq posn (and eposn
-                                  (string-match "[^ ]" string eposn)))
+                                  (string-match "[^ \n]" string eposn)))
                   (substring string bposn eposn))
                 (erc-response.command-args msg)))
         (when posn
--- a/lisp/erc/erc-ezbounce.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/erc/erc-ezbounce.el	Mon Apr 17 08:41:12 2006 +0000
@@ -139,7 +139,7 @@
 (defun erc-ezb-add-session (message)
   "Add an EZBounce session to the session list."
   (when (and erc-ezb-inside-session-listing
-	     (string-match "^\\([^ ]+\\) +\\([^ ]+\\) +\\([^ ]+\\) +\\([^ ]+\\)$" message))
+	     (string-match "^\\([^ \n]+\\) +\\([^ \n]+\\) +\\([^ \n]+\\) +\\([^ \n]+\\)$" message))
     (let ((id (match-string 1 message))
 	  (nick (match-string 2 message))
 	  (to   (match-string 3 message)))
--- a/lisp/erc/erc-join.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/erc/erc-join.el	Mon Apr 17 08:41:12 2006 +0000
@@ -92,7 +92,7 @@
 		   (or erc-server-announced-name erc-session-server))))
     (when (erc-current-nick-p nick)
       (when (and erc-autojoin-domain-only
-		 (string-match "[^.]+\\.\\([^.]+\\.[^.]+\\)$" server))
+		 (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
 	(setq server (match-string 1 server)))
       (let ((elem (assoc server erc-autojoin-channels-alist)))
 	(if elem
@@ -115,7 +115,7 @@
 		   (or erc-server-announced-name erc-session-server))))
     (when (erc-current-nick-p nick)
       (when (and erc-autojoin-domain-only
-		 (string-match "[^.]+\\.\\([^.]+\\.[^.]+\\)$" server))
+		 (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
 	(setq server (match-string 1 server)))
       (let ((elem (assoc server erc-autojoin-channels-alist)))
 	(when elem
--- a/lisp/erc/erc-netsplit.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/erc/erc-netsplit.el	Mon Apr 17 08:41:12 2006 +0000
@@ -64,7 +64,8 @@
   :group 'erc-netsplit
   :type 'boolean)
 
-(defcustom erc-netsplit-regexp "^[^ @!\"]+\\.[^ @!]+ [^ @!]+\\.[^ @!\"]+$"
+(defcustom erc-netsplit-regexp
+  "^[^ @!\"\n]+\\.[^ @!\n]+ [^ @!\n]+\\.[^ @!\"\n]+$"
   "This regular expression should match quit reasons produced
 by netsplits."
   :group 'erc-netsplit
@@ -131,7 +132,7 @@
 (defun erc-netsplit-MODE (proc parsed)
   "Hide mode changes from servers."
   ;; regexp matches things with a . in them, and no ! or @ in them.
-  (when (string-match "^[^@!]+\\.[^@!]+$" (erc-response.sender parsed))
+  (when (string-match "^[^@!\n]+\\.[^@!\n]+$" (erc-response.sender parsed))
     (and erc-netsplit-debug
 	 (erc-display-message
 	  parsed 'notice (process-buffer proc)
--- a/lisp/erc/erc.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/erc/erc.el	Mon Apr 17 08:41:12 2006 +0000
@@ -3132,7 +3132,7 @@
 
 (defun erc-cmd-SV ()
   "Say the current ERC and Emacs version into channel."
-  (erc-send-message (format "I'm using ERC %s with %s %s (%s%s%s)!"
+  (erc-send-message (format "I'm using ERC %s with %s %s (%s%s) of %s."
 			    erc-version-string
 			    (if (featurep 'xemacs) "XEmacs" "GNU Emacs")
 			    emacs-version
@@ -3155,7 +3155,7 @@
 						      x-toolkit-scroll-bars)))
 			       "")
 			     (if (featurep 'multi-tty) ", multi-tty" ""))
-			    (concat ", built " erc-emacs-build-time)))
+			    erc-emacs-build-time))
   t)
 
 (defun erc-cmd-SM ()
@@ -3490,7 +3490,7 @@
 If `point' is at the beginning of a channel name, use that as default."
   (interactive
    (list
-    (let ((chnl (if (looking-at "\\([&#+!][^ ]+\\)") (match-string 1) ""))
+    (let ((chnl (if (looking-at "\\([&#+!][^ \n]+\\)") (match-string 1) ""))
 	  (table (when (erc-server-buffer-live-p)
 		   (set-buffer (process-buffer erc-server-process))
 		   erc-channel-list)))
@@ -4734,12 +4734,12 @@
 
 Return a list of the three separate tokens."
   (cond
-   ((string-match "^\\([^!]*\\)!\\([^@]*\\)@\\(.*\\)$" string)
+   ((string-match "^\\([^!\n]*\\)!\\([^@\n]*\\)@\\(.*\\)$" string)
     (list (match-string 1 string)
 	  (match-string 2 string)
 	  (match-string 3 string)))
    ;; Some bogus bouncers send Nick!(null), try to live with that.
-   ((string-match "^\\([^!]*\\)!\\(.*\\)$" string)
+   ((string-match "^\\([^!\n]*\\)!\\(.*\\)$" string)
     (list (match-string 1 string)
 	  ""
 	  (match-string 2 string)))
@@ -5053,7 +5053,7 @@
   "Return the addressed target in MSG.
 
 The addressed target is the string before the first colon in MSG."
-  (if (string-match "^\\([^: ]*\\):" msg)
+  (if (string-match "^\\([^: \n]*\\):" msg)
       (match-string 1 msg)
     nil))
 
--- a/lisp/files.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/files.el	Mon Apr 17 08:41:12 2006 +0000
@@ -444,14 +444,19 @@
 
 (defcustom enable-local-variables t
   "*Control use of local variables in files you visit.
-The value can be t, nil or something else.
+The value can be t, nil, :safe, or something else.
 
 A value of t means file local variables specifications are obeyed
 if all the specified variable values are safe; if any values are
 not safe, Emacs queries you, once, whether to set them all.
-
-A value of nil means always ignore the file local variables.
+\(When you say yes to certain values, they are remembered as safe.)
+
+:safe means set the safe variables, and ignore the rest.
+nil means always ignore the file local variables.
+
 Any other value means always query you once whether to set them all.
+\(When you say yes to certain values, they are remembered as safe, but
+this has no effect when `enable-local-variables' is \"something else\".)
 
 This variable also controls use of major modes specified in
 a -*- line.
@@ -460,6 +465,7 @@
 always obeys file local variable specifications and the -*- line,
 and ignores this variable."
   :type '(choice (const :tag "Obey" t)
+		 (const :tag "Safe Only" :safe)
 		 (const :tag "Ignore" nil)
 		 (other :tag "Query" other))
   :group 'find-file)
@@ -1779,8 +1785,7 @@
 
 This function is called automatically from `find-file'.  In that case,
 we may set up the file-specified mode and local variables,
-depending on the value of `enable-local-variables': if it is t, we do;
-if it is nil, we don't; otherwise, we query.
+depending on the value of `enable-local-variables'.
 In addition, if `local-enable-local-variables' is nil, we do
 not set local variables (though we do notice a mode specified with -*-.)
 
@@ -2413,8 +2418,7 @@
 			    ""
 			  ", or C-v to scroll")))
 	  (goto-char (point-min))
-	  (let ((inhibit-quit t)
-		(cursor-in-echo-area t)
+	  (let ((cursor-in-echo-area t)
 		(exit-chars
 		 (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g)))
 		done)
@@ -2426,9 +2430,7 @@
 		      (condition-case nil
 			  (scroll-up)
 			(error (goto-char (point-min))))
-		    (setq done (memq (downcase char) exit-chars)))))
-	    (if (= char ?\C-g)
-		(setq quit-flag nil)))
+		    (setq done (memq (downcase char) exit-chars))))))
 	  (setq char (downcase char))
 	  (when (and offer-save (= char ?!) unsafe-vars)
 	    (dolist (elt unsafe-vars)
@@ -2616,13 +2618,22 @@
 		    (and (risky-local-variable-p var val)
 			 (push elt risky-vars))
 		    (push elt unsafe-vars))))
-	    (if (or (and (eq enable-local-variables t)
-			 (null unsafe-vars)
-			 (null risky-vars))
-		    (hack-local-variables-confirm
-		     result unsafe-vars risky-vars))
+	    (if (eq enable-local-variables :safe)
+		;; If caller wants only the safe variables,
+		;; install only them.
 		(dolist (elt result)
-		  (hack-one-local-variable (car elt) (cdr elt)))))
+		  (unless (or (memq (car elt) unsafe-vars)
+			      (memq (car elt) risky-vars))
+		    (hack-one-local-variable (car elt) (cdr elt))))
+	      ;; Query, except in the case where all are known safe
+	      ;; if the user wants no quuery in that case.
+	      (if (or (and (eq enable-local-variables t)
+			   (null unsafe-vars)
+			   (null risky-vars))
+		      (hack-local-variables-confirm
+		       result unsafe-vars risky-vars))
+		  (dolist (elt result)
+		    (hack-one-local-variable (car elt) (cdr elt))))))
 	  (run-hooks 'hack-local-variables-hook))))))
 
 (defun safe-local-variable-p (sym val)
@@ -2678,12 +2689,14 @@
       (and (eq (car exp) 'put)
 	   (hack-one-local-variable-quotep (nth 1 exp))
 	   (hack-one-local-variable-quotep (nth 2 exp))
-	   (memq (nth 1 (nth 2 exp))
-		 '(lisp-indent-hook))
-	   ;; Only allow safe values of lisp-indent-hook;
-	   ;; not functions.
-	   (or (numberp (nth 3 exp))
-	       (equal (nth 3 exp) ''defun)))
+	   (let ((prop (nth 1 (nth 2 exp))) (val (nth 3 exp)))
+	     (cond ((eq prop 'lisp-indent-hook)
+		    ;; Only allow safe values of lisp-indent-hook;
+		    ;; not functions.
+		    (or (numberp val) (equal val ''defun)))
+		   ((eq prop 'edebug-form-spec)
+		    ;; Only allow indirect form specs.
+		    (edebug-basic-spec val)))))
       ;; Allow expressions that the user requested.
       (member exp safe-local-eval-forms)
       ;; Certain functions can be allowed with safe arguments
--- a/lisp/finder.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/finder.el	Mon Apr 17 08:41:12 2006 +0000
@@ -104,6 +104,8 @@
     (define-key map [mouse-2]	'finder-mouse-select)
     (define-key map "\C-m"	'finder-select)
     (define-key map "?"	'finder-summary)
+    (define-key map "n" 'next-line)
+    (define-key map "p" 'previous-line)
     (define-key map "q"	'finder-exit)
     (define-key map "d"	'finder-list-keywords)
     map))
--- a/lisp/gnus/ChangeLog	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/gnus/ChangeLog	Mon Apr 17 08:41:12 2006 +0000
@@ -1,3 +1,59 @@
+2006-04-12  Ralf Angeli  <angeli@iwi.uni-sb.de>
+
+	* flow-fill.el (fill-flowed): Remove trailing space from blank
+	quoted lines.
+
+2006-04-12  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus-art.el (gnus-article-mode): Set
+	cursor-in-non-selected-windows to nil.
+
+2006-04-12  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-art.el (gnus-mime-view-part-as-charset): Ignore charset
+	that the part specifies.
+
+	* mm-decode.el (mm-display-part): Work with external parts and
+	usual parts similarly.
+
+	* mm-extern.el (mm-inline-external-body): Use mm-display-part
+	instead of gnus-display-mime.
+
+	* gnus-uu.el (gnus-uu-save-article): Put mml tags instead of part
+	tag to summarized topics part in order to encode non-ASCII text.
+
+2006-04-11  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus-art.el (gnus-button-valid-localpart-regexp): Exclude `@'.
+
+2006-04-11  Arne J,Ax(Brgensen  <arne@arnested.dk>
+
+	* gnus-sieve.el (gnus-sieve-generate): Delete from the start of
+	the sieve region.
+
+2006-04-11  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus.el: Gnus v5.10.8 is released.
+
+2006-04-11  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* nnslashdot.el (nnslashdot-retrieve-headers-1): Fix up to new
+	layout.
+
+	* rfc2047.el (rfc2047-decode-encoded-words): Don't message about
+	unknown charset.
+
+	* message.el (message-header-synonyms): Add Original-To to the
+	default.
+
+	* gnus-sum.el (gnus-get-newsgroup-headers-xover): group is an
+	optional parameter.
+
+2006-04-07  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* pgg-gpg.el: Revert to revision 7.15 to allow the use of
+	gpg-agent.
+
 2006-04-06  Reiner Steib  <Reiner.Steib@gmx.de>
 
 	* gnus-fun.el (gnus): Require it for gnus-directory.
--- a/lisp/gnus/flow-fill.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/gnus/flow-fill.el	Mon Apr 17 08:41:12 2006 +0000
@@ -114,7 +114,7 @@
     (set-buffer (or (current-buffer) buffer))
     (goto-char (point-min))
     ;; Remove space stuffing.
-    (while (re-search-forward "^ " nil t)
+    (while (re-search-forward "^\\( \\|>+ $\\)" nil t)
       (delete-char -1)
       (forward-line 1))
     (goto-char (point-min))
--- a/lisp/gnus/gnus-art.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/gnus/gnus-art.el	Mon Apr 17 08:41:12 2006 +0000
@@ -3809,6 +3809,7 @@
   (make-local-variable 'gnus-article-ignored-charsets)
   ;; Prevent recent Emacsen from displaying non-break space as "\ ".
   (set (make-local-variable 'nobreak-char-display) nil)
+  (setq cursor-in-non-selected-windows nil)
   (gnus-set-default-directory)
   (buffer-disable-undo)
   (setq buffer-read-only t)
@@ -4477,19 +4478,29 @@
 specified charset."
   (interactive (list nil current-prefix-arg))
   (gnus-article-check-buffer)
-  (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
-	 contents charset
-	 (b (point))
-	 (inhibit-read-only t))
+  (let ((handle (or handle (get-text-property (point) 'gnus-data)))
+	(fun (get-text-property (point) 'gnus-callback))
+	(gnus-newsgroup-ignored-charsets 'gnus-all)
+	gnus-newsgroup-charset type charset)
     (when handle
       (if (mm-handle-undisplayer handle)
 	  (mm-remove-part handle))
-      (let ((gnus-newsgroup-charset
-	     (or (cdr (assq arg
-			    gnus-summary-show-article-charset-alist))
-		 (mm-read-coding-system "Charset: ")))
-	  (gnus-newsgroup-ignored-charsets 'gnus-all))
-	(gnus-article-press-button)))))
+      (when fun
+	(setq gnus-newsgroup-charset
+	      (or (cdr (assq arg gnus-summary-show-article-charset-alist))
+		  (mm-read-coding-system "Charset: ")))
+	;; Strip the charset parameter from `handle'.
+	(setq type (mm-handle-type
+		    (if (equal (mm-handle-media-type handle)
+			       "message/external-body")
+			(progn
+			  (unless (mm-handle-cache handle)
+			    (mm-extern-cache-contents handle))
+			  (mm-handle-cache handle))
+		      handle))
+	      charset (assq 'charset (cdr type)))
+	(delq charset type)
+	(funcall fun handle)))))
 
 (defun gnus-mime-view-part-externally (&optional handle)
   "View the MIME part under point with an external viewer."
@@ -5972,7 +5983,7 @@
 
 ;; Regexp suggested by Felix Wiemann in <87oeuomcz9.fsf@news2.ososo.de>
 (defcustom gnus-button-valid-localpart-regexp
-  "[a-z0-9$%(*-=?[_][^<>\")!;:,{}\n\t ]*"
+  "[a-z0-9$%(*-=?[_][^<>\")!;:,{}\n\t @]*"
   "Regular expression that matches a localpart of mail addresses or MIDs."
   :version "22.1"
   :group 'gnus-article-buttons
--- a/lisp/gnus/gnus-sieve.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/gnus/gnus-sieve.el	Mon Apr 17 08:41:12 2006 +0000
@@ -107,7 +107,7 @@
   (find-file gnus-sieve-file)
   (goto-char (point-min))
   (if (re-search-forward (regexp-quote gnus-sieve-region-start) nil t)
-      (delete-region (match-end 0)
+      (delete-region (match-beginning 0)
 		     (or (re-search-forward (regexp-quote
 					     gnus-sieve-region-end) nil t)
 			 (point)))
--- a/lisp/gnus/gnus-sum.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/gnus/gnus-sum.el	Mon Apr 17 08:41:12 2006 +0000
@@ -5962,7 +5962,8 @@
 	(allp (cond
 	       ((eq gnus-read-all-available-headers t)
 		t)
-	       ((stringp gnus-read-all-available-headers)
+	       ((and (stringp gnus-read-all-available-headers)
+		     group)
 		(string-match gnus-read-all-available-headers group))
 	       (t
 		nil)))
--- a/lisp/gnus/gnus-uu.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/gnus/gnus-uu.el	Mon Apr 17 08:41:12 2006 +0000
@@ -839,7 +839,9 @@
 		       "Date: %s\nFrom: %s\nSubject: %s Digest\n\n"
 		       (message-make-date) name name))
 	      (when (and message-forward-as-mime gnus-uu-digest-buffer)
-		(insert "<#part type=message/rfc822>\nSubject: Topics\n\n"))
+		(insert
+		 "<#mml type=message/rfc822>\nSubject: Topics\n\n<#/mml>\n")
+		(forward-line -1))
 	      (insert "Topics:\n")))
 	(when (not (eq in-state 'end))
 	  (setq state (list 'middle))))
--- a/lisp/gnus/message.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/gnus/message.el	Mon Apr 17 08:41:12 2006 +0000
@@ -2749,7 +2749,8 @@
     (message-carefully-insert-headers headers)))
 
 (defcustom message-header-synonyms
-  '((To Cc Bcc))
+  '((To Cc Bcc)
+    (Original-To))
   "List of lists of header synonyms.
 E.g., if this list contains a member list with elements `Cc' and `To',
 then `message-carefully-insert-headers' will not insert a `To' header
--- a/lisp/gnus/mm-decode.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/gnus/mm-decode.el	Mon Apr 17 08:41:12 2006 +0000
@@ -672,7 +672,14 @@
     (mailcap-parse-mailcaps)
     (if (mm-handle-displayed-p handle)
 	(mm-remove-part handle)
-      (let* ((type (mm-handle-media-type handle))
+      (let* ((ehandle (if (equal (mm-handle-media-type handle)
+				 "message/external-body")
+			  (progn
+			    (unless (mm-handle-cache handle)
+			      (mm-extern-cache-contents handle))
+			    (mm-handle-cache handle))
+			handle))
+	     (type (mm-handle-media-type ehandle))
 	     (method (mailcap-mime-info type))
 	     (filename (or (mail-content-type-get
 			    (mm-handle-disposition handle) 'filename)
@@ -680,8 +687,8 @@
 			    (mm-handle-type handle) 'name)
 			   "<file>"))
 	     (external mm-enable-external))
-	(if (and (mm-inlinable-p handle)
-		 (mm-inlined-p handle))
+	(if (and (mm-inlinable-p ehandle)
+		 (mm-inlined-p ehandle))
 	    (progn
 	      (forward-line 1)
 	      (mm-display-inline handle)
@@ -689,7 +696,7 @@
 	  (when (or method
 		    (not no-default))
 	    (if (and (not method)
-		     (equal "text" (car (split-string type))))
+		     (equal "text" (car (split-string type "/"))))
 		(progn
 		  (forward-line 1)
 		  (mm-insert-inline handle (mm-get-part handle))
--- a/lisp/gnus/mm-extern.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/gnus/mm-extern.el	Mon Apr 17 08:41:12 2006 +0000
@@ -157,25 +157,11 @@
     (save-excursion
       (save-restriction
 	(narrow-to-region (point) (point))
-	(let* ((type (regexp-quote
-		      (mm-handle-media-type (mm-handle-cache handle))))
-	       ;; Force the part to be displayed (but if there is no
-	       ;; method to display, a user will be prompted to save).
-	       ;; See `gnus-mime-display-single'.
-	       (mm-inline-override-types nil)
-	       (mm-attachment-override-types
-		(cons type mm-attachment-override-types))
-	       (mm-automatic-display (cons type mm-automatic-display))
-	       (mm-automatic-external-display
-		(cons type mm-automatic-external-display))
-	       ;; Suppress adding of button to the cached part.
-	       (gnus-inhibit-mime-unbuttonizing nil))
-	  (gnus-display-mime (mm-handle-cache handle)))
-	;; Move undisplayer added to the cached handle to the parent.
-	(mm-handle-set-undisplayer
-	 handle
-	 (mm-handle-undisplayer (mm-handle-cache handle)))
-	(mm-handle-set-undisplayer (mm-handle-cache handle) nil)))))
+	(mm-display-part (mm-handle-cache handle))))
+    ;; Move undisplayer added to the cached handle to the parent.
+    (mm-handle-set-undisplayer
+     handle (mm-handle-undisplayer (mm-handle-cache handle)))
+    (mm-handle-set-undisplayer (mm-handle-cache handle) nil)))
 
 (provide 'mm-extern)
 
--- a/lisp/gnus/nnslashdot.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/gnus/nnslashdot.el	Mon Apr 17 08:41:12 2006 +0000
@@ -142,7 +142,7 @@
 	  (setq article (if (and article (< start article)) article start))
 	  (goto-char point)
 	  (while (re-search-forward
-		  "<a name=\"\\([0-9]+\\)\">\\([^<]+\\)</a>.*\n.*score:\\([^)]+\\))"
+		  "<a name=\"\\([0-9]+\\)\">\\([^<]+\\)</a>.*\n.*\n.*score:\\([^)]+\\))"
 		  nil t)
 	    (setq cid (match-string 1)
 		  subject (match-string 2)
--- a/lisp/gnus/rfc2047.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/gnus/rfc2047.el	Mon Apr 17 08:41:12 2006 +0000
@@ -851,11 +851,8 @@
   (let (word charset cs encoding text rest)
     (while words
       (setq word (pop words))
-      (if (and (or (setq cs (rfc2047-charset-to-coding-system
-			     (setq charset (car word))))
-		   (progn
-		     (message "Unknown charset: %s" charset)
-		     nil))
+      (if (and (setq cs (rfc2047-charset-to-coding-system
+			 (setq charset (car word))))
 	       (condition-case code
 		   (cond ((char-equal ?B (nth 1 word))
 			  (setq text (base64-decode-string
--- a/lisp/hexl.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/hexl.el	Mon Apr 17 08:41:12 2006 +0000
@@ -38,7 +38,7 @@
 ;; grouping.
 ;;
 ;; -iso in `hexl-options' will allow iso characters to display in the
-;; ASCII region of the screen (if your emacs supports this) instead of
+;; ASCII region of the screen (if your Emacs supports this) instead of
 ;; changing them to dots.
 
 ;;; Code:
@@ -62,7 +62,7 @@
   :group 'hexl)
 
 (defcustom hexl-iso ""
-  "If your emacs can handle ISO characters, this should be set to
+  "If your Emacs can handle ISO characters, this should be set to
 \"-iso\" otherwise it should be \"\"."
   :type 'string
   :group 'hexl)
@@ -229,7 +229,7 @@
 				  original-point))
 	  (or (bolp) (setq original-point (1- original-point))))
         (hexlify-buffer)
-        (set-buffer-modified-p modified))
+        (restore-buffer-modified-p modified))
       (make-local-variable 'hexl-max-address)
       (setq hexl-max-address max-address)
       (condition-case nil
@@ -300,9 +300,16 @@
       (lambda (string &optional bound noerror count)
 	(funcall
 	 (if isearch-forward 're-search-forward 're-search-backward)
-	 (if (> (length string) 80)
-	     (regexp-quote string)
-	   (mapconcat 'string string "\\(?:\n\\(?:[:a-f0-9]+ \\)+ \\)?"))
+         (let ((textre
+                (if (> (length string) 80)
+                    (regexp-quote string)
+                  (mapconcat (lambda (c) (regexp-quote (string c))) string
+                             "\\(?:\n\\(?:[:a-f0-9]+ \\)+ \\)?"))))
+           (if (string-match "\\` ?\\([a-f0-9]+ \\)*[a-f0-9]+ ?\\'" string)
+               (concat textre "\\|"
+                       (mapconcat 'regexp-quote (split-string string " ")
+                                  " \\(?: .+\n[a-f0-9]+: \\)?"))
+             textre))
 	 bound noerror count))
     (let ((isearch-search-fun-function nil))
       (isearch-search-fun))))
@@ -318,34 +325,33 @@
   "Save a hexl format buffer as binary in visited file if modified."
   (interactive)
   (if hexl-in-save-buffer nil
-    (set-buffer-modified-p (if (buffer-modified-p)
-			       (save-excursion
-				 (let ((buf (generate-new-buffer " hexl"))
-				       (name (buffer-name))
-				       (file-name (buffer-file-name))
-				       (start (point-min))
-				       (end (point-max))
-				       modified)
-				   (set-buffer buf)
-				   (insert-buffer-substring name start end)
-				   (set-buffer name)
-				   (dehexlify-buffer)
-				   ;; Prevent infinite recursion.
-				   (let ((hexl-in-save-buffer t))
-				     (save-buffer))
-				   (setq modified (buffer-modified-p))
-				   (delete-region (point-min) (point-max))
-				   (insert-buffer-substring buf start end)
-				   (kill-buffer buf)
-				   modified))
-			     (message "(No changes need to be saved)")
-			     nil))
+    (restore-buffer-modified-p
+     (if (buffer-modified-p)
+         (let ((buf (generate-new-buffer " hexl"))
+               (name (buffer-name))
+               (start (point-min))
+               (end (point-max))
+               modified)
+           (with-current-buffer buf
+             (insert-buffer-substring name start end)
+             (set-buffer name)
+             (dehexlify-buffer)
+             ;; Prevent infinite recursion.
+             (let ((hexl-in-save-buffer t))
+               (save-buffer))
+             (setq modified (buffer-modified-p))
+             (delete-region (point-min) (point-max))
+             (insert-buffer-substring buf start end)
+             (kill-buffer buf)
+             modified))
+       (message "(No changes need to be saved)")
+       nil))
     ;; Return t to indicate we have saved t
     t))
 
 ;;;###autoload
 (defun hexl-find-file (filename)
-  "Edit file FILENAME in hexl-mode.
+  "Edit file FILENAME in `hexl-mode'.
 Switch to a buffer visiting file FILENAME, creating one in none exists."
   (interactive
    (list
@@ -367,7 +373,7 @@
 	    (original-point (1+ (hexl-current-address))))
 	(dehexlify-buffer)
 	(remove-hook 'write-contents-functions 'hexl-save-buffer t)
-	(set-buffer-modified-p modified)
+	(restore-buffer-modified-p modified)
 	(goto-char original-point)
 	;; Maybe adjust point for the removed CR characters.
 	(when (eq (coding-system-eol-type buffer-file-coding-system) 1)
@@ -403,7 +409,7 @@
 	    (original-point (1+ (hexl-current-address))))
 	(dehexlify-buffer)
 	(remove-hook 'write-contents-functions 'hexl-save-buffer t)
-	(set-buffer-modified-p modified)
+	(restore-buffer-modified-p modified)
 	(goto-char original-point))))
 
 (defun hexl-current-address (&optional validate)
@@ -917,14 +923,14 @@
 	    )))))
 
 (defun hexl-activate-ruler ()
-  "Activate `ruler-mode'"
+  "Activate `ruler-mode'."
   (require 'ruler-mode)
   (set (make-local-variable 'ruler-mode-ruler-function)
        'hexl-mode-ruler)
   (ruler-mode 1))
 
 (defun hexl-follow-line ()
-  "Activate `hl-line-mode'"
+  "Activate `hl-line-mode'."
   (require 'frame)
   (require 'hl-line)
   (with-no-warnings
@@ -1071,5 +1077,5 @@
 
 (provide 'hexl)
 
-;;; arch-tag: d5a7aa8a-9bce-480b-bcff-6c4c7ca5ea4a
+;; arch-tag: d5a7aa8a-9bce-480b-bcff-6c4c7ca5ea4a
 ;;; hexl.el ends here
--- a/lisp/international/mule-cmds.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/international/mule-cmds.el	Mon Apr 17 08:41:12 2006 +0000
@@ -2476,7 +2476,9 @@
 	;; If a specific EOL conversion was specified in the default
 	;; buffer-file-coding-system, preserve it in the coding system
 	;; we will be using from now on.
-	(if (memq default-eol-type '(0 1 2 unix dos mac))
+	(if (and (memq default-eol-type '(0 1 2 unix dos mac))
+		 coding-system
+		 (coding-system-p coding-system))
 	    (setq coding-system (coding-system-change-eol-conversion
 				 coding-system default-eol-type)))
 
--- a/lisp/loadhist.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/loadhist.el	Mon Apr 17 08:41:12 2006 +0000
@@ -32,6 +32,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 (defun feature-symbols (feature)
   "Return the file and list of definitions associated with FEATURE.
 The value is actually the element of `load-history'
@@ -207,23 +209,29 @@
 	  (elp-restore-function elt))))
     (dolist (x unload-hook-features-list)
       (if (consp x)
-	  (cond
+	  (case (car x)
 	   ;; Remove any feature names that this file provided.
-	   ((eq (car x) 'provide)
+	   (provide
 	    (setq features (delq (cdr x) features)))
-	   ((eq (car x) 'defun)
+	   (defun
 	    (let ((fun (cdr x)))
 	      (when (fboundp fun)
 		(when (fboundp 'ad-unadvise)
 		  (ad-unadvise fun))
-		(fmakunbound fun)
 		(let ((aload (get fun 'autoload)))
-		  (when aload
-		    (fset fun (cons 'autoload aload))))))))
+		  (if aload
+                      (fset fun (cons 'autoload aload))
+                    (fmakunbound fun))))))
+           (require nil)
+           (t (message "Unexpected element %s in load-history" x)))
 	;; Kill local values as much as possible.
 	(dolist (buf (buffer-list))
 	  (with-current-buffer buf
+            (if (and (boundp x) (timerp (symbol-value x)))
+                (cancel-timer (symbol-value x)))
 	    (kill-local-variable x)))
+        (if (and (boundp x) (timerp (symbol-value x)))
+            (cancel-timer (symbol-value x)))
 	;; Get rid of the default binding if we can.
 	(unless (local-variable-if-set-p x)
 	  (makunbound x))))
@@ -232,5 +240,5 @@
 
 (provide 'loadhist)
 
-;;; arch-tag: 70bb846a-c413-4f01-bf88-78dba4ac0798
+;; arch-tag: 70bb846a-c413-4f01-bf88-78dba4ac0798
 ;;; loadhist.el ends here
--- a/lisp/mail/rmail.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mail/rmail.el	Mon Apr 17 08:41:12 2006 +0000
@@ -623,7 +623,9 @@
 
 ;;;###autoload
 (defvar rmail-mime-charset-pattern
-  "^content-type:[ ]*text/plain;[ \t\n]*charset=\"?\\([^ \t\n\";]+\\)\"?"
+  (concat "^content-type:[ ]*text/plain;"
+	  "\\(?:[ \t\n]*\\(format\\|delsp\\)=\"?[-a-z0-9]+\"?;\\)*"
+	  "[ \t\n]*charset=\"?\\([^ \t\n\";]+\\)\"?")
   "Regexp to match MIME-charset specification in a header of message.
 The first parenthesized expression should match the MIME-charset name.")
 
--- a/lisp/mh-e/ChangeLog	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/ChangeLog	Mon Apr 17 08:41:12 2006 +0000
@@ -1,3 +1,129 @@
+2006-04-15  Bill Wohler  <wohler@newt.com>
+
+	* mh-compat.el (mh-font-lock-add-keywords): Fix typo in docstring.
+
+2006-04-14  Bill Wohler  <wohler@newt.com>
+
+	* mh-funcs.el (view-exit-action): No need to wrap defvar with
+	eval-when-compile when shushing compiler.
+
+	* mh-mime.el (mh-identity-pgg-default-user-id): Ditto.
+
+	* mh-seq.el (view-exit-action): Ditto.
+
+	* 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
+	eval-when-compile when shushing compiler, even when
+	mh-do-in-xemacs or another construct is used.
+
+	* mh-comp.el (sendmail-coding-system): Ditto.
+
+	* mh-e.el (mark-active): Ditto.
+
+	* mh-folder.el (desktop-save-buffer, font-lock-auto-fontify)
+	(image-load-path, font-lock-defaults): Ditto.
+
+	* mh-letter.el (image-load-path, font-lock-defaults): Ditto.
+
+	* mh-mime.el (dots, type, ov)
+	(mm-verify-function-alist, mm-decrypt-function-alist)
+	(pressed-details): Ditto.
+
+	* mh-search.el (pick-folder, mh-do-in-xemacs)
+	(mh-mairix-folder, mh-flists-search-folders)
+	(which-func-mode, mh-speed-flists-inhibit-flag): Ditto.
+
+	* mh-seq.el (tool-bar-mode): Ditto.
+
+	* mh-utils.el (completion-root-regexp)
+	(minibuffer-completing-file-name): Ditto.
+
+	* 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.	
+
+	* mh-e.el: Add MH-E function and variable keywords such as
+	mh-defun-compat and mh-defcustom to font-lock-keywords.	
+
+2006-04-13  Bill Wohler  <wohler@newt.com>
+
+	* 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-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)
+	(mh-alias-insert-file, mh-alias-insertion-location)
+	(mh-alias-local-users, mh-alias-local-users-prefix)
+	(mh-alias-passwd-gecos-comma-separator-flag)
+	(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-list, mh-default-folder-must-exist-flag)
+	(mh-default-folder-prefix, mh-identity-list)
+	(mh-auto-fields-list, mh-auto-fields-prompt-flag)
+	(mh-identity-default, mh-identity-handlers, mh-inc-prog)
+	(mh-inc-spool-list, mh-junk-background, mh-junk-disposition)
+	(mh-junk-program, mh-compose-insertion)
+	(mh-compose-skipped-header-fields)
+	(mh-compose-space-does-completion-flag)
+	(mh-delete-yanked-msg-window-flag)
+	(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-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-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-display-buttons-for-alternatives-flag)
+	(mh-display-buttons-for-inline-parts-flag)
+	(mh-do-not-confirm-flag, mh-fetch-x-image-url)
+	(mh-graphical-smileys-flag, mh-graphical-emphasis-flag)
+	(mh-highlight-citation-style, mh-invisible-header-fields)
+	(mh-invisible-header-fields-default, mh-lpr-command-format)
+	(mh-max-inline-image-height, mh-max-inline-image-width)
+	(mh-mhl-format-file, mh-mime-save-parts-default-directory)
+	(mh-print-background-flag, mh-show-maximum-size)
+	(mh-show-use-xface-flag, mh-store-default-directory)
+	(mh-summary-height, mh-speed-update-interval)
+	(mh-show-threads-flag, mh-tool-bar-search-function)
+	(mh-defcustom, mh-after-commands-processed-hook)
+	(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-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)
+	(mh-unseen-updated-hook, mh-folder-address, mh-folder-body)
+	(mh-folder-cur-msg-number, mh-folder-date, mh-folder-deleted)
+	(mh-folder-followup, mh-folder-msg-number, mh-folder-refiled)
+	(mh-folder-sent-to-me-hint, mh-folder-sent-to-me-sender)
+	(mh-folder-subject, mh-folder-tick, mh-folder-to)
+	(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-speedbar-folder, mh-speedbar-folder-with-unseen-messages)
+	(mh-speedbar-selected-folder)
+	(mh-speedbar-selected-folder-with-unseen-messages): Use dotted
+	notation in :package-version keyword.
+
 2006-04-07  Bill Wohler  <wohler@newt.com>
 
 	* mh-e.el (mh-path, mh-variant): Define with mh-defcustom and add
--- a/lisp/mh-e/mh-acros.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-acros.el	Mon Apr 17 08:41:12 2006 +0000
@@ -130,7 +130,9 @@
                (boundp 'mark-active) mark-active))))
 
 ;; Shush compiler.
-(eval-when-compile (mh-do-in-xemacs (defvar struct) (defvar x) (defvar y)))
+(defvar struct)                         ; XEmacs
+(defvar x)                              ; XEmacs
+(defvar y)                              ; XEmacs
 
 ;;;###mh-autoload
 (defmacro mh-defstruct (name-spec &rest fields)
--- a/lisp/mh-e/mh-comp.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-comp.el	Mon Apr 17 08:41:12 2006 +0000
@@ -215,7 +215,7 @@
       (setq other-headers (cdr other-headers)))))
 
 ;; Shush compiler.
-(eval-when-compile (mh-do-in-xemacs (defvar sendmail-coding-system)))
+(defvar sendmail-coding-system)         ; XEmacs
 
 ;;;###autoload
 (defun mh-send-letter (&optional arg)
--- a/lisp/mh-e/mh-compat.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-compat.el	Mon Apr 17 08:41:12 2006 +0000
@@ -40,7 +40,7 @@
 ;; versions of Gnus.
 
 ;; Items are listed alphabetically (except for mh-require which is
-;; needed by a lesser character).
+;; needed sooner it would normally appear).
 
 (require 'mh-acros)
 
@@ -115,6 +115,11 @@
       `(face-background ,face ,frame)
     `(face-background ,face ,frame ,inherit)))
 
+(mh-defun-compat mh-font-lock-add-keywords font-lock-add-keywords
+  (mode keywords &optional how)
+  "XEmacs does not have `font-lock-add-keywords'.
+This function returns nil on that system.")
+
 (mh-defun-compat mh-image-load-path-for-library
   image-load-path-for-library (library image &optional path no-error)
   "Return a suitable search path for images used by LIBRARY.
--- a/lisp/mh-e/mh-e.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-e.el	Mon Apr 17 08:41:12 2006 +0000
@@ -109,6 +109,26 @@
 (require 'mh-buffers)
 (require 'mh-compat)
 
+(mh-font-lock-add-keywords
+ 'emacs-lisp-mode
+ (eval-when-compile
+   `((,(concat "(\\("
+               ;; Function declarations (use font-lock-function-name-face).
+               "\\(mh-def\\(un\\|macro\\)-compat\\)\\|"
+               ;; Variable declarations (use font-lock-variable-name-face).
+               "\\(mh-def\\(custom\\|face\\)\\)\\|"
+               ;; Group declarations (use font-lock-type-face).
+               "\\(mh-defgroup\\)"
+               "\\)\\>"
+               ;; Any whitespace and defined object.
+               "[ \t'\(]*"
+               "\\(setf[ \t]+\\sw+)\\|\\sw+\\)?")
+      (1 font-lock-keyword-face)
+      (7 (cond ((match-beginning 2) font-lock-function-name-face)
+               ((match-beginning 4) font-lock-variable-name-face)
+               (t font-lock-type-face))
+         nil t)))))
+
 
 
 ;;; Global Variables
@@ -603,7 +623,7 @@
   (mh-exchange-point-and-mark-preserving-active-mark))
 
 ;; Shush compiler.
-(eval-when-compile (mh-do-in-xemacs (defvar mark-active)))
+(defvar mark-active)                    ; XEmacs
 
 (defun mh-exchange-point-and-mark-preserving-active-mark ()
   "Put the mark where point is now, and point where the mark is now.
@@ -989,9 +1009,9 @@
 
 (if (boundp 'customize-package-emacs-version-alist)
     (add-to-list 'customize-package-emacs-version-alist
-                 '(MH-E ("6.0" "22.1") ("6.1" "22.1") ("7.0" "22.1")
-                        ("7.1" "22.1") ("7.2" "22.1") ("7.3" "22.1")
-                        ("7.4" "22.1") ("8.0" "22.1"))))
+                 '(MH-E ("6.0" . "22.1") ("6.1" . "22.1") ("7.0" . "22.1")
+                        ("7.1" . "22.1") ("7.2" . "22.1") ("7.3" . "22.1")
+                        ("7.4" . "22.1") ("8.0" . "22.1"))))
 
 
 
@@ -1003,126 +1023,126 @@
 and GNU mailutils."
   :link '(custom-manual "(mh-e)Top")
   :group 'mail
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defgroup mh-alias nil
   "Aliases."
   :link '(custom-manual "(mh-e)Aliases")
   :prefix "mh-alias-"
   :group 'mh-e
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defgroup mh-folder nil
   "Organizing your mail with folders."
   :prefix "mh-"
   :link '(custom-manual "(mh-e)Folders")
   :group 'mh-e
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defgroup mh-folder-selection nil
   "Folder selection."
   :prefix "mh-"
   :link '(custom-manual "(mh-e)Folder Selection")
   :group 'mh-e
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defgroup mh-identity nil
   "Identities."
   :link '(custom-manual "(mh-e)Identities")
   :prefix "mh-identity-"
   :group 'mh-e
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defgroup mh-inc nil
   "Incorporating your mail."
   :prefix "mh-inc-"
   :link '(custom-manual "(mh-e)Incorporating Mail")
   :group 'mh-e
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defgroup mh-junk nil
   "Dealing with junk mail."
   :link '(custom-manual "(mh-e)Junk")
   :prefix "mh-junk-"
   :group 'mh-e
-  :package-version '(MH-E "7.3"))
+  :package-version '(MH-E . "7.3"))
 
 (mh-defgroup mh-letter nil
   "Editing a draft."
   :prefix "mh-"
   :link '(custom-manual "(mh-e)Editing Drafts")
   :group 'mh-e
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defgroup mh-ranges nil
   "Ranges."
   :prefix "mh-"
   :link '(custom-manual "(mh-e)Ranges")
   :group 'mh-e
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defgroup mh-scan-line-formats nil
   "Scan line formats."
   :link '(custom-manual "(mh-e)Scan Line Formats")
   :prefix "mh-"
   :group 'mh-e
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defgroup mh-search nil
   "Searching."
   :link '(custom-manual "(mh-e)Searching")
   :prefix "mh-search-"
   :group 'mh-e
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defgroup mh-sending-mail nil
   "Sending mail."
   :prefix "mh-"
   :link '(custom-manual "(mh-e)Sending Mail")
   :group 'mh-e
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defgroup mh-sequences nil
   "Sequences."
   :prefix "mh-"
   :link '(custom-manual "(mh-e)Sequences")
   :group 'mh-e
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defgroup mh-show nil
   "Reading your mail."
   :prefix "mh-"
   :link '(custom-manual "(mh-e)Reading Mail")
   :group 'mh-e
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defgroup mh-speedbar nil
   "The speedbar."
   :prefix "mh-speed-"
   :link '(custom-manual "(mh-e)Speedbar")
   :group 'mh-e
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defgroup mh-thread nil
   "Threading."
   :prefix "mh-thread-"
   :link '(custom-manual "(mh-e)Threading")
   :group 'mh-e
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defgroup mh-tool-bar nil
   "The tool bar"
   :link '(custom-manual "(mh-e)Tool Bar")
   :prefix "mh-"
   :group 'mh-e
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defgroup mh-hooks nil
   "MH-E hooks."
   :link '(custom-manual "(mh-e)Top")
   :prefix "mh-"
   :group 'mh-e
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defgroup mh-faces nil
   "Faces used in MH-E."
@@ -1130,7 +1150,7 @@
   :prefix "mh-"
   :group 'faces
   :group 'mh-e
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 
 
@@ -1149,7 +1169,7 @@
 lowercase for mailing lists and uppercase for people."
   :type 'boolean
   :group 'mh-alias
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defcustom mh-alias-expand-aliases-flag nil
   "*Non-nil means to expand aliases entered in the minibuffer.
@@ -1159,7 +1179,7 @@
 this expansion is not performed."
   :type 'boolean
   :group 'mh-alias
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defcustom mh-alias-flash-on-comma t
   "*Specify whether to flash address or warn on translation.
@@ -1172,7 +1192,7 @@
                  (const :tag "Flash and Warn If No Alias" 1)
                  (const :tag "Don't Flash Nor Warn If No Alias" nil))
   :group 'mh-alias
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defcustom mh-alias-insert-file nil
   "*Filename used to store a new MH-E alias.
@@ -1186,7 +1206,7 @@
                  (file :tag "Alias File")
                  (repeat :tag "List of Alias Files" file))
   :group 'mh-alias
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defcustom mh-alias-insertion-location 'sorted
   "Specifies where new aliases are entered in alias files.
@@ -1198,7 +1218,7 @@
                  (const :tag "Top" top)
                  (const :tag "Bottom" bottom))
   :group 'mh-alias
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defcustom mh-alias-local-users t
   "*If on, local users are added to alias completion.
@@ -1219,7 +1239,7 @@
 NIS password file."
   :type '(choice (boolean) (string))
   :group 'mh-alias
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defcustom mh-alias-local-users-prefix "local."
   "*String prefixed to the real names of users from the password file.
@@ -1241,7 +1261,7 @@
   :type '(choice (const :tag "Use Login" nil)
                  (string))
   :group 'mh-alias
-  :package-version '(MH-E "7.4"))
+  :package-version '(MH-E . "7.4"))
 
 (mh-defcustom mh-alias-passwd-gecos-comma-separator-flag t
   "*Non-nil means the gecos field in the password file uses a comma separator.
@@ -1253,7 +1273,7 @@
 whose contents may contain commas, you can turn this option off."
   :type 'boolean
   :group 'mh-alias
-  :package-version '(MH-E "7.4"))
+  :package-version '(MH-E . "7.4"))
 
 ;;; Organizing Your Mail with Folders (:group 'mh-folder)
 
@@ -1270,7 +1290,7 @@
                  (const :tag "All" nil)
                  (repeat :tag "Choose Folders" (string :tag "Folder")))
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-ticked-messages-folders t
   "Folders searched for `mh-tick-seq'.
@@ -1285,7 +1305,7 @@
                  (const :tag "All" nil)
                  (repeat :tag "Choose Folders" (string :tag "Folder")))
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-large-folder 200
   "The number of messages that indicates a large folder.
@@ -1297,7 +1317,7 @@
 folders are treated as if they are small."
   :type '(choice (const :tag "No Limit") integer)
   :group 'mh-folder
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-recenter-summary-flag nil
   "*Non-nil means to recenter the summary window.
@@ -1306,13 +1326,13 @@
 show window is toggled off."
   :type 'boolean
   :group 'mh-folder
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-recursive-folders-flag nil
   "*Non-nil means that commands which operate on folders do so recursively."
   :type 'boolean
   :group 'mh-folder
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-sortm-args nil
   "*Additional arguments for \"sortm\"\\<mh-folder-mode-map>.
@@ -1324,7 +1344,7 @@
 \"subject\")\" is a useful setting."
   :type 'string
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 ;;; Folder Selection (:group 'mh-folder-selection)
 
@@ -1338,7 +1358,7 @@
 the default, or an empty string to suppress the default entirely."
   :type 'function
   :group 'mh-folder-selection
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-default-folder-list nil
   "*List of addresses and folders.
@@ -1356,7 +1376,7 @@
                        (string :tag "Folder")
                        (boolean :tag "Check Recipient")))
   :group 'mh-folder-selection
-  :package-version '(MH-E "7.2"))
+  :package-version '(MH-E . "7.2"))
 
 (mh-defcustom mh-default-folder-must-exist-flag t
   "*Non-nil means guessed folder name must exist to be used.
@@ -1370,7 +1390,7 @@
 for more information."
   :type 'boolean
   :group 'mh-folder-selection
-  :package-version '(MH-E "7.2"))
+  :package-version '(MH-E . "7.2"))
 
 (mh-defcustom mh-default-folder-prefix ""
   "*Prefix used for folder names generated from aliases.
@@ -1380,7 +1400,7 @@
 for more information."
   :type 'string
   :group 'mh-folder-selection
-  :package-version '(MH-E "7.2"))
+  :package-version '(MH-E . "7.2"))
 
 ;;; Identities (:group 'mh-identity)
 
@@ -1458,7 +1478,7 @@
          (set-default symbol value)
          (mh-identity-make-menu-no-autoload))
   :group 'mh-identity
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defcustom mh-auto-fields-list nil
   "List of recipients for which header lines are automatically inserted.
@@ -1519,14 +1539,14 @@
                                  (string :tag "Field")
                                  (string :tag "Value"))))))
   :group 'mh-identity
-  :package-version '(MH-E "7.3"))
+  :package-version '(MH-E . "7.3"))
 
 (mh-defcustom mh-auto-fields-prompt-flag t
   "*Non-nil means to prompt before sending if fields inserted.
 See `mh-auto-fields-list'."
   :type 'boolean
   :group 'mh-identity
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-identity-default nil
   "Default identity to use when `mh-letter-mode' is called.
@@ -1537,7 +1557,7 @@
                (mapcar (function (lambda (arg) `(const ,arg)))
                        (mapcar 'car mh-identity-list))))
   :group 'mh-identity
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defcustom mh-identity-handlers
   '(("From" . mh-identity-handler-top)
@@ -1571,7 +1591,7 @@
 containing the VALUE for the field is given."
   :type '(repeat (cons (string :tag "Field") function))
   :group 'mh-identity
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 ;;; Incorporating Your Mail (:group 'mh-inc)
 
@@ -1585,7 +1605,7 @@
 several scan line format variables appropriately."
   :type 'string
   :group 'mh-inc
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (eval-and-compile
   (unless (fboundp 'mh-inc-spool-make-no-autoload)
@@ -1635,7 +1655,7 @@
          (set-default symbol value)
          (mh-inc-spool-make-no-autoload))
   :group 'mh-inc
-  :package-version '(MH-E "7.3"))
+  :package-version '(MH-E . "7.3"))
 
 ;;; Dealing with Junk Mail (:group 'mh-junk)
 
@@ -1677,14 +1697,14 @@
   :type '(choice (const :tag "Off" nil)
                  (const :tag "On" 0))
   :group 'mh-junk
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-junk-disposition nil
   "Disposition of junk mail."
   :type '(choice (const :tag "Delete Spam" nil)
                  (string :tag "Spam Folder"))
   :group 'mh-junk
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-junk-program nil
   "Spam program that MH-E should use.
@@ -1700,7 +1720,7 @@
                  (const :tag "SpamProbe" spamprobe))
   :set 'mh-junk-choose
   :group 'mh-junk
-  :package-version '(MH-E "7.3"))
+  :package-version '(MH-E . "7.3"))
 
 ;;; Editing a Draft (:group 'mh-letter)
 
@@ -1716,7 +1736,7 @@
   :type '(choice (const :tag "MML" mml)
                  (const :tag "MH"  mh))
   :group 'mh-letter
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-compose-skipped-header-fields
   '("From" "Organization" "References" "In-Reply-To"
@@ -1724,13 +1744,13 @@
   "List of header fields to skip over when navigating in draft."
   :type '(repeat (string :tag "Field"))
   :group 'mh-letter
-  :package-version '(MH-E "7.4"))
+  :package-version '(MH-E . "7.4"))
 
 (mh-defcustom mh-compose-space-does-completion-flag nil
   "*Non-nil means \\<mh-letter-mode-map>\\[mh-letter-complete-or-space] does completion in message header."
   :type 'boolean
   :group 'mh-letter
-  :package-version '(MH-E "7.4"))
+  :package-version '(MH-E . "7.4"))
 
 (mh-defcustom mh-delete-yanked-msg-window-flag nil
   "*Non-nil means delete any window displaying the message.
@@ -1740,7 +1760,7 @@
 more room on your screen for your reply."
   :type 'boolean
   :group 'mh-letter
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-extract-from-attribution-verb "wrote:"
   "*Verb to use for attribution when a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
@@ -1754,7 +1774,7 @@
                  (const "schrieb:")
                  (string :tag "Custom String"))
   :group 'mh-letter
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-ins-buf-prefix "> "
   "*String to put before each line of a yanked or inserted message.
@@ -1770,7 +1790,7 @@
 `mail-citation-hook'."
   :type 'string
   :group 'mh-letter
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-letter-complete-function 'ispell-complete-word
   "*Function to call when completing outside of address or folder fields.
@@ -1780,7 +1800,7 @@
 which is set to \"ispell-complete-word\" by default."
   :type '(choice function (const nil))
   :group 'mh-letter
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defcustom mh-letter-fill-column 72
   "*Fill column to use in MH Letter mode.
@@ -1789,7 +1809,7 @@
 message without line wrapping."
   :type 'integer
   :group 'mh-letter
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-mml-method-default (if mh-pgp-support-flag "pgpmime" "none")
   "Default method to use in security tags.
@@ -1812,7 +1832,7 @@
                  (const :tag "S/MIME" "smime")
                  (const :tag "None" "none"))
   :group 'mh-letter
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-signature-file-name "~/.signature"
   "*Source of user's signature.
@@ -1835,7 +1855,7 @@
 `mh-identity-list'."
   :type 'file
   :group 'mh-letter
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-signature-separator-flag t
   "*Non-nil means a signature separator should be inserted.
@@ -1846,7 +1866,7 @@
 replying or yanking a letter into a draft."
   :type 'boolean
   :group 'mh-letter
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-x-face-file "~/.face"
   "*File containing face header field to insert in outgoing mail.
@@ -1875,7 +1895,7 @@
 this option doesn't exist."
   :type 'file
   :group 'mh-letter
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-yank-behavior 'attribution
   "*Controls which part of a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
@@ -1920,7 +1940,7 @@
                  (const :tag "Body With Attribution, Automatically"
                         autoattrib))
   :group 'mh-letter
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 ;;; Ranges (:group 'mh-ranges)
 
@@ -1933,7 +1953,7 @@
 message 200, then use the range \"200:200\"."
   :type 'boolean
   :group 'mh-ranges
-  :package-version '(MH-E "7.4"))
+  :package-version '(MH-E . "7.4"))
 
 ;;; Scan Line Formats (:group 'mh-scan-line-formats)
 
@@ -1960,7 +1980,7 @@
   :type 'boolean
   :group 'mh-scan-line-formats
   :set 'mh-adaptive-cmd-note-flag-check
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (defun mh-scan-format-file-check (symbol value)
   "Check if desired setting is legal.
@@ -1999,7 +2019,7 @@
                  (file  :tag "Specify a scan Format File"))
   :group 'mh-scan-line-formats
   :set 'mh-scan-format-file-check
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (defun mh-adaptive-cmd-note-flag-check (symbol value)
   "Check if desired setting is legal.
@@ -2022,7 +2042,7 @@
 \"mh-profile(5)\") to produce a different type of listing."
   :type 'string
   :group 'mh-scan-line-formats
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 (make-variable-buffer-local 'mh-scan-prog)
 
 ;;; Searching (:group 'mh-search)
@@ -2046,7 +2066,7 @@
                  (const :tag "pick" pick)
                  (const :tag "grep" grep))
   :group 'mh-search
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 ;;; Sending Mail (:group 'mh-sending-mail)
 
@@ -2064,7 +2084,7 @@
 regardless of the settings of this option."
   :type 'boolean
   :group 'mh-sending-mail
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-compose-letter-function nil
   "Invoked when starting a new draft.
@@ -2076,13 +2096,13 @@
 fields."
   :type '(choice (const nil) function)
   :group 'mh-sending-mail
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-compose-prompt-flag nil
   "*Non-nil means prompt for header fields when composing a new draft."
   :type 'boolean
   :group 'mh-sending-mail
-  :package-version '(MH-E "7.4"))
+  :package-version '(MH-E . "7.4"))
 
 (mh-defcustom mh-forward-subject-format "%s: %s"
   "*Format string for forwarded message subject.
@@ -2092,7 +2112,7 @@
 and the second one is replaced with the original \"Subject:\"."
   :type 'string
   :group 'mh-sending-mail
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-insert-x-mailer-flag t
   "*Non-nil means append an \"X-Mailer:\" header field to the header.
@@ -2102,7 +2122,7 @@
 can turn this option off."
   :type 'boolean
   :group 'mh-sending-mail
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-redist-full-contents-flag nil
   "*Non-nil means the \"dist\" command needs entire letter for redistribution.
@@ -2114,7 +2134,7 @@
 has been redistributed before, turn off this option."
   :type 'boolean
   :group 'mh-sending-mail
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-reply-default-reply-to nil
   "*Sets the person or persons to whom a reply will be sent.
@@ -2130,7 +2150,7 @@
                  (const "cc")
                  (const "all"))
   :group 'mh-sending-mail
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-reply-show-message-flag t
   "*Non-nil means the MH-Show buffer is displayed when replying.
@@ -2141,7 +2161,7 @@
 See also `mh-reply'."
   :type 'boolean
   :group 'mh-sending-mail
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 ;;; Sequences (:group 'mh-sequences)
 
@@ -2158,7 +2178,7 @@
 desired, then turn off this option."
   :type 'boolean
   :group 'mh-sequences
-  :package-version '(MH-E "7.4"))
+  :package-version '(MH-E . "7.4"))
 
 (mh-defcustom mh-tick-seq 'tick
   "The name of the MH sequence for ticked messages.
@@ -2170,7 +2190,7 @@
   :type '(choice (const :tag "Disable Ticking" nil)
                  symbol)
   :group 'mh-sequences
-  :package-version '(MH-E "7.3"))
+  :package-version '(MH-E . "7.3"))
 
 (mh-defcustom mh-update-sequences-after-mh-show-flag t
   "*Non-nil means flush MH sequences to disk after message is shown\\<mh-folder-mode-map>.
@@ -2185,7 +2205,7 @@
 commands."
   :type 'boolean
   :group 'mh-sequences
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 ;;; Reading Your Mail (:group 'mh-show)
 
@@ -2198,7 +2218,7 @@
 running \\[electric-buffer-list] to see what I mean."
   :type 'boolean
   :group 'mh-show
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-clean-message-header-flag t
   "*Non-nil means remove extraneous header fields.
@@ -2207,7 +2227,7 @@
 `mh-invisible-header-fields'."
   :type 'boolean
   :group 'mh-show
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-decode-mime-flag (not (not (locate-library "mm-decode")))
   "*Non-nil means attachments are handled\\<mh-folder-mode-map>.
@@ -2225,7 +2245,7 @@
 `mh-graphical-smileys-flag' and `mh-graphical-emphasis-flag'."
   :type 'boolean
   :group 'mh-show
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-display-buttons-for-alternatives-flag nil
   "*Non-nil means display buttons for all alternative attachments.
@@ -2237,7 +2257,7 @@
 inline and buttons are shown for each of the other alternatives."
   :type 'boolean
   :group 'mh-show
-  :package-version '(MH-E "7.4"))
+  :package-version '(MH-E . "7.4"))
 
 (mh-defcustom mh-display-buttons-for-inline-parts-flag nil
   "*Non-nil means display buttons for all inline attachments\\<mh-folder-mode-map>.
@@ -2260,7 +2280,7 @@
 text (including HTML) and images."
   :type 'boolean
   :group 'mh-show
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-do-not-confirm-flag nil
   "*Non-nil means non-reversible commands do not prompt for confirmation.
@@ -2272,7 +2292,7 @@
 retracted--without question."
   :type 'boolean
   :group 'mh-show
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-fetch-x-image-url nil
   "*Control fetching of \"X-Image-URL:\" header field image.
@@ -2308,7 +2328,7 @@
   :type '(choice (const :tag "Ask Before Fetching" ask)
                  (const :tag "Never Fetch" nil))
   :group 'mh-show
-  :package-version '(MH-E "7.3"))
+  :package-version '(MH-E . "7.3"))
 
 (mh-defcustom mh-graphical-smileys-flag t
   "*Non-nil means graphical smileys are displayed.
@@ -2323,7 +2343,7 @@
 turned off."
   :type 'boolean
   :group 'mh-show
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-graphical-emphasis-flag t
   "*Non-nil means graphical emphasis is displayed.
@@ -2340,7 +2360,7 @@
 turned off."
   :type 'boolean
   :group 'mh-show
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-highlight-citation-style 'gnus
   "Style for highlighting citations.
@@ -2356,7 +2376,7 @@
                  (const :tag "Monochrome" font-lock)
                  (const :tag "None" nil))
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 ;; Keep fields alphabetized. Mention source, if known.
 (defvar mh-invisible-header-fields-internal
@@ -2588,7 +2608,7 @@
          (set-default symbol value)
          (mh-invisible-headers))
   :group 'mh-show
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 (mh-defcustom mh-invisible-header-fields-default nil
   "*List of hidden header fields.
@@ -2606,7 +2626,7 @@
          (set-default symbol value)
          (mh-invisible-headers))
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (defvar mh-invisible-header-fields-compiled nil
   "*Regexp matching lines in a message header that are not to be shown.
@@ -2658,7 +2678,7 @@
 \\[mh-ps-print-msg-file]."
   :type 'string
   :group 'mh-show
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-max-inline-image-height nil
   "*Maximum inline image height if \"Content-Disposition:\" is not present.
@@ -2674,7 +2694,7 @@
 these numbers."
   :type '(choice (const nil) integer)
   :group 'mh-show
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-max-inline-image-width nil
   "*Maximum inline image width if \"Content-Disposition:\" is not present.
@@ -2690,7 +2710,7 @@
 these numbers."
   :type '(choice (const nil) integer)
   :group 'mh-show
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-mhl-format-file nil
   "*Specifies the format file to pass to the \"mhl\" program.
@@ -2714,7 +2734,7 @@
                  (const :tag "Use Default mhl Format" t)
                  (file :tag "Specify an mhl Format File"))
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-mime-save-parts-default-directory t
   "Default directory to use for \\<mh-folder-mode-map>\\[mh-mime-save-parts].
@@ -2730,7 +2750,7 @@
                  (const :tag "Prompt Always" t)
                  directory)
   :group 'mh-show
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-print-background-flag nil
   "*Non-nil means messages should be printed in the background\\<mh-folder-mode-map>.
@@ -2746,7 +2766,7 @@
 \\[mh-ps-print-msg-file]."
   :type 'boolean
   :group 'mh-show
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-show-maximum-size 0
   "*Maximum size of message (in bytes) to display automatically.
@@ -2756,7 +2776,7 @@
 message are shown regardless of size."
   :type 'integer
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-show-use-xface-flag (>= emacs-major-version 21)
   "*Non-nil means display face images in MH-show buffers.
@@ -2796,7 +2816,7 @@
 \"X-Image-URL:\" header field image."
   :type 'boolean
   :group 'mh-show
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-store-default-directory nil
   "*Default directory for \\<mh-folder-mode-map>\\[mh-store-msg].
@@ -2808,7 +2828,7 @@
   :type '(choice (const :tag "Current" nil)
                  directory)
   :group 'mh-show
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-summary-height nil
   "*Number of lines in MH-Folder buffer (including the mode line).
@@ -2821,7 +2841,7 @@
   :type '(choice (const :tag "Automatic" nil)
                  (integer :tag "Fixed Size"))
   :group 'mh-show
-  :package-version '(MH-E "7.4"))
+  :package-version '(MH-E . "7.4"))
 
 ;;; The Speedbar (:group 'mh-speedbar)
 
@@ -2830,7 +2850,7 @@
 Set to 0 to disable automatic update."
   :type 'integer
   :group 'mh-speedbar
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 ;;; Threading (:group 'mh-thread)
 
@@ -2843,7 +2863,7 @@
 threaded is less than `mh-large-folder'."
   :type 'boolean
   :group 'mh-thread
-  :package-version '(MH-E "7.1"))
+  :package-version '(MH-E . "7.1"))
 
 ;;; The Tool Bar (:group 'mh-tool-bar)
 
@@ -2859,7 +2879,7 @@
   :type '(choice (const mh-search)
                  (function :tag "Other Function"))
   :group 'mh-tool-bar
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 ;; XEmacs has a couple of extra customizations...
 (mh-do-in-xemacs
@@ -2877,7 +2897,7 @@
                     (not mh-xemacs-has-tool-bar-flag))
                (error "Tool bar not supported"))
            (set-default symbol value))
-    :package-version '(MH-E "7.3"))
+    :package-version '(MH-E . "7.3"))
 
   (mh-defcustom mh-xemacs-tool-bar-position nil
     "*Tool bar location.
@@ -2895,7 +2915,7 @@
                   (const :tag "Left" :value left)
                   (const :tag "Right" :value right))
     :group 'mh-tool-bar
-    :package-version '(MH-E "7.3")))
+    :package-version '(MH-E . "7.3")))
 
 
 
@@ -2911,14 +2931,14 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-alias-reloaded-hook nil
   "Hook run by `mh-alias-reload' after loading aliases."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-alias
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-before-commands-processed-hook nil
   "Hook run by \\<mh-folder-mode-map>\\[mh-execute-commands] before performing outstanding refile and delete requests.
@@ -2929,7 +2949,7 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-before-quit-hook nil
   "Hook run by \\<mh-folder-mode-map>\\[mh-quit] before quitting MH-E.
@@ -2942,7 +2962,7 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-folder
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-before-send-letter-hook nil
   "Hook run at the beginning of the \\<mh-letter-mode-map>\\[mh-send-letter] command.
@@ -2953,7 +2973,7 @@
   :options '(ispell-message)
   :group 'mh-hooks
   :group 'mh-letter
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-delete-msg-hook nil
   "Hook run by \\<mh-letter-mode-map>\\[mh-delete-msg] after marking each message for deletion.
@@ -2963,7 +2983,7 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-show
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-find-path-hook nil
   "Hook run by `mh-find-path' after reading the user's MH profile.
@@ -2974,28 +2994,28 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-e
-  :package-version '(MH-E "7.0"))
+  :package-version '(MH-E . "7.0"))
 
 (mh-defcustom mh-folder-mode-hook nil
   "Hook run by `mh-folder-mode' when visiting a new folder."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-folder
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-forward-hook nil
   "Hook run by `mh-forward' on a forwarded letter."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-sending-mail
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-inc-folder-hook nil
   "Hook run by \\<mh-folder-mode-map>\\[mh-inc-folder] after incorporating mail into a folder."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-inc
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-insert-signature-hook nil
   "Hook run by \\<mh-letter-mode-map>\\[mh-insert-signature] after signature has been inserted.
@@ -3006,7 +3026,7 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-letter
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-kill-folder-suppress-prompt-hooks '(mh-search-p)
   "Abnormal hook run at the beginning of \\<mh-folder-mode-map>\\[mh-kill-folder].
@@ -3024,7 +3044,7 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-folder
-  :package-version '(MH-E "7.4"))
+  :package-version '(MH-E . "7.4"))
 
 (mh-defcustom mh-letter-mode-hook nil
   "Hook run by `mh-letter-mode' on a new letter.
@@ -3037,14 +3057,14 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-sending-mail
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-mh-to-mime-hook nil
   "Hook run on the formatted letter by \\<mh-letter-mode-map>\\[mh-mh-to-mime]."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-letter
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-search-mode-hook nil
   "Hook run upon entry to `mh-search-mode'\\<mh-folder-mode-map>.
@@ -3056,7 +3076,7 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-search
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defcustom mh-quit-hook nil
   "Hook run by \\<mh-folder-mode-map>\\[mh-quit] after quitting MH-E.
@@ -3068,14 +3088,14 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-folder
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-refile-msg-hook nil
   "Hook run by \\<mh-folder-mode-map>\\[mh-refile-msg] after marking each message for refiling."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-folder
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-show-hook nil
   "Hook run after \\<mh-folder-mode-map>\\[mh-show] shows a message.
@@ -3086,7 +3106,7 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-show
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-show-mode-hook nil
   "Hook run upon entry to `mh-show-mode'.
@@ -3097,7 +3117,7 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-show
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 (mh-defcustom mh-unseen-updated-hook nil
   "Hook run after the unseen sequence has been updated.
@@ -3108,7 +3128,7 @@
   :type 'hook
   :group 'mh-hooks
   :group 'mh-sequences
-  :package-version '(MH-E "6.0"))
+  :package-version '(MH-E . "6.0"))
 
 
 
@@ -3326,7 +3346,7 @@
   "Recipient face."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-folder-body
   (mh-face-data 'mh-folder-msg-number
@@ -3337,7 +3357,7 @@
   "Body text face."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-folder-cur-msg-number
   (mh-face-data 'mh-folder-msg-number
@@ -3345,39 +3365,39 @@
   "Current message number face."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-folder-date
   (mh-face-data 'mh-folder-msg-number '((t (:inherit mh-folder-msg-number))))
   "Date face."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-folder-deleted
   (mh-face-data 'mh-folder-msg-number '((t (:inherit mh-folder-msg-number))))
   "Deleted message face."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-folder-followup (mh-face-data 'mh-folder-followup)
   "\"Re:\" face."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-folder-msg-number (mh-face-data 'mh-folder-msg-number)
   "Message number face."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-folder-refiled (mh-face-data 'mh-folder-refiled)
   "Refiled message face."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-folder-sent-to-me-hint
   (mh-face-data 'mh-folder-msg-number '((t (:inherit mh-folder-date))))
@@ -3387,7 +3407,7 @@
 `mh-scan-sent-to-me-sender-regexp'."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-folder-sent-to-me-sender
   (mh-face-data 'mh-folder-followup '((t (:inherit mh-folder-followup))))
@@ -3397,98 +3417,98 @@
 `mh-scan-sent-to-me-sender-regexp'."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-folder-subject (mh-face-data 'mh-folder-subject)
   "Subject face."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-folder-tick (mh-face-data 'mh-folder-tick)
   "Ticked message face."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-folder-to (mh-face-data 'mh-folder-to)
   "\"To:\" face."
   :group 'mh-faces
   :group 'mh-folder
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-letter-header-field (mh-face-data 'mh-letter-header-field)
   "Editable header field value face in draft buffers."
   :group 'mh-faces
   :group 'mh-letter
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-search-folder (mh-face-data 'mh-search-folder)
   "Folder heading face in MH-Folder buffers created by searches."
   :group 'mh-faces
   :group 'mh-search
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-show-cc (mh-face-data 'mh-show-cc)
   "Face used to highlight \"cc:\" header fields."
   :group 'mh-faces
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-show-date (mh-face-data 'mh-show-date)
   "Face used to highlight \"Date:\" header fields."
   :group 'mh-faces
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-show-from (mh-face-data 'mh-show-from)
   "Face used to highlight \"From:\" header fields."
   :group 'mh-faces
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-show-header (mh-face-data 'mh-show-header)
   "Face used to deemphasize less interesting header fields."
   :group 'mh-faces
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-show-pgg-bad (mh-face-data 'mh-show-pgg-bad)
   "Bad PGG signature face."
   :group 'mh-faces
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-show-pgg-good (mh-face-data 'mh-show-pgg-good)
   "Good PGG signature face."
   :group 'mh-faces
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-show-pgg-unknown (mh-face-data 'mh-show-pgg-unknown)
   "Unknown or untrusted PGG signature face."
   :group 'mh-faces
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-show-signature (mh-face-data 'mh-show-signature)
   "Signature face."
   :group 'mh-faces
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-show-subject
   (mh-face-data 'mh-folder-subject '((t (:inherit mh-folder-subject))))
   "Face used to highlight \"Subject:\" header fields."
   :group 'mh-faces
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-show-to (mh-face-data 'mh-show-to)
   "Face used to highlight \"To:\" header fields."
   :group 'mh-faces
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-show-xface
   (mh-face-data 'mh-show-from '((t (:inherit (mh-show-from highlight)))))
@@ -3496,13 +3516,13 @@
 The background and foreground are used in the image."
   :group 'mh-faces
   :group 'mh-show
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-speedbar-folder (mh-face-data 'mh-speedbar-folder)
   "Basic folder face."
   :group 'mh-faces
   :group 'mh-speedbar
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-speedbar-folder-with-unseen-messages
   (mh-face-data 'mh-speedbar-folder
@@ -3510,14 +3530,14 @@
   "Folder face when folder contains unread messages."
   :group 'mh-faces
   :group 'mh-speedbar
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-speedbar-selected-folder
   (mh-face-data 'mh-speedbar-selected-folder)
   "Selected folder face."
   :group 'mh-faces
   :group 'mh-speedbar
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 (mh-defface mh-speedbar-selected-folder-with-unseen-messages
   (mh-face-data 'mh-speedbar-selected-folder
@@ -3525,7 +3545,7 @@
   "Selected folder face when folder contains unread messages."
   :group 'mh-faces
   :group 'mh-speedbar
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E . "8.0"))
 
 ;; Get rid of temporary functions and data structures.
 (fmakunbound 'mh-defcustom)
--- a/lisp/mh-e/mh-folder.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-folder.el	Mon Apr 17 08:41:12 2006 +0000
@@ -522,11 +522,10 @@
   (add-to-list 'which-func-modes 'mh-folder-mode))
 
 ;; Shush compiler.
-(eval-when-compile
-  (defvar desktop-save-buffer)
-  (defvar font-lock-auto-fontify)
-  (defvar image-load-path)
-  (mh-do-in-xemacs (defvar font-lock-defaults)))
+(defvar desktop-save-buffer)
+(defvar font-lock-auto-fontify)
+(defvar image-load-path)
+(defvar font-lock-defaults)             ; XEmacs
 
 (defvar mh-folder-buttons-init-flag nil)
 
--- a/lisp/mh-e/mh-funcs.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-funcs.el	Mon Apr 17 08:41:12 2006 +0000
@@ -138,7 +138,7 @@
     (display-buffer mh-temp-buffer)))
 
 ;; Shush compiler.
-(eval-when-compile (defvar view-exit-action))
+(defvar view-exit-action)
 
 ;;;###mh-autoload
 (defun mh-list-folders ()
--- a/lisp/mh-e/mh-letter.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-letter.el	Mon Apr 17 08:41:12 2006 +0000
@@ -278,9 +278,8 @@
 (defvar mh-letter-buttons-init-flag nil)
 
 ;; Shush compiler.
-(eval-when-compile
-  (defvar image-load-path)
-  (mh-do-in-xemacs (defvar font-lock-defaults)))
+(defvar image-load-path)
+(defvar font-lock-defaults)             ; XEmacs
 
 ;; Ensure new buffers won't get this mode if default-major-mode is nil.
 (put 'mh-letter-mode 'mode-class 'special)
--- a/lisp/mh-e/mh-mime.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-mime.el	Mon Apr 17 08:41:12 2006 +0000
@@ -825,7 +825,9 @@
 ;;; Button Display
 
 ;; Shush compiler.
-(eval-when-compile (mh-do-in-xemacs (defvar dots) (defvar type) (defvar ov)))
+(defvar dots)                           ; XEmacs
+(defvar type)                           ; XEmacs
+(defvar ov)                             ; XEmacs
 
 (defun mh-insert-mime-button (handle index displayed)
   "Insert MIME button for HANDLE.
@@ -870,12 +872,9 @@
       (mh-funcall-if-exists overlay-put ov 'evaporate t))))
 
 ;; Shush compiler.
-(eval-when-compile
-  (when (< emacs-major-version 22)
-    (defvar  mm-verify-function-alist)
-    (defvar  mm-decrypt-function-alist))
-  (mh-do-in-xemacs
-    (defvar pressed-details)))
+(defvar mm-verify-function-alist)       ; < Emacs 22
+(defvar mm-decrypt-function-alist)      ; < Emacs 22
+(defvar pressed-details)                ; XEmacs
 
 (defun mh-insert-mime-security-button (handle)
   "Display buttons for PGP message, HANDLE."
@@ -1537,7 +1536,7 @@
     (after-find-file nil)))
 
 ;; Shush compiler.
-(eval-when-compile (defvar mh-identity-pgg-default-user-id))
+(defvar mh-identity-pgg-default-user-id)
 
 ;;;###mh-autoload
 (defun mh-mml-secure-message-encrypt (method)
--- a/lisp/mh-e/mh-search.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-search.el	Mon Apr 17 08:41:12 2006 +0000
@@ -324,7 +324,7 @@
                        count (> (hash-table-count msg-hash) 0)))))))
 
 ;; Shush compiler.
-(eval-when-compile (mh-do-in-xemacs (defvar pick-folder)))
+(defvar pick-folder)                    ; XEmacs
 
 (defun mh-search-folder (folder window-config)
   "Search FOLDER for messages matching a pattern.
@@ -404,10 +404,8 @@
   (mh-index-sequenced-messages folders mh-tick-seq))
 
 ;; Shush compiler.
-(eval-when-compile
-  (mh-do-in-xemacs
-    (defvar mh-mairix-folder)
-    (defvar mh-flists-search-folders)))
+(defvar mh-mairix-folder)               ; XEmacs
+(defvar mh-flists-search-folders)       ; XEmacs
 
 ;;;###mh-autoload
 (defun mh-index-sequenced-messages (folders sequence)
@@ -1414,9 +1412,7 @@
 (mh-require 'which-func nil t)
 
 ;; Shush compiler.
-(eval-when-compile
-  (if (or mh-xemacs-flag (< emacs-major-version 22))
-      (defvar which-func-mode)))
+(defvar which-func-mode)                ; < Emacs 22, XEmacs
 
 ;;;###mh-autoload
 (defun mh-index-create-imenu-index ()
@@ -1441,7 +1437,7 @@
   mh-index-data)
 
 ;; Shush compiler
-(eval-when-compile (if mh-xemacs-flag (defvar mh-speed-flists-inhibit-flag)))
+(defvar mh-speed-flists-inhibit-flag)   ; XEmacs
 
 ;;;###mh-autoload
 (defun mh-index-execute-commands ()
--- a/lisp/mh-e/mh-seq.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-seq.el	Mon Apr 17 08:41:12 2006 +0000
@@ -134,7 +134,7 @@
       (apply #'mh-speed-flists t folders-changed))))
 
 ;; Shush compiler.
-(eval-when-compile (defvar view-exit-action))
+(defvar view-exit-action)
 
 ;;;###mh-autoload
 (defun mh-list-sequences ()
@@ -202,7 +202,7 @@
                         " "))))
 
 ;; Shush compiler.
-(eval-when-compile (mh-do-in-xemacs (defvar tool-bar-mode)))
+(defvar tool-bar-mode)                  ; XEmacs
 
 ;;;###mh-autoload
 (defun mh-narrow-to-seq (sequence)
--- a/lisp/mh-e/mh-show.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-show.el	Mon Apr 17 08:41:12 2006 +0000
@@ -815,7 +815,7 @@
 (put 'mh-show-mode 'mode-class 'special)
 
 ;; Shush compiler.
-(eval-when-compile (defvar font-lock-auto-fontify))
+(defvar font-lock-auto-fontify)
 
 ;;;###mh-autoload
 (define-derived-mode mh-show-mode text-mode "MH-Show"
--- a/lisp/mh-e/mh-utils.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-utils.el	Mon Apr 17 08:41:12 2006 +0000
@@ -657,7 +657,7 @@
 (defvar mh-folder-hist nil)
 
 ;; Shush compiler.
-(eval-when-compile (defvar mh-speed-flists-cache))
+(defvar mh-speed-flists-cache)
 
 (defvar mh-allow-root-folder-flag nil
   "Non-nil means \"+\" is an acceptable folder name.
@@ -718,10 +718,8 @@
                    (t (file-exists-p path))))))))
 
 ;; Shush compiler.
-(eval-when-compile
-  (mh-do-in-xemacs
-    (defvar completion-root-regexp)
-    (defvar minibuffer-completing-file-name)))
+(defvar completion-root-regexp)          ; XEmacs
+(defvar minibuffer-completing-file-name) ; XEmacs
 
 (defun mh-folder-completing-read (prompt default allow-root-folder-flag)
   "Read folder name with PROMPT and default result DEFAULT.
--- a/lisp/mh-e/mh-xface.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/mh-e/mh-xface.el	Mon Apr 17 08:41:12 2006 +0000
@@ -60,8 +60,7 @@
     (funcall mh-show-xface-function)))
 
 ;; Shush compiler.
-(eval-when-compile
-  (mh-do-in-xemacs (defvar default-enable-multibyte-characters)))
+(defvar default-enable-multibyte-characters) ; XEmacs
 
 (defun mh-face-display-function ()
   "Display a Face, X-Face, or X-Image-URL header field.
--- a/lisp/net/tramp.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/net/tramp.el	Mon Apr 17 08:41:12 2006 +0000
@@ -3584,6 +3584,10 @@
   "Global variable keeping asynchronous process object.
 Used in `tramp-handle-shell-command'")
 
+(defvar tramp-display-shell-command-buffer t
+  "Whether to display output buffer of `shell-command'.
+This is necessary for handling DISPLAY of `process-file'.")
+
 (defun tramp-handle-shell-command (command &optional output-buffer error-buffer)
   "Like `shell-command' for tramp files.
 This will break if COMMAND prints a newline, followed by the value of
@@ -3692,7 +3696,8 @@
 	      (skip-chars-forward "^ ")
 	      (setq status (read (current-buffer)))))
 	  (unless (zerop (buffer-size))
-	    (display-buffer output-buffer))
+	    (when tramp-display-shell-command-buffer
+	      (display-buffer output-buffer)))
 	  status))
     ;; The following is only executed if something strange was
     ;; happening.  Emit a helpful message and do it anyway.
@@ -3707,11 +3712,10 @@
   (when (and (numberp buffer) (zerop buffer))
     (error "Implementation does not handle immediate return"))
   (when (consp buffer) (error "Implementation does not handle error files"))
-  (shell-command
-   (mapconcat 'tramp-shell-quote-argument
-              (cons program args)
-              " ")
-   buffer))
+  (let ((tramp-display-shell-command-buffer display))
+    (shell-command
+     (mapconcat 'tramp-shell-quote-argument (cons program args) " ")
+     buffer)))
 
 ;; File Editing.
 
--- a/lisp/newcomment.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/newcomment.el	Mon Apr 17 08:41:12 2006 +0000
@@ -895,6 +895,11 @@
 		   (delete-char n)
 		   (setq ,bindent (- ,bindent n)))))))))))
 
+(defun comment-add (arg)
+  (if (and (null arg) (= (string-match "[ \t]*\\'" comment-start) 1))
+      comment-add
+    (1- (prefix-numeric-value arg))))
+
 (defun comment-region-internal (beg end cs ce
                                 &optional ccs cce block lines indent)
   "Comment region BEG .. END.
@@ -999,7 +1004,6 @@
 
 (defun comment-region-default (beg end &optional arg)
   (let* ((numarg (prefix-numeric-value arg))
-	 (add comment-add)
 	 (style (cdr (assoc comment-style comment-styles)))
 	 (lines (nth 2 style))
 	 (block (nth 1 style))
@@ -1032,8 +1036,7 @@
      ((consp arg) (uncomment-region beg end))
      ((< numarg 0) (uncomment-region beg end (- numarg)))
      (t
-      (setq numarg (if (and (null arg) (= (length comment-start) 1))
-		       add (1- numarg)))
+      (setq numarg (comment-add arg))
       (comment-region-internal
        beg end
        (let ((s (comment-padright comment-start numarg)))
@@ -1091,9 +1094,8 @@
 	;; FIXME: If there's no comment to kill on this line and ARG is
 	;; specified, calling comment-kill is not very clever.
 	(if arg (comment-kill (and (integerp arg) arg)) (comment-indent))
-      (let ((add (if arg (prefix-numeric-value arg)
-		   (if (= (length comment-start) 1) comment-add 0))))
-	;; Some modes insist on keeping column 0 comment in column 0
+      (let ((add (comment-add arg)))
+        ;; Some modes insist on keeping column 0 comment in column 0
 	;; so we need to move away from it before inserting the comment.
 	(indent-according-to-mode)
 	(insert (comment-padright comment-start add))
--- a/lisp/pcvs-parse.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/pcvs-parse.el	Mon Apr 17 08:41:12 2006 +0000
@@ -271,8 +271,8 @@
 	;; on the current branch (either because it only exists in other
 	;; branches, or because it's been removed).
 	(if (ignore-errors
-	      (with-current-buffer
-		  (find-file-noselect (expand-file-name
+	      (with-temp-buffer
+		(insert-file-contents (expand-file-name
 				       ".cvsignore" (file-name-directory dir)))
 		(goto-char (point-min))
 		(re-search-forward
--- a/lisp/play/landmark.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/play/landmark.el	Mon Apr 17 08:41:12 2006 +0000
@@ -211,22 +211,24 @@
 (defvar lm-emacs-won ()
   "*For making font-lock use the winner's face for the line.")
 
-(defvar lm-font-lock-face-O
-  (if (display-color-p)
-      (list (facemenu-get-face 'fg:red) 'bold))
-  "*Face to use for Emacs' O.")
+(defface lm-font-lock-face-O '((((class color)) :foreground "red")
+			       (t :weight bold))
+  "*Face to use for Emacs' O."
+  :version "22.1"
+  :group 'lm)
 
-(defvar lm-font-lock-face-X
-  (if (display-color-p)
-      (list (facemenu-get-face 'fg:green) 'bold))
-  "*Face to use for your X.")
+(defface lm-font-lock-face-X '((((class color)) :foreground "green")
+			       (t :weight bold))
+  "*Face to use for your X."
+  :version "22.1"
+  :group 'lm)
 
 (defvar lm-font-lock-keywords
-  '(("O" . lm-font-lock-face-O)
-    ("X" . lm-font-lock-face-X)
+  '(("O" . 'lm-font-lock-face-O)
+    ("X" . 'lm-font-lock-face-X)
     ("[-|/\\]" 0 (if lm-emacs-won
-		     lm-font-lock-face-O
-		   lm-font-lock-face-X)))
+		     'lm-font-lock-face-O
+		   'lm-font-lock-face-X)))
   "*Font lock rules for Lm.")
 
 (put 'lm-mode 'front-sticky
--- a/lisp/progmodes/cc-langs.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/progmodes/cc-langs.el	Mon Apr 17 08:41:12 2006 +0000
@@ -267,7 +267,8 @@
        ["Hungry delete"         c-toggle-hungry-state
 	:style toggle :selected c-hungry-delete-key]
        ["Subword mode"          c-subword-mode
-	:style toggle :selected c-subword-mode])))
+	:style toggle :selected (and (boundp 'c-subword-mode)
+                                     c-subword-mode)])))
 
 
 ;;; Syntax tables.
--- a/lisp/progmodes/gdb-ui.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/progmodes/gdb-ui.el	Mon Apr 17 08:41:12 2006 +0000
@@ -417,7 +417,8 @@
   (goto-char (point-min))
   (when (search-forward "read in on demand:" nil t)
     (while (re-search-forward gdb-source-file-regexp nil t)
-      (push (or (match-string 1) (match-string 2)) gdb-source-file-list))
+      (push (file-name-nondirectory (or (match-string 1) (match-string 2)))
+	    gdb-source-file-list))
     (dolist (buffer (buffer-list))
       (with-current-buffer buffer
 	(when (and buffer-file-name
@@ -524,6 +525,7 @@
 	gdb-frame-number nil
 	gdb-var-list nil
 	gdb-force-update t
+	gdb-main-file nil
 	gdb-first-post-prompt t
 	gdb-prompting nil
 	gdb-input-queue nil
@@ -580,8 +582,7 @@
 
 (defun gdb-get-version ()
   (goto-char (point-min))
-  (if (and (re-search-forward gdb-error-regexp nil t)
-	   (string-match ".*(missing implementation)" (match-string 1)))
+  (if (re-search-forward "Undefined\\( mi\\)* command:" nil t)
       (setq gdb-version "pre-6.4")
     (setq gdb-version "6.4+"))
   (gdb-init-2))
@@ -2746,7 +2747,11 @@
   (switch-to-buffer
        (if gud-last-last-frame
 	   (gud-find-file (car gud-last-last-frame))
-	 (gud-find-file gdb-main-file)))
+	 (if gdb-main-file
+	     (gud-find-file gdb-main-file)
+	   ;; Put buffer list in window if we
+	   ;; can't find a source file.
+	   (list-buffers-noselect))))
   (when gdb-use-separate-io-buffer
     (split-window-horizontally)
     (other-window 1)
@@ -3139,19 +3144,18 @@
   (if (re-search-forward  "Stack level \\([0-9]+\\)" nil t)
       (setq gdb-frame-number (match-string 1)))
   (goto-char (point-min))
-  (if (re-search-forward
-    ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\) (\\(\\S-*?\\):[0-9]+?);? "
-       nil t)
-      (progn
-	(setq gdb-selected-frame (match-string 2))
-	(if (gdb-get-buffer 'gdb-locals-buffer)
-	    (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
-	      (setq mode-name (concat "Locals:" gdb-selected-frame))))
-	(if (gdb-get-buffer 'gdb-assembler-buffer)
-	    (with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer)
-	      (setq mode-name (concat "Machine:" gdb-selected-frame))))
-	(setq gdb-frame-address (match-string 1))))
-  (if gud-overlay-arrow-position
+  (when (re-search-forward ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(\\S-+?\\)\
+\\(?: (\\(\\S-+?\\):[0-9]+?)\\)*;? "
+     nil t)
+    (setq gdb-selected-frame (match-string 2))
+    (if (gdb-get-buffer 'gdb-locals-buffer)
+	(with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
+	  (setq mode-name (concat "Locals:" gdb-selected-frame))))
+    (if (gdb-get-buffer 'gdb-assembler-buffer)
+	(with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer)
+	  (setq mode-name (concat "Machine:" gdb-selected-frame))))
+    (setq gdb-frame-address (match-string 1))
+    (if (and (match-string 3) gud-overlay-arrow-position)
       (let ((buffer (marker-buffer gud-overlay-arrow-position))
 	    (position (marker-position gud-overlay-arrow-position)))
 	(when (and buffer (string-equal (buffer-name buffer) (match-string 3)))
@@ -3160,9 +3164,9 @@
 		  (if (string-equal gdb-frame-number "0")
 		      nil
 		    '((overlay-arrow . hollow-right-triangle))))
-	    (set-marker gud-overlay-arrow-position position)))))
+	    (set-marker gud-overlay-arrow-position position))))))
   (goto-char (point-min))
-  (if (re-search-forward " source language \\(\\S-*\\)\." nil t)
+  (if (re-search-forward " source language \\(\\S-+\\)\." nil t)
       (setq gdb-current-language (match-string 1)))
   (gdb-invalidate-assembler))
 
@@ -3281,11 +3285,12 @@
 				   gdb-pending-triggers))
   (goto-char (point-min))
   (if (re-search-forward gdb-error-regexp nil t)
-      (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
-	(let ((buffer-read-only nil))
-	  (erase-buffer)
-	  (insert (match-string 1))
-	  (goto-char (point-min))))
+      (let ((err (match-string 1)))
+	(with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
+	  (let ((buffer-read-only nil))
+	    (erase-buffer)
+	    (insert err)
+	    (goto-char (point-min)))))
     (let ((register-list (reverse gdb-register-names))
 	  (register nil) (register-string nil) (register-values nil))
       (goto-char (point-min))
--- a/lisp/progmodes/perl-mode.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/progmodes/perl-mode.el	Mon Apr 17 08:41:12 2006 +0000
@@ -721,7 +721,10 @@
 	(save-excursion
 	  (forward-char 1)
 	  (forward-sexp -1)
-	  (perl-indent-new-calculate 'virtual nil parse-start)))
+	  (perl-indent-new-calculate
+           ;; Recalculate the parsing-start, since we may have jumped
+           ;; dangerously close (typically in the case of nested functions).
+           'virtual nil (save-excursion (perl-beginning-of-function)))))
    (and (and (= (following-char) ?{)
 	     (save-excursion (forward-char) (perl-hanging-paren-p)))
 	(+ (or default (perl-calculate-indent parse-start))
--- a/lisp/simple.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/simple.el	Mon Apr 17 08:41:12 2006 +0000
@@ -2332,7 +2332,7 @@
 
 If this variable is nil, no filtering is performed.")
 
-(defun filter-buffer-substring (beg end &optional delete)
+(defun filter-buffer-substring (beg end &optional delete noprops)
   "Return the buffer substring between BEG and END, after filtering.
 The buffer substring is passed through each of the filter
 functions in `buffer-substring-filters', and the value from the
@@ -2342,21 +2342,36 @@
 If DELETE is non-nil, the text between BEG and END is deleted
 from the buffer.
 
+If NOPROPS is non-nil, final string returned does not include
+text properties, while the string passed to the filters still
+includes text properties from the buffer text.
+
 Point is temporarily set to BEG before calling
 `buffer-substring-filters', in case the functions need to know
 where the text came from.
 
-This function should be used instead of `buffer-substring' or
-`delete-and-extract-region' when you want to allow filtering to
-take place.  For example, major or minor modes can use
-`buffer-substring-filters' to extract characters that are special
-to a buffer, and should not be copied into other buffers."
-  (save-excursion
-    (goto-char beg)
-    (let ((string (if delete (delete-and-extract-region beg end)
-                    (buffer-substring beg end))))
-      (dolist (filter buffer-substring-filters string)
-        (setq string (funcall filter string))))))
+This function should be used instead of `buffer-substring',
+`buffer-substring-no-properties', or `delete-and-extract-region'
+when you want to allow filtering to take place.  For example,
+major or minor modes can use `buffer-substring-filters' to
+extract characters that are special to a buffer, and should not
+be copied into other buffers."
+  (cond
+   ((or delete buffer-substring-filters)
+    (save-excursion
+      (goto-char beg)
+      (let ((string (if delete (delete-and-extract-region beg end)
+		      (buffer-substring beg end))))
+	(dolist (filter buffer-substring-filters)
+	  (setq string (funcall filter string)))
+	(if noprops
+	    (set-text-properties 0 (length string) nil string))
+	string)))
+   (noprops
+    (buffer-substring-no-properties beg end))
+   (t
+    (buffer-substring beg end))))
+
 
 ;;;; Window system cut and paste hooks.
 
@@ -3742,7 +3757,7 @@
 To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
   (interactive "p")
   (or arg (setq arg 1))
-  
+
   (let ((orig (point)))
 
     ;; Move by lines, if ARG is not 1 (the default).
--- a/lisp/startup.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/startup.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1538,17 +1538,15 @@
           ;; Display the input that we set up in the buffer.
           (set-buffer-modified-p nil)
           (goto-char (point-min))
-          (save-window-excursion
-            (condition-case nil
-                (switch-to-buffer (current-buffer))
-              ;; In case we're in a dedicated or minibuffer-only window.
-              (error
-               ;; There's no point is using pop-to-buffer since creating
-               ;; a new frame will generate enough events that the
-               ;; subsequent `sit-for' will immediately return anyway.
-               ;; (pop-to-buffer (current-buffer))
-               ))
-            (sit-for 120)))
+          (if (or (window-minibuffer-p)
+                  (window-dedicated-p (selected-window)))
+              ;; There's no point is using pop-to-buffer since creating
+              ;; a new frame will generate enough events that the
+              ;; subsequent `sit-for' will immediately return anyway.
+              nil ;; (pop-to-buffer (current-buffer))
+            (save-window-excursion
+              (switch-to-buffer (current-buffer))
+              (sit-for 120))))
       ;; Unwind ... ensure splash buffer is killed
       (kill-buffer "GNU Emacs"))))
 
--- a/lisp/subr.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/subr.el	Mon Apr 17 08:41:12 2006 +0000
@@ -1540,7 +1540,8 @@
       (let ((pass nil)
 	    (c 0)
 	    (echo-keystrokes 0)
-	    (cursor-in-echo-area t))
+	    (cursor-in-echo-area t)
+	    (message-log-max nil))
 	(add-text-properties 0 (length prompt)
 			     minibuffer-prompt-properties prompt)
 	(while (progn (message "%s%s"
--- a/lisp/textmodes/bibtex.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/textmodes/bibtex.el	Mon Apr 17 08:41:12 2006 +0000
@@ -2856,25 +2856,45 @@
 	(bibtex-autofill-entry))
     (run-hooks 'bibtex-add-entry-hook)))
 
-(defun bibtex-entry-update ()
+(defun bibtex-entry-update (&optional entry-type)
   "Update an existing BibTeX entry.
 In the BibTeX entry at point, make new fields for those items that may occur
-according to `bibtex-field-list', but are not yet present."
-  (interactive)
+according to `bibtex-field-list', but are not yet present.
+Also, add field delimiters to numerical fields if they are not present.
+If ENTRY-TYPE is non-nil, change first the entry type to ENTRY-TYPE.
+When called interactively with a prefix arg, query for a value of ENTRY-TYPE."
+  (interactive
+   (list (if current-prefix-arg
+             (let ((completion-ignore-case t))
+               (completing-read "New entry type: " bibtex-entry-field-alist
+                                nil t nil 'bibtex-entry-type-history)))))
   (save-excursion
     (bibtex-beginning-of-entry)
-    ;; For inserting new fields, we use the fact that
-    ;; `bibtex-parse-entry' moves point to the end of the last field.
-    (let* ((fields-alist (bibtex-parse-entry))
-           (field-list (bibtex-field-list
-                        (cdr (assoc "=type=" fields-alist)))))
-      (skip-chars-backward " \t\n")
-      (dolist (field (car field-list))
-        (unless (assoc-string (car field) fields-alist t)
-          (bibtex-make-field field)))
-      (dolist (field (cdr field-list))
-        (unless (assoc-string (car field) fields-alist t)
-          (bibtex-make-optional-field field))))))
+    (when (looking-at bibtex-entry-maybe-empty-head)
+      (goto-char (match-end 0))
+      (if entry-type
+          (save-excursion
+            (replace-match (concat "@" entry-type) nil nil nil 1))
+        (setq entry-type (bibtex-type-in-head)))
+      (let* ((field-list (bibtex-field-list entry-type))
+             (required (copy-tree (car field-list)))
+             (optional (copy-tree (cdr field-list)))
+             bounds)
+        (while (setq bounds (bibtex-parse-field))
+          (let ((fname (bibtex-name-in-field bounds t))
+                (end (copy-marker (bibtex-end-of-field bounds) t)))
+            (setq required (delete (assoc-string fname required t) required)
+                  optional (delete (assoc-string fname optional t) optional))
+            (when (string-match "\\`[0-9]+\\'"
+                                (bibtex-text-in-field-bounds bounds))
+              (goto-char (bibtex-end-of-text-in-field bounds))
+              (insert (bibtex-field-right-delimiter))
+              (goto-char (bibtex-start-of-text-in-field bounds))
+              (insert (bibtex-field-left-delimiter)))
+            (goto-char end)))
+        (skip-chars-backward " \t\n")
+        (dolist (field required) (bibtex-make-field field))
+        (dolist (field optional) (bibtex-make-optional-field field))))))
 
 (defun bibtex-parse-entry (&optional content)
   "Parse entry at point, return an alist.
@@ -3613,17 +3633,20 @@
 
 (defun bibtex-find-text-internal (&optional noerror subfield comma)
   "Find text part of current BibTeX field or entry head.
-Return list (NAME START-TEXT END-TEXT END) with field or entry name,
-start and end of text and end of field or entry head, or nil if not found.
-If optional arg NOERROR is non-nil, an error message is suppressed if text
-is not found.  If optional arg SUBFIELD is non-nil START-TEXT and END-TEXT
-correspond to the current subfield delimited by #.
+Return list (NAME START-TEXT END-TEXT END STRING-CONST) with field
+or entry name, start and end of text, and end of field or entry head.
+STRING-CONST is a flag which is non-nil if current subfield delimited by #
+is a BibTeX string constant.  Return value is nil if field or entry head
+are not found.
+If optional arg NOERROR is non-nil, an error message is suppressed
+if text is not found.  If optional arg SUBFIELD is non-nil START-TEXT
+and END-TEXT correspond to the current subfield delimited by #.
 Optional arg COMMA is as in `bibtex-enclosing-field'."
   (save-excursion
     (let ((pnt (point))
           (bounds (bibtex-enclosing-field comma t))
           (case-fold-search t)
-          name start-text end-text end failure done no-sub)
+          name start-text end-text end failure done no-sub string-const)
       (bibtex-beginning-of-entry)
       (cond (bounds
              (setq name (bibtex-name-in-field bounds t)
@@ -3667,9 +3690,11 @@
           (goto-char start-text)
           (while (not done)
             (if (or (prog1 (looking-at bibtex-field-const)
-                      (setq end-text (match-end 0)))
+                      (setq end-text (match-end 0)
+                            string-const t))
                     (prog1 (setq bounds (bibtex-parse-field-string))
-                      (setq end-text (cdr bounds))))
+                      (setq end-text (cdr bounds)
+                            string-const nil)))
                 (progn
                   (if (and (<= start-text pnt) (<= pnt end-text))
                       (setq done t)
@@ -3678,7 +3703,7 @@
                       (setq start-text (goto-char (match-end 0)))))
               (setq done t failure t)))))
       (cond ((not failure)
-             (list name start-text end-text end))
+             (list name start-text end-text end string-const))
             ((and no-sub (not noerror))
              (error "Not on text part of BibTeX field"))
             ((not noerror) (error "Not on BibTeX field"))))))
@@ -3712,13 +3737,10 @@
 Optional arg COMMA is as in `bibtex-enclosing-field'.  It is t for
 interactive calls."
   (interactive (list t))
-  (let* ((bounds (bibtex-find-text-internal nil t comma))
-         (start (nth 1 bounds))
-         (end (nth 2 bounds)))
-    (if (memq (char-before end) '(?\} ?\"))
-        (delete-region (1- end) end))
-    (if (memq (char-after start) '(?\{ ?\"))
-        (delete-region start (1+ start)))))
+  (let ((bounds (bibtex-find-text-internal nil t comma)))
+    (unless (nth 4 bounds)
+      (delete-region (1- (nth 2 bounds)) (nth 2 bounds))
+      (delete-region (nth 1 bounds) (1+ (nth 1 bounds))))))
 
 (defun bibtex-kill-field (&optional copy-only comma)
   "Kill the entire enclosing BibTeX field.
--- a/lisp/textmodes/org.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/textmodes/org.el	Mon Apr 17 08:41:12 2006 +0000
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <dominik at science dot uva dot nl>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
-;; Version: 4.10
+;; Version: 4.23
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -81,6 +81,35 @@
 ;;
 ;; Changes since version 4.00:
 ;; ---------------------------
+;; Version 4.23
+;;    - Bug fixes.
+;;
+;; Version 4.22
+;;    - Bug fixes.
+;;    - In agenda buffer, mouse-1 no longer follows link.
+;;      See `org-agenda-mouse-1-follows-link' and `org-mouse-1-follows-link'.
+;;
+;; Version 4.20
+;;    - Links use now the [[link][description]] format by default.
+;;      When inserting links, the user is prompted for a description.
+;;    - If a link has a description, only the description is displayed
+;;      the link part is hidden.  Use C-c C-l to edit the link part.
+;;    - TAGS are now bold, but in the same color as the headline.
+;;    - The width of a table column can be limited by using a field "<N>".
+;;    - New structure for the customization tree.
+;;    - Bug fixes.
+;;
+;; Version 4.13
+;;    - The list of agenda files can be maintainted in an external file.
+;;    - Bug fixes.
+;;
+;; Version 4.12
+;;    - Templates for remember buffer.  Note that the remember setup changes.
+;;      To set up templates, see `org-remember-templates'.
+;;    - The time in new time stamps can be rounded, see new option
+;;      `org-time-stamp-rounding-minutes'.
+;;    - Bug fixes (there are *always* more bugs).
+;;
 ;; Version 4.10
 ;;    - Bug fixes.
 ;;
@@ -98,7 +127,7 @@
 ;;    - Leading stars in headlines can be hidden, so make the outline look
 ;;      cleaner.
 ;;    - Mouse-1 can be used to follow links.
-;;     
+;;
 ;; Version 4.06
 ;;    - HTML exporter treats targeted internal links.
 ;;    - Bug fixes.
@@ -137,30 +166,35 @@
 ;;
 ;;; Code:
 
-(eval-when-compile (require 'cl) (require 'calendar))
+(eval-when-compile 
+  (require 'cl)
+  (require 'calendar))
 (require 'outline)
 (require 'time-date)
 (require 'easymenu)
 
-(defvar calc-embedded-close-formula)
-(defvar calc-embedded-open-formula)
-(defvar font-lock-unfontify-region-function)
+(defvar calc-embedded-close-formula)  ; defined by the calc package
+(defvar calc-embedded-open-formula)   ; defined by the calc package
+(defvar font-lock-unfontify-region-function) ; defined by font-lock.el
 
 ;;; Customization variables
 
-(defvar org-version "4.10"
+(defvar org-version "4.23"
   "The version number of the file org.el.")
 (defun org-version ()
   (interactive)
   (message "Org-mode version %s" org-version))
 
-;; The following two constants are for compatibility with different Emacs
-;; versions (Emacs versus XEmacs) and with different versions of outline.el.
-;; The compatibility code in org.el is based on these two constants.
-(defconst org-xemacs-p (featurep 'xemacs)
-  "Are we running XEmacs?")
+;; The following constant is for compatibility with different versions
+;; of outline.el.
 (defconst org-noutline-p (featurep 'noutline)
   "Are we using the new outline mode?")
+(defconst org-xemacs-p (featurep 'xemacs))
+(defconst org-format-transports-properties-p
+  (let ((x "a"))
+    (add-text-properties 0 1 '(test t) x)
+    (get-text-property 0 'test (format "%s" x)))
+  "Does format transport text properties?")
 
 (defgroup org nil
   "Outline-based notes management and organizer."
@@ -174,6 +208,56 @@
   :tag "Org Startup"
   :group 'org)
 
+(defcustom org-startup-folded t
+  "Non-nil means, entering Org-mode will switch to OVERVIEW.
+This can also be configured on a per-file basis by adding one of
+the following lines anywhere in the buffer:
+
+   #+STARTUP: fold
+   #+STARTUP: nofold
+   #+STARTUP: content"
+  :group 'org-startup
+  :type '(choice
+	  (const :tag "nofold: show all" nil)
+	  (const :tag "fold: overview" t)
+	  (const :tag "content: all headlines" content)))
+
+(defcustom org-startup-truncated t
+  "Non-nil means, entering Org-mode will set `truncate-lines'.
+This is useful since some lines containing links can be very long and
+uninteresting.  Also tables look terrible when wrapped."
+  :group 'org-startup
+  :type 'boolean)
+
+(defcustom org-startup-align-all-tables nil
+  "Non-nil means, align all tables when visiting a file.
+This is useful when the column width in tables is forced with <N> cookies
+in table fields.  Such tables will look correct only after the first re-align."
+  :group 'org-startup
+  :type 'boolean)
+
+(defcustom org-startup-with-deadline-check nil
+  "Non-nil means, entering Org-mode will run the deadline check.
+This means, if you start editing an org file, you will get an
+immediate reminder of any due deadlines.
+This can also be configured on a per-file basis by adding one of
+the following lines anywhere in the buffer:
+
+   #+STARTUP: dlcheck
+   #+STARTUP: nodlcheck"
+  :group 'org-startup
+  :type 'boolean)
+
+(defcustom org-insert-mode-line-in-empty-file nil
+  "Non-nil means insert the first line setting Org-mode in empty files.
+When the function `org-mode' is called interactively in an empty file, this
+normally means that the file name does not automatically trigger Org-mode.
+To ensure that the file will always be in Org-mode in the future, a
+line enforcing Org-mode will be inserted into the buffer, if this option
+has been set."
+  :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.
@@ -212,115 +296,24 @@
        (or (assq key org-disputed-keys)
 	   (error "Invalid Key %s in `org-key'" key))))
 
-(defcustom org-startup-folded t
-  "Non-nil means, entering Org-mode will switch to OVERVIEW.
-This can also be configured on a per-file basis by adding one of
-the following lines anywhere in the buffer:
-
-   #+STARTUP: fold
-   #+STARTUP: nofold
-   #+STARTUP: content"
-  :group 'org-startup
-  :type '(choice
-	  (const :tag "nofold: show all" nil)
-	  (const :tag "fold: overview" t)
-	  (const :tag "content: all headlines" content)))
-
-(defcustom org-startup-truncated t
-  "Non-nil means, entering Org-mode will set `truncate-lines'.
-This is useful since some lines containing links can be very long and
-uninteresting.  Also tables look terrible when wrapped."
+(defcustom org-ellipsis nil
+  "The ellipsis to use in the Org-mode outline.
+When nil, just use the standard three dots.  When a string, use that instead,
+and just in Org-mode (which will then use its own display table).
+Changing this requires executing `M-x org-mode' in a buffer to become
+effective."
   :group 'org-startup
-  :type 'boolean)
-
-(defcustom org-startup-with-deadline-check nil
-  "Non-nil means, entering Org-mode will run the deadline check.
-This means, if you start editing an org file, you will get an
-immediate reminder of any due deadlines.
-This can also be configured on a per-file basis by adding one of
-the following lines anywhere in the buffer:
-
-   #+STARTUP: dlcheck
-   #+STARTUP: nodlcheck"
-  :group 'org-startup
-  :type 'boolean)
-
-(defcustom org-insert-mode-line-in-empty-file nil
-  "Non-nil means insert the first line setting Org-mode in empty files.
-When the function `org-mode' is called interactively in an empty file, this
-normally means that the file name does not automatically trigger Org-mode.
-To ensure that the file will always be in Org-mode in the future, a
-line enforcing Org-mode will be inserted into the buffer, if this option
-has been set."
-  :group 'org-startup
-  :type 'boolean)
+  :type '(choice (const :tag "Default" nil)
+		 (string :tag "String" :value "...#")))
+
+(defvar org-display-table nil
+  "The display table for org-mode, in case `org-ellipsis' is non-nil.")
 
 (defgroup org-keywords nil
-  "Options concerning TODO items in Org-mode."
+  "Keywords in Org-mode."
   :tag "Org Keywords"
   :group 'org)
 
-(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
-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."
-  :group 'org-keywords
-  :type '(repeat (string :tag "Keyword")))
-
-(defcustom org-todo-interpretation 'sequence
-  "Controls how TODO keywords are interpreted.
-\\<org-mode-map>Possible values are `sequence' and `type'.
-This variable is only relevant if `org-todo-keywords' contains more than two
-states.  There are two ways how these keywords can be used:
-
-- As a sequence in the process of working on a TODO item, for example
-  (setq org-todo-keywords '(\"TODO\" \"STARTED\" \"VERIFY\" \"DONE\")
-	org-todo-interpretation 'sequence)
-
-- As different types of TODO items, for example
-  (setq org-todo-keywords '(\"URGENT\" \"RELAXED\" \"REMIND\" \"FOR_TOM\" \"DONE\")
-	org-todo-interpretation 'type)
-
-When the states are interpreted as a sequence, \\[org-todo] always cycles
-to the next state, in order to walk through all different states.  So with
-\\[org-todo], you turn an empty entry into the state TODO.  When you started
-working on the item, you use \\[org-todo] again to switch it to \"STARTED\",
-later to VERIFY and finally to DONE.
-
-When the states are interpreted as types, \\[org-todo] still cycles through
-when it is called several times in direct succession, in order to initially
-select the type.  However, if not called immediately after a previous
-\\[org-todo], it switches from each type directly to DONE.  So with the
-above example, you could use `\\[org-todo] \\[org-todo]' to label an entry
-RELAXED.  If you later return to this entry and press \\[org-todo] again,
-RELAXED will not be changed REMIND, but directly to DONE.
-
-You can create a large number of types.  To initially select a
-type, it is then best to use \\[universal-argument] \\[org-todo] in order to specify the
-type with completion.  Of course, you can also type the keyword
-directly into the buffer.  M-TAB completes TODO keywords at the
-beginning of a headline."
-  :group 'org-keywords
-  :type '(choice (const sequence)
-		 (const type)))
-
-(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-keywords
-  :type 'character)
-
-(defcustom org-lowest-priority ?C
-  "The lowest priority of TODO items.  A character like ?A, ?B etc."
-  :group 'org-keywords
-  :type 'character)
-
 (defcustom org-deadline-string "DEADLINE:"
   "String to mark deadline entries.
 A deadline is this string, followed by a time stamp.  Should be a word,
@@ -361,405 +354,22 @@
   :group 'org-keywords
   :type 'string)
 
-(defcustom org-after-todo-state-change-hook nil
-  "Hook which is run after the state of a TODO item was changed.
-The new state (a string with a TODO keyword, or nil) is available in the
-Lisp variable `state'."
-  :group 'org-keywords
-  :type 'hook)
-
-;; Variables for pre-computed regular expressions, all buffer local
-(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)
-(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)
-(defvar org-not-done-regexp nil
-  "Matches any of the TODO state keywords except the last one.")
-(make-variable-buffer-local 'org-not-done-regexp)
-(defvar org-todo-line-regexp nil
-  "Matches a headline and puts TODO state into group 2 if present.")
-(make-variable-buffer-local 'org-todo-line-regexp)
-(defvar org-nl-done-regexp nil
-  "Matches newline followed by a headline with the DONE keyword.")
-(make-variable-buffer-local 'org-nl-done-regexp)
-(defvar org-looking-at-done-regexp nil
-  "Matches the DONE keyword a point.")
-(make-variable-buffer-local 'org-looking-at-done-regexp)
-(defvar org-deadline-regexp nil
-  "Matches the DEADLINE keyword.")
-(make-variable-buffer-local 'org-deadline-regexp)
-(defvar org-deadline-time-regexp nil
-  "Matches the DEADLINE keyword together with a time stamp.")
-(make-variable-buffer-local 'org-deadline-time-regexp)
-(defvar org-deadline-line-regexp nil
-  "Matches the DEADLINE keyword and the rest of the line.")
-(make-variable-buffer-local 'org-deadline-line-regexp)
-(defvar org-scheduled-regexp nil
-  "Matches the SCHEDULED keyword.")
-(make-variable-buffer-local 'org-scheduled-regexp)
-(defvar org-scheduled-time-regexp nil
-  "Matches the SCHEDULED keyword together with a time stamp.")
-(make-variable-buffer-local 'org-scheduled-time-regexp)
-
-(defvar org-category nil
-  "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\"
-
-or contain a special line
-
-#+CATEGORY: ELisp
-
-If the file does not specify a category, then file's base name
-is used instead.")
-(make-variable-buffer-local 'org-category)
-
-(defgroup org-time nil
-  "Options concerning time stamps and deadlines in Org-mode."
-  :tag "Org Time"
-  :group 'org)
-
-(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
-  "Formats for `format-time-string' which are used for time stamps.
-It is not recommended to change this constant.")
-
-
-(defcustom org-deadline-warning-days 30
-  "No. of days before expiration during which a deadline becomes active.
-This variable governs the display in the org file."
-  :group 'org-time
-  :type 'number)
-
-(defcustom org-popup-calendar-for-date-prompt t
-  "Non-nil means, pop up a calendar when prompting for a date.
-In the calendar, the date can be selected with mouse-1.  However, the
-minibuffer will also be active, and you can simply enter the date as well.
-When nil, only the minibuffer will be available."
-  :group 'org-time
-  :type 'boolean)
-
-(defcustom org-calendar-follow-timestamp-change t
-  "Non-nil means, make the calendar window follow timestamp changes.
-When a timestamp is modified and the calendar window is visible, it will be
-moved to the new date."
-  :group 'org-time
-  :type 'boolean)
-
-(defcustom org-log-done nil
-  "When set, insert a (non-active) time stamp when TODO entry is marked DONE.
-When the state of an entry is changed from nothing to TODO, remove a previous
-closing date."
-  :group 'org-time
-  :type 'boolean)
-
-(defgroup org-agenda nil
-  "Options concerning agenda display Org-mode."
-  :tag "Org Agenda"
-  :group 'org)
-
-(defcustom org-agenda-files nil
-  "A list of org files for agenda/diary display.
-Entries are added to this list with \\[org-agenda-file-to-front] and removed with
-\\[org-remove-file].  You can also use customize to edit the list."
-  :group 'org-agenda
-  :type '(repeat file))
-
-(defcustom org-agenda-custom-commands '(("w" todo "WAITING"))
-  "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 of 3 items:
-
-key    The key (a single char as a string) to be associated with the command.
-type   The command type, any of the following symbols:
-        todo        Entries with a specific TODO keyword, in all agenda files.
-        tags        Tags match in all agenda files.
-        todo-tree   Sparse tree of specific TODO keyword in *current* file.
-        tags-tree   Sparse tree with all tags matches in *current* file.
-        occur-tree  Occur sparse tree for current file.
-match  What to search for:
-        - a single keyword for TODO keyword searches
-        - a tags match expression for tags searches
-        - a regular expression for occur searches"
-  :group 'org-agenda
-  :type '(repeat
-	  (list (string :tag "Key")
-		(choice :tag "Type"
-			(const :tag "Tags search in all agenda files" tags)
-			(const :tag "TODO keyword search in all agenda files" todo)
-			(const :tag "Tags sparse tree in current buffer" tags-tree)
-			(const :tag "TODO keyword tree in current buffer" todo-tree)
-			(const :tag "Occur tree in current buffer" occur-tree))
-		(string :tag "Match"))))
-
-(defcustom org-select-timeline-window t
-  "Non-nil means, after creating a timeline, move cursor into Timeline window.
-When nil, cursor will remain in the current window."
-  :group 'org-agenda
-  :type 'boolean)
-
-(defcustom org-select-agenda-window t
-  "Non-nil means, after creating an agenda, move cursor into Agenda window.
-When nil, cursor will remain in the current window."
-  :group 'org-agenda
-  :type 'boolean)
-
-(defcustom org-fit-agenda-window t
-  "Non-nil means, change window size of agenda to fit content."
-  :group 'org-agenda
-  :type 'boolean)
-
-(defcustom org-agenda-show-all-dates t
-  "Non-nil means, `org-agenda' shows every day in the selected range.
-When nil, only the days which actually have entries are shown."
-  :group 'org-agenda
-  :type 'boolean)
-
-;; FIXME: First day of month works only for current month because it would
-;; require a variable ndays treatment.
-(defcustom org-agenda-start-on-weekday 1
-  "Non-nil means, start the overview always on the specified weekday.
-0 Denotes Sunday, 1 denotes Monday etc.
-When nil, always start on the current day."
-  :group 'org-agenda
-  :type '(choice (const :tag "Today" nil)
-		 (const :tag "First day of month" t)
-		 (number :tag "Weekday No.")))
-
-(defcustom org-agenda-ndays 7
-  "Number of days to include in overview display."
-  :group 'org-agenda
-  :type 'number)
-
-(defcustom org-agenda-include-all-todo t
-  "Non-nil means, the agenda will always contain all TODO entries.
-When nil, date-less entries will only be shown if `org-agenda' is called
-with a prefix argument.
-When non-nil, the TODO entries will be listed at the top of the agenda, before
-the entries for specific days."
-  :group 'org-agenda
-  :type 'boolean)
-
-(defcustom org-agenda-include-diary nil
-  "If non-nil, include in the agenda entries from the Emacs Calendar's diary."
-  :group 'org-agenda
-  :type 'boolean)
-
-(defcustom org-calendar-to-agenda-key [?c]
-  "The key to be installed in `calendar-mode-map' for switching to the agenda.
-The command `org-calendar-goto-agenda' will be bound to this key.  The
-default is the character `c' because then `c' can be used to switch back and
-forth between agenda and calendar."
-  :group 'org-agenda
-  :type 'sexp)
-
-(defcustom org-agenda-sorting-strategy '(time-up 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
-symbols are recognized:
-
-time-up         Put entries with time-of-day indications first, early first
-time-down       Put entries with time-of-day indications first, late first
-category-keep   Keep the default order of categories, corresponding to the
-		sequence in `org-agenda-files'.
-category-up     Sort alphabetically by category, A-Z.
-category-down   Sort alphabetically by category, Z-A.
-priority-up     Sort numerically by priority, high priority last.
-priority-down   Sort numerically by priority, high priority first.
-
-The different possibilities will be tried in sequence, and testing stops
-if one comparison returns a \"not-equal\".  For example, the default
-    '(time-up category-keep priority-down)
-means: Pull out all entries having a specified time of day and sort them,
-in order to make a time schedule for the current day the first thing in the
-agenda listing for the day.  Of the entries without a time indication, keep
-the grouped in categories, don't sort the categories, but keep them in
-the sequence given in `org-agenda-files'.  Within each category sort by
-priority.
-
-Leaving out `category-keep' would mean that items will be sorted across
-categories by priority."
-  :group 'org-agenda
-  :type '(repeat
-	  (choice
-	   (const time-up)
-	   (const time-down)
-	   (const category-keep)
-	   (const category-up)
-	   (const category-down)
-	   (const priority-up)
-	   (const priority-down))))
-
-(defcustom org-agenda-prefix-format "  %-12:c%?-12t% s"
-  "Format specification for the prefix of items in the agenda buffer.
-This format works similar to a printf format, with the following meaning:
-
-  %c   the category of the item, \"Diary\" for entries from the diary, or
-       as given by the CATEGORY keyword or derived from the file name.
-  %T   the first tag of the item.
-  %t   the time-of-day specification if one applies to the entry, in the
-       format HH:MM
-  %s   Scheduling/Deadline information, a short string
-
-All specifiers work basically like the standard `%s' of printf, but may
-contain two additional characters:  A question mark just after the `%' and
-a whitespace/punctuation character just before the final letter.
-
-If the first character after `%' is a question mark, the entire field
-will only be included if the corresponding value applies to the
-current entry.  This is useful for fields which should have fixed
-width when present, but zero width when absent.  For example,
-\"%?-12t\" will result in a 12 character time field if a time of the
-day is specified, but will completely disappear in entries which do
-not contain a time.
-
-If there is punctuation or whitespace character just before the final
-format letter, this character will be appended to the field value if
-the value is not empty.  For example, the format \"%-12:c\" leads to
-\"Diary: \" if the category is \"Diary\".  If the category were be
-empty, no additional colon would be interted.
-
-The default value of this option is \"  %-12:c%?-12t% s\", meaning:
-- Indent the line with two space characters
-- Give the category in a 12 chars wide field, padded with whitespace on
-  the right (because of `-').  Append a colon if there is a category
-  (because of `:').
-- If there is a time-of-day, put it into a 12 chars wide field.  If no
-  time, don't put in an empty field, just skip it (because of '?').
-- Finally, put the scheduling information and append a whitespace.
-
-As another example, if you don't want the time-of-day of entries in
-the prefix, you could use:
-
-  (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'."
-  :type 'string
-  :group 'org-agenda)
-
-(defcustom org-timeline-prefix-format "  % s"
-  "Like `org-agenda-prefix-format', but for the timeline of a single file."
-  :type 'string
-  :group 'org-agenda)
-
-(defvar org-prefix-format-compiled nil
-  "The compiled version of the most recently used prefix format.
-Depending on which command was used last, this may be the compiled version
-of `org-agenda-prefix-format' or `org-timeline-prefix-format'.")
-
-(defcustom org-agenda-use-time-grid t
-  "Non-nil means, show a time grid in the agenda schedule.
-A time grid is a set of lines for specific times (like every two hours between
-8:00 and 20:00).  The items scheduled for a day at specific times are
-sorted in between these lines.
-For details about when the grid will be shown, and what it will look like, see
-the variable `org-agenda-time-grid'."
-  :group 'org-agenda
-  :type 'boolean)
-
-(defcustom org-agenda-time-grid
-  '((daily today require-timed)
-    "----------------"
-    (800 1000 1200 1400 1600 1800 2000))
-
-  "The settings for time grid for agenda display.
-This is a list of three items.  The first item is again a list.  It contains
-symbols specifying conditions when the grid should be displayed:
-
- daily         if the agenda shows a single day
- weekly        if the agenda shows an entire week
- today         show grid on current date, independent of daily/weekly display
- require-timed show grid only if at least on item has a time specification
-
-The second item is a string which will be places behing the grid time.
-
-The third item is a list of integers, indicating the times that should have
-a grid line."
-  :group 'org-agenda
-  :type
-  '(list
-    (set :greedy t :tag "Grid Display Options"
-	 (const :tag "Show grid in single day agenda display" daily)
-	 (const :tag "Show grid in weekly agenda display" weekly)
-	 (const :tag "Always show grid for today" today)
-	 (const :tag "Show grid only if any timed entries are present"
-		require-timed)
-	 (const :tag "Skip grid times already present in an entry"
-		remove-match))
-    (string :tag "Grid String")
-    (repeat :tag "Grid Times" (integer :tag "Time"))))
-
-(defcustom org-agenda-remove-times-when-in-prefix t
-  "Non-nil means, remove duplicate time specifications in agenda items.
-When the format `org-agenda-prefix-format' contains a `%t' specifier, a
-time-of-day specification in a headline or diary entry is extracted and
-placed into the prefix.  If this option is non-nil, the original specification
-\(a timestamp or -range, or just a plain time(range) specification like
-11:30-4pm) will be removed for agenda display.  This makes the agenda less
-cluttered.
-The option can be t or nil.  It may also be the symbol `beg', indicating
-that the time should only be removed what it is located at the beginning of
-the headline/diary entry."
-  :group 'org-agenda
-  :type '(choice
-	  (const :tag "Always" t)
-	  (const :tag "Never" nil)
-	  (const :tag "When at beginning of entry" beg)))
-
-(defcustom org-sort-agenda-notime-is-late t
-  "Non-nil means, items without time are considered late.
-This is only relevant for sorting.  When t, items which have no explicit
-time like 15:30 will be considered as 24:01, i.e. later than any items which
-do have a time.  When nil, the default time is before 0:00.  You can use this
-option to decide if the schedule for today should come before or after timeless
-agenda entries."
-  :group 'org-agenda
-  :type 'boolean)
-
-(defcustom org-agenda-remove-tags-when-in-prefix nil
-  "Non-nil means, the tags from copy of headline in agenda.
-When this is the symbol `prefix', only remove tags when
-`org-agenda-prefix-format' contains a `%T' specifier."
-  :group 'org-agenda
-  :type '(choice
-	  (const :tag "Always" t)
-	  (const :tag "Never" nil)
-	  (const :tag "When prefix format contains %T" prefix)))
-
 (defgroup org-structure nil
-  "Options concerning structure editing in Org-mode."
+  "Options concerning the general structure of Org-mode files."
   :tag "Org Structure"
   :group 'org)
 
-(defcustom org-cycle-include-plain-lists nil
-  "Non-nil means, include plain lists into visibility cycling.
-This means that during cycling, plain list items will *temporarily* be
-interpreted as outline headlines with a level given by 1000+i where i is the
-indentation of the bullet.  In all other operations, plain list items are
-not seen as headlines.  For example, you cannot assign a TODO keyword to
-such an item."
-  :group 'org-structure
-  :type 'boolean)
+(defgroup org-cycle nil
+  "Options concerning visibility cycling in Org-mode."
+  :tag "Org Cycle"
+  :group 'org-structure)
 
 (defcustom org-cycle-emulate-tab t
   "Where should `org-cycle' emulate TAB.
 nil    Never
 white  Only in completely white lines
 t      Everywhere except in headlines"
-  :group 'org-structure
+  :group 'org-cycle
   :type '(choice (const :tag "Never" nil)
 		 (const :tag "Only in completely white lines" white)
 		 (const :tag "Everywhere except in headlines" t)
@@ -772,20 +382,58 @@
 argument is a symbol.  After a global state change, it can have the values
 `overview', `content', or `all'.  After a local state change, it can have
 the values `folded', `children', or `subtree'."
-  :group 'org-structure
+  :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-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
+promotion/demotion commands.  It also influences how levels are
+handled by the exporters.
+Changing it requires restart of `font-lock-mode' to become effective
+for fontification also in regions already fontified."
+  :group 'org-edit-structure
+  :group 'org-font-lock
+  :type 'boolean)
+
+(defcustom org-adapt-indentation t
+  "Non-nil means, adapt indentation when promoting and demoting.
+When this is set and the *entire* text in an entry is indented, the
+indentation is increased by one space in a demotion command, and
+decreased by one in a promotion command.  If any line in the entry
+body starts at column 0, indentation is not changed at all."
+  :group 'org-edit-structure
+  :type 'boolean)
+
+(defcustom org-enable-fixed-width-editor t
+  "Non-nil means, lines starting with \":\" are treated as fixed-width.
+This currently only means, they are never auto-wrapped.
+When nil, such lines will be treated like ordinary lines.
+See also the QUOTE keyword."
+  :group 'org-edit-structure
+  :type 'boolean)
+
+(defgroup org-sparse-trees nil
+  "Options concerning sparse trees in Org-mode."
+  :tag "Org Sparse Trees"
+  :group 'org-structure)
+
 (defcustom org-highlight-sparse-tree-matches t
   "Non-nil means, highlight all matches that define a sparse tree.
 The highlights will automatically disappear the next time the buffer is
 changed by an edit command."
-  :group 'org-structure
+  :group 'org-sparse-trees
   :type 'boolean)
 
 (defcustom org-show-hierarchy-above t
   "Non-nil means, show full hierarchy when showing a spot in the tree.
 Turning this off makes sparse trees more compact, but also less clear."
-  :group 'org-structure
+  :group 'org-sparse-trees
   :type 'boolean)
 
 (defcustom org-show-following-heading t
@@ -795,35 +443,31 @@
 easier to edit directly inside the sparse tree.  However, if you use
 `org-occur' mainly as an overview, the following headlines are
 unnecessary clutter."
-  :group 'org-structure
+  :group 'org-sparse-trees
   :type 'boolean)
 
 (defcustom org-occur-hook '(org-first-headline-recenter)
   "Hook that is run after `org-occur' has constructed a sparse tree.
 This can be used to recenter the window to show as much of the structure
 as possible."
-  :group 'org-structure
+  :group 'org-sparse-trees
   :type 'hook)
 
-(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
-promotion/demotion commands.  It also influences how levels are
-handled by the exporters.
-Changing it requires restart of `font-lock-mode' to become effective
-for fontification also in regions already fontified." 
-  :group 'org-structure
-  :group 'org-font-lock
+(defgroup org-plain-lists nil
+  "Options concerning plain lists in Org-mode."
+  :tag "Org Plain lists"
+  :group 'org-structure)
+
+(defcustom org-cycle-include-plain-lists nil
+  "Non-nil means, include plain lists into visibility cycling.
+This means that during cycling, plain list items will *temporarily* be
+interpreted as outline headlines with a level given by 1000+i where i is the
+indentation of the bullet.  In all other operations, plain list items are
+not seen as headlines.  For example, you cannot assign a TODO keyword to
+such an item."
+  :group 'org-plain-lists
   :type 'boolean)
 
-(defcustom org-adapt-indentation t
-  "Non-nil means, adapt indentation when promoting and demoting.
-When this is set and the *entire* text in an entry is indented, the
-indentation is increased by one space in a demotion command, and
-decreased by one in a promotion command.  If any line in the entry
-body starts at column 0, indentation is not changed at all."
-  :group 'org-structure
-  :type 'boolean)
 
 (defcustom org-plain-list-ordered-item-terminator t
   "The character that makes a line with leading number an ordered list item.
@@ -831,7 +475,7 @@
 ?. may look nicer, it creates the danger that a line with leading
 number may be incorrectly interpreted as an item.  ?\) therefore is
 the safe choice."
-  :group 'org-structure
+  :group 'org-plain-lists
   :type '(choice (const :tag "dot like in \"2.\"" ?.)
 		 (const :tag "paren like in \"2)\"" ?\))
 		 (const :tab "both" t)))
@@ -841,16 +485,13 @@
 Renumbering happens when the sequence have been changed with
 \\[org-shiftmetaup] or \\[org-shiftmetadown].  After other editing commands,
 use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
-  :group 'org-structure
+  :group 'org-plain-lists
   :type 'boolean)
 
-(defcustom org-enable-fixed-width-editor t
-  "Non-nil means, lines starting with \":\" are treated as fixed-width.
-This currently only means, they are never auto-wrapped.
-When nil, such lines will be treated like ordinary lines.
-See also the QUOTE keyword."
-  :group 'org-structure
-  :type 'boolean)
+(defgroup org-archive nil
+  "Options concerning archiving in Org-mode."
+  :tag "Org Archive"
+  :group 'org-structure)
 
 (defcustom org-archive-location "%s_archive::"
   "The location where subtrees should be archived.
@@ -885,12 +526,12 @@
 line like
 
 #+ARCHIVE: basement::** Finished Tasks"
-  :group 'org-structure
+  :group 'org-archive
   :type 'string)
 
 (defcustom org-archive-mark-done t
   "Non-nil means, mark archived entries as DONE."
-  :group 'org-structure
+  :group 'org-archive
   :type 'boolean)
 
 (defcustom org-archive-stamp-time t
@@ -898,302 +539,9 @@
 The time stamp will be added directly after the TODO state keyword in the
 first line, so it is probably best to use this in combinations with
 `org-archive-mark-done'."
-  :group 'org-structure
-  :type 'boolean)
-
-(defgroup org-tags nil
-  "Options concerning startup of Org-mode."
-  :tag "Org Tags"
-  :group 'org)
-
-(defcustom org-tags-column 48
-  "The column to which tags should be indented in a headline.
-If this number is positive, it specifies the column.  If it is negative,
-it means that the tags should be flushright to that column.  For example,
--79 works well for a normal 80 character screen."
-  :group 'org-tags
-  :type 'integer)
-
-(defcustom org-auto-align-tags t
-  "Non-nil means, realign tags after pro/demotion of TODO state change.
-These operations change the length of a headline and therefore shift
-the tags around.  With this options turned on, after each such operation
-the tags are again aligned to `org-tags-column'."
-  :group 'org-tags
-  :type 'boolean)
-
-(defcustom org-use-tag-inheritance t
-  "Non-nil means, tags in levels apply also for sublevels.
-When nil, only the tags directly given in a specific line apply there.
-If you turn off this option, you very likely want to turn on the
-companion option `org-tags-match-list-sublevels'."
-  :group 'org-tags
-  :type 'boolean)
-
-(defcustom org-tags-match-list-sublevels nil
-  "Non-nil means list also sublevels of headlines matching tag search.
-Because of tag inheritance (see variable `org-use-tag-inheritance'),
-the sublevels of a headline matching a tag search often also match
-the same search.  Listing all of them can create very long lists.
-Setting this variable to nil causes subtrees to be skipped.
-This option is off by default, because inheritance in on.  If you turn
-inheritance off, you very likely want to turn this option on.
-
-As a special case, if the tag search is restricted to TODO items, the
-value of this variable is ignored and sublevels are always checked, to
-make sure all corresponding TODO items find their way into the list."
-  :group 'org-tags
-  :type 'boolean)
-
-(defvar org-tags-history nil
-  "History of minibuffer reads for tags.")
-(defvar org-last-tags-completion-table nil
-  "The last used completion table for tags.")
-
-(defgroup org-link nil
-  "Options concerning links in Org-mode."
-  :tag "Org Link"
-  :group 'org)
-
-(defcustom org-tab-follows-link nil
-  "Non-nil means, on links TAB will follow the link.
-Needs to be set before org.el is loaded."
-  :group 'org-link
-  :type 'boolean)
-
-(defcustom org-return-follows-link nil
-  "Non-nil means, on links RET will follow the link.
-Needs to be set before org.el is loaded."
-  :group 'org-link
-  :type 'boolean)
-
-(defcustom org-mark-ring-length 4
-  "Number of different positions to be recorded in the ring
-Changing this requires a restart of Emacs to work correctly."
-  :group 'org-link
-  :type 'interger)
-
-(defcustom org-link-format "<%s>"
-  "Default format for linkes in the buffer.
-This is a format string for printf, %s will be replaced by the link text.
-If you want to make sure that your link is always properly terminated,
-include angle brackets into this format, like \"<%s>\".  Some people also
-recommend an additional URL: prefix, so the format would be \"<URL:%s>\"."
-  :group 'org-link
-  :type '(choice
-	  (const :tag "\"%s\"   (e.g. http://www.there.com)" "%s")
-	  (const :tag "\"<%s>\"  (e.g. <http://www.there.com>)" "<%s>")
-	  (const :tag "\"<URL:%s>\"  (e.g. <URL:http://www.there.com>)" "<URL:%s>")
-	  (string :tag "Other" :value "<%s>")))
-
-(defcustom org-allow-space-in-links t
-  "Non-nil means, file names in links may contain space characters.
-When nil, it becomes possible to put several links into a line.
-Note that in tables, a link never extends accross fields, so in a table
-it is always possible to put several links into a line.
-Changing this variable requires a restart of Emacs of become effective."
-  :group 'org-link
-  :type 'boolean)
-
-(defcustom org-radio-targets t
-  "Non-nil means activate text matching a link target.
-Radio targets are strings in triple angular brackets, like <<<My Target>>>.
-When this option is set, any occurrence of \"my target\" in normal text
-becomes a link."
-  :group 'org-link
-  :type 'boolean)
-
-(defcustom org-activate-camels nil
-  "Non-nil means, treat words in CamelCase as in-file links.
-Changing this requires restart of Emacs to become effective."
-  :group 'org-link
-  :type 'boolean)
-
-(defcustom org-context-in-file-links t
-  "Non-nil means, file links from `org-store-link' contain context.
-A search string will be added to the file name with :: as separator and
-used to find the context when the link is activated by the command
-`org-open-at-point'.
-Using a prefix arg to the command \\[org-store-link] (`org-store-link')
-negates this setting for the duration of the command."
-  :group 'org-link
-  :type 'boolean)
-
-(defcustom org-file-link-context-use-camel-case nil
-  "Non-nil means, use CamelCase to store a search context in a file link.
-When nil, the search string simply consists of the words of the string."
-  :group 'org-link
-  :type 'boolean)
-
-(defcustom org-keep-stored-link-after-insertion nil
-  "Non-nil means, keep link in list for entire session.
-
-The command `org-store-link' adds a link pointing to the current
-location to an internal list.  These links accumulate during a session.
-The command `org-insert-link' can be used to insert links into any
-Org-mode file (offering completion for all stored links).  When this
-option is nil, every link which has been inserted once using \\[org-insert-link]
-will be removed from the list, to make completing the unused links
-more efficient."
-  :group 'org-link
+  :group 'org-archive
   :type 'boolean)
 
-(defcustom org-link-frame-setup
-  '((vm . vm-visit-folder-other-frame)
-    (gnus . gnus-other-frame)
-    (file . find-file-other-window))
-  "Setup the frame configuration for following links.
-When following a link with Emacs, it may often be useful to display
-this link in another window or frame.  This variable can be used to
-set this up for the different types of links.
-For VM, use any of
-    `vm-visit-folder'
-    `vm-visit-folder-other-frame'
-For Gnus, use any of
-    `gnus'
-    `gnus-other-frame'
-For FILE, use any of
-    `find-file'
-    `find-file-other-window'
-    `find-file-other-frame'
-For the calendar, use the variable `calendar-setup'.
-For BBDB, it is currently only possible to display the matches in
-another window."
-  :group 'org-link
-  :type '(list
-	  (cons (const vm)
-		(choice
-		 (const vm-visit-folder)
-		 (const vm-visit-folder-other-window)
-		 (const vm-visit-folder-other-frame)))
-	  (cons (const gnus)
-		(choice
-		 (const gnus)
-		 (const gnus-other-frame)))
-	  (cons (const file)
-		(choice
-		 (const find-file)
-		 (const find-file-other-window)
-		 (const find-file-other-frame)))))
-
-(defcustom org-usenet-links-prefer-google nil
-  "Non-nil means, `org-store-link' will create web links to Google groups.
-When nil, Gnus will be used for such links.
-Using a prefix arg to the command \\[org-store-link] (`org-store-link')
-negates this setting for the duration of the command."
-  :group 'org-link
-  :type 'boolean)
-
-(defcustom org-open-non-existing-files nil
-  "Non-nil means, `org-open-file' will open non-existing file.
-When nil, an error will be generated."
-  :group 'org-link
-  :type 'boolean)
-
-(defcustom org-confirm-shell-links t
-  "Non-nil means, ask for confirmation before executing shell links.
-The default is true, to keep new users from shooting into their own foot."
-  :group 'org-link
-  :type 'boolean)
-
-(defconst org-file-apps-defaults-gnu
-  '((t . mailcap))
-  "Default file applications on a UNIX or GNU/Linux system.
-See `org-file-apps'.")
-
-(defconst org-file-apps-defaults-macosx
-  '((t        . "open %s")
-    ("ps"     . "gv %s")
-    ("ps.gz"  . "gv %s")
-    ("eps"    . "gv %s")
-    ("eps.gz" . "gv %s")
-    ("dvi"    . "xdvi %s")
-    ("fig"    . "xfig %s"))
-  "Default file applications on a MacOS X system.
-The system \"open\" is known as a default, but we use X11 applications
-for some files for which the OS does not have a good default.
-See `org-file-apps'.")
-
-(defconst org-file-apps-defaults-windowsnt
-  '((t        . (w32-shell-execute "open" file)))
-  "Default file applications on a Windows NT system.
-The system \"open\" is used for most files.
-See `org-file-apps'.")
-
-(defcustom org-file-apps
-  '(
-    ("txt" . emacs)
-    ("tex" . emacs)
-    ("ltx" . emacs)
-    ("org" . emacs)
-    ("el"  . emacs)
-    )
-  "External applications for opening `file:path' items in a document.
-Org-mode uses system defaults for different file types, but
-you can use this variable to set the application for a given file
-extension.  The entries in this list are cons cells with a file extension
-and the corresponding command.  Possible values for the command are:
- `emacs'     The file will be visited by the current Emacs process.
- `default'   Use the default application for this file type.
- string      A command to be executed by a shell; %s will be replaced
-	     by the path to the file.
- sexp        A Lisp form which will be evaluated.  The file path will
-	     be available in the Lisp variable `file'.
-For more examples, see the system specific constants
-`org-file-apps-defaults-macosx'
-`org-file-apps-defaults-windowsnt'
-`org-file-apps-defaults-gnu'."
-  :group 'org-link
-  :type '(repeat
-	  (cons (choice :value ""
-			(string :tag "Extension")
-			(const :tag "Default for unrecognized files" t)
-			(const :tag "Links to a directory" directory))
-		(choice :value ""
-			(const :tag "Visit with Emacs" emacs)
-			(const :tag "Use system default" default)
-			(string :tag "Command")
-			(sexp :tag "Lisp form")))))
-
-(defcustom org-mhe-search-all-folders nil
-  "Non-nil means, that the search for the mh-message will be extended to 
-all folders if the message cannot be found in the folder given in the link.
-Searching all folders is very effective with one of the search engines 
-supported by MH-E, but will be slow with pick."
-  :group 'org-link
-  :type 'boolean)
-
-(defgroup org-remember nil
-  "Options concerning interaction with remember.el."
-  :tag "Org Remember"
-  :group 'org)
-
-(defcustom org-directory "~/org"
-  "Directory with org files.
-This directory will be used as default to prompt for org files.
-Used by the hooks for remember.el."
-  :group 'org-remember
-  :type 'directory)
-
-(defcustom org-default-notes-file "~/.notes"
-  "Default target for storing notes.
-Used by the hooks for remember.el.  This can be a string, or nil to mean
-the value of `remember-data-file'."
-  :group 'org-remember
-  :type '(choice
-	  (const :tag "Default from remember-data-file" nil)
-	  file))
-
-(defcustom org-reverse-note-order nil
-  "Non-nil means, store new notes at the beginning of a file or entry.
-When nil, new notes will be filed to the end of a file or entry."
-  :group 'org-remember
-  :type '(choice
-	  (const :tag "Reverse always" t)
-	  (const :tag "Reverse never" nil)
-	  (repeat :tag "By file name regexp"
-		  (cons regexp boolean))))
-
 (defgroup org-table nil
   "Options concerning tables in Org-mode."
   :tag "Org Table"
@@ -1230,48 +578,30 @@
 	  (const :tag "on" t)
 	  (const :tag "on, optimized" optimized)))
 
-;; FIXME: We could have a third option which makes it jump only over the first
-;; hline in a table.
-(defcustom org-table-tab-jumps-over-hlines t
-  "Non-nil means, tab in the last column of a table with jump over a hline.
-If a horizontal separator line is following the current line,
-`org-table-next-field' can either create a new row before that line, or jump
-over the line.  When this option is nil, a new line will be created before
-this line."
+(defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized)
+  "Non-nil means, use the optimized table editor version for `orgtbl-mode'.
+In the optimized version, the table editor takes over all simple keys that
+normally just insert a character.  In tables, the characters are inserted
+in a way to minimize disturbing the table structure (i.e. in overwrite mode
+for empty fields).  Outside tables, the correct binding of the keys is
+restored.
+
+The default for this option is t if the optimized version is also used in
+Org-mode.  See the variable `org-enable-table-editor' for details.  Changing
+this variable requires a restart of Emacs to become effective."
   :group 'org-table
   :type 'boolean)
 
-(defcustom org-table-auto-blank-field t
-  "Non-nil means, automatically blank table field when starting to type into it.
-This only happens when typing immediately after a field motion
-command (TAB, S-TAB or RET).
-Only relevant when `org-enable-table-editor' is equal to `optimized'."
-  :group 'org-table
-  :type 'boolean)
+(defgroup org-table-settings nil
+  "Settings for tables in Org-mode."
+  :tag "Org Table Settings"
+  :group 'org-table)
 
 (defcustom org-table-default-size "5x2"
   "The default size for newly created tables, Columns x Rows."
-  :group 'org-table
+  :group 'org-table-settings
    :type 'string)
 
-(defcustom org-table-automatic-realign t
-  "Non-nil means, automatically re-align table when pressing TAB or RETURN.
-When nil, aligning is only done with \\[org-table-align], or after column
-removal/insertion."
-  :group 'org-table
-  :type 'boolean)
-
-(defcustom org-table-spaces-around-separators '(1 . 1)
-  "The number of spaces to be placed before and after separators."
-  :group 'org-table
-  :type '(cons (number :tag "Before \"|\"") (number :tag " After \"|\"")))
-
-(defcustom org-table-spaces-around-invisible-separators '(1 . 2)
-  "The number of spaces to be placed before and after separators.
-This option applies when the column separators have been made invisible."
-  :group 'org-table
-  :type '(cons (number :tag "Before \"|\"") (number :tag " After \"|\"")))
-
 (defcustom org-table-number-regexp "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$"
   "Regular expression for recognizing numbers in table columns.
 If a table column contains mostly numbers, it will be aligned to the
@@ -1284,7 +614,7 @@
     12    12.2    2.4e-08    2x10^12    4.034+-0.02    2.7(10)  >3.5
 
 Other options offered by the customize interface are more restrictive."
-  :group 'org-table
+  :group 'org-table-settings
   :type '(choice
 	  (const :tag "Positive Integers"
 		 "^[0-9]+$")
@@ -1305,29 +635,54 @@
 In a column all non-white fields are considered.  If at least this
 fraction of fields is matched by `org-table-number-fraction',
 alignment to the right border applies."
-  :group 'org-table
+  :group 'org-table-settings
   :type 'number)
 
-(defcustom org-export-highlight-first-table-line t
-  "Non-nil means, highlight the first table line.
-In HTML export, this means use <th> instead of <td>.
-In tables created with table.el, this applies to the first table line.
-In Org-mode tables, all lines before the first horizontal separator
-line will be formatted with <th> tags."
-  :group 'org-table
+(defgroup org-table-editing nil
+  "Bahavior of tables during editing in Org-mode."
+  :tag "Org Table Editing"
+  :group 'org-table)
+
+(defcustom org-table-automatic-realign t
+  "Non-nil means, automatically re-align table when pressing TAB or RETURN.
+When nil, aligning is only done with \\[org-table-align], or after column
+removal/insertion."
+  :group 'org-table-editing
+  :type 'boolean)
+
+(defcustom org-table-limit-column-width t ;kw
+  "Non-nil means, allow to limit the width of table columns with <N> fields."
+  :group 'org-table-editing
+  :type 'boolean)
+
+(defcustom org-table-auto-blank-field t
+  "Non-nil means, automatically blank table field when starting to type into it.
+This only happens when typing immediately after a field motion
+command (TAB, S-TAB or RET).
+Only relevant when `org-enable-table-editor' is equal to `optimized'."
+  :group 'org-table-editing
+  :type 'boolean)
+
+(defcustom org-table-tab-jumps-over-hlines t
+  "Non-nil means, tab in the last column of a table with jump over a hline.
+If a horizontal separator line is following the current line,
+`org-table-next-field' can either create a new row before that line, or jump
+over the line.  When this option is nil, a new line will be created before
+this line."
+  :group 'org-table-editing
   :type 'boolean)
 
 (defcustom org-table-tab-recognizes-table.el t
   "Non-nil means, TAB will automatically notice a table.el table.
 When it sees such a table, it moves point into it and - if necessary -
 calls `table-recognize-table'."
-  :group 'org-table
+  :group 'org-table-editing
   :type 'boolean)
 
 (defgroup org-table-calculation nil
   "Options concerning tables in Org-mode."
   :tag "Org Table Calculation"
-  :group 'org)
+  :group 'org-table)
 
 (defcustom org-table-copy-increment t
   "Non-nil means, increment when copying current field with \\[org-table-copy-down]."
@@ -1398,11 +753,807 @@
   :group 'org-table-calculation
   :type 'boolean)
 
+(defgroup org-link nil
+  "Options concerning links in Org-mode."
+  :tag "Org Link"
+  :group 'org)
+
+(defcustom org-descriptive-links t
+  "Non-nil means, hide link part and only show description of bracket links.
+Bracket links are like [[link][descritpion]]. This variable sets the initial
+state in new org-mode buffers.  The setting can then be toggled on a
+per-buffer basis from the Org->Hyperlinks menu."
+  :group 'org-link
+  :type 'boolean)
+
+(defcustom org-link-style 'bracket
+  "The style of links to be inserted with \\[org-insert-link].
+Possible values are:
+bracket    [[link][description]].   This is recommended
+plain      Description \\n link.     The old way, no longer recommended."
+  :group 'org-link
+  :type '(choice
+	  (const :tag "Bracket (recommended)" bracket)
+	  (const :tag "Plain (no longer recommended)" plain)))
+
+(defcustom org-link-format "%s"
+  "Default format for external, URL-like linkes in the buffer.
+This is a format string for printf, %s will be replaced by the link text.
+The recommended value is just \"%s\", since links will be protected by
+enclosing them in double brackets.  If you prefer plain links (see variable
+`org-link-style'), \"<%s>\" is useful. Some people also recommend an
+additional URL: prefix, so the format would be \"<URL:%s>\"."
+  :group 'org-link
+  :type '(choice
+	  (const :tag "\"%s\"   (e.g. http://www.there.com)" "%s")
+	  (const :tag "\"<%s>\"  (e.g. <http://www.there.com>)" "<%s>")
+	  (const :tag "\"<URL:%s>\"  (e.g. <URL:http://www.there.com>)" "<URL:%s>")
+	  (string :tag "Other" :value "<%s>")))
+
+(defcustom org-activate-links '(bracket angle plain radio tag date)
+  "Types of links that should be activated in Org-mode files.
+This is a list of symbols, each leading to the activation of a certain link
+type.  In principle, it does not hurt to turn on most link types - there may
+be a small gain when turning off unused link types.  The types are:
+
+bracket   The recommended [[link][description]] or [[link]] links with hiding.
+angular   Links in angular brackes that may contain whitespace like
+          <bbdb:Carsten Dominik>.
+plain     Plain links in normal text, no whitespace, like http://google.com.
+radio     Text that is matched by a radio target, see manual for details.
+tag       Tag settings in a headline (link to tag search).
+date      Time stamps (link to calendar).
+camel     CamelCase words defining text searches.
+
+Changing this variable requires a restart of Emacs to become effective."
+  :group 'org-link
+  :type '(set (const :tag "Double bracket links (new style)" bracket)
+	      (const :tag "Angular bracket links (old style)" angular)
+	      (const :tag "plain text links" plain)
+	      (const :tag "Radio target matches" radio)
+	      (const :tag "Tags" tag)
+	      (const :tag "Timestamps" date)
+	      (const :tag "CamelCase words" camel)))
+
+(defgroup org-link-store nil
+  "Options concerning storing links in Org-mode"
+  :tag "Org Store Link"
+  :group 'org-link)
+
+(defcustom org-context-in-file-links t
+  "Non-nil means, file links from `org-store-link' contain context.
+A search string will be added to the file name with :: as separator and
+used to find the context when the link is activated by the command
+`org-open-at-point'.
+Using a prefix arg to the command \\[org-store-link] (`org-store-link')
+negates this setting for the duration of the command."
+  :group 'org-link-store
+  :type 'boolean)
+
+(defcustom org-file-link-context-use-camel-case nil
+  "Non-nil means, use CamelCase to store a search context in a file link.
+When nil, the search string simply consists of the words of the string.
+CamelCase is deprecated, and support for it may be dropped in the future."
+  :group 'org-link-store
+  :type 'boolean)
+
+(defcustom org-keep-stored-link-after-insertion nil
+  "Non-nil means, keep link in list for entire session.
+
+The command `org-store-link' adds a link pointing to the current
+location to an internal list.  These links accumulate during a session.
+The command `org-insert-link' can be used to insert links into any
+Org-mode file (offering completion for all stored links).  When this
+option is nil, every link which has been inserted once using \\[org-insert-link]
+will be removed from the list, to make completing the unused links
+more efficient."
+  :group 'org-link-store
+  :type 'boolean)
+
+(defcustom org-usenet-links-prefer-google nil
+  "Non-nil means, `org-store-link' will create web links to Google groups.
+When nil, Gnus will be used for such links.
+Using a prefix arg to the command \\[org-store-link] (`org-store-link')
+negates this setting for the duration of the command."
+  :group 'org-link-store
+  :type 'boolean)
+
+(defgroup org-link-follow nil
+  "Options concerning following links in Org-mode"
+  :tag "Org Follow Link"
+  :group 'org-link)
+
+(defcustom org-tab-follows-link nil
+  "Non-nil means, on links TAB will follow the link.
+Needs to be set before org.el is loaded."
+  :group 'org-link-follow
+  :type 'boolean)
+
+(defcustom org-return-follows-link nil
+  "Non-nil means, on links RET will follow the link.
+Needs to be set before org.el is loaded."
+  :group 'org-link-follow
+  :type 'boolean)
+
+(defcustom org-mouse-1-follows-link t
+  "Non-nil means, mouse-1 on a link will follow the link.
+A longer mouse click will still set point.  Does not wortk on XEmacs.
+Needs to be set before org.el is loaded."
+  :group 'org-link-follow
+  :type 'boolean)
+
+(defcustom org-mark-ring-length 4
+  "Number of different positions to be recorded in the ring
+Changing this requires a restart of Emacs to work correctly."
+  :group 'org-link-follow
+  :type 'interger)
+
+(defcustom org-link-frame-setup
+  '((vm . vm-visit-folder-other-frame)
+    (gnus . gnus-other-frame)
+    (file . find-file-other-window))
+  "Setup the frame configuration for following links.
+When following a link with Emacs, it may often be useful to display
+this link in another window or frame.  This variable can be used to
+set this up for the different types of links.
+For VM, use any of
+    `vm-visit-folder'
+    `vm-visit-folder-other-frame'
+For Gnus, use any of
+    `gnus'
+    `gnus-other-frame'
+For FILE, use any of
+    `find-file'
+    `find-file-other-window'
+    `find-file-other-frame'
+For the calendar, use the variable `calendar-setup'.
+For BBDB, it is currently only possible to display the matches in
+another window."
+  :group 'org-link-follow
+  :type '(list
+	  (cons (const vm)
+		(choice
+		 (const vm-visit-folder)
+		 (const vm-visit-folder-other-window)
+		 (const vm-visit-folder-other-frame)))
+	  (cons (const gnus)
+		(choice
+		 (const gnus)
+		 (const gnus-other-frame)))
+	  (cons (const file)
+		(choice
+		 (const find-file)
+		 (const find-file-other-window)
+		 (const find-file-other-frame)))))
+
+(defcustom org-open-non-existing-files nil
+  "Non-nil means, `org-open-file' will open non-existing file.
+When nil, an error will be generated."
+  :group 'org-link-follow
+  :type 'boolean)
+
+(defcustom org-confirm-shell-links 'yes-or-no-p
+  "Non-nil means, ask for confirmation before executing shell links.
+Shell links can be dangerous, just thing about a link
+
+     [[shell:rm -rf ~/*][Google Search]]
+
+This link would show up in your Org-mode document as \"Google Search\"
+but really it would remove your entire home directory.  Dangerous indeed.
+Therefore I *definitely* advise agains setting this varaiable to nil.
+Just change it to `y-or-n-p' of you want to confirm with a single key press
+rather than having to type \"yes\"."
+  :group 'org-link-follow
+  :type '(choice
+	  (const :tag "with yes-or-no (safer)" yes-or-no-p)
+	  (const :tag "with y-or-n (faster)" y-or-n-p)
+	  (const :tag "no confirmation (dangerous)" nil)))
+
+(defconst org-file-apps-defaults-gnu
+  '((t . mailcap))
+  "Default file applications on a UNIX or GNU/Linux system.
+See `org-file-apps'.")
+
+(defconst org-file-apps-defaults-macosx
+  '((t        . "open %s")
+    ("ps"     . "gv %s")
+    ("ps.gz"  . "gv %s")
+    ("eps"    . "gv %s")
+    ("eps.gz" . "gv %s")
+    ("dvi"    . "xdvi %s")
+    ("fig"    . "xfig %s"))
+  "Default file applications on a MacOS X system.
+The system \"open\" is known as a default, but we use X11 applications
+for some files for which the OS does not have a good default.
+See `org-file-apps'.")
+
+(defconst org-file-apps-defaults-windowsnt
+  '((t        . (w32-shell-execute "open" file)))
+  "Default file applications on a Windows NT system.
+The system \"open\" is used for most files.
+See `org-file-apps'.")
+
+(defcustom org-file-apps
+  '(
+    ("txt" . emacs)
+    ("tex" . emacs)
+    ("ltx" . emacs)
+    ("org" . emacs)
+    ("el"  . emacs)
+    )
+  "External applications for opening `file:path' items in a document.
+Org-mode uses system defaults for different file types, but
+you can use this variable to set the application for a given file
+extension.  The entries in this list are cons cells with a file extension
+and the corresponding command.  Possible values for the command are:
+ `emacs'     The file will be visited by the current Emacs process.
+ `default'   Use the default application for this file type.
+ string      A command to be executed by a shell; %s will be replaced
+	     by the path to the file.
+ sexp        A Lisp form which will be evaluated.  The file path will
+	     be available in the Lisp variable `file'.
+For more examples, see the system specific constants
+`org-file-apps-defaults-macosx'
+`org-file-apps-defaults-windowsnt'
+`org-file-apps-defaults-gnu'."
+  :group 'org-link-follow
+  :type '(repeat
+	  (cons (choice :value ""
+			(string :tag "Extension")
+			(const :tag "Default for unrecognized files" t)
+			(const :tag "Links to a directory" directory))
+		(choice :value ""
+			(const :tag "Visit with Emacs" emacs)
+			(const :tag "Use system default" default)
+			(string :tag "Command")
+			(sexp :tag "Lisp form")))))
+
+(defcustom org-mhe-search-all-folders nil
+  "Non-nil means, that the search for the mh-message will be extended to
+all folders if the message cannot be found in the folder given in the link.
+Searching all folders is very effective with one of the search engines
+supported by MH-E, but will be slow with pick."
+  :group 'org-link-follow
+  :type 'boolean)
+
+(defgroup org-remember nil
+  "Options concerning interaction with remember.el."
+  :tag "Org Remember"
+  :group 'org)
+
+(defcustom org-directory "~/org"
+  "Directory with org files.
+This directory will be used as default to prompt for org files.
+Used by the hooks for remember.el."
+  :group 'org-remember
+  :type 'directory)
+
+(defcustom org-default-notes-file "~/.notes"
+  "Default target for storing notes.
+Used by the hooks for remember.el.  This can be a string, or nil to mean
+the value of `remember-data-file'."
+  :group 'org-remember
+  :type '(choice
+	  (const :tag "Default from remember-data-file" nil)
+	  file))
+
+(defcustom org-remember-templates nil
+  "Templates for the creation of remember buffers.
+When nil, just let remember make the buffer.
+When not nil, this is a list of 3-element lists.  In each entry, the first
+element is a character, a unique key to select this template.
+The second element is the template.  The third element is optional and can
+specify a destination file for remember items created with this template.
+The default file is given by `org-default-notes-file'.
+
+The template specifies the structure of the remember buffer.  It should have
+a first line starting with a star, to act as the org-mode headline.
+Furthermore, the following %-escapes will be replaced with content:
+  %t  time stamp, date only
+  %T  time stamp with date and time
+  %u  inactive time stamp, date only
+  %U  inactive time stamp with date and time
+  %n  user name
+  %a  annotation, normally the link created with org-store-link
+  %i  initial content, the region when remember is called with C-u.
+      If %i is indented, the entire inserted text will be indented as well.
+  %?  This will be removed, and the cursor placed at this position."
+  :group 'org-remember
+  :type '(repeat :tag "enabled"
+		 (list :value (?a "\n" nil)
+		       (character :tag "Selection Key")
+		       (string :tag "Template")
+		       (file :tag "Destination file (optional)"))))
+
+(defcustom org-reverse-note-order nil
+  "Non-nil means, store new notes at the beginning of a file or entry.
+When nil, new notes will be filed to the end of a file or entry."
+  :group 'org-remember
+  :type '(choice
+	  (const :tag "Reverse always" t)
+	  (const :tag "Reverse never" nil)
+	  (repeat :tag "By file name regexp"
+		  (cons regexp boolean))))
+
+(defgroup org-todo nil
+  "Options concerning TODO items in Org-mode."
+  :tag "Org TODO"
+  :group 'org)
+
+(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
+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."
+  :group 'org-todo
+  :group 'org-keywords
+  :type '(repeat (string :tag "Keyword")))
+
+(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."
+  :group 'org-todo
+  :group 'org-keywords
+  :type '(choice (const sequence)
+		 (const type)))
+
+(defcustom org-after-todo-state-change-hook nil
+  "Hook which is run after the state of a TODO item was changed.
+The new state (a string with a TODO keyword, or nil) is available in the
+Lisp variable `state'."
+  :group 'org-todo
+  :type 'hook)
+
+(defcustom org-log-done nil
+  "When set, insert a (non-active) time stamp when TODO entry is marked DONE.
+When the state of an entry is changed from nothing to TODO, remove a previous
+closing date."
+  :group 'org-todo
+  :type 'boolean)
+
+(defgroup org-priorities nil
+  "Keywords in Org-mode."
+  :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."
+  :group 'org-priorities
+  :type 'character)
+
+(defcustom org-lowest-priority ?C
+  "The lowest priority of TODO items.  A character like ?A, ?B etc."
+  :group 'org-priorities
+  :type 'character)
+
+(defgroup org-time nil
+  "Options concerning time stamps and deadlines in Org-mode."
+  :tag "Org Time"
+  :group 'org)
+
+(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
+  "Formats for `format-time-string' which are used for time stamps.
+It is not recommended to change this constant.")
+
+(defcustom org-time-stamp-rounding-minutes 0
+  "Number of minutes to round time stamps to upon insertion.
+When zero, insert the time unmodified.  Useful rounding numbers
+should be factors of 60, so for example 5, 10, 15.
+When this is not zero, you can still force an exact time-stamp by using
+a double prefix argument to a time-stamp command like `C-c .' or `C-c !'."
+  :group 'org-time
+  :type 'integer)
+
+(defcustom org-deadline-warning-days 30
+  "No. of days before expiration during which a deadline becomes active.
+This variable governs the display in the org file."
+  :group 'org-time
+  :type 'number)
+
+(defcustom org-popup-calendar-for-date-prompt t
+  "Non-nil means, pop up a calendar when prompting for a date.
+In the calendar, the date can be selected with mouse-1.  However, the
+minibuffer will also be active, and you can simply enter the date as well.
+When nil, only the minibuffer will be available."
+  :group 'org-time
+  :type 'boolean)
+
+(defcustom org-calendar-follow-timestamp-change t
+  "Non-nil means, make the calendar window follow timestamp changes.
+When a timestamp is modified and the calendar window is visible, it will be
+moved to the new date."
+  :group 'org-time
+  :type 'boolean)
+
+(defgroup org-tags nil
+  "Options concerning startup of Org-mode."
+  :tag "Org Tags"
+  :group 'org)
+
+(defcustom org-tags-column 48
+  "The column to which tags should be indented in a headline.
+If this number is positive, it specifies the column.  If it is negative,
+it means that the tags should be flushright to that column.  For example,
+-79 works well for a normal 80 character screen."
+  :group 'org-tags
+  :type 'integer)
+
+(defcustom org-auto-align-tags t
+  "Non-nil means, realign tags after pro/demotion of TODO state change.
+These operations change the length of a headline and therefore shift
+the tags around.  With this options turned on, after each such operation
+the tags are again aligned to `org-tags-column'."
+  :group 'org-tags
+  :type 'boolean)
+
+(defcustom org-use-tag-inheritance t
+  "Non-nil means, tags in levels apply also for sublevels.
+When nil, only the tags directly given in a specific line apply there.
+If you turn off this option, you very likely want to turn on the
+companion option `org-tags-match-list-sublevels'."
+  :group 'org-tags
+  :type 'boolean)
+
+(defcustom org-tags-match-list-sublevels nil
+  "Non-nil means list also sublevels of headlines matching tag search.
+Because of tag inheritance (see variable `org-use-tag-inheritance'),
+the sublevels of a headline matching a tag search often also match
+the same search.  Listing all of them can create very long lists.
+Setting this variable to nil causes subtrees of a match to be skipped.
+This option is off by default, because inheritance in on.  If you turn
+inheritance off, you very likely want to turn this option on.
+
+As a special case, if the tag search is restricted to TODO items, the
+value of this variable is ignored and sublevels are always checked, to
+make sure all corresponding TODO items find their way into the list."
+  :group 'org-tags
+  :type 'boolean)
+
+(defvar org-tags-history nil
+  "History of minibuffer reads for tags.")
+(defvar org-last-tags-completion-table nil
+  "The last used completion table for tags.")
+
+(defgroup org-agenda nil
+  "Options concerning agenda display Org-mode."
+  :tag "Org Agenda"
+  :group 'org)
+
+(defvar org-category nil
+  "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\"
+
+or contain a special line
+
+#+CATEGORY: ELisp
+
+If the file does not specify a category, then file's base name
+is used instead.")
+(make-variable-buffer-local 'org-category)
+
+(defcustom org-agenda-files nil
+  "The files to be used for agenda display.
+Entries may be added to this list with \\[org-agenda-file-to-front] and removed with
+\\[org-remove-file].  You can also use customize to edit the list.
+
+If the value of the variable is not a list but a single file name, then
+the list of agenda files is actually stored and maintained in that file, one
+agenda file per line."
+  :group 'org-agenda
+  :type '(choice
+	  (repeat :tag "List of files" file)
+	  (file :tag "Store list in a file\n" :value "~/.agenda_files")))
+
+(defcustom org-agenda-custom-commands '(("w" todo "WAITING"))
+  "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 of 3 items:
+
+key    The key (a single char as a string) to be associated with the command.
+type   The command type, any of the following symbols:
+        todo        Entries with a specific TODO keyword, in all agenda files.
+        tags        Tags match in all agenda files.
+        todo-tree   Sparse tree of specific TODO keyword in *current* file.
+        tags-tree   Sparse tree with all tags matches in *current* file.
+        occur-tree  Occur sparse tree for current file.
+match  What to search for:
+        - a single keyword for TODO keyword searches
+        - a tags match expression for tags searches
+        - a regular expression for occur searches"
+  :group 'org-agenda
+  :type '(repeat
+	  (list (string :tag "Key")
+		(choice :tag "Type"
+			(const :tag "Tags search in all agenda files" tags)
+			(const :tag "TODO keyword search in all agenda files" todo)
+			(const :tag "Tags sparse tree in current buffer" tags-tree)
+			(const :tag "TODO keyword tree in current buffer" todo-tree)
+			(const :tag "Occur tree in current buffer" occur-tree))
+		(string :tag "Match"))))
+
+(defcustom org-agenda-include-all-todo t
+  "Non-nil means, the agenda will always contain all TODO entries.
+When nil, date-less entries will only be shown if `org-agenda' is called
+with a prefix argument.
+When non-nil, the TODO entries will be listed at the top of the agenda, before
+the entries for specific days."
+  :group 'org-agenda
+  :type 'boolean)
+
+(defcustom org-agenda-include-diary nil
+  "If non-nil, include in the agenda entries from the Emacs Calendar's diary."
+  :group 'org-agenda
+  :type 'boolean)
+
+(defcustom org-calendar-to-agenda-key [?c]
+  "The key to be installed in `calendar-mode-map' for switching to the agenda.
+The command `org-calendar-goto-agenda' will be bound to this key.  The
+default is the character `c' because then `c' can be used to switch back and
+forth between agenda and calendar."
+  :group 'org-agenda
+  :type 'sexp)
+
+(defgroup org-agenda-window-setup nil
+  "Options concerning setting up the Agenda window in Org Mode."
+  :tag "Org Agenda Window Setup"
+  :group 'org-agenda)
+
+(defcustom org-agenda-mouse-1-follows-link nil
+  "Non-nil means, mouse-1 on a link will follow the link in the agenda.
+A longer mouse click will still set point.  Does not wortk on XEmacs.
+Needs to be set before org.el is loaded."
+  :group 'org-agenda-setup
+  :type 'boolean)
+
+(defcustom org-select-timeline-window t
+  "Non-nil means, after creating a timeline, move cursor into Timeline window.
+When nil, cursor will remain in the current window."
+  :group 'org-agenda-setup
+  :type 'boolean)
+
+(defcustom org-select-agenda-window t
+  "Non-nil means, after creating an agenda, move cursor into Agenda window.
+When nil, cursor will remain in the current window."
+  :group 'org-agenda-setup
+  :type 'boolean)
+
+(defcustom org-fit-agenda-window t
+  "Non-nil means, change window size of agenda to fit content."
+  :group 'org-agenda-setup
+  :type 'boolean)
+
+(defgroup org-agenda-display nil
+  "Options concerning what to display initially in Agenda."
+  :tag "Org Agenda Display"
+  :group 'org-agenda)
+
+(defcustom org-agenda-show-all-dates t
+  "Non-nil means, `org-agenda' shows every day in the selected range.
+When nil, only the days which actually have entries are shown."
+  :group 'org-agenda-display
+  :type 'boolean)
+
+(defcustom org-agenda-start-on-weekday 1
+  "Non-nil means, start the overview always on the specified weekday.
+0 denotes Sunday, 1 denotes Monday etc.
+When nil, always start on the current day."
+  :group 'org-agenda-display
+  :type '(choice (const :tag "Today" nil)
+		 (number :tag "Weekday No.")))
+
+(defcustom org-agenda-ndays 7
+  "Number of days to include in overview display.
+Should be 1 or 7."
+  :group 'org-agenda-display
+  :type 'number)
+
+(defcustom org-agenda-use-time-grid t
+  "Non-nil means, show a time grid in the agenda schedule.
+A time grid is a set of lines for specific times (like every two hours between
+8:00 and 20:00).  The items scheduled for a day at specific times are
+sorted in between these lines.
+For details about when the grid will be shown, and what it will look like, see
+the variable `org-agenda-time-grid'."
+  :group 'org-agenda-display
+  :type 'boolean)
+
+(defcustom org-agenda-time-grid
+  '((daily today require-timed)
+    "----------------"
+    (800 1000 1200 1400 1600 1800 2000))
+
+  "The settings for time grid for agenda display.
+This is a list of three items.  The first item is again a list.  It contains
+symbols specifying conditions when the grid should be displayed:
+
+ daily         if the agenda shows a single day
+ weekly        if the agenda shows an entire week
+ today         show grid on current date, independent of daily/weekly display
+ require-timed show grid only if at least on item has a time specification
+
+The second item is a string which will be places behing the grid time.
+
+The third item is a list of integers, indicating the times that should have
+a grid line."
+  :group 'org-agenda-display
+  :type
+  '(list
+    (set :greedy t :tag "Grid Display Options"
+	 (const :tag "Show grid in single day agenda display" daily)
+	 (const :tag "Show grid in weekly agenda display" weekly)
+	 (const :tag "Always show grid for today" today)
+	 (const :tag "Show grid only if any timed entries are present"
+		require-timed)
+	 (const :tag "Skip grid times already present in an entry"
+		remove-match))
+    (string :tag "Grid String")
+    (repeat :tag "Grid Times" (integer :tag "Time"))))
+
+(defcustom org-agenda-sorting-strategy '(time-up 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
+symbols are recognized:
+
+time-up         Put entries with time-of-day indications first, early first
+time-down       Put entries with time-of-day indications first, late first
+category-keep   Keep the default order of categories, corresponding to the
+		sequence in `org-agenda-files'.
+category-up     Sort alphabetically by category, A-Z.
+category-down   Sort alphabetically by category, Z-A.
+priority-up     Sort numerically by priority, high priority last.
+priority-down   Sort numerically by priority, high priority first.
+
+The different possibilities will be tried in sequence, and testing stops
+if one comparison returns a \"not-equal\".  For example, the default
+    '(time-up category-keep priority-down)
+means: Pull out all entries having a specified time of day and sort them,
+in order to make a time schedule for the current day the first thing in the
+agenda listing for the day.  Of the entries without a time indication, keep
+the grouped in categories, don't sort the categories, but keep them in
+the sequence given in `org-agenda-files'.  Within each category sort by
+priority.
+
+Leaving out `category-keep' would mean that items will be sorted across
+categories by priority."
+  :group 'org-agenda-display
+  :type '(repeat
+	  (choice
+	   (const time-up)
+	   (const time-down)
+	   (const category-keep)
+	   (const category-up)
+	   (const category-down)
+	   (const priority-up)
+	   (const priority-down))))
+
+(defcustom org-sort-agenda-notime-is-late t
+  "Non-nil means, items without time are considered late.
+This is only relevant for sorting.  When t, items which have no explicit
+time like 15:30 will be considered as 24:01, i.e. later than any items which
+do have a time.  When nil, the default time is before 0:00.  You can use this
+option to decide if the schedule for today should come before or after timeless
+agenda entries."
+  :group 'org-agenda-display
+  :type 'boolean)
+
+
+(defgroup org-agenda-prefix nil
+  "Options concerning the entry prefix in the Org-mode agenda display."
+  :tag "Org Agenda Prefix"
+  :group 'org-agenda)
+
+(defcustom org-agenda-prefix-format "  %-12:c%?-12t% s"
+  "Format specification for the prefix of items in the agenda buffer.
+This format works similar to a printf format, with the following meaning:
+
+  %c   the category of the item, \"Diary\" for entries from the diary, or
+       as given by the CATEGORY keyword or derived from the file name.
+  %T   the first tag of the item.
+  %t   the time-of-day specification if one applies to the entry, in the
+       format HH:MM
+  %s   Scheduling/Deadline information, a short string
+
+All specifiers work basically like the standard `%s' of printf, but may
+contain two additional characters:  A question mark just after the `%' and
+a whitespace/punctuation character just before the final letter.
+
+If the first character after `%' is a question mark, the entire field
+will only be included if the corresponding value applies to the
+current entry.  This is useful for fields which should have fixed
+width when present, but zero width when absent.  For example,
+\"%?-12t\" will result in a 12 character time field if a time of the
+day is specified, but will completely disappear in entries which do
+not contain a time.
+
+If there is punctuation or whitespace character just before the final
+format letter, this character will be appended to the field value if
+the value is not empty.  For example, the format \"%-12:c\" leads to
+\"Diary: \" if the category is \"Diary\".  If the category were be
+empty, no additional colon would be interted.
+
+The default value of this option is \"  %-12:c%?-12t% s\", meaning:
+- Indent the line with two space characters
+- Give the category in a 12 chars wide field, padded with whitespace on
+  the right (because of `-').  Append a colon if there is a category
+  (because of `:').
+- If there is a time-of-day, put it into a 12 chars wide field.  If no
+  time, don't put in an empty field, just skip it (because of '?').
+- Finally, put the scheduling information and append a whitespace.
+
+As another example, if you don't want the time-of-day of entries in
+the prefix, you could use:
+
+  (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'."
+  :type 'string
+  :group 'org-agenda-prefix)
+
+(defcustom org-timeline-prefix-format "  % s"
+  "Like `org-agenda-prefix-format', but for the timeline of a single file."
+  :type 'string
+  :group 'org-agenda-prefix)
+
+(defvar org-prefix-format-compiled nil
+  "The compiled version of the most recently used prefix format.
+Depending on which command was used last, this may be the compiled version
+of `org-agenda-prefix-format' or `org-timeline-prefix-format'.")
+
+;; FIXME:  There seem to be situations where this does no work.
+(defcustom org-agenda-remove-times-when-in-prefix t
+  "Non-nil means, remove duplicate time specifications in agenda items.
+When the format `org-agenda-prefix-format' contains a `%t' specifier, a
+time-of-day specification in a headline or diary entry is extracted and
+placed into the prefix.  If this option is non-nil, the original specification
+\(a timestamp or -range, or just a plain time(range) specification like
+11:30-4pm) will be removed for agenda display.  This makes the agenda less
+cluttered.
+The option can be t or nil.  It may also be the symbol `beg', indicating
+that the time should only be removed what it is located at the beginning of
+the headline/diary entry."
+  :group 'org-agenda-prefix
+  :type '(choice
+	  (const :tag "Always" t)
+	  (const :tag "Never" nil)
+	  (const :tag "When at beginning of entry" beg)))
+
+(defcustom org-agenda-remove-tags-when-in-prefix 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."
+  :group 'org-agenda-prefix
+  :type '(choice
+	  (const :tag "Always" t)
+	  (const :tag "Never" nil)
+	  (const :tag "When prefix format contains %T" prefix)))
+
 (defgroup org-export nil
   "Options for exporting org-listings."
   :tag "Org Export"
   :group 'org)
 
+(defgroup org-export-general nil
+  "General options for exporting Org-mode files."
+  :tag "Org Export General"
+  :group 'org-export)
+
 (defcustom org-export-language-setup
   '(("en"  "Author"          "Date"  "Table of Contents")
     ("da"  "Ophavsmand"      "Dato"  "Indhold")
@@ -1416,7 +1567,7 @@
   "Terms used in export text, translated to different languages.
 Use the variable `org-export-default-language' to set the language,
 or use the +OPTION lines for a per-file setting."
-  :group 'org-export
+  :group 'org-export-general
   :type '(repeat
 	  (list
 	   (string :tag "HTML language tag")
@@ -1427,9 +1578,200 @@
 (defcustom org-export-default-language "en"
   "The default language of HTML export, as a string.
 This should have an association in `org-export-language-setup'."
-  :group 'org-export
+  :group 'org-export-general
   :type 'string)
 
+(defcustom org-export-headline-levels 3
+  "The last level which is still exported as a headline.
+Inferior levels will produce itemize lists when exported.
+Note that a numeric prefix argument to an exporter function overrides
+this setting.
+
+This option can also be set with the +OPTIONS line, e.g. \"H:2\"."
+  :group 'org-export-general
+  :type 'number)
+
+(defcustom org-export-with-section-numbers t
+  "Non-nil means, add section numbers to headlines when exporting.
+
+This option can also be set with the +OPTIONS line, e.g. \"num:t\"."
+  :group 'org-export-general
+  :type 'boolean)
+
+(defcustom org-export-with-toc t
+  "Non-nil means, create a table of contents in exported files.
+The TOC contains headlines with levels up to`org-export-headline-levels'.
+
+Headlines which contain any TODO items will be marked with \"(*)\" in
+ASCII export, and with red color in HTML output.
+
+In HTML output, the TOC will be clickable.
+
+This option can also be set with the +OPTIONS line, e.g. \"toc:nil\"."
+  :group 'org-export-general
+  :type 'boolean)
+
+(defcustom org-export-mark-todo-in-toc nil
+  "Non-nil means, mark TOC lines that contain any open TODO items."
+  :group 'org-export-general
+  :type 'boolean)
+
+(defcustom org-export-preserve-breaks nil
+  "Non-nil means, preserve all line breaks when exporting.
+Normally, in HTML output paragraphs will be reformatted.  In ASCII
+export, line breaks will always be preserved, regardless of this variable.
+
+This option can also be set with the +OPTIONS line, e.g. \"\\n:t\"."
+  :group 'org-export-general
+  :type 'boolean)
+
+(defgroup org-export-translation nil
+  "Options for translating special ascii sequences for the export backends."
+  :tag "Org Export Translation"
+  :group 'org-export)
+
+(defcustom org-export-with-emphasize t
+  "Non-nil means, interpret *word*, /word/, and _word_ as emphasized text.
+If the export target supports emphasizing text, the word will be
+typeset in bold, italic, or underlined, respectively.  Works only for
+single words, but you can say: I *really* *mean* *this*.
+Not all export backends support this.
+
+This option can also be set with the +OPTIONS line, e.g. \"*:nil\"."
+  :group 'org-export-translation
+  :type 'boolean)
+
+(defcustom org-export-with-sub-superscripts t
+  "Non-nil means, interpret \"_\" and \"^\" for export.
+When this option is turned on, you can use TeX-like syntax for sub- and
+superscripts.  Several characters after \"_\" or \"^\" will be
+considered as a single item - so grouping with {} is normally not
+needed.  For example, the following things will be parsed as single
+sub- or superscripts.
+
+ 10^24   or   10^tau     several digits will be considered 1 item.
+ 10^-12  or   10^-tau    a leading sign with digits or a word
+ x^2-y^3                 will be read as x^2 - y^3, because items are
+			 terminated by almost any nonword/nondigit char.
+ 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.
+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)
+
+(defcustom org-export-with-TeX-macros t
+  "Non-nil means, interpret simple TeX-like macros when exporting.
+For example, HTML export converts \\alpha to &alpha; and \\AA to &Aring;.
+No only real TeX macros will work here, but the standard HTML entities
+for math can be used as macro names as well.  For a list of supported
+names in HTML export, see the constant `org-html-entities'.
+Not all export backends support this.
+
+This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"."
+  :group 'org-export-translation
+  :type 'boolean)
+
+(defcustom org-export-with-fixed-width t
+  "Non-nil means, lines starting with \":\" will be in fixed width font.
+This can be used to have pre-formatted text, fragments of code etc.  For
+example:
+  : ;; Some Lisp examples
+  : (while (defc cnt)
+  :   (ding))
+will be looking just like this in also HTML.  See also the QUOTE keyword.
+Not all export backends support this.
+
+This option can also be set with the +OPTIONS line, e.g. \"::nil\"."
+  :group 'org-export-translation
+  :type 'boolean)
+
+(defcustom org-match-sexp-depth 3
+  "Number of stacked braces for sub/superscript matching.
+This has to be set before loading org.el to be effective."
+  :group 'org-export-translation
+  :type 'integer)
+
+(defgroup org-export-tables nil
+  "Options for exporting tables in Org-mode."
+  :tag "Org Export Tables"
+  :group 'org-export)
+
+(defcustom org-export-with-tables t
+  "If non-nil, lines starting with \"|\" define a table.
+For example:
+
+  | Name        | Address  | Birthday  |
+  |-------------+----------+-----------|
+  | Arthur Dent | England  | 29.2.2100 |
+
+Not all export backends support this.
+
+This option can also be set with the +OPTIONS line, e.g. \"|:nil\"."
+  :group 'org-export-tables
+  :type 'boolean)
+
+(defcustom org-export-highlight-first-table-line t
+  "Non-nil means, highlight the first table line.
+In HTML export, this means use <th> instead of <td>.
+In tables created with table.el, this applies to the first table line.
+In Org-mode tables, all lines before the first horizontal separator
+line will be formatted with <th> tags."
+  :group 'org-export-tables
+  :type 'boolean)
+
+(defcustom org-export-table-remove-special-lines t
+  "Remove special lines and marking characters in calculating tables.
+This removes the special marking character column from tables that are set
+up for spreadsheet calculations.  It also removes the entire lines
+marked with `!', `_', or `^'.  The lines with `$' are kept, because
+the values of constants may be useful to have."
+  :group 'org-export-tables
+  :type 'boolean)
+
+(defcustom org-export-prefer-native-exporter-for-tables nil
+  "Non-nil means, always export tables created with table.el natively.
+Natively means, use the HTML code generator in table.el.
+When nil, Org-mode's own HTML generator is used when possible (i.e. if
+the table does not use row- or column-spanning).  This has the
+advantage, that the automatic HTML conversions for math symbols and
+sub/superscripts can be applied.  Org-mode's HTML generator is also
+much faster."
+  :group 'org-export-tables
+  :type 'boolean)
+
+(defgroup org-export-ascii nil
+  "Options specific for ASCII export of Org-mode files."
+  :tag "Org Export ASCII"
+  :group 'org-export)
+
+(defcustom org-export-ascii-show-new-buffer t
+  "Non-nil means, popup buffer containing the exported ASCII text.
+Otherwise the buffer will just be saved to a file and stay hidden."
+  :group 'org-export-ascii
+  :type 'boolean)
+
+(defgroup org-export-xml nil
+  "Options specific for XML export of Org-mode files."
+  :tag "Org Export XML"
+  :group 'org-export)
+
+(defcustom org-export-xml-type 'xoxo ;kw, if we have only one.
+  "The kind of XML to be produced by the XML exporter.
+Allowed values are:
+xoxo   The XOXO exporter."
+  :group 'org-export-xml
+  :type '(choice
+	  (const :tag "XOXO" xoxo)))
+
+(defgroup org-export-html nil
+  "Options specific for HTML export of Org-mode files."
+  :tag "Org Export HTML"
+  :group 'org-export)
+
 (defcustom org-export-html-style
 "<style type=\"text/css\">
   html {
@@ -1473,76 +1815,15 @@
 
 As the value of this option simply gets inserted into the HTML <head> header,
 you can \"misuse\" it to add arbitrary text to the header."
-  :group 'org-export
+  :group 'org-export-html
   :type 'string)
 
-(defcustom org-export-headline-levels 3
-  "The last level which is still exported as a headline.
-Inferior levels will produce itemize lists when exported.
-Note that a numeric prefix argument to an exporter function overrides
-this setting.
-
-This option can also be set with the +OPTIONS line, e.g. \"H:2\"."
-  :group 'org-export
-  :type 'number)
-
-(defcustom org-export-with-section-numbers t
-  "Non-nil means, add section numbers to headlines when exporting.
-
-This option can also be set with the +OPTIONS line, e.g. \"num:t\"."
-  :group 'org-export
-  :type 'boolean)
-
-(defcustom org-export-with-toc t
-  "Non-nil means, create a table of contents in exported files.
-The TOC contains headlines with levels up to`org-export-headline-levels'.
-
-Headlines which contain any TODO items will be marked with \"(*)\" in
-ASCII export, and with red color in HTML output.
-
-In HTML output, the TOC will be clickable.
-
-This option can also be set with the +OPTIONS line, e.g. \"toc:nil\"."
-  :group 'org-export
-  :type 'boolean)
-
-(defcustom org-export-plain-list-max-depth 20
-  "Maximum depth of hand-formatted lists in HTML export.
-
-Org-mode parses hand-formatted enumeration and bullet lists and
-transforms them to HTML open export.  Different indentation of the
-bullet or number indicates different list nesting levels.  To avoid
-confusion, only a single level is allowed by default.  When this is
-larger than 1, deeper indentation leads to deeper list nesting.  For
-example, the default value of 3 allows the following list to be
-formatted correctly in HTML:
-
-  * Fruit
-    - Apple
-    - Banana
-      1. from Africa
-      2. from South America
-    - Pineapple
-  * Bread
-  * Dairy products"
-  :group 'org-export
-  :type 'integer)
-
-(defcustom org-export-preserve-breaks nil
-  "Non-nil means, preserve all line breaks when exporting.
-Normally, in HTML output paragraphs will be reformatted.  In ASCII
-export, line breaks will always be preserved, regardless of this variable.
-
-This option can also be set with the +OPTIONS line, e.g. \"\\n:t\"."
-  :group 'org-export
-  :type 'boolean)
-
 (defcustom org-export-html-inline-images t
   "Non-nil means, inline images into exported HTML pages.
 The link will still be to the original location of the image file.
 So if you are moving the page, lets say to your public HTML site,
 you will have to move the image and maybe change the link."
-  :group 'org-export
+  :group 'org-export-html
   :type 'boolean)
 
 (defcustom org-export-html-expand t
@@ -1551,55 +1832,7 @@
 not be interpreted by a browser.
 
 This option can also be set with the +OPTIONS line, e.g. \"@:nil\"."
-  :group 'org-export
-  :type 'boolean)
-
-(defcustom org-export-with-fixed-width t
-  "Non-nil means, lines starting with \":\" will be in fixed width font.
-This can be used to have pre-formatted text, fragments of code etc.  For
-example:
-  : ;; Some Lisp examples
-  : (while (defc cnt)
-  :   (ding))
-will be looking just like this in also HTML.  In ASCII export, this option
-has no effect.
-
-This option can also be set with the +OPTIONS line, e.g. \"::nil\"."
-  :group 'org-export
-  :type 'boolean)
-
-(defcustom org-export-with-tables t
-  "If non-nil, lines starting with \"|\" define a table.
-For example:
-
-  | Name        | Address  | Birthday  |
-  |-------------+----------+-----------|
-  | Arthur Dent | England  | 29.2.2100 |
-
-In ASCII export, this option has no effect.
-
-This option can also be set with the +OPTIONS line, e.g. \"|:nil\"."
-  :group 'org-export
-  :type 'boolean)
-
-(defcustom org-export-table-remove-special-lines t
-  "Remove special lines and marking characters in calculating tables.
-This removes the special marking character column from tables that are set
-up for spreadsheet calculations.  It also removes the entire lines
-marked with `!', `_', or `^'.  The lines with `$' are kept, because
-the values of constants may be useful to have."
-  :group 'org-export
-  :type 'boolean)
-
-(defcustom org-export-prefer-native-exporter-for-tables nil
-  "Non-nil means, always export tables created with table.el natively.
-Natively means, use the HTML code generator in table.el.
-When nil, Org-mode's own HTML generator is used when possible (i.e. if
-the table does not use row- or column-spanning).  This has the
-advantage, that the automatic HTML conversions for math symbols and
-sub/superscripts can be applied.  Org-mode's HTML generator is also
-much faster."
-  :group 'org-export
+  :group 'org-export-html
   :type 'boolean)
 
 (defcustom org-export-html-table-tag
@@ -1607,104 +1840,51 @@
   "The HTML tag used to start a table.
 This must be a <table> tag, but you may change the options like
 borders and spacing."
-  :group 'org-export
+  :group 'org-export-html
   :type 'string)
 
-(defcustom org-export-with-emphasize t
-  "Non-nil means, interpret *word*, /word/, and _word_ as emphasized text.
-If the export target supports emphasizing text, the word will be
-typeset in bold, italic, or underlined, respectively.  Works only for
-single words, but you can say: I *really* *mean* *this*.
-In ASCII export, this option has no effect.
-
-This option can also be set with the +OPTIONS line, e.g. \"*:nil\"."
-  :group 'org-export
-  :type 'boolean)
-
-(defcustom org-match-sexp-depth 3
-  "Number of stacked braces for sub/superscript matching.
-This has to be set before loading org.el to be effective."
-  :group 'org-export
-  :type 'integer)
-
-;; FIXME: Should () parens be removed as well in sub/superscripts?
-(defcustom org-export-with-sub-superscripts t
-  "Non-nil means, interpret \"_\" and \"^\" for export.
-When this option is turned on, you can use TeX-like syntax for sub- and
-superscripts.  Several characters after \"_\" or \"^\" will be
-considered as a single item - so grouping with {} is normally not
-needed.  For example, the following things will be parsed as single
-sub- or superscripts.
-
- 10^24   or   10^tau     several digits will be considered 1 item.
- 10^-12  or   10^-tau    a leading sign with digits or a word
- x^2-y^3                 will be read as x^2 - y^3, because items are
-			 terminated by almost any nonword/nondigit char.
- 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.
-In ASCII export, this option has no effect.
-
-This option can also be set with the +OPTIONS line, e.g. \"^:nil\"."
-  :group 'org-export
-  :type 'boolean)
-
-(defcustom org-export-with-TeX-macros t
-  "Non-nil means, interpret simple TeX-like macros when exporting.
-For example, HTML export converts \\alpha to &alpha; and \\AA to &Aring;.
-No only real TeX macros will work here, but the standard HTML entities
-for math can be used as macro names as well.  For a list of supported
-names in HTML export, see the constant `org-html-entities'.
-In ASCII export, this option has no effect.
-
-This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"."
-  :group 'org-export
-  :type 'boolean)
-
 (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
 to a file."
-  :group 'org-export
+  :group 'org-export-html
   :type 'boolean)
 
 (defcustom org-export-html-html-helper-timestamp
   "<br><br><hr><p><!-- hhmts start --> <!-- hhmts end -->\n"
   "The HTML tag used as timestamp delimiter for HTML-helper-mode."
-  :group 'org-export
+  :group 'org-export-html
   :type 'string)
 
-(defcustom org-export-ascii-show-new-buffer t
-  "Non-nil means, popup buffer containing the exported ASCII text.
-Otherwise the buffer will just be saved to a file and stay hidden."
-  :group 'org-export
-  :type 'boolean)
-
 (defcustom org-export-html-show-new-buffer nil
   "Non-nil means, popup buffer containing the exported html text.
 Otherwise, the buffer will just be saved to a file and stay hidden."
-  :group 'org-export
+  :group 'org-export-html
   :type 'boolean)
 
+(defgroup org-export-icalendar nil
+  "Options specific for iCalendar export of Org-mode files."
+  :tag "Org Export iCalendar"
+  :group 'org-export)
+
 (defcustom org-combined-agenda-icalendar-file "~/org.ics"
   "The file name for the iCalendar file covering all agenda files.
 This file is created with the command \\[org-export-icalendar-all-agenda-files]."
-  :group 'org-export
+  :group 'org-export-icalendar
   :type 'file)
 
 (defcustom org-icalendar-include-todo nil
   "Non-nil means, export to iCalendar files should also cover TODO items."
-  :group 'org-export
+  :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
+  :group 'org-export-icalendar
   :type 'string)
 
 (defgroup org-font-lock nil
-  "Faces and settings for highlighting in Org-mode."
+  "Font-lock settings for highlighting in Org-mode."
   :tag "Org Font Lock"
   :group 'org)
 
@@ -1741,16 +1921,19 @@
   :group 'org-font-lock
   :type 'boolean)
 
+(defgroup org-faces nil
+  "Faces in Org-mode."
+  :tag "Org Faces"
+  :group 'org-font-lock)
+
 (defface org-hide
   '(
     (((type tty) (class color)) (:foreground "white"))
     (((class color) (background light)) (:foreground "white"))
     (((class color) (background dark)) (:foreground "black"))
-;    (((class color) (background light)) (:foreground "grey90"))
-;    (((class color) (background dark)) (:foreground "grey10"))
     (t (:inverse-video nil)))
   "Face used for level 1 headlines."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-level-1 ;; font-lock-function-name-face
   '((((type tty) (class color)) (:foreground "blue" :weight bold))
@@ -1758,7 +1941,7 @@
     (((class color) (background dark)) (:foreground "LightSkyBlue"))
     (t (:inverse-video t :bold t)))
   "Face used for level 1 headlines."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-level-2 ;; font-lock-variable-name-face
   '((((type tty) (class color)) (:foreground "yellow" :weight light))
@@ -1766,7 +1949,7 @@
     (((class color) (background dark)) (:foreground "LightGoldenrod"))
     (t (:bold t :italic t)))
   "Face used for level 2 headlines."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-level-3 ;; font-lock-keyword-face
   '((((type tty) (class color)) (:foreground "cyan" :weight bold))
@@ -1774,7 +1957,7 @@
     (((class color) (background dark)) (:foreground "Cyan"))
     (t (:bold t)))
   "Face used for level 3 headlines."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-level-4   ;; font-lock-comment-face
   '((((type tty pc) (class color) (background light)) (:foreground "red"))
@@ -1783,7 +1966,7 @@
     (((class color) (background dark)) (:foreground "chocolate1"))
     (t (:bold t :italic t)))
   "Face used for level 4 headlines."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-level-5 ;; font-lock-type-face
   '((((type tty) (class color)) (:foreground "green"))
@@ -1791,7 +1974,7 @@
     (((class color) (background dark)) (:foreground "PaleGreen"))
     (t (:bold t :underline t)))
   "Face used for level 5 headlines."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-level-6 ;; font-lock-constant-face
   '((((type tty) (class color)) (:foreground "magenta"))
@@ -1799,7 +1982,7 @@
     (((class color) (background dark)) (:foreground "Aquamarine"))
     (t (:bold t :underline t)))
   "Face used for level 6 headlines."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-level-7 ;; font-lock-builtin-face
   '((((type tty) (class color)) (:foreground "blue" :weight light))
@@ -1807,7 +1990,7 @@
     (((class color) (background dark)) (:foreground "LightSteelBlue"))
     (t (:bold t)))
   "Face used for level 7 headlines."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-level-8 ;; font-lock-string-face
   '((((type tty) (class color)) (:foreground "green"))
@@ -1815,7 +1998,7 @@
     (((class color) (background dark)) (:foreground "LightSalmon"))
     (t (:italic t)))
   "Face used for level 8 headlines."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-special-keyword ;; font-lock-string-face
   '((((type tty) (class color)) (:foreground "green"))
@@ -1823,7 +2006,7 @@
     (((class color) (background dark)) (:foreground "LightSalmon"))
     (t (:italic t)))
   "Face used for special keywords."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-warning ;; font-lock-warning-face
   '((((type tty) (class color)) (:foreground "red"))
@@ -1832,7 +2015,7 @@
 ;    (((class color) (background dark)) (:foreground "Pink" :bold t))
     (t (:inverse-video t :bold t)))
   "Face for deadlines and TODO keywords."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-headline-done ;; font-lock-string-face
   '((((type tty) (class color)) (:foreground "green"))
@@ -1841,9 +2024,9 @@
     (t (:italic t)))
   "Face used to indicate that a headline is DONE.  See also the variable
 `org-fontify-done-headline'."
-  :group 'org-font-lock)
-
-;; Inheritance does not yet work for xemacs. So we just copy...
+  :group 'org-faces)
+
+;; Inheritance does not work for xemacs. So we just copy...
 
 (defface org-deadline-announce
   '((((type tty) (class color)) (:foreground "blue" :weight bold))
@@ -1851,7 +2034,7 @@
     (((class color) (background dark)) (:foreground "LightSkyBlue"))
     (t (:inverse-video t :bold t)))
   "Face for upcoming deadlines."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-scheduled-today
   '((((type tty) (class color)) (:foreground "green"))
@@ -1859,7 +2042,7 @@
     (((class color) (background dark)) (:foreground "PaleGreen"))
     (t (:bold t :underline t)))
   "Face for items scheduled for a certain day."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-scheduled-previously
   '((((type tty pc) (class color) (background light)) (:foreground "red"))
@@ -1868,7 +2051,7 @@
     (((class color) (background dark)) (:foreground "chocolate1"))
     (t (:bold t :italic t)))
   "Face for items scheduled previously, and not yet done."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-formula
   '((((type tty pc) (class color) (background light)) (:foreground "red"))
@@ -1877,23 +2060,23 @@
     (((class color) (background dark)) (:foreground "chocolate1"))
     (t (:bold t :italic t)))
   "Face for formulas."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-link
   '((((type tty) (class color)) (:foreground "cyan" :weight bold))
-    (((class color) (background light)) (:foreground "Purple"))
-    (((class color) (background dark)) (:foreground "Cyan"))
+    (((class color) (background light)) (:foreground "Purple" :underline t))
+    (((class color) (background dark)) (:foreground "Cyan" :underline t))
     (t (:bold t)))
   "Face for links."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-tag
-  '((((type tty) (class color)) (:foreground "cyan" :weight bold))
-    (((class color) (background light)) (:foreground "Purple" :weight bold))
-    (((class color) (background dark)) (:foreground "Cyan" :weight bold))
+  '((((type tty) (class color)) (:weight bold))
+    (((class color) (background light)) (:weight bold))
+    (((class color) (background dark)) (:weight bold))
     (t (:bold t)))
   "Face for tags."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-done ;; font-lock-type-face
   '((((type tty) (class color)) (:foreground "green"))
@@ -1901,7 +2084,7 @@
     (((class color) (background dark)) (:foreground "PaleGreen" :bold t))
     (t (:bold t :underline t)))
   "Face used for DONE."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-table ;; font-lock-function-name-face
   '((((type tty) (class color)) (:foreground "blue" :weight bold))
@@ -1909,7 +2092,7 @@
     (((class color) (background dark)) (:foreground "LightSkyBlue"))
     (t (:inverse-video t :bold t)))
   "Face used for tables."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defface org-time-grid ;; font-lock-variable-name-face
   '((((type tty) (class color)) (:foreground "yellow" :weight light))
@@ -1917,7 +2100,7 @@
     (((class color) (background dark)) (:foreground "LightGoldenrod"))
     (t (:bold t :italic t)))
   "Face used for time grids."
-  :group 'org-font-lock)
+  :group 'org-faces)
 
 (defvar org-level-faces
   '(org-level-1 org-level-2 org-level-3 org-level-4
@@ -1925,6 +2108,51 @@
     ))
 (defvar org-n-levels (length org-level-faces))
 
+
+;; 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)
+(defvar org-not-done-regexp nil
+  "Matches any of the TODO state keywords except the last one.")
+(make-variable-buffer-local 'org-not-done-regexp)
+(defvar org-todo-line-regexp nil
+  "Matches a headline and puts TODO state into group 2 if present.")
+(make-variable-buffer-local 'org-todo-line-regexp)
+(defvar org-nl-done-regexp nil
+  "Matches newline followed by a headline with the DONE keyword.")
+(make-variable-buffer-local 'org-nl-done-regexp)
+(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)
+(defvar org-deadline-regexp nil
+  "Matches the DEADLINE keyword.")
+(make-variable-buffer-local 'org-deadline-regexp)
+(defvar org-deadline-time-regexp nil
+  "Matches the DEADLINE keyword together with a time stamp.")
+(make-variable-buffer-local 'org-deadline-time-regexp)
+(defvar org-deadline-line-regexp nil
+  "Matches the DEADLINE keyword and the rest of the line.")
+(make-variable-buffer-local 'org-deadline-line-regexp)
+(defvar org-scheduled-regexp nil
+  "Matches the SCHEDULED keyword.")
+(make-variable-buffer-local 'org-scheduled-regexp)
+(defvar org-scheduled-time-regexp nil
+  "Matches the SCHEDULED keyword together with a time stamp.")
+(make-variable-buffer-local 'org-scheduled-time-regexp)
+
 (defun org-set-regexps-and-options ()
   "Precompute regular expressions for current buffer."
   (when (eq major-mode 'org-mode)
@@ -1956,12 +2184,16 @@
 	     ((equal key "STARTUP")
 	      (let ((opts (org-split-string value splitre))
 		    (set '(("fold" org-startup-folded t)
+			   ("overview" org-startup-folded t)
 			   ("nofold" org-startup-folded nil)
+			   ("showall" org-startup-folded nil)
 			   ("content" org-startup-folded content)
 			   ("hidestars" org-hide-leading-stars t)
 			   ("showstars" org-hide-leading-stars nil)
 			   ("odd" org-odd-levels-only t)
 			   ("oddeven" org-odd-levels-only nil)
+			   ("align" org-startup-align-all-tables t)
+			   ("noalign" org-startup-align-all-tables nil)
 			   ("dlcheck" org-startup-with-deadline-check t)
 			   ("nodlcheck" org-startup-with-deadline-check nil)))
 		    l var val)
@@ -2014,57 +2246,57 @@
 
 ;; Tell the compiler about dynamically scoped variables,
 ;; and variables from other packages
-(defvar zmacs-regions)
-(defvar original-date)
-(defvar org-transient-mark-mode)
-(defvar org-old-auto-fill-inhibit-regexp)
-(defvar orgtbl-mode-menu)
-(defvar org-html-entities)
-(defvar org-goto-start-pos)
-(defvar org-cursor-color)
-(defvar org-time-was-given)
-(defvar org-ts-what)
-(defvar mark-active)
-(defvar timecnt)
-(defvar levels-open)
-(defvar title)
-(defvar author)
-(defvar email)
-(defvar text)
-(defvar entry)
-(defvar date)
-(defvar language)
-(defvar options)
-(defvar ans1)
-(defvar ans2)
-(defvar starting-day)
-(defvar include-all-loc)
-(defvar vm-message-pointer)
-(defvar vm-folder-directory)
-(defvar wl-summary-buffer-elmo-folder)
-(defvar wl-summary-buffer-folder-name)
-(defvar gnus-group-name)
-(defvar gnus-article-current)
-(defvar w3m-current-url)
-(defvar mh-progs)
-(defvar mh-current-folder)
-(defvar mh-show-folder-buffer)
-(defvar mh-index-folder)
-(defvar mh-searcher)
-(defvar org-selected-point)
-(defvar calendar-mode-map)
-(defvar remember-save-after-remembering)
-(defvar remember-data-file)
-(defvar last-arg)
-
+(defvar zmacs-regions) ; XEmacs regions
+(defvar original-date) ; dynamically scoped in calendar
+(defvar org-old-auto-fill-inhibit-regexp) ; local variable used by `orgtbl-mode'
+(defvar orgtbl-mode-menu) ; defined when orgtbl mode get initialized
+(defvar org-html-entities) ; defined later in this file
+(defvar org-goto-start-pos) ; dynamically scoped parameter
+(defvar org-time-was-given) ; dynamically scoped parameter
+(defvar org-ts-what) ; dynamically scoped parameter
+(defvar mark-active) ; Emacs only, not available in XEmacs.
+(defvar timecnt) ; dynamically scoped parameter
+(defvar levels-open) ; dynamically scoped parameter
+(defvar title) ; dynamically scoped parameter
+(defvar author) ; dynamically scoped parameter
+(defvar email) ; dynamically scoped parameter
+(defvar text) ; dynamically scoped parameter
+(defvar entry) ; dynamically scoped parameter
+(defvar date) ; dynamically scoped parameter
+(defvar language) ; dynamically scoped parameter
+(defvar options) ; dynamically scoped parameter
+(defvar ans1) ; dynamically scoped parameter
+(defvar ans2) ; dynamically scoped parameter
+(defvar starting-day) ; local variable
+(defvar include-all-loc) ; local variable
+(defvar vm-message-pointer) ; from vm
+(defvar vm-folder-directory) ; from vm
+(defvar wl-summary-buffer-elmo-folder) ; from wanderlust
+(defvar wl-summary-buffer-folder-name) ; from wanderlust
+(defvar gnus-group-name) ; from gnus
+(defvar gnus-article-current) ; from gnus
+(defvar w3m-current-url) ; from w3m
+(defvar mh-progs) ; from MH-E
+(defvar mh-current-folder) ; from MH-E
+(defvar mh-show-folder-buffer) ; from MH-E
+(defvar mh-index-folder) ; from MH-E
+(defvar mh-searcher) ; from MH-E
+(defvar org-selected-point) ; dynamically scoped parameter
+(defvar calendar-mode-map) ; from calendar.el
+(defvar last-arg) ; local variable
+(defvar remember-save-after-remembering) ; from remember.el
+(defvar remember-data-file) ; from remember.el
+(defvar annotation) ; from remember.el, dynamically scoped in `remember-mode'
+(defvar initial)    ; from remember.el, dynamically scoped in `remember-mode'
+(defvar orgtbl-mode) ; defined later in this file
 ;;; Define the mode
 
 (defvar org-mode-map (copy-keymap outline-mode-map)
   "Keymap for Org-mode.")
 
-(defvar org-struct-menu)
-(defvar org-org-menu)
-(defvar org-tbl-menu)
+(defvar org-struct-menu) ; defined later in this file
+(defvar org-org-menu) ; defined later in this file
+(defvar org-tbl-menu) ; defined later in this file
 
 ;; We use a before-change function to check if a table might need
 ;; an update.
@@ -2099,11 +2331,19 @@
   (easy-menu-add org-org-menu)
   (easy-menu-add org-tbl-menu)
   (org-install-agenda-files-menu)
+  (if org-descriptive-links (org-add-to-invisibility-spec '(org-link)))
+  (org-add-to-invisibility-spec '(org-cwidth))
   (setq outline-regexp "\\*+")
-;  (setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)")
+  ;;(setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)")
   (setq outline-level 'org-outline-level)
+  (when (and org-ellipsis (stringp org-ellipsis))
+    (unless org-display-table
+      (setq org-display-table (make-display-table)))
+    (set-display-table-slot org-display-table 
+			    4 (string-to-vector org-ellipsis))
+    (setq buffer-display-table org-display-table))
+  (org-set-regexps-and-options)
   (if org-startup-truncated (setq truncate-lines t))
-  (org-set-regexps-and-options)
   (set (make-local-variable 'font-lock-unfontify-region-function)
        'org-unfontify-region)
   ;; Activate before-change-function
@@ -2124,7 +2364,7 @@
   ;; Get rid of Outline menus, they are not needed
   ;; Need to do this here because define-derived-mode sets up
   ;; the keymap so late.
-  (if org-xemacs-p
+  (if (featurep 'xemacs)
       (progn
 	(delete-menu-item '("Headings"))
 	(delete-menu-item '("Show"))
@@ -2135,6 +2375,8 @@
     (define-key org-mode-map [menu-bar show] 'undefined))
 
   (unless org-inhibit-startup
+    (if org-startup-align-all-tables
+	(org-table-map-tables 'org-table-align))
     (if org-startup-with-deadline-check
 	(call-interactively 'org-check-deadlines)
       (cond
@@ -2147,21 +2389,46 @@
 (defsubst org-current-line (&optional pos)
   (+ (if (bolp) 1 0) (count-lines (point-min) (or pos (point)))))
 
-
-;; FIXME: Do we need to copy?
-(defun org-string-props (string &rest properties)
-  "Add PROPERTIES to string."
-  (add-text-properties 0 (length string) properties string)
+(defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t
+                                   mouse-map t)
+  "Properties to remove when a string without properties is wanted.")
+
+(defsubst org-match-string-no-properties (num &optional string)
+  (if (featurep 'xemacs)
+      (let ((s (match-string num string)))
+	(remove-text-properties 0 (length s) org-rm-props s)
+	s)
+    (match-string-no-properties num string)))
+
+(defun org-current-time ()
+  "Current time, possibly rounded to `org-time-stamp-rounding-minutes'."
+  (if (> org-time-stamp-rounding-minutes 0)
+      (let ((r org-time-stamp-rounding-minutes)
+	    (time (decode-time)))
+	(apply 'encode-time
+	       (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
+		       (nthcdr 2 time))))
+    (current-time)))
+
+(defun org-add-props (string plist &rest props)
+  "Add text properties to entire string, from beginning to end.
+PLIST may be a list of properties, PROPS are individual properties and values
+that will be added to PLIST.  Returns the string that was modified."
+  (add-text-properties
+   0 (length string) (if props (append plist props) plist) string)
   string)
+(put 'org-add-props 'lisp-indent-function 2)
+
 
 ;;; Font-Lock stuff
 
 (defvar org-mouse-map (make-sparse-keymap))
 (define-key org-mouse-map
-  (if org-xemacs-p [button2] [mouse-2]) 'org-open-at-mouse)
+  (if (featurep 'xemacs) [button2] [mouse-2]) 'org-open-at-mouse)
 (define-key org-mouse-map
-  (if org-xemacs-p [button3] [mouse-3]) 'org-find-file-at-mouse)
-(define-key org-mouse-map [follow-link] 'mouse-face)
+  (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))
 (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))
@@ -2171,26 +2438,57 @@
 
 (require 'font-lock)
 
-(defconst org-non-link-chars "\t\n\r|<>\000")
-(defconst org-link-regexp
-  (if org-allow-space-in-links
-      (concat
-       "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|mhe\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)")
-    (concat
-     "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|mhe\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)")
-    )
-  "Regular expression for matching links.")
-(defconst org-link-maybe-angles-regexp
-  (concat "<?\\(" org-link-regexp "\\)>?")
-  "Matches a link and optionally surrounding angle brackets.")
-(defconst org-protected-link-regexp
-  (concat "\000" org-link-regexp "\000")
-  "Matches a link and optionally surrounding angle brackets.")
+(defconst org-non-link-chars "]\t\n\r<>")
+(defconst org-link-types '("https?" "ftp" "mailto" "file" "news" "bbdb" "vm"
+			   "wl" "mhe" "rmail" "gnus" "shell"))
+(defconst org-link-re-with-space 
+  (concat
+   "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
+   "\\([^" org-non-link-chars " ]"
+   "[^" org-non-link-chars "]*"
+   "[^" org-non-link-chars " ]\\)>?")
+   "Matches a link with spaces, optional angular brackets around it.")
+
+(defconst org-link-re-with-space2
+  (concat
+   "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
+   "\\([^" org-non-link-chars " ]"
+   "[^]\t\n\r]*"
+   "[^" org-non-link-chars " ]\\)>?")
+   "Matches a link with spaces, optional angular brackets around it.")
+
+(defconst org-angle-link-re 
+  (concat
+   "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
+   "\\([^" org-non-link-chars " ]"
+   "[^" org-non-link-chars "]*"
+   "\\)>")
+   "Matches link with angular brackets, spaces are allowed.")
+(defconst org-plain-link-re
+  (concat
+   "\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
+   "\\([^]\t\n\r<>,;() ]+\\)")
+   "Matches plain link, without spaces.")
 
 (defconst org-bracket-link-regexp
   "\\[\\[\\([^]]+\\)\\]\\(\\[\\([^]]+\\)\\]\\)?\\]"
   "Matches a link in double brackets.")
 
+(defconst org-bracket-link-analytic-regexp
+  (concat
+  "\\[\\["
+  "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?"
+  "\\([^]]+\\)"
+  "\\]"
+  "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
+  "\\]"))
+; 1: http:
+; 2: http
+; 3: path
+; 4: [desc]
+; 5: desc
+
+
 (defconst org-ts-lengths
   (cons (length (format-time-string (car org-time-stamp-formats)))
 	(length (format-time-string (cdr org-time-stamp-formats))))
@@ -2209,22 +2507,48 @@
 				 org-ts-regexp "\\)?")
   "Regular expression matching a time stamp or time stamp range.")
 
-(defun org-activate-links (limit)
+(defun org-activate-plain-links (limit)
   "Run through the buffer and add overlays to links."
-  (if (re-search-forward org-link-regexp limit t)
+  (if (re-search-forward org-plain-link-re limit t)
+      (progn
+	(add-text-properties (match-beginning 0) (match-end 0)
+			     (list 'mouse-face 'highlight
+				   'keymap org-mouse-map
+				   ))
+	t)))
+
+(defun org-activate-angle-links (limit)
+  "Run through the buffer and add overlays to links."
+  (if (re-search-forward org-angle-link-re limit t)
       (progn
 	(add-text-properties (match-beginning 0) (match-end 0)
 			     (list 'mouse-face 'highlight
-				   'keymap org-mouse-map))
+				   'keymap org-mouse-map
+				   ))
 	t)))
 
-(defun org-activate-links2 (limit)
-  "Run through the buffer and add overlays to links."
+(defun org-activate-bracket-links (limit)
+  "Run through the buffer and add overlays to bracketed links."
   (if (re-search-forward org-bracket-link-regexp limit t)
-      (progn
-	(add-text-properties (match-beginning 0) (match-end 0)
-			     (list 'mouse-face 'highlight
-				   'keymap org-mouse-map))
+      (let* ((help (concat "LINK: " (org-match-string-no-properties 1)))
+	     (ip (list 'invisible 'org-link 'intangible t 'rear-nonsticky t
+		       'keymap org-mouse-map 'mouse-face 'highlight
+		       'help-echo help))
+	     (vp (list 'rear-nonsticky t
+		       'keymap org-mouse-map 'mouse-face 'highlight
+		       'help-echo help)))
+	;; We need to remove the invisible property here.  Table narrowing
+	;; may have made some of this invisible.
+	(remove-text-properties (match-beginning 0) (match-end 0)
+				'(invisible nil))
+	(if (match-end 3)
+	    (progn
+	      (add-text-properties (match-beginning 0) (match-beginning 3) ip)
+	      (add-text-properties (match-beginning 3) (match-end 3) vp)
+	      (add-text-properties (match-end 3) (match-end 0) ip))
+	  (add-text-properties (match-beginning 0) (match-beginning 1) ip)
+	  (add-text-properties (match-beginning 1) (match-end 1) vp)
+	  (add-text-properties (match-end 1) (match-end 0) ip))
 	t)))
 
 (defun org-activate-dates (limit)
@@ -2245,22 +2569,38 @@
 
 (defun org-activate-target-links (limit)
   "Run through the buffer and add overlays to target matches."
-  (when (and org-radio-targets org-target-link-regexp)
+  (when org-target-link-regexp
     (let ((case-fold-search t))
       (if (re-search-forward org-target-link-regexp limit t)
 	  (progn
 	    (add-text-properties (match-beginning 0) (match-end 0)
 				 (list 'mouse-face 'highlight
 				       'keymap org-mouse-map
+				       'help-echo "Radio target link"
 				       'org-linked-text t))
 	    t)))))
 
 (defun org-update-radio-target-regexp ()
   "Find all radio targets in this file and update the regular expression."
   (interactive)
-  (when org-radio-targets
+  (when (memq 'radio org-activate-links)
     (setq org-target-link-regexp
 	  (org-make-target-link-regexp (org-all-targets 'radio)))
+    (org-restart-font-lock)))
+
+(defun org-hide-wide-columns (limit)
+  (let (s e)
+    (setq s (text-property-any (point) (or limit (point-max))
+			       'org-cwidth t))
+    (when s
+      (setq e (next-single-property-change s 'org-cwidth))
+      (add-text-properties s e '(invisible org-cwidth intangible t))
+      (goto-char e)
+      t)))
+
+(defun org-restart-font-lock ()
+  "Restart font-lock-mode, to force refontification."
+  (when (and (boundp 'font-lock-mode) font-lock-mode)
     (font-lock-mode -1)
     (font-lock-mode 1)))
 
@@ -2272,10 +2612,7 @@
     (save-excursion
       (goto-char (point-min))
       (while (re-search-forward re nil t)
-	(add-to-list 'rtn (downcase
-                           (if (fboundp 'match-string-no-properties)
-                               (match-string-no-properties 1)
-                             (match-string 1)))))
+	(add-to-list 'rtn (downcase (org-match-string-no-properties 1))))
       rtn)))
 
 (defun org-make-target-link-regexp (targets)
@@ -2299,13 +2636,12 @@
 
 (defun org-activate-camels (limit)
   "Run through the buffer and add overlays to dates."
-  (if org-activate-camels
-      (if (re-search-forward org-camel-regexp limit t)
-	  (progn
-	    (add-text-properties (match-beginning 0) (match-end 0)
-				 (list 'mouse-face 'highlight
-				       'keymap org-mouse-map))
-	    t))))
+  (if (re-search-forward org-camel-regexp limit t)
+      (progn
+	(add-text-properties (match-beginning 0) (match-end 0)
+			     (list 'mouse-face 'highlight
+				   'keymap org-mouse-map))
+	t)))
 
 (defun org-activate-tags (limit)
   (if (re-search-forward "[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \r\n]" limit t)
@@ -2331,28 +2667,31 @@
 
 (defun org-set-font-lock-defaults ()
   (let* ((em org-fontify-emphasized-text)
+	 (lk org-activate-links)
 	 (org-font-lock-extra-keywords
 	  (list
 	   '("^\\(\\**\\)\\(\\*\\)\\(.*\\)" (1 (org-get-level-face 1))
 	     (2 (org-get-level-face 2)) (3 (org-get-level-face 3)))
-	   '(org-activate-links (0 'org-link t))
-	   '(org-activate-links2 (0 'org-link t))
-	   '(org-activate-target-links (0 'org-link t))
-	   '(org-activate-dates (0 'org-link t))
-	   '(org-activate-camels (0 'org-link t))
-	   '(org-activate-tags (1 'org-tag t))
+	   '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
+	     (1 'org-table))
+	   (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-link t)))
+	   (if (memq 'camel lk) '(org-activate-camels (0 'org-link t)))
+	   (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend)))
+	   (if org-table-limit-column-width
+	       '(org-hide-wide-columns (0 nil append)))
 	   (list (concat "^\\*+[ \t]*" org-not-done-regexp)
 		 '(1 'org-warning t))
 	   (list (concat "\\[#[A-Z]\\]") '(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))
-;	   (if em '("\\(\\s-\\|^\\)\\(\\*\\([a-zA-Z]+\\)\\*\\)\\([^a-zA-Z*]\\|$\\)" (3 'bold)))
-;	   (if em '("\\(\\s-\\|^\\)\\(/\\([a-zA-Z]+\\)/\\)\\([^a-zA-Z*]\\|$\\)" (3 'italic)))
-;	   (if em '("\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)" (3 'underline)))
-	   (if em '("\\*[a-zA-Z]+\\*" 0 'bold))
-	   (if em '("/*[a-zA-Z]+/" 0 'italic))
-	   (if em '("_[a-zA-Z]+_" 0 'underline))
+	   (if em '("\\(\\W\\|^\\)\\(\\*\\w+\\*\\)\\(\\W\\|$\\)" 2 'bold prepend))
+	   (if em '("\\(\\W\\|^\\)\\(/\\w+/\\)\\(\\W\\|$\\)"     2 'italic prepend))
+	   (if em '("\\(\\W\\|^\\)\\(_\\w+_\\)\\(\\W\\|$\\)"     2 'underline prepend))
 	   (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string
 			 "\\|" org-quote-string "\\)\\>")
 		 '(1 'org-special-keyword t))
@@ -2362,11 +2701,11 @@
 		     '(1 'org-done t) '(2 'org-headline-done t))
 	     (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>")
 		   '(1 'org-done t)))
-	   '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
-	     (1 'org-table t))
 	   '("^[ \t]*\\(:.*\\)" (1 'org-table t))
 	   '("| *\\(:?=[^|\n]*\\)" (1 'org-formula t))
 	   '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t))
+	   (if org-format-transports-properties-p
+	       '("| *\\(<[0-9]+>\\) *|" (1 'org-formula t)))
 	   )))
     (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
     ;; Now set the full font-lock-keywords
@@ -2383,6 +2722,7 @@
   "Get the right face for match N in font-lock matching of healdines."
   (setq org-l (- (match-end 2) (match-beginning 1)))
   (if org-odd-levels-only (setq org-l (1+ (/ org-l 2))))
+;  (setq org-f (nth (1- (% org-l org-n-levels)) org-level-faces))
   (setq org-f (nth (% (1- org-l) org-n-levels) org-level-faces))
   (cond
    ((eq n 1) (if org-hide-leading-stars 'org-hide org-f))
@@ -2397,8 +2737,8 @@
 	 (inhibit-modification-hooks t)
 	 deactivate-mark buffer-file-name buffer-file-truename)
     (remove-text-properties beg end
-			    '(mouse-face nil keymap nil org-linked-text nil))))
-
+			    '(mouse-face nil keymap nil org-linked-text nil
+					 invisible nil intangible nil))))
 ;;; Visibility cycling
 
 (defvar org-cycle-global-status nil)
@@ -2448,8 +2788,9 @@
       ;; Enter the table or move to the next field in the table
       (or (org-table-recognize-table.el)
 	  (progn
-	    (org-table-justify-field-maybe)
-	    (org-table-next-field))))
+	    (if arg (org-table-edit-field t)
+	      (org-table-justify-field-maybe)
+	      (org-table-next-field)))))
 
      ((eq arg t) ;; Global cycling
 
@@ -2560,13 +2901,14 @@
 (defun org-optimize-window-after-visibility-change (state)
   "Adjust the window after a change in outline visibility.
 This function is the default value of the hook `org-cycle-hook'."
-  (cond
-   ((eq state 'overview) (org-first-headline-recenter 1))
-   ((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)))))
+  (when (get-buffer-window (current-buffer))
+    (cond
+     ((eq state 'overview) (org-first-headline-recenter 1))
+     ((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-subtree-end-visible-p ()
   "Is the end of the current subtree visible?"
@@ -2655,6 +2997,7 @@
 	(insert-buffer-substring buf)
 	(let ((org-startup-truncated t)
 	      (org-startup-folded t)
+	      (org-startup-align-all-tables nil)
 	      (org-startup-with-deadline-check nil))
 	  (org-mode))
 	(setq buffer-read-only t)
@@ -2729,10 +3072,8 @@
 		     (funcall outline-level)))))
       (unless (bolp) (newline))
       (insert head)
-      (unless (eolp)
-	(save-excursion (newline-and-indent)))
-      (unless (equal (char-before) ?\ )
-	(insert " "))
+      (if (looking-at "[ \t]*")
+	  (replace-match " "))
       (run-hooks 'org-insert-heading-hook))))
 
 (defun org-insert-item ()
@@ -2976,7 +3317,6 @@
 	       (if cut "Cut" "Copied")
 	       (length org-subtree-clip)))))
 
-;; FIXME: this needs to be adapted for the odd-level-only stuff.
 (defun org-paste-subtree (&optional level tree)
   "Paste the clipboard as a subtree, with modification of headline level.
 The entire subtree is promoted or demoted in order to match a new headline
@@ -3283,7 +3623,6 @@
 (defvar org-last-indent-begin-marker (make-marker))
 (defvar org-last-indent-end-marker (make-marker))
 
-
 (defun org-outdent-item (arg)
   "Outdent a local list item."
   (interactive "p")
@@ -3401,7 +3740,7 @@
 	  (looking-at org-todo-line-regexp)
 	  (goto-char (or (match-end 2) (match-beginning 3)))
 	  (insert "(" (format-time-string (cdr org-time-stamp-formats)
-					  (current-time))
+					  (org-current-time))
 		  ")"))
 	;; Save the buffer, if it is not the same buffer.
 	(if (not (eq this-buffer buffer)) (save-buffer))))
@@ -3632,7 +3971,7 @@
 	(insert org-closed-string " "
 		(format-time-string
 		 (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]")
-		 (current-time))
+		 (org-current-time))
 		"\n")))))
 
 (defun org-show-todo-tree (arg)
@@ -3727,17 +4066,19 @@
 
 ;; Overlay compatibility functions
 (defun org-make-overlay (beg end &optional buffer)
-  (if org-xemacs-p (make-extent beg end buffer) (make-overlay beg end buffer)))
+  (if (featurep 'xemacs)
+      (make-extent beg end buffer)
+    (make-overlay beg end buffer)))
 (defun org-delete-overlay (ovl)
-  (if org-xemacs-p (delete-extent ovl) (delete-overlay ovl)))
+  (if (featurep 'xemacs) (delete-extent ovl) (delete-overlay ovl)))
 (defun org-detatch-overlay (ovl)
-  (if org-xemacs-p (detach-extent ovl) (delete-overlay ovl)))
+  (if (featurep 'xemacs) (detach-extent ovl) (delete-overlay ovl)))
 (defun org-move-overlay (ovl beg end &optional buffer)
-  (if org-xemacs-p
+  (if (featurep 'xemacs)
       (set-extent-endpoints ovl beg end buffer)
     (move-overlay ovl beg end buffer)))
 (defun org-overlay-put (ovl prop value)
-  (if org-xemacs-p
+  (if (featurep 'xemacs)
       (set-extent-property ovl prop value)
     (overlay-put ovl prop value)))
 
@@ -3876,7 +4217,6 @@
 brackets.  It is inactive in the sense that it does not trigger agenda entries,
 does not link to the calendar and cannot be changed with the S-cursor keys.
 So these are more for recording a certain time/date."
-  ;; FIXME:  Would it be better not to ask for a date/time here?
   (interactive "P")
   (let ((fmt (if arg (cdr org-time-stamp-formats)
 	       (car org-time-stamp-formats)))
@@ -3891,8 +4231,6 @@
 (org-overlay-put org-date-ovl 'face 'org-warning)
 (org-detatch-overlay org-date-ovl)
 
-;;; FIXME: Make the function take "Fri" as "next friday"
-;;; because these are mostly being used to record the current time.
 (defun org-read-date (&optional with-time to-time)
   "Read a date and make things smooth for the user.
 The prompt will suggest to enter an ISO date, but you can also enter anything
@@ -3905,6 +4243,7 @@
   12:45         --> today 12:45
   22 sept 0:34  --> currentyear-09-22 0:34
   12            --> currentyear-currentmonth-12
+  Fri           --> nearest Friday (today or later)
   etc.
 The function understands only English month and weekday abbreviations,
 but this can be configured with the variables `parse-time-months' and
@@ -3924,29 +4263,30 @@
 this change.  The calling routine may then choose to change the format
 used to insert the time stamp into the buffer to include the time."
   (require 'parse-time)
-  (let* ((default-time
+  (let* ((org-time-stamp-rounding-minutes
+	  (if (equal with-time '(16)) 0 org-time-stamp-rounding-minutes))
+	 (ct (org-current-time))
+	 (default-time
 	   ;; Default time is either today, or, when entering a range,
 	   ;; the range start.
 	   (if (save-excursion
 		 (re-search-backward
-		  (concat org-ts-regexp "--\\=")
+		  (concat org-ts-regexp "--\\=") ; FIXME: exactly two minuses?
 		  (- (point) 20) t))
 	       (apply
 		'encode-time
-		(mapcar (lambda(x) (or x 0))  ;; FIXME: Problem with timezone?
+		(mapcar (lambda(x) (or x 0))
 			(parse-time-string (match-string 1))))
-	     (current-time)))
+	     ct))
 	 (calendar-move-hook nil)
 	 (view-diary-entries-initially nil)
 	 (timestr (format-time-string
 		   (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time))
 	 (prompt (format "YYYY-MM-DD [%s]: " timestr))
 	 ans ans1 ans2
-	 second minute hour day month year tl)
+	 second minute hour day month year tl wday wday1)
 
     (if org-popup-calendar-for-date-prompt
-	;; Also show a calendar for date selection
-	;; Copied (with modifications) from planner.el by John Wiegley
 	(save-excursion
 	  (save-window-excursion
 	    (calendar)
@@ -3958,9 +4298,9 @@
 		   (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 org-xemacs-p [button1] [mouse-1])
+	      (define-key map (if (featurep 'xemacs) [button1] [mouse-1])
 		'org-calendar-select-mouse)
-	      (define-key map (if org-xemacs-p [button2] [mouse-2])
+	      (define-key map (if (featurep 'xemacs) [button2] [mouse-2])
 		'org-calendar-select-mouse)
 	      (define-key minibuffer-local-map [(meta shift left)]
 		(lambda () (interactive)
@@ -4009,12 +4349,19 @@
 	  (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
 				   t nil ans))))
     (setq tl (parse-time-string ans)
-	  year (or (nth 5 tl) (string-to-number (format-time-string "%Y")))
-	  month (or (nth 4 tl) (string-to-number (format-time-string "%m")))
-	  day (or (nth 3 tl) (string-to-number (format-time-string "%d")))
-	  hour (or (nth 2 tl) (string-to-number (format-time-string "%H")))
-	  minute (or (nth 1 tl) (string-to-number (format-time-string "%M")))
-	  second (or (nth 0 tl) 0))
+	  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)))
+	  day (or (nth 3 tl) (string-to-number (format-time-string "%d" ct)))
+	  hour (or (nth 2 tl) (string-to-number (format-time-string "%H" ct)))
+	  minute (or (nth 1 tl) (string-to-number (format-time-string "%M" ct)))
+	  second (or (nth 0 tl) 0)
+	  wday (nth 6 tl))
+    (when (and wday (not (nth 3 tl)))
+      ;; Weekday was given, but no day, so pick that day in the week
+      ;; on or after the derived date.
+      (setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year))))
+      (unless (equal wday wday1)
+	(setq day (+ day (% (- wday wday1 -7) 7)))))
     (if (and (boundp 'org-time-was-given)
 	     (nth 2 tl))
 	(setq org-time-was-given t))
@@ -4118,8 +4465,6 @@
 	 (fd1 "%dd")
 	 (fh "%02d:%02d")
 	 y d h m align)
-    ;; FIXME:  Should I re-introduce years, make year refer to same date?
-    ;; This would be the only useful way to have years, actually.
     (if havetime
 	(setq ; y (floor (/ diff ys))  diff (mod diff ys)
 	 y 0
@@ -4336,7 +4681,7 @@
 (defvar org-agenda-mode-map (make-sparse-keymap)
   "Keymap for `org-agenda-mode'.")
 
-(defvar org-agenda-menu)
+(defvar org-agenda-menu) ; defined later in this file.
 (defvar org-agenda-follow-mode nil)
 (defvar org-agenda-show-log nil)
 (defvar org-agenda-buffer-name "*Org Agenda*")
@@ -4372,7 +4717,7 @@
       (if (get 'org-agenda-files 'org-restrict)
 	  "Restricted to single file"
 	"Edit File List")
-      '(customize-variable 'org-agenda-files)
+      '(org-edit-agenda-file-list)
       (not (get 'org-agenda-files 'org-restrict)))
      "--")
     (mapcar 'org-file-menu-entry (org-agenda-files))))
@@ -4443,10 +4788,11 @@
   "Local keymap for agenda entries from Org-mode.")
 
 (define-key org-agenda-keymap
-  (if org-xemacs-p [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)
+  (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)
 (define-key org-agenda-keymap
-  (if org-xemacs-p [(button3)] [(mouse-3)]) 'org-agenda-show-mouse)
-(define-key org-agenda-keymap [follow-link] 'mouse-face)
+  (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))
 (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
   '("Agenda"
     ("Agenda Files")
@@ -4553,7 +4899,7 @@
 			   ((eq type 'todo-tree) "TODO kwd tree")
 			   ((eq type 'occur-tree) "Occur tree")
 			   (t "???"))
-			  (org-string-props string 'face 'org-link))))
+			  (org-add-props string nil 'face 'org-warning))))
 	(goto-char (point-min))
 	(if (fboundp 'fit-window-to-buffer) (fit-window-to-buffer))
 	(message "Press key for agenda command%s"
@@ -4614,10 +4960,58 @@
        (fit-window-to-buffer nil (/ (* (frame-height) 3) 4)
                              (/ (frame-height) 2))))
 
-(defun org-agenda-files ()
-  "Get the list of agenda files."
-  (or (get 'org-agenda-files 'org-restrict)
-      org-agenda-files))
+(defun org-agenda-files (&optional unrestricted)
+  "Get the list of agenda files.
+Optional UNRESTRICTED means return the full list even if a restriction
+is currently in place."
+  (cond
+   ((and (not unrestricted) (get 'org-agenda-files 'org-restrict)))
+   ((stringp org-agenda-files) (org-read-agenda-file-list))
+   ((listp org-agenda-files) org-agenda-files)
+   (t (error "Invalid value of `org-agenda-files'"))))
+
+(defvar org-window-configuration)
+
+(defun org-edit-agenda-file-list ()
+  "Edit the list of agenda files.
+Depending on setup, this either uses customize to edit the variable
+`org-agenda-files', or it visits the file that is holding the list.  In the
+latter case, the buffer is set up in a way that saving it automatically kills
+the buffer and restores the previous window configuration."
+  (interactive)
+  (if (stringp org-agenda-files)
+      (let ((cw (current-window-configuration)))
+	(find-file org-agenda-files)
+	(set (make-local-variable 'org-window-configuration) cw)
+	(org-add-hook 'after-save-hook
+		      (lambda ()
+			(set-window-configuration
+			 (prog1 org-window-configuration
+			   (kill-buffer (current-buffer))))
+			(org-install-agenda-files-menu)
+			(message "New agenda file list installed"))
+		      nil 'local)
+	(message (substitute-command-keys
+		  "Edit list and finish with \\[save-buffer]")))
+    (customize-variable 'org-agenda-files)))
+
+(defun org-store-new-agenda-file-list (list)
+  "Set new value for the agenda file list and save it correcly."
+  (if (stringp org-agenda-files)
+      (let ((f org-agenda-files) b)
+	(while (setq b (find-buffer-visiting f)) (kill-buffer b))
+	(with-temp-file f
+	  (insert (mapconcat 'identity list "\n") "\n")))
+    (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode))
+      (setq org-agenda-files list)
+      (customize-save-variable 'org-agenda-files org-agenda-files))))
+
+(defun org-read-agenda-file-list ()
+  "Read the list of agenda files from a file."
+  (when (stringp org-agenda-files)
+    (with-temp-buffer
+      (insert-file-contents org-agenda-files)
+      (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*"))))
 
 (defvar org-agenda-markers nil
   "List of all currently active markers created by `org-agenda'.")
@@ -4736,7 +5130,7 @@
 		    (calendar-month-name (extract-calendar-month date)) " "
 		    (number-to-string (extract-calendar-year date)) "\n")
 	    (put-text-property s (1- (point)) 'face
-			       'org-link)
+			       'org-level-3)
 	    (if (equal d today)
 		(put-text-property s (1- (point)) 'org-today t))
 	    (insert (org-finalize-agenda-entries rtn) "\n")
@@ -4771,7 +5165,8 @@
 		  (and (null ndays) (equal 1 org-agenda-ndays)))
 	      nil org-agenda-start-on-weekday))
 	 (org-agenda-keep-modes keep-modes)
-	 (files (copy-sequence (org-agenda-files)))
+	 (thefiles (org-agenda-files))
+	 (files thefiles)
 	 (win (selected-window))
 	 (today (time-to-days (current-time)))
 	 (sd (or start-day today))
@@ -4808,7 +5203,7 @@
     (set (make-local-variable 'include-all-loc) include-all)
     (when (and (or include-all org-agenda-include-all-todo)
 	       (member today day-numbers))
-      (setq files (org-agenda-files)
+      (setq files thefiles
 	    rtnall nil)
       (while (setq file (pop files))
 	(catch 'nextfile
@@ -4820,7 +5215,7 @@
       (when rtnall
 	(insert "ALL CURRENTLY OPEN TODO ITEMS:\n")
 	(add-text-properties (point-min) (1- (point))
-			     (list 'face 'org-link))
+			     (list 'face 'org-level-3))
 	(insert (org-finalize-agenda-entries rtnall) "\n")))
     (while (setq d (pop day-numbers))
       (setq date (calendar-gregorian-from-absolute d)
@@ -4830,7 +5225,7 @@
 	  (setq start-pos (point))
 	(if (and start-pos (not end-pos))
 	    (setq end-pos (point))))
-      (setq files (org-agenda-files)
+      (setq files thefiles
 	    rtnall nil)
       (while (setq file (pop files))
 	(catch 'nextfile
@@ -4856,7 +5251,7 @@
 			    (calendar-month-name (extract-calendar-month date))
 			    (extract-calendar-year date)))
 	    (put-text-property s (1- (point)) 'face
-			       'org-link)
+			       'org-level-3)
 	    (if rtnall (insert
 			(org-finalize-agenda-entries
 			 (org-agenda-add-time-grid-maybe
@@ -4927,7 +5322,7 @@
 	(setq rtnall (append rtnall rtn))))
     (insert "Global list of TODO items of type: ")
     (add-text-properties (point-min) (1- (point))
-			 (list 'face 'org-link))
+			 (list 'face 'org-level-3))
     (setq pos (point))
     (insert (or org-select-this-todo-keyword "ALL") "\n")
     (add-text-properties pos (1- (point)) (list 'face 'org-warning))
@@ -4939,7 +5334,7 @@
 		    (format "(%d)%s" (setq n (1+ n)) x))
 		  org-todo-keywords " "))
      "\n")
-    (add-text-properties pos (1- (point)) (list 'face 'org-link))
+    (add-text-properties pos (1- (point)) (list 'face 'org-level-3))
     (when rtnall
       (insert (org-finalize-agenda-entries rtnall) "\n"))
     (goto-char (point-min))
@@ -4949,12 +5344,9 @@
 
 (defun org-check-agenda-file (file)
   "Make sure FILE exists.  If not, ask user what to do."
-  ;; FIXME:  this does not correctly change the menus
-  ;; Could probably be fixed by explicitly going to the buffer where
-  ;; the call originated.
   (when (not (file-exists-p file))
-    (message "non-existent file %s.  [R]emove from agenda-files or [A]bort?"
-	     file)
+    (message "non-existent file %s. [R]emove from list or [A]bort?"
+	     (abbreviate-file-name file))
     (let ((r (downcase (read-char-exclusive))))
       (cond
        ((equal r ?r)
@@ -5075,12 +5467,12 @@
 
 (defun org-highlight (begin end &optional buffer)
   "Highlight a region with overlay."
-  (funcall (if org-xemacs-p 'set-extent-endpoints 'move-overlay)
+  (funcall (if (featurep 'xemacs) 'set-extent-endpoints 'move-overlay)
 	   org-hl begin end (or buffer (current-buffer))))
 
 (defun org-unhighlight ()
   "Detach overlay INDEX."
-  (funcall (if org-xemacs-p 'detach-extent 'delete-overlay) org-hl))
+  (funcall (if (featurep 'xemacs) 'detach-extent 'delete-overlay) org-hl))
 
 
 (defun org-agenda-follow-mode ()
@@ -5153,7 +5545,7 @@
 	 (org-disable-agenda-to-diary t))
     (save-excursion
       (save-window-excursion
-	(list-diary-entries date 1)))
+	(list-diary-entries date 1)))  ;; Keep this name for now, compatibility
     (if (not (get-buffer fancy-diary-buffer))
 	(setq entries nil)
       (with-current-buffer fancy-diary-buffer
@@ -5176,11 +5568,7 @@
 	     (lambda (x)
 	       (setq x (org-format-agenda-item "" x "Diary" nil 'time))
 	       ;; Extend the text properties to the beginning of the line
-	       (add-text-properties
-		0 (length x)
-		(text-properties-at (1- (length x)) x)
-		x)
-	       x)
+	       (org-add-props x (text-properties-at (1- (length x)) x)))
 	     entries)))))
 
 (defun org-agenda-cleanup-fancy-diary ()
@@ -5219,18 +5607,13 @@
 
 (defun org-modify-diary-entry-string (string)
   "Add text properties to string, allowing org-mode to act on it."
-  (add-text-properties
-   0 (length string)
-   (list 'mouse-face 'highlight
-	 'keymap org-agenda-keymap
-	 'help-echo
-	 (format
-	  "mouse-2 or RET jump to diary file %s"
-	  (abbreviate-file-name buffer-file-name))
-	 'org-agenda-diary-link t
-	 'org-marker (org-agenda-new-marker (point-at-bol)))
-   string)
-  string)
+  (org-add-props string nil
+    'mouse-face 'highlight
+    'keymap org-agenda-keymap
+    'help-echo (format "mouse-2 or RET jump to diary file %s"
+		       (abbreviate-file-name buffer-file-name))
+    'org-agenda-diary-link t
+    'org-marker (org-agenda-new-marker (point-at-bol))))
 
 (defun org-diary-default-entry ()
   "Add a dummy entry to the diary.
@@ -5247,9 +5630,10 @@
 If the current buffer visits an agenda file, find the next one in the list.
 If the current buffer does not, find the first agenda file."
   (interactive)
-  (let ((files (append org-agenda-files (list (car org-agenda-files))))
-	(tcf (if buffer-file-name (file-truename buffer-file-name)))
-	file)
+  (let* ((fs (org-agenda-files t))
+	 (files (append fs (list (car fs))))
+	 (tcf (if buffer-file-name (file-truename buffer-file-name)))
+	 file)
     (unless files (error "No agenda files"))
     (catch 'exit
       (while (setq file (pop files))
@@ -5257,7 +5641,7 @@
 	    (when (car files)
 	      (find-file (car files))
 	      (throw 'exit t))))
-      (find-file (car org-agenda-files)))))
+      (find-file (car fs)))))
 
 (defun org-agenda-file-to-end ()
   "Move/add the current file to the end of the agenda file list.
@@ -5274,7 +5658,7 @@
   (interactive "P")
   (let ((file-alist (mapcar (lambda (x)
 			      (cons (file-truename x) x))
-			    org-agenda-files))
+			    (org-agenda-files t)))
 	(ctf (file-truename buffer-file-name))
 	x had)
     (setq x (assoc ctf file-alist) had x)
@@ -5283,9 +5667,7 @@
     (if to-end
 	(setq file-alist (append (delq x file-alist) (list x)))
       (setq file-alist (cons x (delq x file-alist))))
-    (setq org-agenda-files (mapcar 'cdr file-alist))
-    (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode))
-      (customize-save-variable 'org-agenda-files org-agenda-files))
+    (org-store-new-agenda-file-list (mapcar 'cdr file-alist))
     (org-install-agenda-files-menu)
     (message "File %s to %s of agenda file list"
 	     (if had "moved" "added") (if to-end "end" "front"))))
@@ -5303,20 +5685,16 @@
 			     (if (equal true-file
 					(file-truename x))
 				 nil x))
-			   org-agenda-files))))
-    (if (not (= (length files) (length org-agenda-files)))
+			   (org-agenda-files t)))))
+    (if (not (= (length files) (length (org-agenda-files t))))
 	(progn
-	  (setq org-agenda-files files)
-	  (customize-save-variable 'org-agenda-files org-agenda-files)
+	  (org-store-new-agenda-file-list files)
 	  (org-install-agenda-files-menu)
 	  (message "Removed file: %s" afile))
       (message "File was not in list: %s" afile))))
 
 (defun org-file-menu-entry (file)
   (vector file (list 'find-file file) t))
-;; FIXME: Maybe we removed a buffer visited through the menu from
-;; org-agenda-new-buffers, so that the buffer will not be removed
-;; when exiting the agenda????
 
 (defun org-get-all-dates (beg end &optional no-ranges force-today inactive)
   "Return a list of all relevant day numbers from BEG to END buffer positions.
@@ -5394,7 +5772,7 @@
   (setq args (or args '(:deadline :scheduled :timestamp)))
   (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
 		    (list entry)
-		  org-agenda-files))
+		  (org-agenda-files t)))
 	 file rtn results)
     ;; If this is called during org-agenda, don't return any entries to
     ;; the calendar.  Org Agenda will list these entries itself.
@@ -5441,6 +5819,7 @@
   (setq args (or args '(:deadline :scheduled :timestamp)))
   (let* ((org-startup-with-deadline-check nil)
 	 (org-startup-folded nil)
+	 (org-startup-align-all-tables nil)
 	 (buffer (if (file-exists-p file)
 		     (org-get-agenda-file-buffer file)
 		   (error "No such file %s" file)))
@@ -5541,11 +5920,9 @@
                       (length
                        (member (match-string 2) org-todo-keywords)))
                  1)))
-      (add-text-properties
-       0 (length txt) (append (list 'org-marker marker 'org-hd-marker marker
-				    'priority priority 'category category)
-			      props)
-       txt)
+      (org-add-props txt props
+	'org-marker marker 'org-hd-marker marker
+	'priority priority 'category category)
       (push txt ee)
       (goto-char (match-end 1)))
     (nreverse ee)))
@@ -5601,32 +5978,19 @@
 			       (match-string 1) category tags timestr)))
 		(setq txt org-agenda-no-heading-message))
 	      (setq priority (org-get-priority txt))
-	      (add-text-properties
-	       0 (length txt) (append (list 'org-marker marker
-					    'org-hd-marker hdmarker) props)
-	       txt)
+	      (org-add-props txt props
+		'org-marker marker 'org-hd-marker hdmarker)
 	      (if deadlinep
-		  (add-text-properties
-		   0 (length txt)
-		   (list 'face
-			 (if donep 'org-done 'org-warning)
-			 'undone-face 'org-warning
-			 'done-face 'org-done
-			 'category category
-			 'priority (+ 100 priority))
-		   txt)
+		  (org-add-props txt nil
+		    'face (if donep 'org-done 'org-warning)
+		    'undone-face 'org-warning 'done-face 'org-done
+		    'category category 'priority (+ 100 priority))
 		(if scheduledp
-		    (add-text-properties
-		     0 (length txt)
-		     (list 'face 'org-scheduled-today
-			   'undone-face 'org-scheduled-today
-			   'done-face 'org-done
-			   'category category
-			   priority (+ 99 priority))
-		     txt)
-		  (add-text-properties
-		   0 (length txt)
-		   (list 'priority priority 'category category) txt)))
+		    (org-add-props txt nil
+		      'face 'org-scheduled-today
+		      'undone-face 'org-scheduled-today 'done-face 'org-done
+		      'category category 'priority (+ 99 priority))
+		  (org-add-props txt nil 'priority priority 'category category)))
 	      (push txt ee))
 	    (outline-next-heading))))
     (nreverse ee)))
@@ -5673,15 +6037,10 @@
 			       (match-string 1) category tags timestr)))
 		(setq txt org-agenda-no-heading-message))
 	      (setq priority 100000)
-	      (add-text-properties
-	       0 (length txt) (append (list 'org-marker marker
-					    'org-hd-marker hdmarker
-					    'face 'org-done
-					    'priority priority
-					    'category category
-					    'undone-face 'org-warning
-					    'done-face 'org-done) props)
-	       txt)
+	      (org-add-props txt props
+		'org-marker marker 'org-hd-marker hdmarker 'face 'org-done
+		'priority priority 'category category
+		'undone-face 'org-warning 'done-face 'org-done)
 	      (push txt ee))
 	    (outline-next-heading))))
     (nreverse ee)))
@@ -5726,23 +6085,19 @@
 			       (format "In %3d d.: " diff) head category tags))))
 	      (setq txt org-agenda-no-heading-message))
 	    (when txt
-	      (add-text-properties
-	       0 (length txt)
-	       (append
-		(list 'org-marker (org-agenda-new-marker pos)
-		      'org-hd-marker (org-agenda-new-marker pos1)
-		      'priority (+ (- 10 diff) (org-get-priority txt))
-		      'category category
-		      'face (cond ((<= diff 0) 'org-warning)
-				  ((<= diff 5) 'org-scheduled-previously)
-				  (t nil))
-		      'undone-face (cond
-				    ((<= diff 0) 'org-warning)
-				    ((<= diff 5) 'org-scheduled-previously)
-				    (t nil))
-		      'done-face 'org-done)
-		props)
-	       txt)
+	      (org-add-props txt props
+		'org-marker (org-agenda-new-marker pos)
+		'org-hd-marker (org-agenda-new-marker pos1)
+		'priority (+ (- 10 diff) (org-get-priority txt))
+		'category category
+		'face (cond ((<= diff 0) 'org-warning)
+			    ((<= diff 5) 'org-scheduled-previously)
+			    (t nil))
+		'undone-face (cond
+			      ((<= diff 0) 'org-warning)
+			      ((<= diff 5) 'org-scheduled-previously)
+			      (t nil))
+		'done-face 'org-done)
 	      (push txt ee)))))
     ee))
 
@@ -5787,13 +6142,11 @@
 			       category tags))))
 	      (setq txt org-agenda-no-heading-message))
 	    (when txt
-	      (add-text-properties
-	       0 (length txt)
-	       (append (list 'org-marker (org-agenda-new-marker pos)
-			     'org-hd-marker (org-agenda-new-marker pos1)
-			     'priority (+ (- 5 diff) (org-get-priority txt))
-			     'category category)
-		       props) txt)
+	      (org-add-props txt props
+		'org-marker (org-agenda-new-marker pos)
+		'org-hd-marker (org-agenda-new-marker pos1)
+		'priority (+ (- 5 diff) (org-get-priority txt))
+		'category category)
 	      (push txt ee)))))
     ee))
 
@@ -5833,13 +6186,9 @@
 			     (match-string 1) category tags
 			     (if (= d0 d1) timestr))))
 	      (setq txt org-agenda-no-heading-message))
-	    (add-text-properties
-	     0 (length txt) (append (list 'org-marker marker
-					  'org-hd-marker hdmarker
-					  'priority (org-get-priority txt)
-					  'category category)
-				    props)
-	     txt)
+	    (org-add-props txt props
+	      'org-marker marker 'org-hd-marker hdmarker
+	      'priority (org-get-priority txt) 'category category)
 	    (push txt ee)))
       (outline-next-heading))
     ;; Sort the entries by expiration date.
@@ -5901,7 +6250,8 @@
 			     (file-name-sans-extension
 			      (file-name-nondirectory buffer-file-name))
 			   "")))
-	   (tag (or (nth (1- (or (length tags) 0)) tags) ""))
+	   (tag (if tags (nth (1- (length tags)) tags) ""))
+	   ;;(tag (or (nth (1- (or (length tags) 0)) tags) ""))  FIXME: rm
 	   time              ;; needed for the eval of the prefix format
 	   (ts (if dotime (concat (if (stringp dotime) dotime "") txt)))
 	   (time-of-day (and dotime (org-get-time-of-day ts)))
@@ -5946,14 +6296,11 @@
 	(setq rtn (concat (eval org-prefix-format-compiled) txt)))
 
       ;; And finally add the text properties
-      (add-text-properties
-       0 (length rtn) (list 'category (downcase category)
-			    'tags tags
-			    'prefix-length (- (length rtn) (length txt))
-			    'time-of-day time-of-day
-			    'dotime dotime)
-       rtn)
-      rtn)))
+      (org-add-props rtn nil
+	'category (downcase category) 'tags tags
+	'prefix-length (- (length rtn) (length txt))
+	'time-of-day time-of-day
+	'dotime dotime))))
 
 (defun org-agenda-add-time-grid-maybe (list ndays todayp)
   (catch 'exit
@@ -5977,7 +6324,7 @@
 	(unless (and remove (member time have))
 	  (setq time (int-to-string time))
 	  (push (org-format-agenda-item
-		 nil string "" nil ;; FIXME: put a category for the grid?
+		 nil string "" nil
 		 (concat (substring time 0 -2) ":" (substring time -2)))
 		new)
 	  (put-text-property
@@ -6078,7 +6425,7 @@
 	 (priority-down (if priority-up (- priority-up) nil))
 	 (category-up (org-cmp-category a b))
 	 (category-down (if category-up (- category-up) nil))
-	 (category-keep (if category-up +1 nil)))  ; FIXME +1 or -1?
+	 (category-keep (if category-up +1 nil)))
     (cdr (assoc
 	  (eval (cons 'or org-agenda-sorting-strategy))
 	  '((-1 . t) (1 . nil) (nil . nil))))))
@@ -6370,7 +6717,6 @@
   "Return the heading of the current entry, without the stars."
   (save-excursion
     (and (memq (char-before) '(?\n ?\r)) (skip-chars-forward "^\n\r"))
-;;FIXME????????    (and (bolp) (end-of-line 1))
     (if (and (re-search-backward "[\r\n]\\*" nil t)
 	     (looking-at "[\r\n]\\*+[ \t]+\\([^\r\n]*\\)"))
 	(match-string 1)
@@ -6576,12 +6922,8 @@
 		       category tags-list))
             (goto-char lspos)
 	    (setq marker (org-agenda-new-marker))
-	    (add-text-properties
-	     0 (length txt)
-	     (append (list 'org-marker marker 'org-hd-marker marker
-			   'category category)
-		     props)
-	     txt)
+	    (org-add-props txt props
+	      'org-marker marker 'org-hd-marker marker 'category category)
 	    (push txt rtn))
 	  ;; if we are to skip sublevels, jump to end of subtree
           (point)
@@ -6683,13 +7025,13 @@
 		(setq rtnall (append rtnall rtn))))))))
     (insert "Headlines with TAGS match: ")
     (add-text-properties (point-min) (1- (point))
-			 (list 'face 'org-link))
+			 (list 'face 'org-level-3))
     (setq pos (point))
     (insert match "\n")
     (add-text-properties pos (1- (point)) (list 'face 'org-warning))
     (setq pos (point))
     (insert "Press `C-u r' to search again with new search string\n")
-    (add-text-properties pos (1- (point)) (list 'face 'org-link))
+    (add-text-properties pos (1- (point)) (list 'face 'org-level-3))
     (when rtnall
       (insert (mapconcat 'identity rtnall "\n")))
     (goto-char (point-min))
@@ -6724,7 +7066,7 @@
 				 nil nil current 'org-tags-history)))
 	(while (string-match "[-+&]+" tags)
 	  (setq tags (replace-match ":" t t tags))))
-      ;; FIXME: still optimize this byt not checking when JUST-ALIGN?
+      ;; FIXME: still optimize this by not checking when JUST-ALIGN?
       (unless (setq empty (string-match "\\`[\t ]*\\'" tags))
 	(unless (string-match ":$" tags) (setq tags (concat tags ":")))
 	(unless (string-match "^:" tags) (setq tags (concat ":" tags))))
@@ -6738,7 +7080,6 @@
 	(setq hd (match-string 1))
 	(delete-region (match-beginning 0) (match-end 0))
 	(insert-before-markers (org-trim hd) (if empty "" " ")))
-      ;; FIXME:  What happens when adding a new tag???  Seems OK!!!
       (unless (equal tags "")
 	(move-to-column (max (current-column)
 			     (if (> org-tags-column 0)
@@ -6782,7 +7123,7 @@
   (save-excursion
     (beginning-of-line 1)
     (if (looking-at ".*[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \t]*\\(\r\\|$\\)")
-	(match-string 1)
+	(org-match-string-no-properties 1)
       "")))
 
 (defun org-get-buffer-tags ()
@@ -6792,7 +7133,7 @@
       (goto-char (point-min))
       (while (re-search-forward "[ \t]:\\([A-Za-z_@0-9:]+\\):[ \t\r\n]" nil t)
 	(mapc (lambda (x) (add-to-list 'tags x))
-	      (org-split-string (match-string 1) ":"))))
+	      (org-split-string (org-match-string-no-properties 1) ":"))))
     (mapcar 'list tags)))
 
 ;;; Link Stuff
@@ -6829,10 +7170,10 @@
 		     (looking-at org-bracket-link-regexp)
 		     (<= (match-beginning 0) pos)
 		     (>= (match-end 0) pos))
-	    (setq link (match-string 1))
+	    (setq link (org-link-unescape (org-match-string-no-properties 1)))
 	    (while (string-match " *\n *" link)
 	      (setq link (replace-match " " t t link)))
-	    (if (string-match org-link-regexp link)
+	    (if (string-match org-link-re-with-space2 link)
 		(setq type (match-string 1 link)
 		      path (match-string 2 link))
 	      (setq type "thisfile"
@@ -6849,11 +7190,12 @@
 	  (throw 'match t))
 
 	(save-excursion
-	  (skip-chars-backward
-	   (concat (if org-allow-space-in-links "^" "^ ")
-		   org-non-link-chars))
-	  (when (or (looking-at org-link-regexp)
-		    (and (re-search-forward org-link-regexp (point-at-eol) t)
+	  (skip-chars-backward (concat "^[]" org-non-link-chars " "))
+	  (if (equal (char-before) ?<) (backward-char 1))
+	  (when (or (looking-at org-angle-link-re)
+		    (looking-at org-plain-link-re)
+		    (and (or (re-search-forward org-angle-link-re (point-at-eol) t)
+			     (re-search-forward org-plain-link-re (point-at-eol) t))
 			 (<= (match-beginning 0) pos)
 			 (>= (match-end 0) pos)))
 	    (setq type (match-string 1)
@@ -6869,22 +7211,12 @@
 	    (throw 'match t)))
 	(save-excursion
 	  (skip-chars-backward "a-zA-Z_")
-	  (when (and org-activate-camels
+	  (when (and (memq 'camel org-activate-links)
 		     (looking-at org-camel-regexp))
 	    (setq type "camel" path (match-string 0))
 	    (if (equal (char-before) ?*)
 		(setq path (concat "*" path))))
-	  (throw 'match t))
-	(save-excursion
-	  (when (re-search-forward
-		 org-link-regexp
-		 (save-excursion
-		   (condition-case nil
-		       (progn (outline-end-of-subtree) (max pos (point)))
-		     (error (end-of-line 1) (point))))
-		 t)
-	      (setq type (match-string 1)
-		    path (match-string 2)))))
+	  (throw 'match t)))
       (unless path
 	(error "No link found"))
       ;; Remove any trailing spaces in path
@@ -6894,7 +7226,6 @@
       (cond
 
        ((member type '("http" "https" "ftp" "mailto" "news"))
-	;; give these to some browser
 	(browse-url (concat type ":" path)))
 
        ((string= type "tags")
@@ -6971,7 +7302,10 @@
 	  (while (string-match "@}" cmd)
 	    (setq cmd (replace-match ">" t t cmd)))
 	  (if (or (not org-confirm-shell-links)
-		  (yes-or-no-p (format "Execute \"%s\" in the shell? " cmd)))
+		  (funcall org-confirm-shell-links
+			   (format "Execute \"%s\" in shell? "
+				   (org-add-props cmd nil
+				     'face 'org-warning))))
 	      (shell-command cmd)
 	    (error "Abort"))))
 
@@ -7044,7 +7378,7 @@
 	       (if (or (org-search-not-link re0 nil t)
 		       (org-search-not-link re1 nil t)
 		       (org-search-not-link re2 nil t)
-		       (org-search-not-link re2a nil t) ;; FIXME: Right place???
+		       (org-search-not-link re2a nil t)
 		       (org-search-not-link re3 nil t)
 		       (org-search-not-link re4 nil t)
 		       (org-search-not-link re5 nil t)
@@ -7202,12 +7536,12 @@
 	(cond
 	 ((featurep 'tramp)
 	  ;; use tramp to access the file
-	  (if org-xemacs-p
+	  (if (featurep 'xemacs)
 	      (setq folder (format "[%s@%s]%s" user host file))
 	    (setq folder (format "/%s@%s:%s" user host file))))
 	 (t
 	  ;; use ange-ftp or efs
-	  (require (if org-xemacs-p 'efs 'ange-ftp))
+	  (require (if (featurep 'xemacs) 'efs 'ange-ftp))
 	  (setq folder (format "/%s@%s:%s" user host file))))))
   (when folder
     (funcall (cdr (assq 'vm org-link-frame-setup)) folder readonly)
@@ -7360,6 +7694,28 @@
       (kill-this-buffer)
       (error "Message not found"))))
 
+(defun org-upgrade-old-links (&optional query-description)
+  "Transfer old <...> style links to new [[...]] style links.
+With arg query-description, ask at each match for a description text to use
+for this link."
+  (interactive (list (y-or-n-p "Would you like to be queried for a description at each link?")))
+  (save-excursion
+    (goto-char (point-min))
+    (let ((re (concat "\\([^[]\\)<\\(" 
+		      "\\(" (mapconcat 'identity org-link-types "\\|") 
+		      "\\):"
+		      "[^" org-non-link-chars "]+\\)>"))
+	  l1 l2 (cnt 0))
+      (while (re-search-forward re nil t)
+	(setq cnt (1+ cnt)
+	      l1 (org-match-string-no-properties 2)
+	      l2 (save-match-data (org-link-escape l1)))
+	(when query-description (setq l1 (read-string "Desc: " l1)))
+	(if (equal l1 l2)
+	    (replace-match (concat (match-string 1) "[[" l1 "]]") t t)
+	  (replace-match (concat (match-string 1) "[[" l2 "][" l1 "]]") t t)))
+      (message "%d matches have beed treated" cnt))))
+
 (defun org-open-file (path &optional in-emacs line search)
   "Open the file at PATH.
 First, this expands any special file name abbreviations.  Then the
@@ -7409,7 +7765,7 @@
 	(shell-command (concat cmd " &"))))
      ((or (stringp cmd)
 	  (eq cmd 'emacs))
-      (unless (equal (file-truename file) (file-truename buffer-file-name))
+      (unless (equal (file-truename file) (file-truename (or buffer-file-name "")))
 	(funcall (cdr (assq 'file org-link-frame-setup)) file))
       (if line (goto-line line)
 	(if search (org-link-search search))))
@@ -7450,7 +7806,7 @@
 For links to usenet articles, arg negates `org-usenet-links-prefer-google'.
 For file links, arg negates `org-context-in-file-links'."
   (interactive "P")
-  (let (link cpltxt txt (pos (point)))
+  (let (link cpltxt desc txt (pos (point)))
     (cond
 
      ((eq major-mode 'bbdb-mode)
@@ -7486,9 +7842,7 @@
 			   folder)
 	     (setq folder (replace-match "" t t folder)))
 	 (setq cpltxt (concat author " on: " subject))
-	 (setq link (concat cpltxt "\n  "
-			    (org-make-link
-			     "vm:" folder "#" message-id))))))
+	 (setq link (org-make-link "vm:" folder "#" message-id)))))
 
      ((eq major-mode 'wl-summary-mode)
       (let* ((msgnum (wl-summary-message-number))
@@ -7496,14 +7850,12 @@
 					     msgnum 'message-id))
 	     (wl-message-entity (elmo-msgdb-overview-get-entity
 				 msgnum (wl-summary-buffer-msgdb)))
-	     (author (wl-summary-line-from)) ; FIXME: how to get author name?
-	     (subject "???"))   ; FIXME: How to get subject of email?
+	     (author (wl-summary-line-from)) ; FIXME: correct?
+	     (subject "???"))   ; FIXME:
 	(setq message-id (org-remove-angle-brackets message-id))
 	(setq cpltxt (concat author  " on: " subject))
-	(setq link (concat cpltxt "\n  "
-			   (org-make-link
-			    "wl:" wl-summary-buffer-folder-name
-			   "#" message-id)))))
+	(setq link (org-make-link "wl:" wl-summary-buffer-folder-name
+				  "#" message-id))))
 
      ((or (equal major-mode 'mh-folder-mode)
 	  (equal major-mode 'mh-show-mode))
@@ -7511,11 +7863,9 @@
 	    (to-header (org-mhe-get-header "To:"))
 	    (subject (org-mhe-get-header "Subject:")))
 	(setq cpltxt (concat from-header " on: " subject))
-	(setq link (concat cpltxt "\n  "
-			   (org-make-link
-			    "mhe:" (org-mhe-get-message-real-folder) "#"
-			    (org-remove-angle-brackets
-			     (org-mhe-get-header "Message-Id:")))))))
+	(setq link (org-make-link "mhe:" (org-mhe-get-message-real-folder) "#"
+				  (org-remove-angle-brackets
+				   (org-mhe-get-header "Message-Id:"))))))
 
      ((eq major-mode 'rmail-mode)
       (save-excursion
@@ -7527,9 +7877,7 @@
 		(subject (mail-fetch-field "subject")))
 	    (setq message-id (org-remove-angle-brackets message-id))
 	    (setq cpltxt (concat author  " on: " subject))
-	    (setq link (concat cpltxt "\n  "
-			       (org-make-link
-				"rmail:" folder "#" message-id)))))))
+	    (setq link (org-make-link "rmail:" folder "#" message-id))))))
 
      ((eq major-mode 'gnus-group-mode)
       (let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus
@@ -7561,10 +7909,8 @@
 		   cpltxt "\n  "
 		   (format "http://groups.google.com/groups?as_umsgid=%s"
 			   (org-fixup-message-id-for-http message-id))))
-	  (setq link (concat cpltxt "\n"
-			     (org-make-link
-			      "gnus:" group
-			      "#" (number-to-string article)))))))
+	  (setq link (org-make-link "gnus:" group
+				    "#" (number-to-string article))))))
 
      ((eq major-mode 'w3-mode)
       (setq cpltxt (url-view-url t)
@@ -7596,7 +7942,8 @@
 		(concat cpltxt "::"
 			(if org-file-link-context-use-camel-case
 			    (org-make-org-heading-camel txt)
-			  (org-make-org-heading-search-string txt))))))
+			  (org-make-org-heading-search-string txt)))
+		desc "NONE")))
       (if (string-match "::\\'" cpltxt)
 	  (setq cpltxt (substring cpltxt 0 -2)))
       (setq link (org-make-link cpltxt)))
@@ -7614,7 +7961,8 @@
 	      (concat cpltxt "::"
 		      (if org-file-link-context-use-camel-case
 			  (org-make-org-heading-camel txt)
-			(org-make-org-heading-search-string txt)))))
+			(org-make-org-heading-search-string txt)))
+	      desc "NONE"))
       (setq link (org-make-link cpltxt)))
 
      ((interactive-p)
@@ -7622,12 +7970,17 @@
 
      (t (setq link nil)))
 
+    (if (consp link) (setq cpltxt (car link) link (cdr link)))
+    (setq link (or link cpltxt)
+	  desc (or desc cpltxt))
+    (if (equal desc "NONE") (setq desc nil))
+
     (if (and (interactive-p) link)
 	(progn
 	  (setq org-stored-links
-		(cons (cons (or cpltxt link) link) org-stored-links))
+		(cons (list cpltxt link desc) org-stored-links))
 	  (message "Stored: %s" (or cpltxt link)))
-      link)))
+      (org-make-link-string link desc))))
 
 (defun org-make-org-heading-search-string (&optional string heading)
   "Make search string for STRING or current headline."
@@ -7675,11 +8028,52 @@
   "Concatenate STRINGS, format resulting string with `org-link-format'."
   (format org-link-format (apply 'concat strings)))
 
-(defun org-make-link2 (link &optional description)
-  "Make a link with brackets."
-  (concat "[[" link "]"
-	  (if description (concat "[" description "]") "")
-	  "]"))
+(defun org-make-link-string (link &optional description)
+  "Make a link with brackets, consisting of LINK and DESCRIPTION."
+  (if (eq org-link-style 'plain)
+      (if (equal description link)
+	  link
+	(concat description "\n" link))
+    (when (stringp description)
+      ;; Remove brackets from the description, they are fatal.
+      (while (string-match "\\[\\|\\]" description)
+	(setq description (replace-match "" t t description))))
+    (when (equal (org-link-escape link) description)
+      ;; No description needed, it is identical
+      (setq description nil))
+    (when (and (not description)
+	       (not (equal link (org-link-escape link))))
+      (setq description link))
+    (concat "[[" (org-link-escape link) "]"
+	    (if description (concat "[" description "]") "")
+	    "]")))
+
+(defconst org-link-escape-chars '(("[" . "%5B") ("]" . "%5D") (" " . "%20"))
+  "Association list of escapes for some characters problematic in links.")
+
+(defun org-link-escape (text)
+  "Escape charaters in TEXT that are problematic for links."
+  (when text
+    (let ((re (mapconcat (lambda (x) (regexp-quote (car x)))
+			 org-link-escape-chars "\\|")))
+      (while (string-match re text)
+	(setq text
+	      (replace-match
+	       (cdr (assoc (match-string 0 text) org-link-escape-chars))
+	       t t text)))
+      text)))
+
+(defun org-link-unescape (text)
+  "Reverse the action of `org-link-escape'."
+  (when text
+    (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x)))
+			 org-link-escape-chars "\\|")))
+      (while (string-match re text)
+	(setq text
+	      (replace-match
+	       (car (rassoc (match-string 0 text) org-link-escape-chars))
+	       t t text)))
+      text)))
 
 (defun org-xor (a b)
   "Exclusive or."
@@ -7728,6 +8122,12 @@
 stored link.  As SPC triggers completion in the minibuffer, you need to
 use M-SPC or C-q SPC to force the insertion of a space character.
 
+You will also be prompted for a description, and if one is given, it will
+be displayed in the buffer instead of the link.
+
+If there is already a link at point, this command will allow you to edit link
+and description parts.
+
 With a \\[universal-argument] prefix, prompts for a file to link to.  The file name can be
 selected using completion.  The path to the file will be relative to
 the current directory if the file is in the current directory or a
@@ -7737,68 +8137,76 @@
 With two \\[universal-argument] prefixes, enforce an absolute path even if the file
 is in the current directory or below."
   (interactive "P")
-  (let ((link (if complete-file
-		  (read-file-name "File: ")
-		(completing-read
-		 "Link: " org-stored-links nil nil nil
-		 org-insert-link-history
-		 (or (car (car org-stored-links))))))
-	linktxt matched)
-    (if (or (not link) (equal link ""))
-      (error "No links available"))
-    (if complete-file
-	(let ((pwd (file-name-as-directory (expand-file-name "."))))
-	  (cond
-	   ((equal complete-file '(16))
-	    (insert
-	     (org-make-link
-	      "file:" (abbreviate-file-name (expand-file-name link)))))
-	   ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)")
-			  (expand-file-name link))
-	    (insert
-	     (org-make-link
-	      "file:" (match-string 1 (expand-file-name link)))))
-	   (t (insert (org-make-link "file:" link)))))
-      (setq linktxt (cdr (assoc link org-stored-links)))
+  (let (link desc entry remove file (pos (point)))
+    (cond
+     ((save-excursion
+	(skip-chars-forward "^]\n\r")
+	(and (re-search-backward "\\[\\[" nil t)
+	     (looking-at org-bracket-link-regexp)
+	     (<= (match-beginning 0) pos)
+	     (>= (match-end 0) pos)))
+      ;; We do have a link at point, and we are going to edit it.
+      (setq remove (list (match-beginning 0) (match-end 0)))
+      (setq desc (if (match-end 3) (org-match-string-no-properties 3)))
+      (setq link (read-string "Link: " 
+			      (org-link-unescape 
+			       (org-match-string-no-properties 1)))))
+     (complete-file
+      ;; Completing read for file names.
+      (setq file (read-file-name "File: "))
+      (let ((pwd (file-name-as-directory (expand-file-name "."))))
+	(cond
+	 ((equal complete-file '(16))
+	  (setq link (org-make-link
+		      "file:"
+		      (abbreviate-file-name (expand-file-name file)))))
+	 ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)")
+			(expand-file-name file))
+	  (setq link  (org-make-link
+		       "file:" (match-string 1 (expand-file-name file)))))
+	 (t (setq link (org-make-link "file:" file))))))
+     (t
+      ;; Read link, with completion for stored links.
+      (setq link (org-completing-read
+		  "Link: " org-stored-links nil nil nil
+		  org-insert-link-history
+		  (or (car (car org-stored-links)))))
+      (setq entry (assoc link org-stored-links))
       (if (not org-keep-stored-link-after-insertion)
 	  (setq org-stored-links (delq (assoc link org-stored-links)
 				       org-stored-links)))
-      (if (not linktxt) (setq link (org-make-link link)))
-      (setq link (or linktxt link))
-      (when (string-match "<\\<file:\\(.+?\\)::\\([^>]+\\)>" link)
-	(let* ((path (match-string 1 link))
-	       (case-fold-search nil)
-	       (search (match-string 2 link)))
-	  (when (save-match-data
-		  (equal (file-truename buffer-file-name)
-			 (file-truename path)))
-	    ;; We are linking to this same file
-	    (if (and org-file-link-context-use-camel-case
-		     (save-match-data
-		       (string-match (concat "^" org-camel-regexp "$") search)))
-		(setq link (replace-match search t t link)
-		      matched t)
-	      (setq link (replace-match (concat "[[" search "]]")
-					t t link)
-		    matched t)))))
-      (let ((lines (org-split-string link "\n")))
-	(insert (car lines))
-	(setq matched (or matched (string-match org-link-regexp (car lines))))
-	(setq lines (cdr lines))
-	(while lines
-	  (insert "\n")
-	  (if (save-excursion
-		(beginning-of-line 0)
-		(looking-at "[ \t]+\\S-"))
-	      (indent-relative))
-	  (setq matched (or matched
-			    (string-match org-link-regexp (car lines))))
-	  (insert (car lines))
-	  (setq lines (cdr lines))))
-      (unless matched
-	(error "Add link type: http(s),ftp,mailto,file,news,bbdb,vm,wl,rmail,gnus, or shell")))))
+      (setq link (if entry (nth 1 entry) link)
+	    desc (or desc (nth 2 entry)))))
+
+    (if (string-match org-plain-link-re link)
+	;; URL-like link, normalize the use of angular brackets.
+	(setq link (org-make-link (org-remove-angle-brackets link))))
+
+    ;; Check if we are linking to the current file. If yes, simplify the link.
+    (when (string-match "\\<file:\\(.+?\\)::\\([^>]+\\)" link)
+      (let* ((path (match-string 1 link))
+	     (case-fold-search nil)
+	     (search (match-string 2 link)))
+	(when (save-match-data
+		(equal (file-truename buffer-file-name)
+		       (file-truename path)))
+	    ;; We are linking to this same file, with a search option
+	  (setq link search))))
+    (setq desc (read-string "Description: " desc))
+    (unless (string-match "\\S-" desc) (setq desc nil))
+    (if remove (apply 'delete-region remove))
+    (insert (org-make-link-string link desc))))
+
+(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)
+    (apply 'completing-read args)))
 
 ;;; Hooks for remember.el
+
+(defvar org-finish-function nil)
+
 ;;;###autoload
 (defun org-remember-annotation ()
   "Return a link to the current location as an annotation for remember.el.
@@ -7815,6 +8223,51 @@
 <left>/<right>    -> before/after current headline, same headings level")
 
 ;;;###autoload
+(defun org-remember-apply-template ()
+  "Initialize *remember* buffer with template, invode `org-mode'.
+This function should be placed into `remember-mode-hook' and in fact requires
+to be run from that hook to fucntion properly."
+  (when org-remember-templates
+    (let* ((entry (if (= (length org-remember-templates) 1)
+		      (cdar org-remember-templates)
+		    (message "Select template: %s"
+			     (mapconcat
+			      (lambda (x) (char-to-string (car x)))
+			      org-remember-templates " "))
+		    (cdr (assoc (read-char-exclusive) org-remember-templates))))
+	   (tpl (if (consp (cdr entry)) (cadr entry) (cdr entry)))
+	   (file (if (consp (cdr entry)) (nth 2 entry)))
+	   (v-t (format-time-string (car org-time-stamp-formats) (org-current-time)))
+	   (v-T (format-time-string (cdr org-time-stamp-formats) (org-current-time)))
+	   (v-u (concat "[" (substring v-t 1 -1) "]"))
+	   (v-U (concat "[" (substring v-T 1 -1) "]"))
+	   (v-a annotation)   ; defined in `remember-mode'
+	   (v-i initial)      ; defined in `remember-mode'
+	   (v-n user-full-name)
+	   )
+      (unless tpl (setq tpl "")	(message "No template") (ding))
+      (insert tpl) (goto-char (point-min))
+      (while (re-search-forward "%\\([tTuTai]\\)" nil t)
+	(when (and initial (equal (match-string 0) "%i"))
+	  (save-match-data
+	    (let* ((lead (buffer-substring
+			  (point-at-bol) (match-beginning 0))))
+	      (setq v-i (mapconcat 'identity
+				     (org-split-string initial "\n")
+				     (concat "\n" lead))))))
+	(replace-match
+	 (or (eval (intern (concat "v-" (match-string 1)))) "")
+	 t t))
+      (let ((org-startup-folded nil)
+	    (org-startup-with-deadline-check nil))
+	(org-mode))
+      (if (and file (string-match "\\S-" file) (not (file-directory-p file)))
+	  (set (make-local-variable 'org-default-notes-file) file))
+      (goto-char (point-min))
+      (if (re-search-forward "%\\?" nil t) (replace-match ""))
+      (set (make-local-variable 'org-finish-function) 'remember-buffer))))
+
+;;;###autoload
 (defun org-remember-handler ()
   "Store stuff from remember.el into an org file.
 First prompts for an org file.  If the user just presses return, the value
@@ -7855,22 +8308,25 @@
 	   (visiting (find-buffer-visiting file))
 	   (org-startup-with-deadline-check nil)
 	   (org-startup-folded nil)
+	   (org-startup-align-all-tables nil)
 	   spos level indent reversed)
       ;; Modify text so that it becomes a nice subtree which can be inserted
       ;; into an org tree.
       (let* ((lines (split-string txt "\n"))
-	     (first (car lines))
-	     (lines (cdr lines)))
+	     first)
+	;; remove empty lines at the beginning
+	(while (and lines (string-match "^[ \t]*\n" (car lines)))
+	  (setq lines (cdr lines)))
+	(setq first (car lines) lines (cdr lines))
 	(if (string-match "^\\*+" first)
 	    ;; Is already a headline
-	    (setq indent (make-string (- (match-end 0) (match-beginning 0)
-					 -1) ?\ ))
+	    (setq indent nil)
 	  ;; We need to add a headline:  Use time and first buffer line
 	  (setq lines (cons first lines)
 		first (concat "* " (current-time-string)
 			      " (" (remember-buffer-desc) ")")
 		indent "  "))
-	(if org-adapt-indentation
+	(if (and org-adapt-indentation indent)
 	    (setq lines (mapcar (lambda (x) (concat indent x)) lines)))
 	(setq txt (concat first "\n"
 			  (mapconcat 'identity lines "\n"))))
@@ -7895,7 +8351,7 @@
 		     (widen)
 		     (goto-char (if reversed (point-min) (point-max)))
 		     (if (not (bolp)) (newline))
-		     (org-paste-subtree (or current-prefix-arg 2) txt)))
+		     (org-paste-subtree 2 txt)))
 		  ((and (org-on-heading-p nil) (not current-prefix-arg))
 		   ;; Put it below this entry, at the beg/end of the subtree
 		   (org-back-to-heading)
@@ -7987,6 +8443,15 @@
 	(org-table-convert)))
    (t (call-interactively 'table-insert))))
 
+(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."
+  (interactive "P")
+  (if (org-region-active-p)
+      (org-table-convert-region (region-beginning) (region-end) arg)
+    (org-table-create arg)))
+
 (defun org-table-create (&optional size)
   "Query for a size and insert a table skeleton.
 SIZE is a string Columns x Rows like for example \"3x2\"."
@@ -8019,12 +8484,13 @@
 	  (goto-char pos)))
     (org-table-align)))
 
-(defun org-table-convert-region (beg0 end0 nspace)
+(defun org-table-convert-region (beg0 end0 &optional nspace)
   "Convert region to a table.
 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)."
+  (interactive "rP")
   (let* ((beg (min beg0 end0))
 	 (end (max beg0 end0))
 	 (tabsep t)
@@ -8110,17 +8576,17 @@
 (defvar org-table-last-alignment nil
   "List of flags for flushright alignment, from the last re-alignment.
 This is being used to correctly align a single field after TAB or RET.")
-;; FIXME:  The following is currently not used.
 (defvar org-table-last-column-widths nil
   "List of max width of fields in each column.
 This is being used to correctly align a single field after TAB or RET.")
 
 (defvar org-last-recalc-line nil)
+(defconst org-narrow-column-arrow "=>"
+  "Used as display property in narrowed table columns.")
 
 (defun org-table-align ()
   "Align the table at point by aligning all vertical bars."
   (interactive)
-  ;; (message "align") (sit-for 2)
   (let* (
 	 ;; Limits of table
 	 (beg (org-table-begin))
@@ -8133,25 +8599,33 @@
 	 column
 	 (indent "") cnt frac
 	 rfmt hfmt
-	 (spaces (if (org-in-invisibility-spec-p '(org-table))
-		     org-table-spaces-around-invisible-separators
-		   org-table-spaces-around-separators))
+	 (spaces '(1 . 1))
 	 (sp1 (car spaces))
 	 (sp2 (cdr spaces))
 	 (rfmt1 (concat
 		 (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|"))
 	 (hfmt1 (concat
 		 (make-string sp2 ?-) "%s" (make-string sp1 ?-) "+"))
-	 emptystrings)
+	 emptystrings xx links narrow fmax fmin f1 len c e)
     (untabify beg end)
-    ;; (message "Aligning table...")
+    (remove-text-properties beg end '(org-cwidth t display t))
+    ;; Check if we have links
+    (goto-char beg)
+    (setq links (re-search-forward org-bracket-link-regexp end t))
+    ;; Make sure the link properties are right FIXME:  Can this be optimized????
+    (when links (goto-char beg) (while (org-activate-bracket-links end)))
+    ;; Check if we are narrowing any columns
+    (goto-char beg)
+    (setq narrow (and org-format-transports-properties-p
+		      (re-search-forward "<[0-9]+>" end t)))
     ;; Get the rows
     (setq lines (org-split-string
-		 (buffer-substring-no-properties beg end) "\n"))
+		 (buffer-substring beg end) "\n"))
     ;; Store the indentation of the first line
     (if (string-match "^ *" (car lines))
 	(setq indent (make-string (- (match-end 0) (match-beginning 0)) ?\ )))
-    ;; Mark the hlines
+    ;; Mark the hlines by setting the corresponding element to nil
+    ;; At the same time, we remove trailing space.
     (setq lines (mapcar (lambda (l)
 			  (if (string-match "^ *|-" l)
 			      nil
@@ -8159,7 +8633,7 @@
 				(substring l 0 (match-beginning 0))
 			      l)))
 			lines))
-    ;; Get the data fields
+    ;; Get the data fields by splitting the lines.
     (setq fields (mapcar
 		  (lambda (l)
 		      (org-split-string l " *| *"))
@@ -8173,28 +8647,62 @@
        (error "Empty table - created default table")))
     ;; A list of empty string to fill any short rows on output
     (setq emptystrings (make-list maxfields ""))
-    ;; Get the maximum length of a field and the most common datatype
-    ;; for each column
+    ;; Check for special formatting.
     (setq i -1)
     (while (< (setq i (1+ i)) maxfields)   ;; Loop over all columns
       (setq column (mapcar (lambda (x) (or (nth i x) "")) fields))
-      ;; maximum length
-      (push (apply 'max 1 (mapcar 'string-width column)) lengths)
-      ;; compute the fraction stepwise, ignoring empty fields
+      ;; Check if there is an explicit width specified
+      (when (and org-table-limit-column-width narrow)
+	(setq c column fmax nil)
+	(while c
+	  (setq e (pop c))
+	  (if (and (stringp e) (string-match "^<\\([0-9]+\\)>$" e))
+	      (setq fmax (string-to-number (match-string 1 e)) c nil)))
+	;; Find fields that are wider than fmax, and shorten them
+	(when fmax
+	  (loop for xx in column do
+		(when (and (stringp xx)
+			   (> (org-string-width xx) fmax))
+		  (org-add-props xx nil
+		    'help-echo
+		    (concat "Clipped table field, use C-c ` to edit. Full value is:\n" (copy-sequence xx)))
+		  (setq f1 (min fmax (or (string-match org-bracket-link-regexp xx) fmax)))
+		  (unless (> f1 1)
+		    (error "Cannot narrow field starting with wide link \"%s\""
+			   (match-string 0 xx)))
+		  (add-text-properties f1 (length xx) (list 'org-cwidth t) xx)
+		  (add-text-properties (- f1 2) f1 
+				       (list 'display org-narrow-column-arrow)
+				       xx)))))
+      ;; Get the maximum width for each column
+      (push (apply 'max 1 (mapcar 'org-string-width column)) lengths)
+      ;; Get the fraction of numbers, to decide about alignment of the column
       (setq cnt 0 frac 0.0)
-      (mapcar
-       (lambda (x)
-	 (if (equal x "")
-	     nil
-	   (setq frac ( / (+ (* frac cnt)
-			     (if (string-match org-table-number-regexp x) 1 0))
-			  (setq cnt (1+ cnt))))))
-       column)
+      (loop for x in column do
+	    (if (equal x "")
+		nil
+	      (setq frac ( / (+ (* frac cnt)
+				(if (string-match org-table-number-regexp x) 1 0))
+			     (setq cnt (1+ cnt))))))
       (push (>= frac org-table-number-fraction) typenums))
-    (setq lengths (nreverse lengths)
-	  typenums (nreverse typenums))
+    (setq lengths (nreverse lengths) typenums (nreverse typenums))
+
+    ;; Store the alignment of this table, for later editing of single fields
     (setq org-table-last-alignment typenums
 	  org-table-last-column-widths lengths)
+
+    ;; With invisible characters, `format' does not get the field width right
+    ;; So we need to make these fields wide by hand.
+    (when links
+      (loop for i from 0 upto (1- maxfields) do
+	    (setq len (nth i lengths))
+	    (loop for j from 0 upto (1- (length fields)) do
+		  (setq c (nthcdr i (car (nthcdr j fields))))
+		  (if (and (stringp (car c))
+			   (string-match org-bracket-link-regexp (car c))
+			   (< (org-string-width (car c)) len))
+		      (setcar c (concat (car c) (make-string (- len (org-string-width (car c))) ?\ )))))))
+
     ;; Compute the formats needed for output of the table
     (setq rfmt (concat indent "|") hfmt (concat indent "|"))
     (while (setq l (pop lengths))
@@ -8203,13 +8711,7 @@
 	    hfmt (concat hfmt (format hfmt1 (make-string l ?-)))))
     (setq rfmt (concat rfmt "\n")
 	  hfmt (concat (substring hfmt 0 -1) "|\n"))
-    ;; Produce the new table
-    ;;(while lines
-    ;;  (setq l (pop lines))
-    ;;  (if l
-    ;;      (setq new (concat new (apply 'format rfmt
-    ;;                                   (append (pop fields) emptystrings))))
-    ;;    (setq new (concat new hfmt))))
+
     (setq new (mapconcat
 	       (lambda (l)
 		 (if l (apply 'format rfmt
@@ -8222,15 +8724,35 @@
     (move-marker org-table-aligned-begin-marker (point))
     (insert new)
     (move-marker org-table-aligned-end-marker (point))
+    (when (and orgtbl-mode (not (eq major-mode 'org-mode)))
+      (goto-char org-table-aligned-begin-marker)
+      (while (org-hide-wide-columns org-table-aligned-end-marker)))
     ;; Try to move to the old location (approximately)
     (goto-line linepos)
     (set-window-start (selected-window) winstart 'noforce)
     (org-table-goto-column colpos)
     (setq org-table-may-need-update nil)
-    (if (org-in-invisibility-spec-p '(org-table))
-	(org-table-add-invisible-to-vertical-lines))
     ))
 
+(defun org-string-width (s)
+  "Compute width of string, ignoring invisible characters.
+This ignores character with invisibility property `org-link', and also
+characters with property `org-cwidth', because these will become invisible
+upon the next fontification round."
+  (let (b)
+    (when (or (eq t buffer-invisibility-spec)
+	      (assq 'org-link buffer-invisibility-spec))
+      (while (setq b (text-property-any 0 (length s)
+					'invisible 'org-link s))
+	(setq s (concat (substring s 0 b)
+			(substring s (or (next-single-property-change
+					  b 'invisible s) (length s)))))))
+    (while (setq b (text-property-any 0 (length s) 'org-cwidth t s))
+      (setq s (concat (substring s 0 b)
+		      (substring s (or (next-single-property-change
+					b 'org-cwidth s) (length s))))))
+    (string-width s)))
+
 (defun org-table-begin (&optional table-type)
   "Find the beginning of the table and return its position.
 With argument TABLE-TYPE, go to the beginning of a table.el-type table."
@@ -8261,10 +8783,7 @@
 Optional argument NEW may specify text to replace the current field content."
   (cond
    ((and (not new) org-table-may-need-update)) ; Realignment will happen anyway
-   ((org-at-table-hline-p)
-    ;; FIXME:  I used to enforce realign here, but I think this is not needed.
-    ;; (setq org-table-may-need-update t)
-    )
+   ((org-at-table-hline-p))
    ((and (not new)
 	 (or (not (equal (marker-buffer org-table-aligned-begin-marker)
 			 (current-buffer)))
@@ -8275,7 +8794,7 @@
    (t ;; realign the current field, based on previous full realign
     (let* ((pos (point)) s
 	   (col (org-table-current-column))
-	   (num (nth (1- col) org-table-last-alignment))
+	   (num (if (> col 0) (nth (1- col) org-table-last-alignment)))
 	   l f n o e)
       (when (> col 0)
 	(skip-chars-backward "^|\n")
@@ -8435,7 +8954,7 @@
     (if (looking-at "|[^|\n]+")
 	(let* ((pos (match-beginning 0))
 	       (match (match-string 0))
-	       (len (string-width match)))
+	       (len (org-string-width match)))
 	  (replace-match (concat "|" (make-string (1- len) ?\ )))
 	  (goto-char (+ 2 pos))
 	  (substring match 1)))))
@@ -8693,21 +9212,13 @@
   (interactive "P")
   (if (not (org-at-table-p))
       (error "Not at a table"))
-  (let* ((line
-	  (org-expand-wide-chars
-	   (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
-	 new)
-    (if (string-match "^[ \t]*|-" line)
-	(setq new (mapcar (lambda (x) (if (member x '(?| ?+)) ?| ?\ )) line))
-      (setq new (mapcar (lambda (x) (if (equal x ?|) ?| ?\ )) line)))
+  (let* ((line (buffer-substring (point-at-bol) (point-at-eol)))
+	 (new (org-table-clean-line line)))
     ;; Fix the first field if necessary
-    (setq new (concat new))
     (if (string-match "^[ \t]*| *[#$] *|" line)
 	(setq new (replace-match (match-string 0 line) t t new)))
     (beginning-of-line (if arg 2 1))
-    (let (org-table-may-need-update)
-      (insert-before-markers new)
-      (insert-before-markers "\n"))
+    (let (org-table-may-need-update) (insert-before-markers new "\n"))
     (beginning-of-line 0)
     (re-search-forward "| ?" (point-at-eol) t)
     (and org-table-may-need-update (org-table-align))))
@@ -8718,39 +9229,31 @@
   (interactive "P")
   (if (not (org-at-table-p))
       (error "Not at a table"))
-  (let ((line
-	 (org-expand-wide-chars
-	  (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
-	(col (current-column))
-	start)
-    (if (string-match "^[ \t]*|-" line)
-	(setq line
-	      (mapcar (lambda (x) (if (member x '(?| ?+))
-				      (prog1 (if start ?+ ?|) (setq start t))
-				    (if start ?- ?\ )))
-		      line))
-      (setq line
-	    (mapcar (lambda (x) (if (equal x ?|)
-				    (prog1 (if start ?+ ?|) (setq start t))
-				    (if start ?- ?\ )))
-		    line)))
+  (let ((line (org-table-clean-line
+	       (buffer-substring (point-at-bol) (point-at-eol))))
+	(col (current-column)))
+    (while (string-match "|\\( +\\)|" line)
+      (setq line (replace-match 
+		  (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))
-    (apply 'insert line)
-    (if (equal (char-before (point)) ?+)
-	(progn (backward-delete-char 1) (insert "|")))
-    (insert "\n")
+    (insert line "\n")
     (beginning-of-line (if arg 1 -1))
     (move-to-column col)))
 
-(defun org-expand-wide-chars (s)
-  "Expand wide characters to spaces."
-  (let (w a)
-    (mapconcat
-     (lambda (x)
-       (if (> (setq w (string-width (setq a (char-to-string x)))) 1)
-	   (make-string w ?\ )
-	 a))
-     s "")))
+(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."
+  (if (string-match "^[ \t]*|-" s)
+      ;; It's a hline, just map the characters
+      (setq s (mapcar (lambda (x) (if (member x '(?| ?+)) ?| ?\ )) s))
+    (while (string-match "|\\([ \t]*?[^ \t\r\n|][^\r\n|]*\\)|" s)
+      (setq s (replace-match
+	       (concat "|" (make-string (org-string-width (match-string 1 s))
+					?\ ) "|")
+	       t t s)))
+    s))
 
 (defun org-table-kill-row ()
   "Delete the current row or horizontal line from the table."
@@ -8982,6 +9485,64 @@
 	  (insert (org-trim s) " ")
 	  (org-table-align))))))
 
+(defvar org-field-marker nil)
+
+(defun org-table-edit-field (arg)
+  "Edit table field in a different window.
+This is mainly useful for fields that contain hidden parts.
+When called with a \\[universal-argument] prefix, just make the full field visible so that
+it can be edited in place."
+  (interactive "P")
+  (if arg
+      (let ((b (save-excursion (skip-chars-backward "^|") (point)))
+	    (e (save-excursion (skip-chars-forward "^|\r\n") (point))))
+	(remove-text-properties b e '(org-cwidth t invisible t
+						 display t intangible t))
+	(if (and (boundp 'font-lock-mode) font-lock-mode)
+	    (font-lock-fontify-block)))
+    (let ((pos (move-marker (make-marker) (point)))
+	  (field (org-table-get-field))
+	  (cw (current-window-configuration))
+	  p)
+      (switch-to-buffer-other-window "*Org tmp*")
+      (erase-buffer)
+      (insert "#\n# Edit field and finish with C-c C-c\n#\n")
+      (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)
+      (set (make-local-variable 'org-finish-function)
+	   'org-table-finish-edit-field)
+      (set (make-local-variable 'org-window-configuration) cw)
+      (set (make-local-variable 'org-field-marker) pos)
+      (message "Edit and finish with C-c C-c"))))
+
+(defun org-table-finish-edit-field ()
+  "Finish editing a table data field.
+Remove all newline characters, insert the result into the table, realign
+the table and kill the editing buffer."
+  (let ((pos org-field-marker)
+	(cw org-window-configuration)
+	(cb (current-buffer))
+	text)
+    (goto-char (point-min))
+    (while (re-search-forward "^#.*\n?" nil t) (replace-match ""))
+    (while (re-search-forward "\\([ \t]*\n[ \t]*\\)+" nil t)
+      (replace-match " "))
+    (setq text (org-trim (buffer-string)))
+    (set-window-configuration cw)
+    (kill-buffer cb)
+    (select-window (get-buffer-window (marker-buffer pos)))
+    (goto-char pos)
+    (move-marker pos nil)
+    (org-table-check-inside-data-field)
+    (org-table-get-field nil text)
+    (org-table-align)
+    (message "New field value inserted")))
+
 (defun org-trim (s)
   "Remove whitespace at beginning and end of string."
   (if (string-match "^[ \t]+" s) (setq s (replace-match "" t t s)))
@@ -8997,7 +9558,7 @@
 many lines, whatever width that takes.
 The return value is a list of lines, without newlines at the end."
   (let* ((words (org-split-string string "[ \t\n]+"))
-	 (maxword (apply 'max (mapcar 'string-width words)))
+	 (maxword (apply 'max (mapcar 'org-string-width words)))
 	 w ll)
     (cond (width
 	   (org-do-wrap words (max maxword width)))
@@ -9024,7 +9585,6 @@
       (setq lines (push line lines)))
     (nreverse lines)))
 
-;; FIXME: I think I can make this more efficient
 (defun org-split-string (string &optional separators)
   "Splits STRING into substrings at SEPARATORS.
 No empty strings are returned if there are matches at the beginning
@@ -9053,49 +9613,6 @@
 		    list)))
     (nreverse list)))
 
-(defun org-table-add-invisible-to-vertical-lines ()
-  "Add an `invisible' property to vertical lines of current table."
-  (interactive)
-  (let* ((beg (org-table-begin))
-	 (end (org-table-end))
-	 (end1))
-    (save-excursion
-      (goto-char beg)
-      (while (< (point) end)
-	(setq end1 (point-at-eol))
-	(if (looking-at org-table-dataline-regexp)
-	    (while (re-search-forward "|" end1 t)
-	      (add-text-properties (1- (point)) (point)
-				   '(invisible org-table)))
-	  (while (re-search-forward "[+|]" end1 t)
-	    (add-text-properties (1- (point)) (point)
-				 '(invisible org-table))))
-	(beginning-of-line 2)))))
-
-(defun org-table-toggle-vline-visibility (&optional arg)
-  "Toggle the visibility of table vertical lines.
-The effect is immediate and on all tables in the file.
-With prefix ARG, make lines invisible when ARG is positive, make lines
-visible when ARG is not positive."
-  (interactive "P")
-  (let ((action (cond
-		 ((and arg (> (prefix-numeric-value arg) 0)) 'on)
-		 ((and arg (< (prefix-numeric-value arg) 1)) 'off)
-		 (t (if (org-in-invisibility-spec-p '(org-table))
-			'off
-		      'on)))))
-    (if (eq action 'off)
-	(progn
-	  (org-remove-from-invisibility-spec '(org-table))
-	  (org-table-map-tables 'org-table-align)
-	  (message "Vertical table lines visible")
-	  (if (org-at-table-p)
-	      (org-table-align)))
-      (org-add-to-invisibility-spec '(org-table))
-      (org-table-map-tables 'org-table-align)
-      (message "Vertical table lines invisible"))
-    (redraw-frame (selected-frame))))
-
 (defun org-table-map-tables (function)
   "Apply FUNCTION to the start of all tables in the buffer."
   (save-excursion
@@ -9107,7 +9624,8 @@
 	(beginning-of-line 1)
 	(if (looking-at org-table-line-regexp)
 	    (save-excursion (funcall function)))
-	(re-search-forward org-table-any-border-regexp nil 1)))))
+	(re-search-forward org-table-any-border-regexp nil 1))))
+  (message "Mapping tables: done"))
 
 (defun org-table-sum (&optional beg end nlast)
   "Sum numbers in region of current table column.
@@ -9362,13 +9880,13 @@
      ((eq action 'swap)
       (setq col1 (car columns) col2 (nth 1 columns)
 	    sc1 (int-to-string col1) sc2 (int-to-string col2))
-      ;; Hopefully, ZqZ will never be a name in a table...  FIXME:
-      (org-table-replace-in-formulas list sc1 "ZqZ")
+      ;; Hopefully, ZqZtZ will never be a name in a table
+      (org-table-replace-in-formulas list sc1 "ZqZtZ")
       (org-table-replace-in-formulas list sc2 sc1)
-      (org-table-replace-in-formulas list "ZqZ" sc2)
-      (if (assoc sc1 list) (setcar (assoc sc1 list) "ZqZ"))
+      (org-table-replace-in-formulas list "ZqZtZ" sc2)
+      (if (assoc sc1 list) (setcar (assoc sc1 list) "ZqZtZ"))
       (if (assoc sc2 list) (setcar (assoc sc2 list) sc1))
-      (if (assoc "ZqZ" list)  (setcar (assoc "ZqZ" list) sc2)))
+      (if (assoc "ZqZtZ" list)  (setcar (assoc "ZqZtZ" list) sc2)))
      (t (error "Invalid action in `org-table-modify-formulas'")))
     (if list (org-table-store-formulas list))))
 
@@ -9681,7 +10199,8 @@
 			    (org-table-align)))))
 
 (defun org-table-recalculate (&optional all noalign)
-  "Recalculate the current table line by applying all stored formulas."
+  "Recalculate the current table line by applying all stored formulas.
+With prefix arg ALL, do this for all lines in the table."
   (interactive "P")
   (or (memq this-command org-recalc-commands)
       (setq org-recalc-commands (cons this-command org-recalc-commands)))
@@ -9797,7 +10316,6 @@
 (define-key org-edit-formulas-map "\C-c?" 'org-show-variable)
 
 (defvar org-pos)
-(defvar org-window-configuration)
 
 (defun org-table-edit-formulas ()
   "Edit the formulas of the current table in a separate buffer."
@@ -9949,20 +10467,6 @@
 ;; active, this binding is ignored inside tables and replaced with a
 ;; modified self-insert.
 
-(defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized)
-  "Non-nil means, use the optimized table editor version for `orgtbl-mode'.
-In the optimized version, the table editor takes over all simple keys that
-normally just insert a character.  In tables, the characters are inserted
-in a way to minimize disturbing the table structure (i.e. in overwrite mode
-for empty fields).  Outside tables, the correct binding of the keys is
-restored.
-
-The default for this option is t if the optimized version is also used in
-Org-mode.  See the variable `org-enable-table-editor' for details.  Changing
-this variable requires a restart of Emacs to become effective."
-  :group 'org-table
-  :type 'boolean)
-
 (defvar orgtbl-mode nil
   "Variable controlling `orgtbl-mode', a minor mode enabling the `org-mode'
 table editor in arbitrary modes.")
@@ -10002,13 +10506,29 @@
 	       (if auto-fill-inhibit-regexp
 		   (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp)
 		 "[ \t]*|"))
+	  (org-add-to-invisibility-spec '(org-cwidth))
 	  (easy-menu-add orgtbl-mode-menu)
 	  (run-hooks 'orgtbl-mode-hook))
       (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
+      (org-cleanup-narrow-column-properties)
+      (org-remove-from-invisibility-spec '(org-cwidth))
       (remove-hook 'before-change-functions 'org-before-change-function t)
       (easy-menu-remove orgtbl-mode-menu)
       (force-mode-line-update 'all))))
 
+(defun org-cleanup-narrow-column-properties ()
+  "Remove all properties related to narrow-column invisibility."
+  (let ((s 1))
+    (while (setq s (text-property-any s (point-max)
+				      'display org-narrow-column-arrow))
+      (remove-text-properties s (1+ s) '(display t)))
+    (setq s 1)
+    (while (setq s (text-property-any s (point-max) 'org-cwidth 1))
+      (remove-text-properties s (1+ s) '(org-cwidth t)))
+    (setq s 1)
+    (while (setq s (text-property-any s (point-max) 'invisible 'org-cwidth))
+      (remove-text-properties s (1+ s) '(invisible t)))))
+
 ;; Install it as a minor mode.
 (put 'orgtbl-mode :included t)
 (put 'orgtbl-mode :menu-tag "Org Table Mode")
@@ -10069,10 +10589,11 @@
 	  '("\C-c?"              org-table-current-column)
 	  '("\C-c "              org-table-blank-field)
 	  '("\C-c+"              org-table-sum)
-	  '("\C-c|"              org-table-toggle-vline-visibility)
 	  '("\C-c="              org-table-eval-formula)
 	  '("\C-c'"              org-table-edit-formulas)
+	  '("\C-c`"              org-table-edit-field)
 	  '("\C-c*"              org-table-recalculate)
+	  '("\C-c|"              org-table-create-or-convert-from-region)
 	  '("\C-c^"              org-table-sort-lines)
 	  '([(control ?#)]       org-table-rotate-recalc-marks)))
 	elt key fun cmd)
@@ -10100,8 +10621,8 @@
       ;; some standard editing functions
       (org-remap orgtbl-mode-map
 		 'self-insert-command 'orgtbl-self-insert-command
-		 'delete-char 'orgtbl-delete-char
-		 'delete-backward-char 'orgtbl-delete-backward-char)
+		 'delete-char 'org-delete-char
+		 'delete-backward-char 'org-delete-backward-char)
       (define-key orgtbl-mode-map "|" 'org-force-self-insert))
     (easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu"
       '("OrgTbl"
@@ -10111,6 +10632,7 @@
 	["Next Row" org-return :active (org-at-table-p) :keys "RET"]
 	"--"
 	["Blank Field" org-table-blank-field :active (org-at-table-p) :keys "C-c SPC"]
+	["Edit Field" org-table-edit-field :active (org-at-table-p) :keys "C-c ` "]
 	["Copy Field from Above"
 	 org-table-copy-down :active (org-at-table-p) :keys "S-RET"]
 	"--"
@@ -10118,7 +10640,9 @@
 	 ["Move Column Left" org-metaleft :active (org-at-table-p) :keys "M-<left>"]
 	 ["Move Column Right" org-metaright :active (org-at-table-p) :keys "M-<right>"]
 	 ["Delete Column" org-shiftmetaleft :active (org-at-table-p) :keys "M-S-<left>"]
-	 ["Insert Column" org-shiftmetaright :active (org-at-table-p) :keys "M-S-<right>"])
+	 ["Insert Column" org-shiftmetaright :active (org-at-table-p) :keys "M-S-<right>"]
+	 "--"
+	 ["Enable Narrowing" (setq org-table-limit-column-width (not org-table-limit-column-width)) :active (org-at-table-p) :selected org-table-limit-column-width :style toggle])
 	("Row"
 	 ["Move Row Up" org-metaup :active (org-at-table-p) :keys "M-<up>"]
 	 ["Move Row Down" org-metadown :active (org-at-table-p) :keys "M-<down>"]
@@ -10148,11 +10672,12 @@
 	))
     t)
 
-(defun orgtbl-tab ()
+(defun orgtbl-tab (arg)
   "Justification and field motion for `orgtbl-mode'."
-  (interactive)
-  (org-table-justify-field-maybe)
-  (org-table-next-field))
+  (interactive "P")
+  (if arg (org-table-edit-field t)
+    (org-table-justify-field-maybe)
+    (org-table-next-field)))
 
 (defun orgtbl-ret ()
   "Justification and field motion for `orgtbl-mode'."
@@ -10193,43 +10718,6 @@
   (interactive "p")
   (self-insert-command N))
 
-(defun orgtbl-delete-backward-char (N)
-  "Like `delete-backward-char', insert whitespace at field end in tables.
-When deleting backwards, in tables this function will insert whitespace in
-front of the next \"|\" separator, to keep the table aligned.  The table will
-still be marked for re-alignment, because a narrow field may lead to a
-reduced column width."
-  (interactive "p")
-  (if (and (org-at-table-p)
-	   (eq N 1)
-	   (string-match "|" (buffer-substring (point-at-bol) (point)))
-	   (looking-at ".*?|"))
-      (let ((pos (point)))
-	(backward-delete-char N)
-	(skip-chars-forward "^|")
-	(insert " ")
-	(goto-char (1- pos)))
-    (delete-backward-char N)))
-
-(defun orgtbl-delete-char (N)
-  "Like `delete-char', but insert whitespace at field end in tables.
-When deleting characters, in tables this function will insert whitespace in
-front of the next \"|\" separator, to keep the table aligned.  The table
-will still be marked for re-alignment, because a narrow field may lead to
-a reduced column width."
-  (interactive "p")
-  (if (and (org-at-table-p)
-	   (not (bolp))
-	   (not (= (char-after) ?|))
-	   (eq N 1))
-      (if (looking-at ".*?|")
-	  (let ((pos (point)))
-	    (replace-match (concat
-			    (substring (match-string 0) 1 -1)
-			    " |"))
-	    (goto-char pos)))
-    (delete-char N)))
-
 ;;; Exporting
 
 (defconst org-level-max 20)
@@ -10576,6 +11064,8 @@
   (let* ((cb (current-buffer))
 	 (re-radio (and org-target-link-regexp
 			(concat "\\([^<]\\)\\(" org-target-link-regexp "\\)")))
+	 (re-plain-link (concat "\\([^[<]\\)" org-plain-link-re))
+	 (re-angle-link (concat "\\([^[]\\)" org-angle-link-re))
 	 rtn)
     (save-excursion
       (set-buffer (get-buffer-create " org-mode-tmp"))
@@ -10587,16 +11077,30 @@
       (goto-char (point-min))
       (while (re-search-forward "^#.*?\\(<<<?[^>\r\n]+>>>?\\).*" nil t)
 	(replace-match "\\1(INVISIBLE)"))
-      ;; Find matches for radio targets and turn them into links
+      ;; Find matches for radio targets and turn them into internal links
       (goto-char (point-min))
       (when re-radio
 	(while (re-search-forward re-radio nil t)
 	  (replace-match "\\1[[\\2]]")))
       ;; Find all links that contain a newline and put them into a single line
       (goto-char (point-min))
-      (while (re-search-forward "\\(\\[\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\]\\)" nil t)
-	(replace-match "\\1 \\2")
+      (while (re-search-forward "\\(\\(\\[\\|\\]\\)\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\(\\[\\|\\]\\)\\)" nil t)
+	(replace-match "\\1 \\3")
 	(goto-char (match-beginning 0)))
+      ;; Normalize links: Convert angle and plain links into bracket links
+      (goto-char (point-min))
+      (while (re-search-forward re-plain-link nil t)
+	(replace-match
+	 (concat 
+	  (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]")
+	 t t))
+      (goto-char (point-min))
+      (while (re-search-forward re-angle-link nil t)
+	(replace-match
+	 (concat 
+	  (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]")
+	 t t))
+
       ;; Remove comments
       (goto-char (point-min))
       (while (re-search-forward "^#.*\n?" nil t)
@@ -10683,7 +11187,7 @@
 	 (buffer (find-file-noselect filename))
 	 (levels-open (make-vector org-level-max nil))
 	 (date  (format-time-string "%Y/%m/%d" (current-time)))
-	 (time  (format-time-string "%X" (current-time)))
+	 (time  (format-time-string "%X" (org-current-time)))
 	 (author      user-full-name)
 	 (title       (buffer-name))
 	 (options     nil)
@@ -10742,7 +11246,8 @@
 					  (not (equal (match-string 2 line)
 						      org-done-string)))
 					; TODO, not DONE
-				     (and (= level umax)
+				     (and org-export-mark-todo-in-toc
+					  (= level umax)
 					  (org-search-todo-below
 					   line lines level))))
 			   (setq txt (org-html-expand-for-ascii txt))
@@ -10800,7 +11305,7 @@
 	      (if todo (throw 'exit t))))))))
 
 ;; FIXME: Try to handle <b> and <i> as faces via text properties.
-;; FIXME: Can I implement *bold*,/italic/ and _underline_ for ASCII export?
+;; We could also implement *bold*,/italic/ and _underline_ for ASCII export
 (defun org-html-expand-for-ascii (line)
   "Handle quoted HTML for ASCII export."
   (if org-export-html-expand
@@ -10896,7 +11401,7 @@
 #+CATEGORY:  %s
 #+SEQ_TODO:  %s
 #+TYP_TODO:  %s
-#+STARTUP:   %s %s %s %s
+#+STARTUP:   %s %s %s %s %s
 #+ARCHIVE:   %s
 "
    (buffer-name) (user-full-name) user-mail-address org-export-default-language
@@ -10918,10 +11423,11 @@
        (mapconcat 'identity org-todo-keywords " ")
      "Me Jason Marie DONE")
    (cdr (assoc org-startup-folded
-	       '((nil . "nofold")(t . "fold")(content . "content"))))
+	       '((nil . "showall") (t . "overview") (content . "content"))))
    (if org-startup-with-deadline-check "dlcheck" "nodlcheck")
    (if org-odd-levels-only "odd" "oddeven")
    (if org-hide-leading-stars "hidestars" "showstars")
+   (if org-startup-align-all-tables "align" "noalign")
    org-archive-location
    ))
 
@@ -11023,7 +11529,7 @@
          (buffer (find-file-noselect filename))
          (levels-open (make-vector org-level-max nil))
 	 (date (format-time-string "%Y/%m/%d" (current-time)))
-	 (time  (format-time-string "%X" (current-time)))
+	 (time  (format-time-string "%X" (org-current-time)))
          (author      user-full-name)
 	 (title       (buffer-name))
          (options     nil)
@@ -11052,6 +11558,7 @@
 	 table-open type
 	 table-buffer table-orig-buffer
 	 ind start-is-num starter
+	 rpl path desc desc1 desc2 link
 	 )
     (message "Exporting...")
 
@@ -11118,7 +11625,8 @@
 					    (not (equal (match-string 2 line)
 							org-done-string)))
 					; TODO, not DONE
-				       (and (= level umax)
+				       (and org-export-mark-todo-in-toc
+					    (= level umax)
 					    (org-search-todo-below
 					     line lines level))))
 			     (if org-export-with-section-numbers
@@ -11200,7 +11708,7 @@
 	    (cond
 	     ((match-end 2)
 	      (setq line (replace-match
-			  (concat "@<a name=\"" 
+			  (concat "@<a name=\""
 				  (org-solidify-link-text (match-string 1 line))
 				  "\">\\nbsp@</a>")
 			  t t line)))
@@ -11211,28 +11719,10 @@
 			  t t line)))
 	     (t
 	      (setq line (replace-match
-			  (concat "@<a name=\"" 
+			  (concat "@<a name=\""
 				  (org-solidify-link-text (match-string 1 line))
 				  "\" class=\"target\">" (match-string 1 line) "@</a> ")
-			  t t line)))))	      
-	  ;; Replace internal links
-	  (while (string-match org-bracket-link-regexp line)
-	    (setq line (replace-match
-			(concat
-			    "@<a href=\"#"
-			    (org-solidify-link-text (match-string 1 line) target-alist)
-			    "\">"
-			    (match-string (if (match-end 3) 3 1) line)
-			    "@</a>")
-			t t line)))
-
-	  ;; Protect the external links
-	  (setq start 0)
-	  (while (string-match org-link-maybe-angles-regexp line start)
-	    (setq start (match-end 0))
-	    (setq line (replace-match
-			(concat "\000" (match-string 1 line) "\000")
-			t t line)))
+			  t t line)))))
 
 	  ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"
 	  ;; handle @<..> HTML tags (replace "@&gt;..&lt;" by "<..>")
@@ -11240,19 +11730,27 @@
 
 	  ;; Format the links
 	  (setq start 0)
-	  (while (string-match org-protected-link-regexp line start)
-	    (setq start (- (match-end 0) 2))
-	    (setq type (match-string 1 line))
+	  (while (string-match org-bracket-link-analytic-regexp line start)
+	    (setq start (match-beginning 0))
+	    (setq type (if (match-end 2) (match-string 2 line) "internal"))
+	    (setq path (match-string 3 line))
+	    (setq desc1 (if (match-end 5) (match-string 5 line))
+		  desc2 (if (match-end 2) (concat type ":" path) path)
+		  desc (or desc1 desc2))
 	    (cond
+	     ((equal type "internal")
+	      (setq rpl
+		    (concat
+		     "<a href=\"#"
+		     (org-solidify-link-text path target-alist)
+		     "\">" desc "</a>")))
 	     ((member type '("http" "https" "ftp" "mailto" "news"))
 	      ;; standard URL
-	      (setq line (replace-match
-					;                          "<a href=\"\\1:\\2\">&lt;\\1:\\2&gt;</a>"
-			  "<a href=\"\\1:\\2\">\\1:\\2</a>"
-			  nil nil line)))
+	      (setq link (concat type ":" path))
+	      (setq rpl (concat "<a href=\"" link "\">" desc "</a>")))
 	     ((string= type "file")
 	      ;; FILE link
-	      (let* ((filename (match-string 2 line))
+	      (let* ((filename path)
 		     (abs-p (file-name-absolute-p filename))
 		     (thefile (if abs-p (expand-file-name filename) filename))
 		     (thefile (save-match-data
@@ -11262,17 +11760,15 @@
 		     (file-is-image-p
 		      (save-match-data
 			(string-match (org-image-file-name-regexp) thefile))))
-		(setq line (replace-match
-			    (if (and org-export-html-inline-images
-				     file-is-image-p)
-				(concat "<img src=\"" thefile "\"/>")
-			      (concat "<a href=\"" thefile "\">\\1:\\2</a>"))
-			    nil nil line))))
-
+		(setq rpl (if (and org-export-html-inline-images
+				   file-is-image-p)
+			      (concat "<img src=\"" thefile "\"/>")
+			    (concat "<a href=\"" thefile "\">" desc "</a>")))))
 	     ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell"))
-	      (setq line (replace-match
-			  "<i>&lt;\\1:\\2&gt;</i>" nil nil line)))))
-
+	      (setq rpl (concat "<i>&lt;" type ":" path "&gt;</i>"))))
+	    ;; FIXME: We get to see the escaped links!!!!!
+	    (setq line (replace-match rpl t t line)
+		  start (+ start (length rpl))))
 	  ;; TODO items
 	  (if (and (string-match org-todo-line-regexp line)
 		   (match-beginning 2))
@@ -11330,8 +11826,7 @@
 	      (insert (org-format-table-html table-buffer table-orig-buffer))))
 	   (t
 	    ;; Normal lines
-	    (when (and (> org-export-plain-list-max-depth 0)
-		       (string-match
+	    (when (and (string-match
 			(cond
 			 ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+[.)]\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)")
 			 ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+\\.\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)")
@@ -11355,9 +11850,7 @@
 	      (cond
 	       ((and starter
 		     (or (not in-local-list)
-			 (> ind (car local-list-indent)))
-		     (< (length local-list-indent)
-			org-export-plain-list-max-depth))
+			 (> ind (car local-list-indent))))
 		;; Start new (level of ) list
 		(insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n"))
 		(push start-is-num local-list-num)
@@ -11541,32 +12034,38 @@
   s)
 
 (defun org-html-expand (string)
-  "Prepare STRING for HTML export.  Applies all active conversions."
-  ;; First check if there is a link in the line - if yes, apply conversions
-  ;; only before the start of the link.
-  ;; FIXME: This is no longer correct, because links now have an end.
-  (let* ((m (string-match org-link-regexp string))
-	 (s (if m (substring string 0 m) string))
-	 (r (if m (substring string m) "")))
-    ;; convert & to &amp;, < to &lt; and > to &gt;
-    (setq s (org-html-protect s))
-    (if org-export-html-expand
-	(while (string-match "@&lt;\\([^&]*\\)&gt;" s)
-	  (setq s (replace-match "<\\1>" nil nil s))))
-    (if org-export-with-emphasize
-	(setq s (org-export-html-convert-emphasize s)))
-    (if org-export-with-sub-superscripts
-	(setq s (org-export-html-convert-sub-super s)))
-    (if org-export-with-TeX-macros
-	(let ((start 0) wd ass)
-	  (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)" s start))
-	    (setq wd (match-string 1 s))
-	    (if (setq ass (assoc wd org-html-entities))
-		(setq s (replace-match (or (cdr ass)
-					   (concat "&" (car ass) ";"))
-				       t t s))
-	      (setq start (+ start (length wd)))))))
-    (concat s r)))
+  "Prepare STRING for HTML export.  Applies all active conversions.
+If there are links in the string, don't modify these."
+  (let* (m s l res)
+    (while (setq m (string-match org-bracket-link-regexp string))
+      (setq s (substring string 0 m)
+	    l (match-string 0 string)
+	    string (substring string (match-end 0)))
+      (push (org-html-do-expand s) res)
+      (push l res))
+    (push (org-html-do-expand string) res)
+    (apply 'concat (nreverse res))))
+
+(defun org-html-do-expand (s)
+  "Apply all active conversions to translate special ASCII to HTML."
+  (setq s (org-html-protect s))
+  (if org-export-html-expand
+      (while (string-match "@&lt;\\([^&]*\\)&gt;" s)
+	(setq s (replace-match "<\\1>" nil nil s))))
+  (if org-export-with-emphasize
+      (setq s (org-export-html-convert-emphasize s)))
+  (if org-export-with-sub-superscripts
+      (setq s (org-export-html-convert-sub-super s)))
+  (if org-export-with-TeX-macros
+      (let ((start 0) wd ass)
+	(while (setq start (string-match "\\\\\\([a-zA-Z]+\\)" s start))
+	  (setq wd (match-string 1 s))
+	  (if (setq ass (assoc wd org-html-entities))
+	      (setq s (replace-match (or (cdr ass)
+					 (concat "&" (car ass) ";"))
+				     t t s))
+	    (setq start (+ start (length wd)))))))
+  s)
 
 (defun org-create-multibrace-regexp (left right n)
   "Create a regular expression which will match a balanced sexp.
@@ -11613,25 +12112,14 @@
   string)
 
 (defun org-export-html-convert-emphasize (string)
-  (while (string-match
-	  "\\(\\s-\\|^\\)\\(\\*\\([a-zA-Z]+\\)\\*\\)\\([^a-zA-Z*]\\|$\\)"
-	  string)
-    (setq string (replace-match
-		  (concat "<b>" (match-string 3 string) "</b>")
-		  t t string 2)))
-  (while (string-match
-	  "\\(\\s-\\|^\\)\\(/\\([a-zA-Z]+\\)/\\)\\([^a-zA-Z*]\\|$\\)"
-	  string)
-    (setq string (replace-match
-		  (concat "<i>" (match-string 3 string) "</i>")
-		  t t string 2)))
-  (while (string-match
-	  "\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)"
-	  string)
-    (setq string (replace-match
-		  (concat "<u>" (match-string 3 string) "</u>")
-		  t t string 2)))
-  string)
+  (let (c (s 0))
+    (while (string-match "\\(\\W\\|^\\)\\([*/_]\\)\\(\\w+\\)\\2\\(\\W\\|$\\)" string s)
+      (setq c (cdr (assoc (match-string 2 string)
+			  '(("*" . "b") ("/" . "i") ("_" . "u"))))
+	    s (+ (match-end 0) 3)
+	    string (replace-match
+		    (concat "\\1<" c ">\\3</" c ">\\4") t nil string)))
+    string))
 
 (defun org-parse-key-lines ()
   "Find the special key lines with the information for exporters."
@@ -11755,20 +12243,103 @@
   (interactive)
   (org-export-icalendar nil buffer-file-name))
 
+(defun org-export-as-xml ()
+  "Export current buffer as XOXO XML buffer."
+  (interactive)
+  (cond ((eq org-export-xml-type 'xoxo)
+	 (org-export-as-xoxo (current-buffer)))))
+
+(defun org-export-as-xoxo-insert-into (buffer &rest output)
+  (with-current-buffer buffer
+    (apply 'insert output)))
+
+(defun org-export-as-xoxo (&optional buffer)
+  "Export the org buffer as XOXO.
+The XOXO buffer is named *xoxo-<source buffer name>*"
+  (interactive (list (current-buffer)))
+  ;; A quickie abstraction
+
+  ;; Output everything as XOXO
+  (with-current-buffer (get-buffer buffer)
+    (goto-char (point-min))  ;; CD:  beginning-of-buffer is not allowed.
+    (let* ((filename (concat (file-name-sans-extension buffer-file-name)
+			     ".xml"))
+	   (out (find-file-noselect filename))
+	   (last-level 1)
+	   (hanging-li nil))
+      ;; Check the output buffer is empty.
+      (with-current-buffer out (erase-buffer))
+      ;; Kick off the output
+      (org-export-as-xoxo-insert-into out "<ol class='xoxo'>\n")
+      (while (re-search-forward "^\\(\\*+\\) \\(.+\\)" (point-max) 't)
+        (let* ((hd (match-string-no-properties 1))
+               (level (length hd))
+               (text (concat
+                      (match-string-no-properties 2)
+                      (save-excursion
+                        (goto-char (match-end 0))
+                        (let ((str ""))
+                          (catch 'loop
+                            (while 't
+                              (forward-line)
+                              (if (looking-at "^[ \t]\\(.*\\)")
+                                  (setq str (concat str (match-string-no-properties 1)))
+                                (throw 'loop str)))))))))
+
+          ;; Handle level rendering
+          (cond
+           ((> level last-level)
+            (org-export-as-xoxo-insert-into out "\n<ol>\n"))
+
+           ((< level last-level)
+            (dotimes (- (- last-level level) 1)
+              (if hanging-li
+                  (org-export-as-xoxo-insert-into out "</li>\n"))
+              (org-export-as-xoxo-insert-into out "</ol>\n"))
+            (when hanging-li
+              (org-export-as-xoxo-insert-into out "</li>\n")
+              (setq hanging-li nil)))
+
+           ((equal level last-level)
+            (if hanging-li
+                (org-export-as-xoxo-insert-into out "</li>\n")))
+           )
+
+          (setq last-level level)
+
+          ;; And output the new li
+          (setq hanging-li 't)
+          (if (equal ?+ (elt text 0))
+              (org-export-as-xoxo-insert-into out "<li class='" (substring text 1) "'>")
+            (org-export-as-xoxo-insert-into out "<li>" text))))
+
+      ;; Finally finish off the ol
+      (dotimes (- last-level 1)
+        (if hanging-li
+            (org-export-as-xoxo-insert-into out "</li>\n"))
+        (org-export-as-xoxo-insert-into out "</ol>\n"))
+
+      ;; Finish the buffer off and clean it up.
+      (switch-to-buffer-other-window out)
+      (indent-region (point-min) (point-max))
+      (save-buffer)
+      (goto-char (point-min))
+      )))
+
 ;;;###autoload
 (defun org-export-icalendar-all-agenda-files ()
   "Export all files in `org-agenda-files' to iCalendar .ics files.
 Each iCalendar file will be located in the same directory as the Org-mode
 file, but with extension `.ics'."
   (interactive)
-  (apply 'org-export-icalendar nil org-agenda-files))
+  (apply 'org-export-icalendar nil (org-agenda-files t)))
 
 ;;;###autoload
 (defun org-export-icalendar-combine-agenda-files ()
   "Export all files in `org-agenda-files' to a single combined iCalendar file.
 The file is stored under the name `org-combined-agenda-icalendar-file'."
   (interactive)
-  (apply 'org-export-icalendar t org-agenda-files))
+  (apply 'org-export-icalendar t (org-agenda-files t)))
 
 (defun org-export-icalendar (combine &rest files)
   "Create iCalendar files for all elements of FILES.
@@ -11929,7 +12500,7 @@
 (define-key org-mode-map [(meta tab)] 'org-complete)
 (define-key org-mode-map "\M-\C-i"    'org-complete)            ; for tty emacs
 ;; The following line is necessary under Suse GNU/Linux
-(unless org-xemacs-p
+(unless (featurep 'xemacs)
   (define-key org-mode-map [S-iso-lefttab]  'org-shifttab))
 (define-key org-mode-map [(shift tab)]    'org-shifttab)
 
@@ -12007,9 +12578,10 @@
 (define-key org-mode-map "\C-c?"          'org-table-current-column)
 (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-toggle-vline-visibility)
 (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)
@@ -12028,6 +12600,8 @@
 (define-key org-mode-map "\C-c\C-xt"      'org-insert-export-options-template)
 (define-key org-mode-map "\C-c:"          'org-toggle-fixed-width-section)
 (define-key org-mode-map "\C-c\C-xh"      'org-export-as-html)
+(define-key org-mode-map "\C-c\C-xx"      'org-export-as-xml)
+(define-key org-mode-map "\C-c\C-x\C-x"   'org-export-as-xml)
 (define-key org-mode-map "\C-c\C-xb"      'org-export-as-html-and-open)
 (define-key org-mode-map "\C-c\C-x\C-b"   'org-export-as-html-and-open)
 
@@ -12044,14 +12618,19 @@
 overwritten, and the table is not marked as requiring realignment."
   (interactive "p")
   (if (and (org-table-p)
-	   (or
-	    (and org-table-auto-blank-field
-		 (member last-command
-			 '(org-cycle org-return org-shifttab org-ctrl-c-ctrl-c))
-		 (org-table-blank-field))
-	    t)
+	   (progn
+	     ;; check if we blank the field, and if that triggers align
+	     (and org-table-auto-blank-field
+		  (member last-command
+			  '(org-cycle org-return org-shifttab org-ctrl-c-ctrl-c))
+		  (if (or (equal (char-after) ?\ ) (looking-at "[^|\n]*  |"))
+		      ;; got extra space, this field does not determine column width
+		      (let (org-table-may-need-update) (org-table-blank-field))
+		    ;; no extra space, this field may determine column width
+		    (org-table-blank-field)))
+	     t)
 	   (eq N 1)
-	   (looking-at "[^|\n]*  +|"))
+	   (looking-at "[^|\n]*  |"))
       (let (org-table-may-need-update)
 	(goto-char (1- (match-end 0)))
 	(delete-backward-char 1)
@@ -12060,45 +12639,51 @@
     (setq org-table-may-need-update t)
     (self-insert-command N)))
 
-;; FIXME:
-;; The following two functions might still be optimized to trigger
-;; re-alignment less frequently.
-
 (defun org-delete-backward-char (N)
   "Like `delete-backward-char', insert whitespace at field end in tables.
 When deleting backwards, in tables this function will insert whitespace in
 front of the next \"|\" separator, to keep the table aligned.  The table will
-still be marked for re-alignment, because a narrow field may lead to a
-reduced column width."
+still be marked for re-alignment if the field did fill the entire column,
+because, in this case the deletion might narrow the column."
   (interactive "p")
   (if (and (org-table-p)
 	   (eq N 1)
 	   (string-match "|" (buffer-substring (point-at-bol) (point)))
 	   (looking-at ".*?|"))
-      (let ((pos (point)))
+      (let ((pos (point)) 
+	    (noalign (looking-at "[^|\n\r]*  |"))
+	    (c org-table-may-need-update))
 	(backward-delete-char N)
 	(skip-chars-forward "^|")
 	(insert " ")
-	(goto-char (1- pos)))
+	(goto-char (1- pos))
+	;; noalign: if there were two spaces at the end, this field
+	;; does not determine the width of the column.
+	(if noalign (setq org-table-may-need-update c)))
     (backward-delete-char N)))
 
 (defun org-delete-char (N)
   "Like `delete-char', but insert whitespace at field end in tables.
 When deleting characters, in tables this function will insert whitespace in
-front of the next \"|\" separator, to keep the table aligned.  The table
-will still be marked for re-alignment, because a narrow field may lead to
-a reduced column width."
+front of the next \"|\" separator, to keep the table aligned.  The table will
+still be marked for re-alignment if the field did fill the entire column,
+because, in this case the deletion might narrow the column."
   (interactive "p")
   (if (and (org-table-p)
 	   (not (bolp))
 	   (not (= (char-after) ?|))
 	   (eq N 1))
       (if (looking-at ".*?|")
-	  (let ((pos (point)))
+	  (let ((pos (point))
+		(noalign (looking-at "[^|\n\r]*  |"))
+		(c org-table-may-need-update))
 	    (replace-match (concat
 			    (substring (match-string 0) 1 -1)
 			    " |"))
-	    (goto-char pos)))
+	    (goto-char pos)
+	    ;; noalign: if there were two spaces at the end, this field
+	    ;; does not determine the width of the column.
+	    (if noalign (setq org-table-may-need-update c))))
     (delete-char N)))
 
 ;; How to do this: Measure non-white length of current string
@@ -12287,22 +12872,42 @@
     (org-paste-subtree arg)))
 
 (defun org-ctrl-c-ctrl-c (&optional arg)
-  "Call realign table, or recognize a table.el table, or update keywords.
-When the cursor is inside a table created by the table.el package,
-activate that table.  Otherwise, if the cursor is at a normal table
-created with org.el, re-align that table.  This command works even if
-the automatic table editor has been turned off.
-
-If the cursor is in a headline, prompt for tags and insert them into
-the current line, aligned to `org-tags-column'.  When in a headline and
-called with prefix arg, realign all tags in the current buffer.
-
-If the cursor is in one of the special #+KEYWORD lines, this triggers
-scanning the buffer for these lines and updating the information.
-If the cursor is on a #+TBLFM line, re-apply the formulae to the table."
+  "Set tags in headline, or update according to changed information at point.
+
+This command does many different things, depending on context:
+
+- If the cursor is in a headline, prompt for tags and insert them
+  into the current line, aligned to `org-tags-column'.  When called
+  with prefix arg, realign all tags in the current buffer.
+
+- If the cursor is in one of the special #+KEYWORD lines, this
+  triggers scanning the buffer for these lines and updating the
+  information. 
+
+- If the cursor is inside a table, realign the table.  This command
+  works even if the automatic table editor has been turned off.
+
+- If the cursor is on a #+TBLFM line, re-apply the formulas to
+  the entire table.
+
+- If the cursor is inside a table created by the table.el package,
+  activate that table.
+
+- If the current buffer is a remember buffer, close note and file it.
+  with a prefix argument, file it without further interaction to the default
+  location.
+
+- If the cursor is on a <<<target>>>, update radio targets and corresponding
+  links in this buffer.
+
+- If the cursor is on a numbered item in a plain list, renumber the
+  ordered list."
   (interactive "P")
   (let  ((org-enable-table-editor t))
     (cond
+     ((and (local-variable-p 'org-finish-function (current-buffer))
+	   (fboundp org-finish-function))
+      (funcall org-finish-function))
      ((org-on-target-p) (org-update-radio-target-regexp))
      ((org-on-heading-p) (org-set-tags arg))
      ((org-at-table.el-p)
@@ -12328,14 +12933,6 @@
 	  (if (org-at-table-p) (org-table-recalculate t))))
        (t
 	(org-mode-restart))))
-     ((org-region-active-p)
-      (org-table-convert-region (region-beginning) (region-end) arg))
-     ((condition-case nil
-	  (and (region-beginning) (region-end))
-	(error nil))
-      (if (y-or-n-p "Convert inactive region to table? ")
-	  (org-table-convert-region (region-beginning) (region-end) arg)
-	(error "Abort")))
      (t (error "C-c C-c can do nothing useful at this location.")))))
 
 (defun org-mode-restart ()
@@ -12377,13 +12974,16 @@
     ["Next Row" org-return (org-at-table-p)]
     "--"
     ["Blank Field" org-table-blank-field (org-at-table-p)]
+    ["Edit Field" org-table-edit-field (org-at-table-p)]
     ["Copy Field from Above" org-table-copy-down (org-at-table-p)]
     "--"
     ("Column"
      ["Move Column Left" org-metaleft (org-at-table-p)]
      ["Move Column Right" org-metaright (org-at-table-p)]
      ["Delete Column" org-shiftmetaleft (org-at-table-p)]
-     ["Insert Column" org-shiftmetaright (org-at-table-p)])
+     ["Insert Column" org-shiftmetaright (org-at-table-p)]
+    "--"
+    ["Enable Narrowing" (setq org-table-limit-column-width (not org-table-limit-column-width)) :active (org-at-table-p) :selected org-table-limit-column-width :style toggle])
     ("Row"
      ["Move Row Up" org-metaup (org-at-table-p)]
      ["Move Row Down" org-metadown (org-at-table-p)]
@@ -12414,12 +13014,9 @@
      (setq org-table-formula-debug (not org-table-formula-debug))
      :style toggle :selected org-table-formula-debug]
     "--"
-    ["Invisible Vlines" org-table-toggle-vline-visibility
-     :style toggle :selected (org-in-invisibility-spec-p '(org-table))]
-    "--"
     ["Create" org-table-create (and (not (org-at-table-p))
 				    org-enable-table-editor)]
-    ["Convert Region" org-ctrl-c-ctrl-c (not (org-at-table-p 'any))]
+    ["Convert Region" org-table-convert-region (not (org-at-table-p 'any))]
     ["Import from File" org-table-import (not (org-at-table-p))]
     ["Export to File" org-table-export (org-at-table-p)]
     "--"
@@ -12493,14 +13090,26 @@
     ("Hyperlinks"
      ["Store Link (Global)" org-store-link t]
      ["Insert Link" org-insert-link t]
-     ["Follow Link" org-open-at-point t])
+     ["Follow Link" org-open-at-point t]
+     "--"
+     ["Descriptive Links"
+      (progn (org-add-to-invisibility-spec '(org-link)) (org-restart-font-lock))
+      :style radio :selected (member '(org-link) buffer-invisibility-spec)]
+     ["Literal Links"
+      (progn
+	(org-remove-from-invisibility-spec '(org-link)) (org-restart-font-lock))
+      :style radio :selected (not (member '(org-link) buffer-invisibility-spec))]
+     "--"
+     ["Upgrade all <link> to [[link][desc]]" org-upgrade-old-links
+      (save-excursion (goto-char (point-min)) 
+		      (re-search-forward "<[a-z]+:" nil t))])
     "--"
     ("Export"
      ["ASCII" org-export-as-ascii t]
      ["Extract Visible Text" org-export-copy-visible t]
      ["HTML"  org-export-as-html t]
      ["HTML and Open" org-export-as-html-and-open t]
-;     ["OPML" org-export-as-opml nil]
+     ["XML (XOXO)" org-export-as-xml t]
      "--"
      ["iCalendar this file" org-export-icalendar-this-file t]
      ["iCalendar all agenda files" org-export-icalendar-all-agenda-files
@@ -12516,7 +13125,7 @@
     ("Customize"
      ["Browse Org Group" org-customize t]
      "--"
-     ["Build Full Customize Menu" org-create-customize-menu
+     ["Expand This Menu" org-create-customize-menu
       (fboundp 'customize-menu-create)])
     "--"
     ["Refresh setup" org-mode-restart t]
@@ -12530,16 +13139,22 @@
   (Info-goto-node (format "(org)%s" (or node ""))))
 
 (defun org-install-agenda-files-menu ()
-  (easy-menu-change
-   '("Org") "File List for Agenda"
-   (append
-    (list
-     ["Edit File List" (customize-variable 'org-agenda-files) t]
-     ["Add/Move Current File to Front of List" org-agenda-file-to-front t]
-     ["Remove Current File from List" org-remove-file t]
-     ["Cycle through agenda files" org-cycle-agenda-files t]
-     "--")
-    (mapcar 'org-file-menu-entry org-agenda-files))))
+  (let ((bl (buffer-list)))
+    (save-excursion
+      (while bl
+	(set-buffer (pop bl))
+	(if (eq major-mode 'org-mode) (setq bl nil)))
+      (when (eq major-mode 'org-mode)
+	(easy-menu-change
+	 '("Org") "File List for Agenda"
+	 (append
+	  (list
+	   ["Edit File List" (org-edit-agenda-file-list) t]
+	   ["Add/Move Current File to Front of List" org-agenda-file-to-front t]
+	   ["Remove Current File from List" org-remove-file t]
+	   ["Cycle through agenda files" org-cycle-agenda-files t]
+	   "--")
+	  (mapcar 'org-file-menu-entry (org-agenda-files t))))))))
 
 ;;; Documentation
 
@@ -12623,9 +13238,10 @@
   ;; through to `fill-paragraph' when appropriate.
   (set (make-local-variable 'fill-paragraph-function) 'org-fill-paragraph)
   ;; Adaptive filling: To get full control, first make sure that
-  ;; `adaptive-fill-regexp' never matches.  Then install our won matcher.
-  (setq adaptive-fill-regexp "\000")
-  (setq adaptive-fill-function 'org-adaptive-fill-function))
+  ;; `adaptive-fill-regexp' never matches.  Then install our own matcher.
+  (set (make-local-variable 'adaptive-fill-regexp) "\000")
+  (set (make-local-variable 'adaptive-fill-function)
+       'org-adaptive-fill-function))
 
 (defun org-fill-paragraph (&optional justify)
   "Re-align a table, pass through to fill-paragraph if no table."
@@ -12650,7 +13266,7 @@
 
 (defun org-add-hook (hook function &optional append local)
   "Add-hook, compatible with both Emacsen."
-  (if (and local org-xemacs-p)
+  (if (and local (featurep 'xemacs))
       (add-local-hook hook function append)
     (add-hook hook function append local)))
 
@@ -12659,7 +13275,7 @@
 Works on both Emacs and XEmacs."
   (if org-ignore-region
       nil
-    (if org-xemacs-p
+    (if (featurep 'xemacs)
 	(and zmacs-regions (region-active-p))
       (and transient-mark-mode mark-active))))
 
@@ -12795,10 +13411,10 @@
     (save-excursion
       (skip-chars-forward "<")
       (and (re-search-backward "<<" nil t)
-	   (or (looking-at org-target-regexp)
-	       (looking-at org-radio-target-regexp))
+	   (or (looking-at org-radio-target-regexp)
+	       (looking-at org-target-regexp))
 	   (<= (match-beginning 0) pos)
-	   (>= (match-end 0) pos)))))
+	   (>= (1+ (match-end 0)) pos)))))
 
 (defun org-up-heading-all (arg)
   "Move to the heading line of which the present line is a subheading.
@@ -12900,7 +13516,6 @@
        (or (match-beginning 1) (point-max)))
      (if org-noutline-p nil ?\n))))
 
-
 (defun org-make-options-regexp (kwds)
   "Make a regular expression for keyword lines."
   (concat
@@ -12936,3 +13551,4 @@
 
 ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
 ;;; org.el ends here
+
--- a/lisp/textmodes/picture.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/textmodes/picture.el	Mon Apr 17 08:41:12 2006 +0000
@@ -758,8 +758,9 @@
 
 (defun picture-mode-exit (&optional nostrip)
   "Undo `picture-mode' and return to previous major mode.
-With no argument strips whitespace from end of every line in Picture buffer
-  otherwise just return to previous mode."
+With no argument, strip whitespace from end of every line in Picture buffer;
+  otherwise, just return to previous mode.
+Runs `picture-mode-exit-hook' at the end."
   (interactive "P")
   (if (not (eq major-mode 'picture-mode))
       (error "You aren't editing a Picture")
@@ -769,7 +770,8 @@
     (setq major-mode picture-mode-old-major-mode)
     (kill-local-variable 'tab-stop-list)
     (setq truncate-lines picture-mode-old-truncate-lines)
-    (force-mode-line-update)))
+    (force-mode-line-update)
+    (run-hooks 'picture-mode-exit-hook)))
 
 (provide 'picture)
 
--- a/lisp/time-stamp.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/time-stamp.el	Mon Apr 17 08:41:12 2006 +0000
@@ -5,7 +5,7 @@
 
 ;; This file is part of GNU Emacs.
 
-;; Maintainer's Time-stamp: <2006-02-06 15:11:58 ttn>
+;; Maintainer's Time-stamp: <2006-04-12 20:30:56 rms>
 ;; Maintainer: Stephen Gildea <gildea@stop.mail-abuse.org>
 ;; Keywords: tools
 
@@ -93,6 +93,7 @@
   :type 'string
   :group 'time-stamp
   :version "20.1")
+;;;###autoload(put 'time-stamp-format 'safe-local-variable 'stringp)
 
 (defcustom time-stamp-active t
   "*Non-nil to enable time-stamping of buffers by \\[time-stamp].
@@ -150,7 +151,7 @@
 incompatible with other people's files!  If you must change them for some
 application, do so in the local variables section of the time-stamped file
 itself.")
-
+;;;###autoload(put 'time-stamp-line-limit 'safe-local-variable 'integerp)
 
 (defvar time-stamp-start "Time-stamp:[ \t]+\\\\?[\"<]+"    ;Do not change!
   "Regexp after which the time stamp is written by \\[time-stamp].
@@ -163,7 +164,7 @@
 incompatible with other people's files!  If you must change them for some
 application, do so in the local variables section of the time-stamped file
 itself.")
-
+;;;###autoload(put 'time-stamp-start 'safe-local-variable t)
 
 (defvar time-stamp-end "\\\\?[\">]"    ;Do not change!
   "Regexp marking the text after the time stamp.
@@ -183,6 +184,7 @@
 or `time-stamp-inserts-lines' for yourself or you will be incompatible
 with other people's files!  If you must change them for some application,
 do so in the local variables section of the time-stamped file itself.")
+;;;###autoload(put 'time-stamp-end 'safe-local-variable t)
 
 
 (defvar time-stamp-inserts-lines nil    ;Do not change!
@@ -199,6 +201,7 @@
 yourself or you will be incompatible with other people's files!
 If you must change them for some application, do so in the local
 variables section of the time-stamped file itself.")
+;;;###autoload(put 'time-stamp-inserts-lines 'safe-local-variable t)
 
 
 (defvar time-stamp-count 1		;Do not change!
@@ -209,6 +212,7 @@
 incompatible with other people's files!  If you must change it for
 some application, do so in the local variables section of the
 time-stamped file itself.")
+;;;###autoload(put 'time-stamp-count 'safe-local-variable 'integerp)
 
 
 (defvar time-stamp-pattern nil		;Do not change!
@@ -244,6 +248,7 @@
 incompatible with other people's files!  If you must change them for
 some application, do so only in the local variables section of the
 time-stamped file itself.")
+;;;###autoload(put 'time-stamp-pattern 'safe-local-variable 'stringp)
 
 
 
--- a/lisp/vc.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/vc.el	Mon Apr 17 08:41:12 2006 +0000
@@ -584,9 +584,9 @@
   :group 'vc
   :version "21.1")
 
-(defcustom vc-annotate-display-mode nil
+(defcustom vc-annotate-display-mode 'fullscale
   "Which mode to color the output of \\[vc-annotate] with by default."
-  :type '(choice (const :tag "Default" nil)
+  :type '(choice (const :tag "By Color Map Range" nil)
 		 (const :tag "Scale to Oldest" scale)
 		 (const :tag "Scale Oldest->Newest" fullscale)
 		 (number :tag "Specify Fractional Number of Days"
@@ -617,30 +617,64 @@
 
 ;; Annotate customization
 (defcustom vc-annotate-color-map
-  '(( 20. . "#FFCC00")
-    ( 40. . "#FF6666")
-    ( 60. . "#FF6600")
-    ( 80. . "#FF3300")
-    (100. . "#FF00FF")
-    (120. . "#FF0000")
-    (140. . "#CCCC00")
-    (160. . "#CC00CC")
-    (180. . "#BC8F8F")
-    (200. . "#99CC00")
-    (220. . "#999900")
-    (240. . "#7AC5CD")
-    (260. . "#66CC00")
-    (280. . "#33CC33")
-    (300. . "#00CCFF")
-    (320. . "#00CC99")
-    (340. . "#0099FF"))
+  (if (and (tty-display-color-p) (<= (display-color-cells) 8))
+      ;; A custom sorted TTY colormap
+      (let* ((colors
+	      (sort
+	       (delq nil
+		     (mapcar (lambda (x)
+			       (if (not (or
+					 (string-equal (car x) "white")
+					 (string-equal (car x) "black") ))
+				   (car x)))
+			     (tty-color-alist)))
+	       (lambda (a b)
+		 (cond
+		  ((or (string-equal a "red") (string-equal b "blue")) t)
+		  ((or (string-equal b "red") (string-equal a "blue")) nil)
+		  ((string-equal a "yellow") t)
+		  ((string-equal b "yellow") nil)
+		  ((string-equal a "cyan") t)
+		  ((string-equal b "cyan") nil)
+		  ((string-equal a "green") t)
+		  ((string-equal b "green") nil)
+		  ((string-equal a "magenta") t)
+		  ((string-equal b "magenta") nil)
+		  (t (string< a b))))))
+	     (date 20.)
+	     (delta (/ (- 360. date) (1- (length colors)))))
+	(mapcar (lambda (x)
+		  (prog1
+		      (cons date x)
+		    (setq date (+ date delta)))) colors))
+    ;; Normal colormap: hue stepped from 0-240deg, value=1., saturation=0.75
+    '(( 20. . "#FF3F3F")
+      ( 40. . "#FF6C3F")
+      ( 60. . "#FF993F")
+      ( 80. . "#FFC63F")
+      (100. . "#FFF33F")
+      (120. . "#DDFF3F")
+      (140. . "#B0FF3F")
+      (160. . "#83FF3F")
+      (180. . "#56FF3F")
+      (200. . "#3FFF56")
+      (220. . "#3FFF83")
+      (240. . "#3FFFB0")
+      (260. . "#3FFFDD")
+      (280. . "#3FF3FF")
+      (300. . "#3FC6FF")
+      (320. . "#3F99FF")
+      (340. . "#3F6CFF")
+      (360. . "#3F3FFF")))
   "Association list of age versus color, for \\[vc-annotate].
-Ages are given in units of fractional days.  Default is eighteen steps
-using a twenty day increment."
+Ages are given in units of fractional days.  Default is eighteen
+steps using a twenty day increment, from red to blue.  For TTY
+displays with 8 or fewer colors, the default is red to blue with
+all other colors between (excluding black and white)."
   :type 'alist
   :group 'vc)
 
-(defcustom vc-annotate-very-old-color "#0046FF"
+(defcustom vc-annotate-very-old-color "#3F3FFF"
   "Color for lines older than the current color range in \\[vc-annotate]]."
   :type 'string
   :group 'vc)
@@ -852,7 +886,7 @@
   (if vc-dired-mode
       (set-buffer (find-file-noselect (dired-get-filename)))
     (while vc-parent-buffer
-      (pop-to-buffer vc-parent-buffer))
+      (set-buffer vc-parent-buffer))
     (if (not buffer-file-name)
 	(error "Buffer %s is not associated with a file" (buffer-name))
       (if (not (vc-backend buffer-file-name))
@@ -2971,7 +3005,7 @@
 (easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
   "VC Annotate Display Menu"
   `("VC-Annotate"
-    ["Default" (unless (null vc-annotate-display-mode)
+    ["By Color Map Range" (unless (null vc-annotate-display-mode)
                  (setq vc-annotate-display-mode nil)
                  (vc-annotate-display-select))
      :style toggle :selected (null vc-annotate-display-mode)]
@@ -3013,11 +3047,7 @@
 use; you may override this using the second optional arg MODE."
   (interactive)
   (if mode (setq vc-annotate-display-mode mode))
-  (when buffer
-    (set-buffer buffer)
-    (display-buffer buffer))
-  (if (not vc-annotate-parent-rev)
-      (vc-annotate-mode))
+  (pop-to-buffer (or buffer (current-buffer)))
   (cond ((null vc-annotate-display-mode)
          ;; The ratio is global, thus relative to the global color-map.
          (kill-local-variable 'vc-annotate-color-map)
@@ -3077,7 +3107,11 @@
   (vc-ensure-vc-buffer)
   (setq vc-annotate-display-mode display-mode) ;Not sure why.  --Stef
   (let* ((temp-buffer-name (format "*Annotate %s (rev %s)*" (buffer-name) rev))
-         (temp-buffer-show-function 'vc-annotate-display-select))
+         (temp-buffer-show-function 'vc-annotate-display-select)
+         ;; If BUF is specified, we presume the caller maintains current line,
+         ;; so we don't need to do it here.  This implementation may give
+         ;; strange results occasionally in the case of REV != WORKFILE-REV.
+         (current-line (unless buf (line-number-at-pos))))
     (message "Annotating...")
     ;; If BUF is specified it tells in which buffer we should put the
     ;; annotations.  This is used when switching annotations to another
@@ -3087,15 +3121,21 @@
 	      ;; In case it had to be uniquified.
 	      (setq temp-buffer-name (buffer-name))))
     (with-output-to-temp-buffer temp-buffer-name
-      (vc-call annotate-command file (get-buffer temp-buffer-name) rev))
-    (with-current-buffer temp-buffer-name
-      (set (make-local-variable 'vc-annotate-backend) (vc-backend file))
-      (set (make-local-variable 'vc-annotate-parent-file) file)
-      (set (make-local-variable 'vc-annotate-parent-rev) rev)
-      (set (make-local-variable 'vc-annotate-parent-display-mode)
-	   display-mode))
-
-  (message "Annotating... done")))
+      (vc-call annotate-command file (get-buffer temp-buffer-name) rev)
+      ;; we must setup the mode first, and then set our local
+      ;; variables before the show-function is called at the exit of
+      ;; with-output-to-temp-buffer
+      (with-current-buffer temp-buffer-name
+        (if (not (equal major-mode 'vc-annotate-mode))
+            (vc-annotate-mode))
+        (set (make-local-variable 'vc-annotate-backend) (vc-backend file))
+        (set (make-local-variable 'vc-annotate-parent-file) file)
+        (set (make-local-variable 'vc-annotate-parent-rev) rev)
+        (set (make-local-variable 'vc-annotate-parent-display-mode)
+             display-mode)))
+    (when current-line
+      (goto-line current-line temp-buffer-name))
+    (message "Annotating... done")))
 
 (defun vc-annotate-prev-version (prefix)
   "Visit the annotation of the version previous to this one.
@@ -3191,7 +3231,8 @@
 revision."
   (if (not (equal major-mode 'vc-annotate-mode))
       (message "Cannot be invoked outside of a vc annotate buffer")
-    (let* ((oldline (line-number-at-pos))
+    (let* ((buf (current-buffer))
+	   (oldline (line-number-at-pos))
 	   (revspeccopy revspec)
 	   (newrev nil))
       (cond
@@ -3218,10 +3259,10 @@
       (when newrev
 	(vc-annotate vc-annotate-parent-file newrev
                      vc-annotate-parent-display-mode
-                     (current-buffer))
+                     buf)
 	(goto-line (min oldline (progn (goto-char (point-max))
 				       (previous-line)
-				       (line-number-at-pos))))))))
+				       (line-number-at-pos))) buf)))))
 
 (defun vc-annotate-compcar (threshold a-list)
   "Test successive cons cells of A-LIST against THRESHOLD.
@@ -3275,7 +3316,11 @@
       (let* ((color (or (vc-annotate-compcar difference vc-annotate-color-map)
 			(cons nil vc-annotate-very-old-color)))
 	     ;; substring from index 1 to remove any leading `#' in the name
-	     (face-name (concat "vc-annotate-face-" (substring (cdr color) 1)))
+	     (face-name (concat "vc-annotate-face-"
+				(if (string-equal
+				     (substring (cdr color) 0 1) "#")
+				    (substring (cdr color) 1)
+				  (cdr color))))
 	     ;; Make the face if not done.
 	     (face (or (intern-soft face-name)
 		       (let ((tmp-face (make-face (intern face-name))))
--- a/lispref/ChangeLog	Sun Apr 09 01:43:22 2006 +0000
+++ b/lispref/ChangeLog	Mon Apr 17 08:41:12 2006 +0000
@@ -1,3 +1,33 @@
+2006-04-15  Michael Olson  <mwolson@gnu.org>
+
+	* processes.texi (Transaction Queues): Mention the new optional
+	`delay-question' argument for `tq-enqueue'.
+
+2006-04-13  Bill Wohler  <wohler@newt.com>
+
+	* customize.texi (Common Keywords): Use dotted notation for
+	:package-version value. Specify its values. Improve documentation
+	for customize-package-emacs-version-alist.
+
+2006-04-12  Bill Wohler  <wohler@newt.com>
+
+	* customize.texi (Common Keywords): Move description of
+	customize-package-emacs-version-alist to @defvar.
+
+2006-04-10  Bill Wohler  <wohler@newt.com>
+
+	* customize.texi (Common Keywords): Add :package-version.
+
+2006-04-10  Kim F. Storm  <storm@cua.dk>
+
+	* text.texi (Buffer Contents): Add NOPROPS arg to
+	filter-buffer-substring.
+
+2006-04-08  Kevin Ryde  <user42@zip.com.au>
+
+	* os.texi (Command-Line Arguments): Update xref to emacs manual
+	"Command Arguments" -> "Emacs Invocation", per change there.
+
 2006-04-08  Thien-Thi Nguyen  <ttn@gnu.org>
 
 	* display.texi (Other Display Specs): Arrange a @code{DOTTED-LIST} to
--- a/lispref/customize.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/lispref/customize.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -130,8 +130,49 @@
 This option specifies that the item was first introduced in Emacs
 version @var{version}, or that its default value was changed in that
 version.  The value @var{version} must be a string.
+
+@item :package-version '(@var{package} . @var{version})
+This option specifies that the item was first introduced in
+@var{package} version @var{version}, or that its default value was
+changed in that version.  This keyword takes priority over :version.
+The value of @var{package} is a symbol and @var{version} is a string.
+The @var{package} and @var{version} must appear in the alist
+@code{customize-package-emacs-version-alist}.  Since @var{package} must
+be unique and the user might see it in an error message, a good choice
+is the official name of the package, such as MH-E or Gnus.
+
 @end table
 
+Packages that use the @code{:package-version} keyword must also update
+the @code{customize-package-emacs-version-alist} variable.
+
+@defvar customize-package-emacs-version-alist
+This alist provides a mapping for the versions of Emacs that are
+associated with versions of a package listed in the
+@code{:package-version} keyword.  Its elements look like this:
+
+@example
+(@var{package} (@var{pversion} . @var{eversion})@dots{})
+@end example
+
+For each @var{package}, which is a symbol, there are one or more
+elements that contain a package version @var{pversion} with an
+associated Emacs version @var{eversion}.  These versions are strings.
+For example, the MH-E package updates this alist with the following:
+
+@smallexample
+(add-to-list 'customize-package-emacs-version-alist
+             '(MH-E ("6.0" . "22.1") ("6.1" . "22.1") ("7.0" . "22.1")
+                    ("7.1" . "22.1") ("7.2" . "22.1") ("7.3" . "22.1")
+                    ("7.4" . "22.1") ("8.0" . "22.1")))
+@end smallexample
+
+The value of @var{package} needs to be unique and it needs to match
+the @var{package} value appearing in the @code{:package-version}
+keyword.  Since the user might see the value in a error message, a good
+choice is the official name of the package, such as MH-E or Gnus.
+@end defvar
+
 @node Group Definitions
 @section Defining Custom Groups
 
--- a/lispref/os.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/lispref/os.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -404,8 +404,9 @@
 arguments is in @code{command-line-args}.)
 
 The command-line arguments are parsed by the @code{command-line-1}
-function in the @file{startup.el} file.  See also @ref{Command
-Arguments, , Command Line Arguments, emacs, The GNU Emacs Manual}.
+function in the @file{startup.el} file.  See also @ref{Emacs
+Invocation, , Command Line Arguments for Emacs Invocation, emacs, The
+GNU Emacs Manual}.
 @end defvar
 
 @defvar command-line-args
--- a/lispref/processes.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/lispref/processes.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -1508,7 +1508,7 @@
 machine.
 @end defun
 
-@defun tq-enqueue queue question regexp closure fn
+@defun tq-enqueue queue question regexp closure fn &optional delay-question
 This function sends a transaction to queue @var{queue}.  Specifying the
 queue has the effect of specifying the subprocess to talk to.
 
@@ -1521,6 +1521,10 @@
 text at the end of the entire answer, but nothing before; that's how
 @code{tq-enqueue} determines where the answer ends.
 
+If the argument @var{delay-question} is non-nil, delay sending this
+question until the process has finished replying to any previous
+questions.  This produces more reliable results with some processes."
+
 The return value of @code{tq-enqueue} itself is not meaningful.
 @end defun
 
--- a/lispref/text.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/lispref/text.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -205,7 +205,7 @@
 properties, just the characters themselves.  @xref{Text Properties}.
 @end defun
 
-@defun filter-buffer-substring start end &optional delete
+@defun filter-buffer-substring start end &optional delete noprops
 This function passes the buffer text between @var{start} and @var{end}
 through the filter functions specified by the variable
 @code{buffer-substring-filters}, and returns the value from the last
@@ -217,7 +217,12 @@
 between @var{start} and @var{end} after copying it, like
 @code{delete-and-extract-region}.
 
-Lisp code should use this function instead of @code{buffer-substring}
+If @var{noprops} is non-@code{nil}, the final string returned does not
+include text properties, while the string passed through the filters
+still includes text properties from the buffer text.
+
+Lisp code should use this function instead of @code{buffer-substring},
+@code{buffer-substring-no-properties},
 or @code{delete-and-extract-region} when copying into user-accessible
 data structures such as the kill-ring, X clipboard, and registers.
 Major and minor modes can add functions to
--- a/mac/ChangeLog	Sun Apr 09 01:43:22 2006 +0000
+++ b/mac/ChangeLog	Mon Apr 17 08:41:12 2006 +0000
@@ -1,3 +1,7 @@
+2006-04-12  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* inc/config.h (pid_t): Define to int.
+
 2006-02-10  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* makefile.MPW (shortlisp, SOME_MACHINE_LISP): Sync with
--- a/mac/inc/config.h	Sun Apr 09 01:43:22 2006 +0000
+++ b/mac/inc/config.h	Mon Apr 17 08:41:12 2006 +0000
@@ -906,7 +906,7 @@
 /* #undef mbstate_t */
 
 /* Define to `int' if <sys/types.h> does not define. */
-/* #undef pid_t */
+#define pid_t int
 
 /* Define to any substitute for sys_siglist. */
 /* #undef sys_siglist */
--- a/man/ChangeLog	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/ChangeLog	Mon Apr 17 08:41:12 2006 +0000
@@ -1,3 +1,77 @@
+2006-04-13  Carsten Dominik  <dominik@science.uva.nl>
+
+	* org.texi: (Updating settings): New section.
+	(Visibility cycling): Better names for the startup folding
+	options.
+	(Exporting): Completely restructured.
+	(The very busy C-c C-c key): New section.
+	(Summary of in-buffer settings): New section.
+
+2006-04-12  Richard Stallman  <rms@gnu.org>
+
+	* search.texi: Clean up previous change.
+
+2006-04-12  Eli Zaretskii  <eliz@gnu.org>
+
+	* search.texi (Regexp Backslash, Regexp Replace): Add index
+	entries for ``back reference'' and mention the term itself in the
+	text.
+
+2006-04-11  Richard Stallman  <rms@gnu.org>
+
+	* custom.texi (Safe File Variables):
+	Document enable-local-variables = :safe.
+
+2006-04-11  Karl Berry  <karl@gnu.org>
+
+        * emacs-xtra.texi, emacs.texi (Dired under VC, VC Dired Commands,
+         Remote Repositories, Version Backups, Local Version Control,
+         Snapshots, Making and Using Snapshots, Snapshot Caveats,
+         Miscellaneous Commands and Features of VC, Change Logs and VC,
+         Renaming VC Work Files and Master Files,
+         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.
+
+2006-04-11  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus.texi, gnus-faq.texi, message.texi: Gnus v5.10.8 is released.
+
+2006-04-10  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus.texi (Misc Group Stuff, Summary Buffer, Article Keymap)
+	(Server Commands): Key `v' is reserved for users.
+
+2006-04-11  J.D. Smith  <jdsmith@as.arizona.edu>
+
+	* files.texi (Old Versions): Update description of vc-annotate's
+	use of color to indicate date ranges.
+
+2006-04-11  Carsten Dominik  <dominik@science.uva.nl>
+
+	* org.texi (Link format): New section, emphasis on bracket links.
+	(External links): Document bracket links.
+	(FAQ): Expanded to cover shell links and the new link format.
+
+2006-04-09  Kevin Ryde  <user42@zip.com.au>
+
+	* org.texi (Formula syntax): Typo in node name of calc-eval xref.
+
+	* sending.texi (Mail Sending): In send-mail-function @pxref smtpmail,
+	put info and printed manual names the right way around.
+
+2006-04-09  Karl Berry  <karl@gnu.org>
+
+	* 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
+	node names.
+
+	* emacs.texi: move @summarycontents and @contents to the beginning
+	of the file.
+
 2006-04-07  Reiner Steib  <Reiner.Steib@gmx.de>
 
 	* gnus.texi (Summary Buffer Lines): Add `*'.
--- a/man/building.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/building.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -323,7 +323,7 @@
 subprocesses; to work around this lack, @kbd{M-x compile} runs the
 compilation command synchronously on MS-DOS.  As a consequence, you must
 wait until the command finishes before you can do anything else in
-Emacs.  @xref{MS-DOS}.
+Emacs.  @xref{MS-DOS,,,emacs-xtra,Specialized Emacs Features}.
 
 @node Grep Searching
 @section Searching with Grep under Emacs
--- a/man/cmdargs.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/cmdargs.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -551,7 +551,7 @@
 inside Emacs.
 @item SMTPSERVER
 The name of the outgoing mail server.  Used by the SMTP library
-(@pxref{Top,,Sending mail via SMTP,smtpmail}).
+(@pxref{Top,,,Sending mail via SMTP,smtpmail}).
 @cindex background mode, on @command{xterm}
 @item TERM
 The type of the terminal that Emacs is using.  This variable must be
--- a/man/custom.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/custom.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -1227,9 +1227,10 @@
   The variable @code{enable-local-variables} allows you to change the
 way Emacs processes local variables.  Its default value is @code{t},
 which specifies the behavior described above.  If it is @code{nil},
-Emacs simply ignores all file local variables.  Any other value says
-to query you about each file that has local variables, without trying
-to determine whether the values are known to be safe.
+Emacs simply ignores all file local variables.  @code{:safe} means use
+only the safe values and ignore the rest.  Any other value says to
+query you about each file that has local variables, without trying to
+determine whether the values are known to be safe.
 
 @vindex enable-local-eval
   The variable @code{enable-local-eval} controls whether Emacs
--- a/man/emacs-xtra.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/emacs-xtra.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -57,13 +57,16 @@
 @menu
 * Introduction::                  What documentation belongs here?
 * Autorevert::                    Auto Reverting non-file buffers.
-* Subdir switches::               Subdirectory switches in Dired.
+* Subdir Switches::               Subdirectory switches in Dired.
 * Advanced Calendar/Diary Usage:: Advanced Calendar/Diary customization.
 * Emerge::                        A convenient way of merging two versions
                                     of a program.
 * Picture Mode::                  Editing pictures made up of characters
                                     using the quarter-plane screen model.
+
+* Advanced VC Usage::             Advanced VC (version control) features.
 * Fortran::                       Fortran mode and its special features.
+* MS-DOG::                        
 * Index::
 @end menu
 
@@ -272,7 +275,7 @@
 completely up to date (or will be after @code{auto-revert-interval}
 seconds).
 
-@node Subdir switches
+@node Subdir Switches
 @chapter Subdirectory Switches in Dired
 
 You can insert subdirectories with specified @code{ls} switches in
@@ -1888,6 +1891,887 @@
 @kbd{C-c C-x} (@code{picture-yank-rectangle-from-register}) does
 likewise for the rectangle found in a specified register.
 
+@node Advanced VC Usage
+@chapter Advanced VC Usage
+
+  Commonly used features of Emacs' version control (VC) support are
+described in the main Emacs manual (@pxref{Version Control,,,emacs,
+the Emacs Manual}).  This chapter describes more advanced VC usage.
+
+@menu
+* VC Dired Mode::       Listing files managed by version control.
+* VC Dired Commands::   Commands to use in a VC Dired buffer.
+* Remote Repositories:: Efficient access to remote CVS servers.
+* Snapshots::           Sets of file versions treated as a unit.
+* Miscellaneous VC::    Various other commands and features of VC.
+* Customizing VC::      Variables that change VC's behavior.
+@end menu
+
+@node VC Dired Mode
+@section Dired under VC
+
+@cindex PCL-CVS
+@pindex cvs
+@cindex CVS Dired Mode
+  The VC Dired Mode described here works with all the version control
+systems that VC supports.  Another more powerful facility, designed
+specifically for CVS, is called PCL-CVS.  @xref{Top, , About PCL-CVS,
+pcl-cvs, PCL-CVS --- The Emacs Front-End to CVS}.
+
+@kindex C-x v d
+@findex vc-directory
+  When you are working on a large program, it is often useful to find
+out which files have changed within an entire directory tree, or to view
+the status of all files under version control at once, and to perform
+version control operations on collections of files.  You can use the
+command @kbd{C-x v d} (@code{vc-directory}) to make a directory listing
+that includes only files relevant for version control.
+
+@vindex vc-dired-terse-display
+  @kbd{C-x v d} creates a buffer which uses VC Dired Mode.  This looks
+much like an ordinary Dired buffer (@pxref{Dired,,,emacs, the
+Emacs Manual}); however, normally it shows only the noteworthy files
+(those locked or not up-to-date).  This is called @dfn{terse display}.
+If you set the variable @code{vc-dired-terse-display} to @code{nil},
+then VC Dired shows all relevant files---those managed under version
+control, plus all subdirectories (@dfn{full display}).  The command
+@kbd{v t} in a VC Dired buffer toggles between terse display and full
+display (@pxref{VC Dired Commands}).
+
+@vindex vc-dired-recurse
+  By default, VC Dired produces a recursive listing of noteworthy or
+relevant files at or below the given directory.  You can change this by
+setting the variable @code{vc-dired-recurse} to @code{nil}; then VC
+Dired shows only the files in the given directory.
+
+  The line for an individual file shows the version control state in the
+place of the hard link count, owner, group, and size of the file.  If
+the file is unmodified, in sync with the master file, the version
+control state shown is blank.  Otherwise it consists of text in
+parentheses.  Under RCS and SCCS, the name of the user locking the file
+is shown; under CVS, an abbreviated version of the @samp{cvs status}
+output is used.  Here is an example using RCS:
+
+@smallexample
+@group
+  /home/jim/project:
+
+  -rw-r--r-- (jim)      Apr  2 23:39 file1
+  -r--r--r--            Apr  5 20:21 file2
+@end group
+@end smallexample
+
+@noindent
+The files @samp{file1} and @samp{file2} are under version control,
+@samp{file1} is locked by user jim, and @samp{file2} is unlocked.
+
+  Here is an example using CVS:
+
+@smallexample
+@group
+  /home/joe/develop:
+
+  -rw-r--r-- (modified) Aug  2  1997 file1.c
+  -rw-r--r--            Apr  4 20:09 file2.c
+  -rw-r--r-- (merge)    Sep 13  1996 file3.c
+@end group
+@end smallexample
+
+  Here @samp{file1.c} is modified with respect to the repository, and
+@samp{file2.c} is not.  @samp{file3.c} is modified, but other changes
+have also been checked in to the repository---you need to merge them
+with the work file before you can check it in.
+
+@vindex vc-stay-local
+@vindex vc-cvs-stay-local
+  In the above, if the repository were on a remote machine, VC would
+only contact it when the variable @code{vc-stay-local} (or
+@code{vc-cvs-stay-local}) is nil (@pxref{CVS Options}).  This is
+because access to the repository may be slow, or you may be working
+offline and not have access to the repository at all.  As a
+consequence, VC would not be able to tell you that @samp{file3.c} is
+in the ``merge'' state; you would learn that only when you try to
+check-in your modified copy of the file, or use a command such as
+@kbd{C-x v m}.
+
+  In practice, this is not a problem because CVS handles this case
+consistently whenever it arises.  In VC, you'll simply get prompted to
+merge the remote changes into your work file first.  The benefits of
+less network communication usually outweigh the disadvantage of not
+seeing remote changes immediately.
+
+@vindex vc-directory-exclusion-list
+  When VC Dired displays subdirectories (in the ``full'' display mode),
+it omits some that should never contain any files under version control.
+By default, this includes Version Control subdirectories such as
+@samp{RCS} and @samp{CVS}; you can customize this by setting the
+variable @code{vc-directory-exclusion-list}.
+
+  You can fine-tune VC Dired's format by typing @kbd{C-u C-x v d}---as in
+ordinary Dired, that allows you to specify additional switches for the
+@samp{ls} command.
+
+@node VC Dired Commands
+@section VC Dired Commands
+
+  All the usual Dired commands work normally in VC Dired mode, except
+for @kbd{v}, which is redefined as the version control prefix.  You can
+invoke VC commands such as @code{vc-diff} and @code{vc-print-log} by
+typing @kbd{v =}, or @kbd{v l}, and so on.  Most of these commands apply
+to the file name on the current line.
+
+  The command @kbd{v v} (@code{vc-next-action}) operates on all the
+marked files, so that you can lock or check in several files at once.
+If it operates on more than one file, it handles each file according to
+its current state; thus, it might lock one file, but check in another
+file.  This could be confusing; it is up to you to avoid confusing
+behavior by marking a set of files that are in a similar state.  If no
+files are marked, @kbd{v v} operates on the file in the current line.
+
+  If any files call for check-in, @kbd{v v} reads a single log entry,
+then uses it for all the files being checked in.  This is convenient for
+registering or checking in several files at once, as part of the same
+change.
+
+@findex vc-dired-toggle-terse-mode
+@findex vc-dired-mark-locked
+  You can toggle between terse display (only locked files, or files not
+up-to-date) and full display at any time by typing @kbd{v t}
+(@code{vc-dired-toggle-terse-mode}).  There is also a special command
+@kbd{* l} (@code{vc-dired-mark-locked}), which marks all files currently
+locked (or, with CVS, all files not up-to-date).  Thus, typing @kbd{* l
+t k} is another way to delete from the buffer all files except those
+currently locked.
+
+@node Remote Repositories
+@section Remote Repositories
+@cindex remote repositories (CVS)
+
+  A common way of using CVS is to set up a central CVS repository on
+some Internet host, then have each developer check out a personal
+working copy of the files on his local machine.  Committing changes to
+the repository, and picking up changes from other users into one's own
+working area, then works by direct interactions with the CVS server.
+
+  One difficulty is that access to the CVS server is often slow, and
+that developers might need to work off-line as well.  VC is designed
+to reduce the amount of network interaction necessary.
+
+@menu
+* Version Backups::        Keeping local copies of repository versions.
+* Local Version Control::  Using another version system for local editing.
+@end menu
+
+@node Version Backups
+@subsection Version Backups
+@cindex version backups
+
+@cindex automatic version backups
+  When VC sees that the CVS repository for a file is on a remote
+machine, it automatically makes local backups of unmodified versions
+of the file---@dfn{automatic version backups}.  This means that you
+can compare the file to the repository version (@kbd{C-x v =}), or
+revert to that version (@kbd{C-x v u}), without any network
+interactions.
+
+  The local copy of the unmodified file is called a @dfn{version
+backup} to indicate that it corresponds exactly to a version that is
+stored in the repository.  Note that version backups are not the same
+as ordinary Emacs backup files (@pxref{Backup,,,emacs, the Emacs
+Manual}).  But they follow a similar naming convention.
+
+  For a file that comes from a remote CVS repository, VC makes a
+version backup whenever you save the first changes to the file, and
+removes it after you have committed your modified version to the
+repository. You can disable the making of automatic version backups by
+setting @code{vc-cvs-stay-local} to @code{nil} (@pxref{CVS Options}).
+
+@cindex manual version backups
+  The name of the automatic version backup for version @var{version}
+of file @var{file} is @code{@var{file}.~@var{version}.~}.  This is
+almost the same as the name used by @kbd{C-x v ~} (@pxref{Old
+Versions,,,emacs, the Emacs Manual}), the only difference being
+the additional dot (@samp{.})  after the version number.  This
+similarity is intentional, because both kinds of files store the same
+kind of information.  The file made by @kbd{C-x v ~} acts as a
+@dfn{manual version backup}.
+
+  All the VC commands that operate on old versions of a file can use
+both kinds of version backups.  For instance, @kbd{C-x v ~} uses
+either an automatic or a manual version backup, if possible, to get
+the contents of the version you request.  Likewise, @kbd{C-x v =} and
+@kbd{C-x v u} use either an automatic or a manual version backup, if
+one of them exists, to get the contents of a version to compare or
+revert to.  If you changed a file outside of Emacs, so that no
+automatic version backup was created for the previous text, you can
+create a manual backup of that version using @kbd{C-x v ~}, and thus
+obtain the benefit of the local copy for Emacs commands.
+
+  The only difference in Emacs's handling of manual and automatic
+version backups, once they exist, is that Emacs deletes automatic
+version backups when you commit to the repository.  By contrast,
+manual version backups remain until you delete them.
+
+@node Local Version Control
+@subsection Local Version Control
+@cindex local version control
+@cindex local back end (version control)
+
+When you make many changes to a file that comes from a remote
+repository, it can be convenient to have version control on your local
+machine as well.  You can then record intermediate versions, revert to
+a previous state, etc., before you actually commit your changes to the
+remote server.
+
+VC lets you do this by putting a file under a second, local version
+control system, so that the file is effectively registered in two
+systems at the same time.  For the description here, we will assume
+that the remote system is CVS, and you use RCS locally, although the
+mechanism works with any combination of version control systems
+(@dfn{back ends}).
+
+To make it work with other back ends, you must make sure that the
+``more local'' back end comes before the ``more remote'' back end in
+the setting of @code{vc-handled-backends} (@pxref{Customizing VC}).  By
+default, this variable is set up so that you can use remote CVS and
+local RCS as described here.
+
+To start using local RCS for a file that comes from a remote CVS
+server, you must @emph{register the file in RCS}, by typing @kbd{C-u
+C-x v v rcs @key{RET}}.  (In other words, use @code{vc-next-action} with a
+prefix argument, and specify RCS as the back end.)
+
+You can do this at any time; it does not matter whether you have
+already modified the file with respect to the version in the CVS
+repository.  If possible, VC tries to make the RCS master start with
+the unmodified repository version, then checks in any local changes
+as a new version.  This works if you have not made any changes yet, or
+if the unmodified repository version exists locally as a version
+backup (@pxref{Version Backups}).  If the unmodified version is not
+available locally, the RCS master starts with the modified version;
+the only drawback to this is that you cannot compare your changes
+locally to what is stored in the repository.
+
+The version number of the RCS master is derived from the current CVS
+version, starting a branch from it.  For example, if the current CVS
+version is 1.23, the local RCS branch will be 1.23.1.  Version 1.23 in
+the RCS master will be identical to version 1.23 under CVS; your first
+changes are checked in as 1.23.1.1.  (If the unmodified file is not
+available locally, VC will check in the modified file twice, both as
+1.23 and 1.23.1.1, to make the revision numbers consistent.)
+
+If you do not use locking under CVS (the default), locking is also
+disabled for RCS, so that editing under RCS works exactly as under
+CVS.
+
+When you are done with local editing, you can commit the final version
+back to the CVS repository by typing @kbd{C-u C-x v v cvs @key{RET}}.
+This initializes the log entry buffer (@pxref{Log Buffer,,,emacs, the
+Emacs Manual}) to contain all the log entries you have recorded in the
+RCS master; you can edit them as you wish, and then commit in CVS by
+typing @kbd{C-c C-c}.  If the commit is successful, VC removes the RCS
+master, so that the file is once again registered under CVS only.
+(The RCS master is not actually deleted, just renamed by appending
+@samp{~} to the name, so that you can refer to it later if you wish.)
+
+While using local RCS, you can pick up recent changes from the CVS
+repository into your local file, or commit some of your changes back
+to CVS, without terminating local RCS version control.  To do this,
+switch to the CVS back end temporarily, with the @kbd{C-x v b} command:
+
+@table @kbd
+@item C-x v b
+Switch to another back end that the current file is registered
+under (@code{vc-switch-backend}).
+
+@item C-u C-x v b @var{backend} @key{RET}
+Switch to @var{backend} for the current file.
+@end table
+
+@kindex C-x v b
+@findex vc-switch-backend
+@kbd{C-x v b} does not change the buffer contents, or any files; it
+only changes VC's perspective on how to handle the file.  Any
+subsequent VC commands for that file will operate on the back end that
+is currently selected.
+
+If the current file is registered in more than one back end, typing
+@kbd{C-x v b} ``cycles'' through all of these back ends.  With a
+prefix argument, it asks for the back end to use in the minibuffer.
+
+Thus, if you are using local RCS, and you want to pick up some recent
+changes in the file from remote CVS, first visit the file, then type
+@kbd{C-x v b} to switch to CVS, and finally use @kbd{C-x v m
+@key{RET}} to merge the news (@pxref{Merging,,,emacs, the Emacs
+Manual}).  You can then switch back to RCS by typing @kbd{C-x v b}
+again, and continue to edit locally.
+
+But if you do this, the revision numbers in the RCS master no longer
+correspond to those of CVS.  Technically, this is not a problem, but
+it can become difficult to keep track of what is in the CVS repository
+and what is not.  So we suggest that you return from time to time to
+CVS-only operation, by committing your local changes back to the
+repository using @kbd{C-u C-x v v cvs @key{RET}}.
+
+@node Snapshots
+@section Snapshots
+@cindex snapshots and version control
+
+  A @dfn{snapshot} is a named set of file versions (one for each
+registered file) that you can treat as a unit.  One important kind of
+snapshot is a @dfn{release}, a (theoretically) stable version of the
+system that is ready for distribution to users.
+
+@menu
+* Making Snapshots::		The snapshot facilities.
+* Snapshot Caveats::		Things to be careful of when using snapshots.
+@end menu
+
+@node Making Snapshots
+@subsection Making and Using Snapshots
+
+  There are two basic commands for snapshots; one makes a
+snapshot with a given name, the other retrieves a named snapshot.
+
+@table @code
+@kindex C-x v s
+@findex vc-create-snapshot
+@item C-x v s @var{name} @key{RET}
+Define the last saved versions of every registered file in or under the
+current directory as a snapshot named @var{name}
+(@code{vc-create-snapshot}).
+
+@kindex C-x v r
+@findex vc-retrieve-snapshot
+@item C-x v r @var{name} @key{RET}
+For all registered files at or below the current directory level, select
+whatever versions correspond to the snapshot @var{name}
+(@code{vc-retrieve-snapshot}).
+
+This command reports an error if any files are locked at or below the
+current directory, without changing anything; this is to avoid
+overwriting work in progress.
+@end table
+
+  A snapshot uses a very small amount of resources---just enough to record
+the list of file names and which version belongs to the snapshot.  Thus,
+you need not hesitate to create snapshots whenever they are useful.
+
+  You can give a snapshot name as an argument to @kbd{C-x v =} or
+@kbd{C-x v ~} (@pxref{Old Versions,,,emacs, the Emacs Manual}).
+Thus, you can use it to compare a snapshot against the current files,
+or two snapshots against each other, or a snapshot against a named
+version.
+
+@node Snapshot Caveats
+@subsection Snapshot Caveats
+
+@cindex named configurations (RCS)
+  VC's snapshot facilities are modeled on RCS's named-configuration
+support.  They use RCS's native facilities for this, so
+snapshots made using RCS through VC are visible even when you bypass VC.
+
+  With CVS, Meta-CVS, and Subversion, VC also uses the native
+mechanism provided by that back end to make snapshots and retrieve them
+(@dfn{tags} for CVS and Meta-CVS, @dfn{copies} for Subversion).
+
+@c worded verbosely to avoid overfull hbox.
+  For SCCS, VC implements snapshots itself.  The files it uses contain
+name/file/version-number triples.  These snapshots are visible only
+through VC.
+
+  There is no support for VC snapshots using GNU Arch yet.
+
+  A snapshot is a set of checked-in versions.  So make sure that all the
+files are checked in and not locked when you make a snapshot.
+
+  File renaming and deletion can create some difficulties with snapshots.
+This is not a VC-specific problem, but a general design issue in version
+control systems that no one has solved very well yet.
+
+  If you rename a registered file, you need to rename its master along
+with it (the command @code{vc-rename-file} does this automatically).  If
+you are using SCCS, you must also update the records of the snapshot, to
+mention the file by its new name (@code{vc-rename-file} does this,
+too).  An old snapshot that refers to a master file that no longer
+exists under the recorded name is invalid; VC can no longer retrieve
+it.  It would be beyond the scope of this manual to explain enough about
+RCS and SCCS to explain how to update the snapshots by hand.
+
+  Using @code{vc-rename-file} makes the snapshot remain valid for
+retrieval, but it does not solve all problems.  For example, some of the
+files in your program probably refer to others by name.  At the very
+least, the makefile probably mentions the file that you renamed.  If you
+retrieve an old snapshot, the renamed file is retrieved under its new
+name, which is not the name that the makefile expects.  So the program
+won't really work as retrieved.
+
+@node Miscellaneous VC
+@section Miscellaneous Commands and Features of VC
+
+  This section explains the less-frequently-used features of VC.
+
+@menu
+* Change Logs and VC::  Generating a change log file from log entries.
+* Renaming and VC::     A command to rename both the source and master
+                          file correctly.
+* Version Headers::     Inserting version control headers into working files.
+@end menu
+
+@node Change Logs and VC
+@subsection Change Logs and VC
+
+  If you use RCS or CVS for a program and also maintain a change log
+file for it (@pxref{Change Log,,,emacs, the Emacs Manual}), you
+can generate change log entries automatically from the version control
+log entries:
+
+@table @kbd
+@item C-x v a
+@kindex C-x v a
+@findex vc-update-change-log
+Visit the current directory's change log file and, for registered files
+in that directory, create new entries for versions checked in since the
+most recent entry in the change log file.
+(@code{vc-update-change-log}).
+
+This command works with RCS or CVS only, not with any of the other
+back ends.
+
+@item C-u C-x v a
+As above, but only find entries for the current buffer's file.
+
+@item M-1 C-x v a
+As above, but find entries for all the currently visited files that are
+maintained with version control.  This works only with RCS, and it puts
+all entries in the log for the default directory, which may not be
+appropriate.
+@end table
+
+  For example, suppose the first line of @file{ChangeLog} is dated
+1999-04-10, and that the only check-in since then was by Nathaniel
+Bowditch to @file{rcs2log} on 1999-05-22 with log text @samp{Ignore log
+messages that start with `#'.}.  Then @kbd{C-x v a} visits
+@file{ChangeLog} and inserts text like this:
+
+@iftex
+@medbreak
+@end iftex
+@smallexample
+@group
+1999-05-22  Nathaniel Bowditch  <nat@@apn.org>
+
+        * rcs2log: Ignore log messages that start with `#'.
+@end group
+@end smallexample
+@iftex
+@medbreak
+@end iftex
+
+@noindent
+You can then edit the new change log entry further as you wish.
+
+  Some of the new change log entries may duplicate what's already in
+ChangeLog.  You will have to remove these duplicates by hand.
+
+  Normally, the log entry for file @file{foo} is displayed as @samp{*
+foo: @var{text of log entry}}.  The @samp{:} after @file{foo} is omitted
+if the text of the log entry starts with @w{@samp{(@var{functionname}):
+}}.  For example, if the log entry for @file{vc.el} is
+@samp{(vc-do-command): Check call-process status.}, then the text in
+@file{ChangeLog} looks like this:
+
+@iftex
+@medbreak
+@end iftex
+@smallexample
+@group
+1999-05-06  Nathaniel Bowditch  <nat@@apn.org>
+
+        * vc.el (vc-do-command): Check call-process status.
+@end group
+@end smallexample
+@iftex
+@medbreak
+@end iftex
+
+  When @kbd{C-x v a} adds several change log entries at once, it groups
+related log entries together if they all are checked in by the same
+author at nearly the same time.  If the log entries for several such
+files all have the same text, it coalesces them into a single entry.
+For example, suppose the most recent check-ins have the following log
+entries:
+
+@flushleft
+@bullet{} For @file{vc.texinfo}: @samp{Fix expansion typos.}
+@bullet{} For @file{vc.el}: @samp{Don't call expand-file-name.}
+@bullet{} For @file{vc-hooks.el}: @samp{Don't call expand-file-name.}
+@end flushleft
+
+@noindent
+They appear like this in @file{ChangeLog}:
+
+@iftex
+@medbreak
+@end iftex
+@smallexample
+@group
+1999-04-01  Nathaniel Bowditch  <nat@@apn.org>
+
+        * vc.texinfo: Fix expansion typos.
+
+        * vc.el, vc-hooks.el: Don't call expand-file-name.
+@end group
+@end smallexample
+@iftex
+@medbreak
+@end iftex
+
+  Normally, @kbd{C-x v a} separates log entries by a blank line, but you
+can mark several related log entries to be clumped together (without an
+intervening blank line) by starting the text of each related log entry
+with a label of the form @w{@samp{@{@var{clumpname}@} }}.  The label
+itself is not copied to @file{ChangeLog}.  For example, suppose the log
+entries are:
+
+@flushleft
+@bullet{} For @file{vc.texinfo}: @samp{@{expand@} Fix expansion typos.}
+@bullet{} For @file{vc.el}: @samp{@{expand@} Don't call expand-file-name.}
+@bullet{} For @file{vc-hooks.el}: @samp{@{expand@} Don't call expand-file-name.}
+@end flushleft
+
+@noindent
+Then the text in @file{ChangeLog} looks like this:
+
+@iftex
+@medbreak
+@end iftex
+@smallexample
+@group
+1999-04-01  Nathaniel Bowditch  <nat@@apn.org>
+
+        * vc.texinfo: Fix expansion typos.
+        * vc.el, vc-hooks.el: Don't call expand-file-name.
+@end group
+@end smallexample
+@iftex
+@medbreak
+@end iftex
+
+  A log entry whose text begins with @samp{#} is not copied to
+@file{ChangeLog}.  For example, if you merely fix some misspellings in
+comments, you can log the change with an entry beginning with @samp{#}
+to avoid putting such trivia into @file{ChangeLog}.
+
+@node Renaming and VC
+@subsection Renaming VC Work Files and Master Files
+
+@findex vc-rename-file
+  When you rename a registered file, you must also rename its master
+file correspondingly to get proper results.  Use @code{vc-rename-file}
+to rename the source file as you specify, and rename its master file
+accordingly.  It also updates any snapshots (@pxref{Snapshots}) that
+mention the file, so that they use the new name; despite this, the
+snapshot thus modified may not completely work (@pxref{Snapshot
+Caveats}).
+
+  Some back ends do not provide an explicit rename operation to their
+repositories.  After issuing @code{vc-rename-file}, use @kbd{C-x v v}
+on the original and renamed buffers and provide the necessary edit
+log.
+
+  You cannot use @code{vc-rename-file} on a file that is locked by
+someone else.
+
+@node Version Headers
+@subsection Inserting Version Control Headers
+
+   Sometimes it is convenient to put version identification strings
+directly into working files.  Certain special strings called
+@dfn{version headers} are replaced in each successive version by the
+number of that version, the name of the user who created it, and other
+relevant information.  All of the back ends that VC supports have such
+a mechanism, except GNU Arch.
+
+  VC does not normally use the information contained in these headers.
+The exception is RCS---with RCS, version headers are sometimes more
+reliable than the master file to determine which version of the file
+you are editing.  Note that in a multi-branch environment, version
+headers are necessary to make VC behave correctly (@pxref{Multi-User
+Branching,,,emacs, the Emacs Manual}).
+
+  Searching for RCS version headers is controlled by the variable
+@code{vc-consult-headers}.  If it is non-@code{nil} (the default),
+Emacs searches for headers to determine the version number you are
+editing.  Setting it to @code{nil} disables this feature.
+
+  Note that although CVS uses the same kind of version headers as RCS
+does, VC never searches for these headers if you are using CVS,
+regardless of the above setting.
+
+@kindex C-x v h
+@findex vc-insert-headers
+  You can use the @kbd{C-x v h} command (@code{vc-insert-headers}) to
+insert a suitable header string.
+
+@table @kbd
+@item C-x v h
+Insert headers in a file for use with your version-control system.
+@end table
+
+@vindex vc-@var{backend}-header
+  The default header string is @samp{@w{$}Id$} for RCS and
+@samp{@w{%}W%} for SCCS.  You can specify other headers to insert by
+setting the variables @code{vc-@var{backend}-header} where
+@var{backend} is @code{rcs} or @code{sccs}.
+
+  Instead of a single string, you can specify a list of strings; then
+each string in the list is inserted as a separate header on a line of
+its own.
+
+  It may be necessary to use apparently-superfluous backslashes when
+writing the strings that you put in this variable.  For instance, you
+might write @code{"$Id\$"} rather than @code{"$Id@w{$}"}.  The extra
+backslash prevents the string constant from being interpreted as a
+header, if the Emacs Lisp file containing it is maintained with
+version control.
+
+@vindex vc-comment-alist
+  Each header is inserted surrounded by tabs, inside comment delimiters,
+on a new line at point.  Normally the ordinary comment
+start and comment end strings of the current mode are used, but for
+certain modes, there are special comment delimiters for this purpose;
+the variable @code{vc-comment-alist} specifies them.  Each element of
+this list has the form @code{(@var{mode} @var{starter} @var{ender})}.
+
+@vindex vc-static-header-alist
+  The variable @code{vc-static-header-alist} specifies further strings
+to add based on the name of the buffer.  Its value should be a list of
+elements of the form @code{(@var{regexp} . @var{format})}.  Whenever
+@var{regexp} matches the buffer name, @var{format} is inserted as part
+of the header.  A header line is inserted for each element that matches
+the buffer name, and for each string specified by
+@code{vc-@var{backend}-header}.  The header line is made by processing the
+string from @code{vc-@var{backend}-header} with the format taken from the
+element.  The default value for @code{vc-static-header-alist} is as follows:
+
+@example
+@group
+(("\\.c$" .
+  "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
+#endif /* lint */\n"))
+@end group
+@end example
+
+@noindent
+It specifies insertion of text of this form:
+
+@example
+@group
+
+#ifndef lint
+static char vcid[] = "@var{string}";
+#endif /* lint */
+@end group
+@end example
+
+@noindent
+Note that the text above starts with a blank line.
+
+  If you use more than one version header in a file, put them close
+together in the file.  The mechanism in @code{revert-buffer} that
+preserves markers may not handle markers positioned between two version
+headers.
+
+@node Customizing VC
+@section Customizing VC
+
+@vindex vc-handled-backends
+The variable @code{vc-handled-backends} determines which version
+control systems VC should handle.  The default value is @code{(RCS CVS
+SVN SCCS Arch MCVS)}, so it contains all six version systems that are
+currently supported.  If you want VC to ignore one or more of these
+systems, exclude its name from the list.  To disable VC entirely, set
+this variable to @code{nil}.
+
+The order of systems in the list is significant: when you visit a file
+registered in more than one system (@pxref{Local Version Control}), VC
+uses the system that comes first in @code{vc-handled-backends} by
+default.  The order is also significant when you register a file for
+the first time, @pxref{Registering,,,emacs, the Emacs Manual} for
+details.
+
+@menu
+* General VC Options::  Options that apply to multiple back ends.
+* RCS and SCCS::        Options for RCS and SCCS.
+* CVS Options::         Options for CVS.
+@end menu
+
+@node General VC Options
+@subsection General Options
+
+@vindex vc-make-backup-files
+  Emacs normally does not save backup files for source files that are
+maintained with version control.  If you want to make backup files even
+for files that use version control, set the variable
+@code{vc-make-backup-files} to a non-@code{nil} value.
+
+@vindex vc-keep-workfiles
+  Normally the work file exists all the time, whether it is locked or
+not.  If you set @code{vc-keep-workfiles} to @code{nil}, then checking
+in a new version with @kbd{C-x v v} deletes the work file; but any
+attempt to visit the file with Emacs creates it again.  (With CVS, work
+files are always kept.)
+
+@vindex vc-follow-symlinks
+  Editing a version-controlled file through a symbolic link can be
+dangerous.  It bypasses the version control system---you can edit the
+file without locking it, and fail to check your changes in.  Also,
+your changes might overwrite those of another user.  To protect against
+this, VC checks each symbolic link that you visit, to see if it points
+to a file under version control.
+
+  The variable @code{vc-follow-symlinks} controls what to do when a
+symbolic link points to a version-controlled file.  If it is @code{nil},
+VC only displays a warning message.  If it is @code{t}, VC automatically
+follows the link, and visits the real file instead, telling you about
+this in the echo area.  If the value is @code{ask} (the default), VC
+asks you each time whether to follow the link.
+
+@vindex vc-suppress-confirm
+  If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x v v}
+and @kbd{C-x v i} can save the current buffer without asking, and
+@kbd{C-x v u} also operates without asking for confirmation.  (This
+variable does not affect @kbd{C-x v c}; that operation is so drastic
+that it should always ask for confirmation.)
+
+@vindex vc-command-messages
+  VC mode does much of its work by running the shell commands for RCS,
+CVS and SCCS.  If @code{vc-command-messages} is non-@code{nil}, VC
+displays messages to indicate which shell commands it runs, and
+additional messages when the commands finish.
+
+@vindex vc-path
+  You can specify additional directories to search for version control
+programs by setting the variable @code{vc-path}.  These directories
+are searched before the usual search path.  It is rarely necessary to
+set this variable, because VC normally finds the proper files
+automatically.
+
+@node RCS and SCCS
+@subsection Options for RCS and SCCS
+
+@cindex non-strict locking (RCS)
+@cindex locking, non-strict (RCS)
+  By default, RCS uses locking to coordinate the activities of several
+users, but there is a mode called @dfn{non-strict locking} in which
+you can check-in changes without locking the file first.  Use
+@samp{rcs -U} to switch to non-strict locking for a particular file,
+see the @code{rcs} manual page for details.
+
+  When deducing the version control state of an RCS file, VC first
+looks for an RCS version header string in the file (@pxref{Version
+Headers}).  If there is no header string, VC normally looks at the
+file permissions of the work file; this is fast.  But there might be
+situations when the file permissions cannot be trusted.  In this case
+the master file has to be consulted, which is rather expensive.  Also
+the master file can only tell you @emph{if} there's any lock on the
+file, but not whether your work file really contains that locked
+version.
+
+@vindex vc-consult-headers
+  You can tell VC not to use version headers to determine the file
+status by setting @code{vc-consult-headers} to @code{nil}.  VC then
+always uses the file permissions (if it is supposed to trust them), or
+else checks the master file.
+
+@vindex vc-mistrust-permissions
+  You can specify the criterion for whether to trust the file
+permissions by setting the variable @code{vc-mistrust-permissions}.
+Its value can be @code{t} (always mistrust the file permissions and
+check the master file), @code{nil} (always trust the file
+permissions), or a function of one argument which makes the decision.
+The argument is the directory name of the @file{RCS} subdirectory.  A
+non-@code{nil} value from the function says to mistrust the file
+permissions.  If you find that the file permissions of work files are
+changed erroneously, set @code{vc-mistrust-permissions} to @code{t}.
+Then VC always checks the master file to determine the file's status.
+
+  VC determines the version control state of files under SCCS much as
+with RCS.  It does not consider SCCS version headers, though.  Thus,
+the variable @code{vc-mistrust-permissions} affects SCCS use, but
+@code{vc-consult-headers} does not.
+
+@node CVS Options
+@subsection Options specific for CVS
+
+@cindex locking (CVS)
+  By default, CVS does not use locking to coordinate the activities of
+several users; anyone can change a work file at any time.  However,
+there are ways to restrict this, resulting in behavior that resembles
+locking.
+
+@cindex CVSREAD environment variable (CVS)
+  For one thing, you can set the @env{CVSREAD} environment variable
+(the value you use makes no difference).  If this variable is defined,
+CVS makes your work files read-only by default.  In Emacs, you must
+type @kbd{C-x v v} to make the file writable, so that editing works
+in fact similar as if locking was used.  Note however, that no actual
+locking is performed, so several users can make their files writable
+at the same time.  When setting @env{CVSREAD} for the first time, make
+sure to check out all your modules anew, so that the file protections
+are set correctly.
+
+@cindex cvs watch feature
+@cindex watching files (CVS)
+  Another way to achieve something similar to locking is to use the
+@dfn{watch} feature of CVS.  If a file is being watched, CVS makes it
+read-only by default, and you must also use @kbd{C-x v v} in Emacs to
+make it writable.  VC calls @code{cvs edit} to make the file writable,
+and CVS takes care to notify other developers of the fact that you
+intend to change the file.  See the CVS documentation for details on
+using the watch feature.
+
+@vindex vc-stay-local
+@vindex vc-cvs-stay-local
+@cindex remote repositories (CVS)
+  When a file's repository is on a remote machine, VC tries to keep
+network interactions to a minimum.  This is controlled by the variable
+@code{vc-cvs-stay-local}.  There is another variable,
+@code{vc-stay-local}, which enables the feature also for other back
+ends that support it, including CVS.  In the following, we will talk
+only about @code{vc-cvs-stay-local}, but everything applies to
+@code{vc-stay-local} as well.
+
+If @code{vc-cvs-stay-local} is @code{t} (the default), then VC uses
+only the entry in the local CVS subdirectory to determine the file's
+state (and possibly information returned by previous CVS commands).
+One consequence of this is that when you have modified a file, and
+somebody else has already checked in other changes to the file, you
+are not notified of it until you actually try to commit.  (But you can
+try to pick up any recent changes from the repository first, using
+@kbd{C-x v m @key{RET}}, @pxref{Merging,,,emacs, the Emacs Manual}).
+
+  When @code{vc-cvs-stay-local} is @code{t}, VC also makes local
+version backups, so that simple diff and revert operations are
+completely local (@pxref{Version Backups}).
+
+  On the other hand, if you set @code{vc-cvs-stay-local} to @code{nil},
+then VC queries the remote repository @emph{before} it decides what to
+do in @code{vc-next-action} (@kbd{C-x v v}), just as it does for local
+repositories.  It also does not make any version backups.
+
+  You can also set @code{vc-cvs-stay-local} to a regular expression
+that is matched against the repository host name; VC then stays local
+only for repositories from hosts that match the pattern.
+
+@vindex vc-cvs-global-switches
+  You can specify additional command line options to pass to all CVS
+operations in the variable @code{vc-cvs-global-switches}.  These
+switches are inserted immediately after the @code{cvs} command, before
+the name of the operation to invoke.
+
+
 @node Fortran
 @chapter Fortran Mode
 @cindex Fortran mode
@@ -2406,6 +3290,687 @@
   Type @samp{;?} or @samp{;C-h} to display a list of all the built-in
 Fortran abbrevs and what they stand for.
 
+
+@node MS-DOG
+@chapter Emacs and MS-DOS
+@cindex MS-DOG
+@cindex MS-DOS peculiarities
+
+  This section briefly describes the peculiarities of using Emacs on
+the MS-DOS ``operating system'' (also known as ``MS-DOG'').
+Information about Emacs and Microsoft's current operating system
+Windows (also known as ``Losedows) is in the main Emacs manual
+(@pxref{Emacs and Microsoft Systems,,, emacs, the Emacs Manual}).
+
+  If you build Emacs for MS-DOS, the binary will also run on Windows
+3.X, Windows NT, Windows 9X/ME, Windows 2000, or OS/2 as a DOS
+application; all of this chapter applies for all of those systems, if
+you use an Emacs that was built for MS-DOS.
+
+  @xref{Text and Binary,,,emacs, the Emacs Manual}, for information
+about Emacs' special handling of text files under MS-DOS (and
+Windows).
+
+@menu
+* Keyboard: MS-DOS Keyboard.   Keyboard conventions on MS-DOS.
+* Mouse: MS-DOS Mouse.         Mouse conventions on MS-DOS.
+* Display: MS-DOS Display.     Fonts, frames and display size on MS-DOS.
+* Files: MS-DOS File Names.    File name conventions on MS-DOS.
+* Printing: MS-DOS Printing.   How to specify the printer on MS-DOS.
+* I18N: MS-DOS and MULE.       Support for internationalization on MS-DOS.
+* Processes: MS-DOS Processes. Running subprocesses on MS-DOS.
+@end menu
+
+@node MS-DOS Keyboard
+@section Keyboard Usage on MS-DOS
+
+@kindex DEL @r{(MS-DOS)}
+@kindex BS @r{(MS-DOS)}
+  The key that is called @key{DEL} in Emacs (because that's how it is
+designated on most workstations) is known as @key{BS} (backspace) on a
+PC.  That is why the PC-specific terminal initialization remaps the
+@key{BS} key to act as @key{DEL}; the @key{DELETE} key is remapped to act
+as @kbd{C-d} for the same reasons.
+
+@kindex C-g @r{(MS-DOS)}
+@kindex C-BREAK @r{(MS-DOS)}
+@cindex quitting on MS-DOS
+  Emacs built for MS-DOS recognizes @kbd{C-@key{BREAK}} as a quit
+character, just like @kbd{C-g}.  This is because Emacs cannot detect
+that you have typed @kbd{C-g} until it is ready for more input.  As a
+consequence, you cannot use @kbd{C-g} to stop a running command
+(@pxref{Quitting,,,emacs, the Emacs Manual}).  By contrast,
+@kbd{C-@key{BREAK}} @emph{is} detected as soon as you type it (as
+@kbd{C-g} is on other systems), so it can be used to stop a running
+command and for emergency escape (@pxref{Emergency Escape,,,emacs, the
+Emacs Manual}).
+
+@cindex Meta (under MS-DOS)
+@cindex Hyper (under MS-DOS)
+@cindex Super (under MS-DOS)
+@vindex dos-super-key
+@vindex dos-hyper-key
+  The PC keyboard maps use the left @key{ALT} key as the @key{META} key.
+You have two choices for emulating the @key{SUPER} and @key{HYPER} keys:
+choose either the right @key{CTRL} key or the right @key{ALT} key by
+setting the variables @code{dos-hyper-key} and @code{dos-super-key} to 1
+or 2 respectively.  If neither @code{dos-super-key} nor
+@code{dos-hyper-key} is 1, then by default the right @key{ALT} key is
+also mapped to the @key{META} key.  However, if the MS-DOS international
+keyboard support program @file{KEYB.COM} is installed, Emacs will
+@emph{not} map the right @key{ALT} to @key{META}, since it is used for
+accessing characters like @kbd{~} and @kbd{@@} on non-US keyboard
+layouts; in this case, you may only use the left @key{ALT} as @key{META}
+key.
+
+@kindex C-j @r{(MS-DOS)}
+@vindex dos-keypad-mode
+  The variable @code{dos-keypad-mode} is a flag variable that controls
+what key codes are returned by keys in the numeric keypad.  You can also
+define the keypad @key{ENTER} key to act like @kbd{C-j}, by putting the
+following line into your @file{_emacs} file:
+
+@smallexample
+;; @r{Make the @key{ENTER} key from the numeric keypad act as @kbd{C-j}.}
+(define-key function-key-map [kp-enter] [?\C-j])
+@end smallexample
+
+@node MS-DOS Mouse
+@section Mouse Usage on MS-DOS
+
+@cindex mouse support under MS-DOS
+  Emacs on MS-DOS supports a mouse (on the default terminal only).
+The mouse commands work as documented, including those that use menus
+and the menu bar (@pxref{Menu Bar,,,emacs, the Emacs Manual}).  Scroll
+bars don't work in MS-DOS Emacs.  PC mice usually have only two
+buttons; these act as @kbd{Mouse-1} and @kbd{Mouse-2}, but if you
+press both of them together, that has the effect of @kbd{Mouse-3}.  If
+the mouse does have 3 buttons, Emacs detects that at startup, and all
+the 3 buttons function normally, as on X.
+
+  Help strings for menu-bar and pop-up menus are displayed in the echo
+area when the mouse pointer moves across the menu items.  Highlighting
+of mouse-sensitive text (@pxref{Mouse References,,,emacs, the Emacs
+Manual}) is also supported.
+
+@cindex mouse, set number of buttons
+@findex msdos-set-mouse-buttons
+  Some versions of mouse drivers don't report the number of mouse
+buttons correctly.  For example, mice with a wheel report that they
+have 3 buttons, but only 2 of them are passed to Emacs; the clicks on
+the wheel, which serves as the middle button, are not passed.  In
+these cases, you can use the @kbd{M-x msdos-set-mouse-buttons} command
+to tell Emacs how many mouse buttons to expect.  You could make such a
+setting permanent by adding this fragment to your @file{_emacs} init
+file:
+
+@example
+;; @r{Treat the mouse like a 2-button mouse.}
+(msdos-set-mouse-buttons 2)
+@end example
+
+@cindex Windows clipboard support
+  Emacs built for MS-DOS supports clipboard operations when it runs on
+Windows.  Commands that put text on the kill ring, or yank text from
+the ring, check the Windows clipboard first, just as Emacs does on the
+X Window System (@pxref{Mouse Commands,,,emacs, the Emacs Manual}).
+Only the primary selection and the cut buffer are supported by MS-DOS
+Emacs on Windows; the secondary selection always appears as empty.
+
+  Due to the way clipboard access is implemented by Windows, the
+length of text you can put into the clipboard is limited by the amount
+of free DOS memory that is available to Emacs.  Usually, up to 620KB of
+text can be put into the clipboard, but this limit depends on the system
+configuration and is lower if you run Emacs as a subprocess of
+another program.  If the killed text does not fit, Emacs outputs a
+message saying so, and does not put the text into the clipboard.
+
+  Null characters also cannot be put into the Windows clipboard.  If the
+killed text includes null characters, Emacs does not put such text into
+the clipboard, and displays in the echo area a message to that effect.
+
+@vindex dos-display-scancodes
+  The variable @code{dos-display-scancodes}, when non-@code{nil},
+directs Emacs to display the @acronym{ASCII} value and the keyboard scan code of
+each keystroke; this feature serves as a complement to the
+@code{view-lossage} command, for debugging.
+
+@node MS-DOS Display
+@section Display on MS-DOS
+@cindex faces under MS-DOS
+@cindex fonts, emulating under MS-DOS
+
+  Display on MS-DOS cannot use font variants, like bold or italic, but
+it does support multiple faces, each of which can specify a foreground
+and a background color.  Therefore, you can get the full functionality
+of Emacs packages that use fonts (such as @code{font-lock}, Enriched
+Text mode, and others) by defining the relevant faces to use different
+colors.  Use the @code{list-colors-display} command (@pxref{Frame
+Parameters,,,emacs, the Emacs Manual}) and the
+@code{list-faces-display} command (@pxref{Faces,,,emacs, the Emacs
+Manual}) to see what colors and faces are available and what they look
+like.
+
+  @xref{MS-DOS and MULE}, later in this chapter, for information on
+how Emacs displays glyphs and characters that aren't supported by the
+native font built into the DOS display.
+
+@cindex cursor shape on MS-DOS
+  When Emacs starts, it changes the cursor shape to a solid box.  This
+is for compatibility with other systems, where the box cursor is the
+default in Emacs.  This default shape can be changed to a bar by
+specifying the @code{cursor-type} parameter in the variable
+@code{default-frame-alist} (@pxref{Creating Frames,,,emacs, the Emacs
+Manual}).  The MS-DOS terminal doesn't support a vertical-bar cursor,
+so the bar cursor is horizontal, and the @code{@var{width}} parameter,
+if specified by the frame parameters, actually determines its height.
+For this reason, the @code{bar} and @code{hbar} cursor types produce
+the same effect on MS-DOS.  As an extension, the bar cursor
+specification can include the starting scan line of the cursor as well
+as its width, like this:
+
+@example
+ '(cursor-type bar @var{width} . @var{start})
+@end example
+
+@noindent
+In addition, if the @var{width} parameter is negative, the cursor bar
+begins at the top of the character cell.
+
+@cindex frames on MS-DOS
+  The MS-DOS terminal can only display a single frame at a time.  The
+Emacs frame facilities work on MS-DOS much as they do on text-only
+terminals (@pxref{Frames,,,emacs, the Emacs Manual}).  When you run
+Emacs from a DOS window on MS-Windows, you can make the visible frame
+smaller than the full screen, but Emacs still cannot display more than
+a single frame at a time.
+
+@cindex frame size under MS-DOS
+@findex mode4350
+@findex mode25
+  The @code{mode4350} command switches the display to 43 or 50
+lines, depending on your hardware; the @code{mode25} command switches
+to the default 80x25 screen size.
+
+  By default, Emacs only knows how to set screen sizes of 80 columns by
+25, 28, 35, 40, 43 or 50 rows.  However, if your video adapter has
+special video modes that will switch the display to other sizes, you can
+have Emacs support those too.  When you ask Emacs to switch the frame to
+@var{n} rows by @var{m} columns dimensions, it checks if there is a
+variable called @code{screen-dimensions-@var{n}x@var{m}}, and if so,
+uses its value (which must be an integer) as the video mode to switch
+to.  (Emacs switches to that video mode by calling the BIOS @code{Set
+Video Mode} function with the value of
+@code{screen-dimensions-@var{n}x@var{m}} in the @code{AL} register.)
+For example, suppose your adapter will switch to 66x80 dimensions when
+put into video mode 85.  Then you can make Emacs support this screen
+size by putting the following into your @file{_emacs} file:
+
+@example
+(setq screen-dimensions-66x80 85)
+@end example
+
+  Since Emacs on MS-DOS can only set the frame size to specific
+supported dimensions, it cannot honor every possible frame resizing
+request.  When an unsupported size is requested, Emacs chooses the next
+larger supported size beyond the specified size.  For example, if you
+ask for 36x80 frame, you will get 40x80 instead.
+
+  The variables @code{screen-dimensions-@var{n}x@var{m}} are used only
+when they exactly match the specified size; the search for the next
+larger supported size ignores them.  In the above example, even if your
+VGA supports 38x80 dimensions and you define a variable
+@code{screen-dimensions-38x80} with a suitable value, you will still get
+40x80 screen when you ask for a 36x80 frame.  If you want to get the
+38x80 size in this case, you can do it by setting the variable named
+@code{screen-dimensions-36x80} with the same video mode value as
+@code{screen-dimensions-38x80}.
+
+  Changing frame dimensions on MS-DOS has the effect of changing all the
+other frames to the new dimensions.
+
+@node MS-DOS File Names
+@section File Names on MS-DOS
+@cindex file names under MS-DOS
+@cindex init file, default name under MS-DOS
+
+  MS-DOS normally uses a backslash, @samp{\}, to separate name units
+within a file name, instead of the slash used on other systems.  Emacs
+on MS-DOS permits use of either slash or backslash, and also knows
+about drive letters in file names.
+
+  On MS-DOS, file names are case-insensitive and limited to eight
+characters, plus optionally a period and three more characters.  Emacs
+knows enough about these limitations to handle file names that were
+meant for other operating systems.  For instance, leading dots
+@samp{.}  in file names are invalid in MS-DOS, so Emacs transparently
+converts them to underscores @samp{_}; thus your default init file
+(@pxref{Init File,,,emacs, the Emacs Manual}) is called @file{_emacs}
+on MS-DOS.  Excess characters before or after the period are generally
+ignored by MS-DOS itself; thus, if you visit the file
+@file{LongFileName.EvenLongerExtension}, you will silently get
+@file{longfile.eve}, but Emacs will still display the long file name
+on the mode line.  Other than that, it's up to you to specify file
+names which are valid under MS-DOS; the transparent conversion as
+described above only works on file names built into Emacs.
+
+@cindex backup file names on MS-DOS
+  The above restrictions on the file names on MS-DOS make it almost
+impossible to construct the name of a backup file (@pxref{Backup
+Names,,,emacs, the Emacs Manual}) without losing some of the original
+file name characters.  For example, the name of a backup file for
+@file{docs.txt} is @file{docs.tx~} even if single backup is used.
+
+@cindex file names under Windows 95/NT
+@cindex long file names in DOS box under Windows 95/NT
+  If you run Emacs as a DOS application under Windows 9X, Windows ME, or
+Windows 2000, you can turn on support for long file names.  If you do
+that, Emacs doesn't truncate file names or convert them to lower case;
+instead, it uses the file names that you specify, verbatim.  To enable
+long file name support, set the environment variable @env{LFN} to
+@samp{y} before starting Emacs.  Unfortunately, Windows NT doesn't allow
+DOS programs to access long file names, so Emacs built for MS-DOS will
+only see their short 8+3 aliases.
+
+@cindex @env{HOME} directory under MS-DOS
+  MS-DOS has no notion of home directory, so Emacs on MS-DOS pretends
+that the directory where it is installed is the value of the @env{HOME}
+environment variable.  That is, if your Emacs binary,
+@file{emacs.exe}, is in the directory @file{c:/utils/emacs/bin}, then
+Emacs acts as if @env{HOME} were set to @samp{c:/utils/emacs}.  In
+particular, that is where Emacs looks for the init file @file{_emacs}.
+With this in mind, you can use @samp{~} in file names as an alias for
+the home directory, as you would on GNU or Unix.  You can also set
+@env{HOME} variable in the environment before starting Emacs; its
+value will then override the above default behavior.
+
+  Emacs on MS-DOS handles the directory name @file{/dev} specially,
+because of a feature in the emulator libraries of DJGPP that pretends
+I/O devices have names in that directory.  We recommend that you avoid
+using an actual directory named @file{/dev} on any disk.
+
+@node MS-DOS Printing
+@section Printing and MS-DOS
+
+  Printing commands, such as @code{lpr-buffer}
+(@pxref{Printing,,,emacs, the Emacs Manual }) and
+@code{ps-print-buffer} (@pxref{PostScript,,,emacs, the Emacs Manual})
+can work in MS-DOS and MS-Windows by sending the output to one of the
+printer ports, if a Posix-style @code{lpr} program is unavailable.
+The same Emacs variables control printing on all systems, but in some
+cases they have different default values on MS-DOS and MS-Windows.
+
+@vindex printer-name @r{(MS-DOS)}
+  If you want to use your local printer, printing on it in the usual DOS
+manner, then set the Lisp variable @code{lpr-command} to @code{""} (its
+default value) and @code{printer-name} to the name of the printer
+port---for example, @code{"PRN"}, the usual local printer port (that's
+the default), or @code{"LPT2"}, or @code{"COM1"} for a serial printer.
+You can also set @code{printer-name} to a file name, in which case
+``printed'' output is actually appended to that file.  If you set
+@code{printer-name} to @code{"NUL"}, printed output is silently
+discarded (sent to the system null device).
+
+  On MS-Windows, when the Windows network software is installed, you can
+also use a printer shared by another machine by setting
+@code{printer-name} to the UNC share name for that printer---for example,
+@code{"//joes_pc/hp4si"}.  (It doesn't matter whether you use forward
+slashes or backslashes here.)  To find out the names of shared printers,
+run the command @samp{net view} at a DOS command prompt to obtain a list
+of servers, and @samp{net view @var{server-name}} to see the names of printers
+(and directories) shared by that server.  Alternatively, click the
+@samp{Network Neighborhood} icon on your desktop, and look for machines
+which share their printers via the network.
+
+@cindex @samp{net use}, and printing on MS-Windows
+@cindex networked printers (MS-Windows)
+  If the printer doesn't appear in the output of @samp{net view}, or
+if setting @code{printer-name} to the UNC share name doesn't produce a
+hardcopy on that printer, you can use the @samp{net use} command to
+connect a local print port such as @code{"LPT2"} to the networked
+printer.  For example, typing @kbd{net use LPT2:
+\\joes_pc\hp4si}@footnote{
+Note that the @samp{net use} command requires the UNC share name to be
+typed with the Windows-style backslashes, while the value of
+@code{printer-name} can be set with either forward- or backslashes.}
+causes Windows to @dfn{capture} the LPT2 port and redirect the printed
+material to the printer connected to the machine @code{joes_pc}.
+After this command, setting @code{printer-name} to @code{"LPT2"}
+should produce the hardcopy on the networked printer.
+
+  With some varieties of Windows network software, you can instruct
+Windows to capture a specific printer port such as @code{"LPT2"}, and
+redirect it to a networked printer via the @w{@code{Control
+Panel->Printers}} applet instead of @samp{net use}.
+
+  Some printers expect DOS codepage encoding of non-@acronym{ASCII} text, even
+though they are connected to a Windows machine which uses a different
+encoding for the same locale.  For example, in the Latin-1 locale, DOS
+uses codepage 850 whereas Windows uses codepage 1252.  @xref{MS-DOS and
+MULE}.  When you print to such printers from Windows, you can use the
+@kbd{C-x RET c} (@code{universal-coding-system-argument}) command before
+@kbd{M-x lpr-buffer}; Emacs will then convert the text to the DOS
+codepage that you specify.  For example, @kbd{C-x RET c cp850-dos RET
+M-x lpr-region RET} will print the region while converting it to the
+codepage 850 encoding.  You may need to create the @code{cp@var{nnn}}
+coding system with @kbd{M-x codepage-setup}.
+
+  If you set @code{printer-name} to a file name, it's best to use an
+absolute file name.  Emacs changes the working directory according to
+the default directory of the current buffer, so if the file name in
+@code{printer-name} is relative, you will end up with several such
+files, each one in the directory of the buffer from which the printing
+was done.
+
+@findex print-buffer @r{(MS-DOS)}
+@findex print-region @r{(MS-DOS)}
+@vindex lpr-headers-switches @r{(MS-DOS)}
+  The commands @code{print-buffer} and @code{print-region} call the
+@code{pr} program, or use special switches to the @code{lpr} program, to
+produce headers on each printed page.  MS-DOS and MS-Windows don't
+normally have these programs, so by default, the variable
+@code{lpr-headers-switches} is set so that the requests to print page
+headers are silently ignored.  Thus, @code{print-buffer} and
+@code{print-region} produce the same output as @code{lpr-buffer} and
+@code{lpr-region}, respectively.  If you do have a suitable @code{pr}
+program (for example, from GNU Textutils), set
+@code{lpr-headers-switches} to @code{nil}; Emacs will then call
+@code{pr} to produce the page headers, and print the resulting output as
+specified by @code{printer-name}.
+
+@vindex print-region-function @r{(MS-DOS)}
+@cindex lpr usage under MS-DOS
+@vindex lpr-command @r{(MS-DOS)}
+@vindex lpr-switches @r{(MS-DOS)}
+  Finally, if you do have an @code{lpr} work-alike, you can set the
+variable @code{lpr-command} to @code{"lpr"}.  Then Emacs will use
+@code{lpr} for printing, as on other systems.  (If the name of the
+program isn't @code{lpr}, set @code{lpr-command} to specify where to
+find it.)  The variable @code{lpr-switches} has its standard meaning
+when @code{lpr-command} is not @code{""}.  If the variable
+@code{printer-name} has a string value, it is used as the value for the
+@code{-P} option to @code{lpr}, as on Unix.
+
+@findex ps-print-buffer @r{(MS-DOS)}
+@findex ps-spool-buffer @r{(MS-DOS)}
+@vindex ps-printer-name @r{(MS-DOS)}
+@vindex ps-lpr-command @r{(MS-DOS)}
+@vindex ps-lpr-switches @r{(MS-DOS)}
+  A parallel set of variables, @code{ps-lpr-command},
+@code{ps-lpr-switches}, and @code{ps-printer-name} (@pxref{PostScript
+Variables,,,emacs, the Emacs Manual}), defines how PostScript files
+should be printed.  These variables are used in the same way as the
+corresponding variables described above for non-PostScript printing.
+Thus, the value of @code{ps-printer-name} is used as the name of the
+device (or file) to which PostScript output is sent, just as
+@code{printer-name} is used for non-PostScript printing.  (There are
+two distinct sets of variables in case you have two printers attached
+to two different ports, and only one of them is a PostScript printer.)
+
+  The default value of the variable @code{ps-lpr-command} is @code{""},
+which causes PostScript output to be sent to the printer port specified
+by @code{ps-printer-name}, but @code{ps-lpr-command} can also be set to
+the name of a program which will accept PostScript files.  Thus, if you
+have a non-PostScript printer, you can set this variable to the name of
+a PostScript interpreter program (such as Ghostscript).  Any switches
+that need to be passed to the interpreter program are specified using
+@code{ps-lpr-switches}.  (If the value of @code{ps-printer-name} is a
+string, it will be added to the list of switches as the value for the
+@code{-P} option.  This is probably only useful if you are using
+@code{lpr}, so when using an interpreter typically you would set
+@code{ps-printer-name} to something other than a string so it is
+ignored.)
+
+  For example, to use Ghostscript for printing on an Epson printer
+connected to the @samp{LPT2} port, put this in your @file{_emacs} file:
+
+@example
+(setq ps-printer-name t)  ; Ghostscript doesn't understand -P
+(setq ps-lpr-command "c:/gs/gs386")
+(setq ps-lpr-switches '("-q" "-dNOPAUSE"
+			"-sDEVICE=epson"
+			"-r240x72"
+			"-sOutputFile=LPT2"
+			"-Ic:/gs"))
+@end example
+
+@noindent
+(This assumes that Ghostscript is installed in the @file{"c:/gs"}
+directory.)
+
+@vindex dos-printer
+@vindex dos-ps-printer
+  For backwards compatibility, the value of @code{dos-printer}
+(@code{dos-ps-printer}), if it has a value, overrides the value of
+@code{printer-name} (@code{ps-printer-name}), on MS-DOS and MS-Windows
+only.
+
+
+@node MS-DOS and MULE
+@section International Support on MS-DOS
+@cindex international support @r{(MS-DOS)}
+
+  Emacs on MS-DOS supports the same international character sets as it
+does on GNU, Unix and other platforms (@pxref{International,,,emacs,
+the Emacs Manual}), including coding systems for converting between
+the different character sets.  However, due to incompatibilities
+between MS-DOS/MS-Windows and other systems, there are several
+DOS-specific aspects of this support that you should be aware of.
+This section describes these aspects.
+
+  The description below is largely specific to the MS-DOS port of
+Emacs, especially where it talks about practical implications for
+Emacs users.  For other operating systems, see the @file{code-pages.el}
+package, which implements support for MS-DOS- and MS-Windows-specific
+encodings for all platforms other than MS-DOS.
+
+@table @kbd
+@item M-x dos-codepage-setup
+Set up Emacs display and coding systems as appropriate for the current
+DOS codepage.
+
+@item M-x codepage-setup
+Create a coding system for a certain DOS codepage.
+@end table
+
+@cindex codepage, MS-DOS
+@cindex DOS codepages
+  MS-DOS is designed to support one character set of 256 characters at
+any given time, but gives you a variety of character sets to choose
+from.  The alternative character sets are known as @dfn{DOS codepages}.
+Each codepage includes all 128 @acronym{ASCII} characters, but the other 128
+characters (codes 128 through 255) vary from one codepage to another.
+Each DOS codepage is identified by a 3-digit number, such as 850, 862,
+etc.
+
+  In contrast to X, which lets you use several fonts at the same time,
+MS-DOS normally doesn't allow use of several codepages in a single
+session.  MS-DOS was designed to load a single codepage at system
+startup, and require you to reboot in order to change
+it@footnote{Normally, one particular codepage is burnt into the
+display memory, while other codepages can be installed by modifying
+system configuration files, such as @file{CONFIG.SYS}, and rebooting.
+While there is third-party software that allows changing the codepage
+without rebooting, we describe here how a stock MS-DOS system
+behaves.}.  Much the same limitation applies when you run DOS
+executables on other systems such as MS-Windows.
+
+@cindex unibyte operation @r{(MS-DOS)}
+  If you invoke Emacs on MS-DOS with the @samp{--unibyte} option
+(@pxref{Initial Options,,,emacs, the Emacs Manual}), Emacs does not
+perform any conversion of non-@acronym{ASCII} characters.  Instead, it
+reads and writes any non-@acronym{ASCII} characters verbatim, and
+sends their 8-bit codes to the display verbatim.  Thus, unibyte Emacs
+on MS-DOS supports the current codepage, whatever it may be, but
+cannot even represent any other characters.
+
+@vindex dos-codepage
+  For multibyte operation on MS-DOS, Emacs needs to know which
+characters the chosen DOS codepage can display.  So it queries the
+system shortly after startup to get the chosen codepage number, and
+stores the number in the variable @code{dos-codepage}.  Some systems
+return the default value 437 for the current codepage, even though the
+actual codepage is different.  (This typically happens when you use the
+codepage built into the display hardware.)  You can specify a different
+codepage for Emacs to use by setting the variable @code{dos-codepage} in
+your init file.
+
+@cindex language environment, automatic selection on @r{MS-DOS}
+  Multibyte Emacs supports only certain DOS codepages: those which can
+display Far-Eastern scripts, like the Japanese codepage 932, and those
+that encode a single ISO 8859 character set.
+
+  The Far-Eastern codepages can directly display one of the MULE
+character sets for these countries, so Emacs simply sets up to use the
+appropriate terminal coding system that is supported by the codepage.
+The special features described in the rest of this section mostly
+pertain to codepages that encode ISO 8859 character sets.
+
+  For the codepages which correspond to one of the ISO character sets,
+Emacs knows the character set name based on the codepage number.  Emacs
+automatically creates a coding system to support reading and writing
+files that use the current codepage, and uses this coding system by
+default.  The name of this coding system is @code{cp@var{nnn}}, where
+@var{nnn} is the codepage number.@footnote{The standard Emacs coding
+systems for ISO 8859 are not quite right for the purpose, because
+typically the DOS codepage does not match the standard ISO character
+codes.  For example, the letter @samp{@,{c}} (@samp{c} with cedilla) has
+code 231 in the standard Latin-1 character set, but the corresponding
+DOS codepage 850 uses code 135 for this glyph.}
+
+@cindex mode line @r{(MS-DOS)}
+  All the @code{cp@var{nnn}} coding systems use the letter @samp{D}
+(for ``DOS'') as their mode-line mnemonic.  Since both the terminal
+coding system and the default coding system for file I/O are set to
+the proper @code{cp@var{nnn}} coding system at startup, it is normal
+for the mode line on MS-DOS to begin with @samp{-DD\-}.  @xref{Mode
+Line,,,emacs, the Emacs Manual}.  Far-Eastern DOS terminals do not use
+the @code{cp@var{nnn}} coding systems, and thus their initial mode
+line looks like the Emacs default.
+
+  Since the codepage number also indicates which script you are using,
+Emacs automatically runs @code{set-language-environment} to select the
+language environment for that script (@pxref{Language
+Environments,,,emacs, the Emacs Manual}).
+
+  If a buffer contains a character belonging to some other ISO 8859
+character set, not the one that the chosen DOS codepage supports, Emacs
+displays it using a sequence of @acronym{ASCII} characters.  For example, if the
+current codepage doesn't have a glyph for the letter @samp{@`o} (small
+@samp{o} with a grave accent), it is displayed as @samp{@{`o@}}, where
+the braces serve as a visual indication that this is a single character.
+(This may look awkward for some non-Latin characters, such as those from
+Greek or Hebrew alphabets, but it is still readable by a person who
+knows the language.)  Even though the character may occupy several
+columns on the screen, it is really still just a single character, and
+all Emacs commands treat it as one.
+
+@cindex IBM graphics characters (MS-DOS)
+@cindex box-drawing characters (MS-DOS)
+@cindex line-drawing characters (MS-DOS)
+  Not all characters in DOS codepages correspond to ISO 8859
+characters---some are used for other purposes, such as box-drawing
+characters and other graphics.  Emacs maps these characters to two
+special character sets called @code{eight-bit-control} and
+@code{eight-bit-graphic}, and displays them as their IBM glyphs.
+However, you should be aware that other systems might display these
+characters differently, so you should avoid them in text that might be
+copied to a different operating system, or even to another DOS machine
+that uses a different codepage.
+
+@vindex dos-unsupported-character-glyph
+  Emacs supports many other characters sets aside from ISO 8859, but it
+cannot display them on MS-DOS.  So if one of these multibyte characters
+appears in a buffer, Emacs on MS-DOS displays them as specified by the
+@code{dos-unsupported-character-glyph} variable; by default, this glyph
+is an empty triangle.  Use the @kbd{C-u C-x =} command to display the
+actual code and character set of such characters.  @xref{Position
+Info,,,emacs, the Emacs Manual}.
+
+@findex codepage-setup
+  By default, Emacs defines a coding system to support the current
+codepage.  To define a coding system for some other codepage (e.g., to
+visit a file written on a DOS machine in another country), use the
+@kbd{M-x codepage-setup} command.  It prompts for the 3-digit code of
+the codepage, with completion, then creates the coding system for the
+specified codepage.  You can then use the new coding system to read and
+write files, but you must specify it explicitly for the file command
+when you want to use it (@pxref{Text Coding,,,emacs, the Emacs Manual}).
+
+  These coding systems are also useful for visiting a file encoded using
+a DOS codepage, using Emacs running on some other operating system.
+
+@cindex MS-Windows codepages
+  MS-Windows provides its own codepages, which are different from the
+DOS codepages for the same locale.  For example, DOS codepage 850
+supports the same character set as Windows codepage 1252; DOS codepage
+855 supports the same character set as Windows codepage 1251, etc.
+The MS-Windows version of Emacs uses the current codepage for display
+when invoked with the @samp{-nw} option.  Support for codepages in the
+Windows port of Emacs is part of the @file{code-pages.el} package.
+
+@node MS-DOS Processes
+@section Subprocesses on MS-DOS
+
+@cindex compilation under MS-DOS
+@cindex inferior processes under MS-DOS
+@findex compile @r{(MS-DOS)}
+@findex grep @r{(MS-DOS)}
+  Because MS-DOS is a single-process ``operating system,''
+asynchronous subprocesses are not available.  In particular, Shell
+mode and its variants do not work.  Most Emacs features that use
+asynchronous subprocesses also don't work on MS-DOS, including
+Shell mode and GUD.  When in doubt, try and see; commands that
+don't work output an error message saying that asynchronous processes
+aren't supported.
+
+  Compilation under Emacs with @kbd{M-x compile}, searching files with
+@kbd{M-x grep} and displaying differences between files with @kbd{M-x
+diff} do work, by running the inferior processes synchronously.  This
+means you cannot do any more editing until the inferior process
+finishes.
+
+  Spell checking also works, by means of special support for synchronous
+invocation of the @code{ispell} program.  This is slower than the
+asynchronous invocation on other platforms
+
+  Instead of the Shell mode, which doesn't work on MS-DOS, you can use
+the @kbd{M-x eshell} command.  This invokes the Eshell package that
+implements a Posix-like shell entirely in Emacs Lisp.
+
+  By contrast, Emacs compiled as a native Windows application
+@strong{does} support asynchronous subprocesses.  @xref{Windows
+Processes,,,emacs, the Emacs Manual}.
+
+@cindex printing under MS-DOS
+  Printing commands, such as @code{lpr-buffer}
+(@pxref{Printing,,,emacs, the Emacs Manual}) and
+@code{ps-print-buffer} (@pxref{PostScript,,,emacs, the Emacs Manual}),
+work in MS-DOS by sending the output to one of the printer ports.
+@xref{MS-DOS Printing,,,emacs, the Emacs Manual}.
+
+  When you run a subprocess synchronously on MS-DOS, make sure the
+program terminates and does not try to read keyboard input.  If the
+program does not terminate on its own, you will be unable to terminate
+it, because MS-DOS provides no general way to terminate a process.
+Pressing @kbd{C-c} or @kbd{C-@key{BREAK}} might sometimes help in these
+cases.
+
+  Accessing files on other machines is not supported on MS-DOS.  Other
+network-oriented commands such as sending mail, Web browsing, remote
+login, etc., don't work either, unless network access is built into
+MS-DOS with some network redirector.
+
+@cindex directory listing on MS-DOS
+@vindex dired-listing-switches @r{(MS-DOS)}
+  Dired on MS-DOS uses the @code{ls-lisp} package where other
+platforms use the system @code{ls} command.  Therefore, Dired on
+MS-DOS supports only some of the possible options you can mention in
+the @code{dired-listing-switches} variable.  The options that work are
+@samp{-A}, @samp{-a}, @samp{-c}, @samp{-i}, @samp{-r}, @samp{-S},
+@samp{-s}, @samp{-t}, and @samp{-u}.
+
+
 @node Index
 @unnumbered Index
 
--- a/man/emacs.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/emacs.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -73,7 +73,12 @@
 Cover art by Etienne Suvasa.
 
 @end titlepage
-@page
+
+
+@summarycontents
+@contents
+
+
 @ifnottex
 @node Top, Distrib, (dir), (dir)
 @top The Emacs Editor
@@ -122,7 +127,7 @@
 * Glossary::	        The glossary.
 * Antinews::	        Information about Emacs version 21.
 * Mac OS::              Using Emacs in the Mac.
-* MS-DOS::              Using Emacs on MS-DOS and Microsoft Windows.
+* Emacs and Microsoft Windows::  Using Emacs on Microsoft Windows.
 * Manifesto::	        What's GNU?  Gnu's Not Unix!
 * Acknowledgments::     Major contributors to GNU Emacs.
 
@@ -394,10 +399,6 @@
 * Old Versions::        Examining and comparing old versions.
 * Secondary VC Commands:: The commands used a little less frequently.
 * Branches::            Multiple lines of development.
-* Remote Repositories:: Efficient access to remote CVS servers.
-* Snapshots::           Sets of file versions treated as a unit.
-* Miscellaneous VC::    Various other commands and features of VC.
-* Customizing VC::      Variables that change VC's behavior.
 
 Using Multiple Buffers
 
@@ -855,16 +856,9 @@
 * Mac Font Specs::      Specifying fonts on Mac.
 * Mac Functions::       Mac-specific Lisp functions.
 
-MS-DOS and Windows 95/98/NT
+Emacs and Microsoft Windows
 
-* MS-DOS Keyboard::     Keyboard usage on MS-DOS.
-* MS-DOS Mouse::        Mouse usage on MS-DOS.
-* MS-DOS Display::      Fonts, frames and display size on MS-DOS.
-* MS-DOS File Names::   File-name conventions on MS-DOS.
 * Text and Binary::     Text files on MS-DOS use CRLF to separate lines.
-* MS-DOS Printing::     How to specify the printer on MS-DOS.
-* MS-DOS and MULE::     Support for internationalization on MS-DOS.
-* MS-DOS Processes::    Running subprocesses on MS-DOS.
 * Windows Processes::   Running subprocesses on Windows.
 * Windows System Menu:: Controlling what the ALT key does.
 @end menu
@@ -926,10 +920,10 @@
 installed on GNU and Unix systems.  GNU Emacs can also be used on VMS,
 MS-DOS (also called MS-DOG), Microsoft Windows, and Macintosh systems.
 Those systems use different file name syntax; in addition, VMS and
-MS-DOS do not support all GNU Emacs features.  @xref{MS-DOS}, for
-information about using Emacs on MS-DOS and Windows.  @xref{Mac OS},
-for information about using Emacs on Macintosh.  We don't try to
-describe VMS usage in this manual.
+MS-DOS do not support all GNU Emacs features.  @xref{Emacs and
+Microsoft Windows}, for information about using Emacs on Windows.
+@xref{Mac OS}, for information about using Emacs on Macintosh.  We
+don't try to describe VMS usage in this manual.
 @end iftex
 
 @node Distrib, Intro, Top, Top
@@ -1604,8 +1598,6 @@
 @unnumbered Concept Index
 @printindex cp
 
-@summarycontents
-@contents
 @bye
 
 @ignore
--- a/man/files.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/files.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -517,7 +517,8 @@
 Control}), the variable @code{vc-make-backup-files} determines whether
 to make backup files.  By default it is @code{nil}, since backup files
 are redundant when you store all the previous versions in a version
-control system.  @xref{General VC Options}.
+control system.  @xref{General VC Options,,,emacs-xtra, Specialized
+Emacs Features}.
 
   At your option, Emacs can keep either a single backup for each file,
 or make a series of numbered backup files for each file that you edit.
@@ -1200,7 +1201,7 @@
 
   VC is enabled by default in Emacs.  To disable it, set the
 customizable variable @code{vc-handled-backends} to @code{nil}
-(@pxref{Customizing VC}).
+(@pxref{Customizing VC,,,emacs-xtra, Specialized Emacs Features}).
 
 @menu
 * Introduction to VC::  How version control works in general.
@@ -1209,10 +1210,6 @@
 * Old Versions::        Examining and comparing old versions.
 * Secondary VC Commands::    The commands used a little less frequently.
 * Branches::            Multiple lines of development.
-* Remote Repositories:: Efficient access to remote CVS servers.
-* Snapshots::           Sets of file versions treated as a unit.
-* Miscellaneous VC::    Various other commands and features of VC.
-* Customizing VC::      Variables that change VC's behavior.
 @end menu
 
 @node Introduction to VC
@@ -1350,7 +1347,7 @@
   CVS normally allows each user to modify his own copy of the work file
 at any time, but requires merging with changes from other users at
 check-in time.  However, CVS can also be set up to require locking.
-(@pxref{CVS Options}).
+(@pxref{CVS Options,,,emacs-xtra, Specialized Emacs Features}).
 
 @node Types of Log File
 @subsubsection Types of Log File
@@ -1382,7 +1379,8 @@
 the entry in @file{ChangeLog}, then copy it to the log buffer when you
 check in the change.  Or you can write the entry in the log buffer
 while checking in the change, and later use the @kbd{C-x v a} command
-to copy it to @file{ChangeLog} (@pxref{Change Logs and VC}).
+to copy it to @file{ChangeLog} (@pxref{Change Logs and
+VC,,,emacs-xtra, Specialized Emacs Features}).
 
 @node VC Mode Line
 @subsection Version Control and the Mode Line
@@ -1547,7 +1545,7 @@
 Instead of the version number, you can also specify the name of a
 version control system.  This is useful when one file is being managed
 with two version control systems at the same time (@pxref{Local
-Version Control}).
+Version Control,,,emacs-xtra, Specialized Emacs Features}).
 @end itemize
 
 @node Log Buffer
@@ -1569,14 +1567,16 @@
 entries for the file(s) concerned in the top entry in the ChangeLog
 and uses those paragraphs as the log text.  This text is only inserted
 if the top entry was made under your user name on the current date.
-@xref{Change Logs and VC}, for the opposite way of
-working---generating ChangeLog entries from the revision control log.
-
-  In the @samp{*VC-Log*} buffer, @kbd{C-c C-f} (@kbd{M-x log-edit-show-files})
-shows the list of files to be committed in case you need to check
-that.  (This can be a list of more than one file if you use VC Dired
-mode or PCL-CVS.  @xref{VC Dired Mode}, and @ref{Top, , About PCL-CVS,
-pcl-cvs, PCL-CVS --- The Emacs Front-End to CVS}.)
+@xref{Change Logs and VC,,,emacs-xtra, Specialized Emacs Features},
+for the opposite way of working---generating ChangeLog entries from
+the revision control log.
+
+  In the @samp{*VC-Log*} buffer, @kbd{C-c C-f} (@kbd{M-x
+log-edit-show-files}) shows the list of files to be committed in case
+you need to check that.  (This can be a list of more than one file if
+you use VC Dired mode or PCL-CVS.  @xref{VC Dired Mode,,,emacs-xtra,
+Specialized Emacs Features}, and @ref{Top, , About PCL-CVS, pcl-cvs,
+PCL-CVS --- The Emacs Front-End to CVS}.)
 
   When you have finished editing the log message, type @kbd{C-c C-c} to
 exit the buffer and commit the change.
@@ -1644,7 +1644,7 @@
   You can specify a checked-in version by its number; an empty input
 specifies the current contents of the work file (which may be different
 from all the checked-in versions).  You can also specify a snapshot name
-(@pxref{Snapshots}) instead of one or both version numbers.
+(@pxref{Snapshots,,,emacs-xtra, Specialized Emacs Features}) instead of one or both version numbers.
 
   If you supply a directory name instead of the name of a registered
 file, this command compares the two specified versions of all registered
@@ -1672,23 +1672,22 @@
 @kindex C-x v g
   For some back ends, you can display the file @dfn{annotated} with
 per-line version information and using colors to enhance the visual
-appearance, with the command @kbd{M-x vc-annotate}.
-It creates a new buffer (the ``annotate buffer'') displaying the
-file's text, with each part colored to show how old it is.  Text
-colored red is new, blue means old, and intermediate colors indicate
-intermediate ages.  By default, the time scale is 360 days, so that
-everything more than one year old is shown in blue.
+appearance, with the command @kbd{M-x vc-annotate}.  It creates a new
+buffer (the ``annotate buffer'') displaying the file's text, with each
+part colored to show how old it is.  Text colored red is new, blue means
+old, and intermediate colors indicate intermediate ages.  By default,
+the color is scaled over the full range of ages, such that the oldest
+changes are blue, and the newest changes are red.
 
   When you give a prefix argument to this command, it uses the
 minibuffer to read two arguments: which version number to display and
-annotate (instead of the current file contents), and a stretch factor
-for the time scale.  A stretch factor of 0.1 means that the color
-range from red to blue spans the past 36 days instead of 360 days.  A
-stretch factor greater than 1 means the color range spans more than a
-year.
-
-  From the annotate buffer, you can use the following keys to browse the
-annotations of past revisions, view diffs, or view log entries:
+annotate (instead of the current file contents), and the time span in
+days the color range should cover.  
+
+  From the annotate buffer, these and other color scaling options are
+available from the @samp{VC-Annotate} menu.  In this buffer, you can
+also use the following keys to browse the annotations of past revisions,
+view diffs, or view log entries:
 
 @table @kbd
 @item P
@@ -1734,8 +1733,6 @@
 * Registering::         Putting a file under version control.
 * VC Status::           Viewing the VC status of files.
 * VC Undo::             Canceling changes before or after check-in.
-* VC Dired Mode::       Listing files managed by version control.
-* VC Dired Commands::   Commands to use in a VC Dired buffer.
 @end menu
 
 @node Registering
@@ -1754,14 +1751,15 @@
   To register the file, Emacs must choose which version control system
 to use for it.  If the file's directory already contains files
 registered in a version control system, Emacs uses that system.  If
-there is more than one system in use for a directory, Emacs uses the one
-that appears first in @code{vc-handled-backends} (@pxref{Customizing VC}).
-On the other hand, if there are no files already registered,
-Emacs uses the first system from @code{vc-handled-backends} that could
-register the file (for example, you cannot register a file under CVS if
-its directory is not already part of a CVS tree); with the default
-value of @code{vc-handled-backends}, this means that Emacs uses RCS in
-this situation.
+there is more than one system in use for a directory, Emacs uses the
+one that appears first in @code{vc-handled-backends}
+(@pxref{Customizing VC,,,emacs-xtra, Specialized Emacs Features}).  On
+the other hand, if there are no files already registered, Emacs uses
+the first system from @code{vc-handled-backends} that could register
+the file (for example, you cannot register a file under CVS if its
+directory is not already part of a CVS tree); with the default value
+of @code{vc-handled-backends}, this means that Emacs uses RCS in this
+situation.
 
   If locking is in use, @kbd{C-x v i} leaves the file unlocked and
 read-only.  Type @kbd{C-x v v} if you wish to start editing it.  After
@@ -1816,14 +1814,16 @@
 
 @item P
 Move to the log of the previous file, when the logs of multiple files
-are in the log buffer (@pxref{VC Dired Mode}).  Otherwise, just move
-to the beginning of the log.  A numeric prefix argument is a repeat
-count, so @kbd{C-u 10 P} would move backward 10 files.
+are in the log buffer (@pxref{VC Dired Mode,,,emacs-xtra, Specialized
+Emacs Features}).  Otherwise, just move to the beginning of the log.  A
+numeric prefix argument is a repeat count, so @kbd{C-u 10 P} would
+move backward 10 files.
 
 @item N
 Move to the log of the next file, when the logs of multiple files are
-in the log buffer (@pxref{VC Dired Mode}).  It also takes a numeric
-prefix argument as a repeat count.
+in the log buffer (@pxref{VC Dired Mode,,,emacs-xtra, Specialized
+Emacs Features}).  It also takes a numeric prefix argument as a repeat
+count.
 
 @item f
 Visit the revision indicated at the current line, like typing @kbd{C-x
@@ -1877,10 +1877,11 @@
 erroneous check-in, fix the error, and check the file in again.
 
   When @kbd{C-x v c} does not revert the buffer, it unexpands all
-version control headers in the buffer instead (@pxref{Version Headers}).
-This is because the buffer no longer corresponds to any existing
-version.  If you check it in again, the check-in process will expand the
-headers properly for the new version number.
+version control headers in the buffer instead (@pxref{Version
+Headers,,,emacs-xtra, Specialized Emacs Features}).  This is because
+the buffer no longer corresponds to any existing version.  If you
+check it in again, the check-in process will expand the headers
+properly for the new version number.
 
   However, it is impossible to unexpand the RCS @samp{@w{$}Log$} header
 automatically.  If you use that header feature, you have to unexpand it
@@ -1892,142 +1893,6 @@
 under CVS, because canceling versions is very dangerous and discouraged
 with CVS.
 
-@node VC Dired Mode
-@subsubsection Dired under VC
-
-@cindex PCL-CVS
-@pindex cvs
-@cindex CVS Dired Mode
-  The VC Dired Mode described here works with all the version control
-systems that VC supports.  Another more powerful facility, designed
-specifically for CVS, is called PCL-CVS.  @xref{Top, , About PCL-CVS,
-pcl-cvs, PCL-CVS --- The Emacs Front-End to CVS}.
-
-@kindex C-x v d
-@findex vc-directory
-  When you are working on a large program, it is often useful to find
-out which files have changed within an entire directory tree, or to view
-the status of all files under version control at once, and to perform
-version control operations on collections of files.  You can use the
-command @kbd{C-x v d} (@code{vc-directory}) to make a directory listing
-that includes only files relevant for version control.
-
-@vindex vc-dired-terse-display
-  @kbd{C-x v d} creates a buffer which uses VC Dired Mode.  This looks
-much like an ordinary Dired buffer (@pxref{Dired}); however, normally it
-shows only the noteworthy files (those locked or not up-to-date).  This
-is called @dfn{terse display}.  If you set the variable
-@code{vc-dired-terse-display} to @code{nil}, then VC Dired shows all
-relevant files---those managed under version control, plus all
-subdirectories (@dfn{full display}).  The command @kbd{v t} in a VC
-Dired buffer toggles between terse display and full display (@pxref{VC
-Dired Commands}).
-
-@vindex vc-dired-recurse
-  By default, VC Dired produces a recursive listing of noteworthy or
-relevant files at or below the given directory.  You can change this by
-setting the variable @code{vc-dired-recurse} to @code{nil}; then VC
-Dired shows only the files in the given directory.
-
-  The line for an individual file shows the version control state in the
-place of the hard link count, owner, group, and size of the file.  If
-the file is unmodified, in sync with the master file, the version
-control state shown is blank.  Otherwise it consists of text in
-parentheses.  Under RCS and SCCS, the name of the user locking the file
-is shown; under CVS, an abbreviated version of the @samp{cvs status}
-output is used.  Here is an example using RCS:
-
-@smallexample
-@group
-  /home/jim/project:
-
-  -rw-r--r-- (jim)      Apr  2 23:39 file1
-  -r--r--r--            Apr  5 20:21 file2
-@end group
-@end smallexample
-
-@noindent
-The files @samp{file1} and @samp{file2} are under version control,
-@samp{file1} is locked by user jim, and @samp{file2} is unlocked.
-
-  Here is an example using CVS:
-
-@smallexample
-@group
-  /home/joe/develop:
-
-  -rw-r--r-- (modified) Aug  2  1997 file1.c
-  -rw-r--r--            Apr  4 20:09 file2.c
-  -rw-r--r-- (merge)    Sep 13  1996 file3.c
-@end group
-@end smallexample
-
-  Here @samp{file1.c} is modified with respect to the repository, and
-@samp{file2.c} is not.  @samp{file3.c} is modified, but other changes
-have also been checked in to the repository---you need to merge them
-with the work file before you can check it in.
-
-@vindex vc-stay-local
-@vindex vc-cvs-stay-local
-  In the above, if the repository were on a remote machine, VC would
-only contact it when the variable @code{vc-stay-local} (or
-@code{vc-cvs-stay-local}) is nil (@pxref{CVS Options}).  This is
-because access to the repository may be slow, or you may be working
-offline and not have access to the repository at all.  As a
-consequence, VC would not be able to tell you that @samp{file3.c} is
-in the ``merge'' state; you would learn that only when you try to
-check-in your modified copy of the file, or use a command such as
-@kbd{C-x v m}.
-
-  In practice, this is not a problem because CVS handles this case
-consistently whenever it arises.  In VC, you'll simply get prompted to
-merge the remote changes into your work file first.  The benefits of
-less network communication usually outweigh the disadvantage of not
-seeing remote changes immediately.
-
-@vindex vc-directory-exclusion-list
-  When VC Dired displays subdirectories (in the ``full'' display mode),
-it omits some that should never contain any files under version control.
-By default, this includes Version Control subdirectories such as
-@samp{RCS} and @samp{CVS}; you can customize this by setting the
-variable @code{vc-directory-exclusion-list}.
-
-  You can fine-tune VC Dired's format by typing @kbd{C-u C-x v d}---as in
-ordinary Dired, that allows you to specify additional switches for the
-@samp{ls} command.
-
-@node VC Dired Commands
-@subsubsection VC Dired Commands
-
-  All the usual Dired commands work normally in VC Dired mode, except
-for @kbd{v}, which is redefined as the version control prefix.  You can
-invoke VC commands such as @code{vc-diff} and @code{vc-print-log} by
-typing @kbd{v =}, or @kbd{v l}, and so on.  Most of these commands apply
-to the file name on the current line.
-
-  The command @kbd{v v} (@code{vc-next-action}) operates on all the
-marked files, so that you can lock or check in several files at once.
-If it operates on more than one file, it handles each file according to
-its current state; thus, it might lock one file, but check in another
-file.  This could be confusing; it is up to you to avoid confusing
-behavior by marking a set of files that are in a similar state.  If no
-files are marked, @kbd{v v} operates on the file in the current line.
-
-  If any files call for check-in, @kbd{v v} reads a single log entry,
-then uses it for all the files being checked in.  This is convenient for
-registering or checking in several files at once, as part of the same
-change.
-
-@findex vc-dired-toggle-terse-mode
-@findex vc-dired-mark-locked
-  You can toggle between terse display (only locked files, or files not
-up-to-date) and full display at any time by typing @kbd{v t}
-(@code{vc-dired-toggle-terse-mode}).  There is also a special command
-@kbd{* l} (@code{vc-dired-mark-locked}), which marks all files currently
-locked (or, with CVS, all files not up-to-date).  Thus, typing @kbd{* l
-t k} is another way to delete from the buffer all files except those
-currently locked.
-
 @node Branches
 @subsection Multiple Branches of a File
 @cindex branch (version control)
@@ -2206,9 +2071,10 @@
 records.
 
   This technique works reliably and automatically, provided that the
-source files contain RCS version headers (@pxref{Version Headers}).  The
-headers enable Emacs to be sure, at all times, which version number is
-present in the work file.
+source files contain RCS version headers (@pxref{Version
+Headers,,,emacs-xtra, Specialized Emacs Features}).  The headers enable
+Emacs to be sure, at all times, which version number is present in the
+work file.
 
   If the files do not have version headers, you must instead tell Emacs
 explicitly in each session which branch you are working on.  To do this,
@@ -2216,730 +2082,6 @@
 branch number.  This ensures that Emacs knows which branch it is using
 during this particular editing session.
 
-@node Remote Repositories
-@subsection Remote Repositories
-@cindex remote repositories (CVS)
-
-  A common way of using CVS is to set up a central CVS repository on
-some Internet host, then have each developer check out a personal
-working copy of the files on his local machine.  Committing changes to
-the repository, and picking up changes from other users into one's own
-working area, then works by direct interactions with the CVS server.
-
-  One difficulty is that access to the CVS server is often slow, and
-that developers might need to work off-line as well.  VC is designed
-to reduce the amount of network interaction necessary.
-
-@menu
-* Version Backups::        Keeping local copies of repository versions.
-* Local Version Control::  Using another version system for local editing.
-@end menu
-
-@node Version Backups
-@subsubsection Version Backups
-@cindex version backups
-
-@cindex automatic version backups
-  When VC sees that the CVS repository for a file is on a remote
-machine, it automatically makes local backups of unmodified versions
-of the file---@dfn{automatic version backups}.  This means that you
-can compare the file to the repository version (@kbd{C-x v =}), or
-revert to that version (@kbd{C-x v u}), without any network
-interactions.
-
-  The local copy of the unmodified file is called a @dfn{version
-backup} to indicate that it corresponds exactly to a version that is
-stored in the repository.  Note that version backups are not the same
-as ordinary Emacs backup files (@pxref{Backup}).  But they follow a
-similar naming convention.
-
-  For a file that comes from a remote CVS repository, VC makes a
-version backup whenever you save the first changes to the file, and
-removes it after you have committed your modified version to the
-repository. You can disable the making of automatic version backups by
-setting @code{vc-cvs-stay-local} to @code{nil} (@pxref{CVS Options}).
-
-@cindex manual version backups
-  The name of the automatic version backup for version @var{version}
-of file @var{file} is @code{@var{file}.~@var{version}.~}.  This is
-almost the same as the name used by @kbd{C-x v ~} (@pxref{Old
-Versions}), the only difference being the additional dot (@samp{.})
-after the version number.  This similarity is intentional, because
-both kinds of files store the same kind of information.  The file made
-by @kbd{C-x v ~} acts as a @dfn{manual version backup}.
-
-  All the VC commands that operate on old versions of a file can use
-both kinds of version backups.  For instance, @kbd{C-x v ~} uses
-either an automatic or a manual version backup, if possible, to get
-the contents of the version you request.  Likewise, @kbd{C-x v =} and
-@kbd{C-x v u} use either an automatic or a manual version backup, if
-one of them exists, to get the contents of a version to compare or
-revert to.  If you changed a file outside of Emacs, so that no
-automatic version backup was created for the previous text, you can
-create a manual backup of that version using @kbd{C-x v ~}, and thus
-obtain the benefit of the local copy for Emacs commands.
-
-  The only difference in Emacs's handling of manual and automatic
-version backups, once they exist, is that Emacs deletes automatic
-version backups when you commit to the repository.  By contrast,
-manual version backups remain until you delete them.
-
-@node Local Version Control
-@subsubsection Local Version Control
-@cindex local version control
-@cindex local back end (version control)
-
-When you make many changes to a file that comes from a remote
-repository, it can be convenient to have version control on your local
-machine as well.  You can then record intermediate versions, revert to
-a previous state, etc., before you actually commit your changes to the
-remote server.
-
-VC lets you do this by putting a file under a second, local version
-control system, so that the file is effectively registered in two
-systems at the same time.  For the description here, we will assume
-that the remote system is CVS, and you use RCS locally, although the
-mechanism works with any combination of version control systems
-(@dfn{back ends}).
-
-To make it work with other back ends, you must make sure that the
-``more local'' back end comes before the ``more remote'' back end in
-the setting of @code{vc-handled-backends} (@pxref{Customizing VC}).  By
-default, this variable is set up so that you can use remote CVS and
-local RCS as described here.
-
-To start using local RCS for a file that comes from a remote CVS
-server, you must @emph{register the file in RCS}, by typing @kbd{C-u
-C-x v v rcs @key{RET}}.  (In other words, use @code{vc-next-action} with a
-prefix argument, and specify RCS as the back end.)
-
-You can do this at any time; it does not matter whether you have
-already modified the file with respect to the version in the CVS
-repository.  If possible, VC tries to make the RCS master start with
-the unmodified repository version, then checks in any local changes
-as a new version.  This works if you have not made any changes yet, or
-if the unmodified repository version exists locally as a version
-backup (@pxref{Version Backups}).  If the unmodified version is not
-available locally, the RCS master starts with the modified version;
-the only drawback to this is that you cannot compare your changes
-locally to what is stored in the repository.
-
-The version number of the RCS master is derived from the current CVS
-version, starting a branch from it.  For example, if the current CVS
-version is 1.23, the local RCS branch will be 1.23.1.  Version 1.23 in
-the RCS master will be identical to version 1.23 under CVS; your first
-changes are checked in as 1.23.1.1.  (If the unmodified file is not
-available locally, VC will check in the modified file twice, both as
-1.23 and 1.23.1.1, to make the revision numbers consistent.)
-
-If you do not use locking under CVS (the default), locking is also
-disabled for RCS, so that editing under RCS works exactly as under
-CVS.
-
-When you are done with local editing, you can commit the final version
-back to the CVS repository by typing @kbd{C-u C-x v v cvs @key{RET}}.
-This initializes the log entry buffer (@pxref{Log Buffer}) to contain
-all the log entries you have recorded in the RCS master; you can edit
-them as you wish, and then commit in CVS by typing @kbd{C-c C-c}.  If
-the commit is successful, VC removes the RCS master, so that the file
-is once again registered under CVS only.  (The RCS master is not
-actually deleted, just renamed by appending @samp{~} to the name, so
-that you can refer to it later if you wish.)
-
-While using local RCS, you can pick up recent changes from the CVS
-repository into your local file, or commit some of your changes back
-to CVS, without terminating local RCS version control.  To do this,
-switch to the CVS back end temporarily, with the @kbd{C-x v b} command:
-
-@table @kbd
-@item C-x v b
-Switch to another back end that the current file is registered
-under (@code{vc-switch-backend}).
-
-@item C-u C-x v b @var{backend} @key{RET}
-Switch to @var{backend} for the current file.
-@end table
-
-@kindex C-x v b
-@findex vc-switch-backend
-@kbd{C-x v b} does not change the buffer contents, or any files; it
-only changes VC's perspective on how to handle the file.  Any
-subsequent VC commands for that file will operate on the back end that
-is currently selected.
-
-If the current file is registered in more than one back end, typing
-@kbd{C-x v b} ``cycles'' through all of these back ends.  With a
-prefix argument, it asks for the back end to use in the minibuffer.
-
-Thus, if you are using local RCS, and you want to pick up some recent
-changes in the file from remote CVS, first visit the file, then type
-@kbd{C-x v b} to switch to CVS, and finally use @kbd{C-x v m
-@key{RET}} to merge the news (@pxref{Merging}).  You can then switch
-back to RCS by typing @kbd{C-x v b} again, and continue to edit
-locally.
-
-But if you do this, the revision numbers in the RCS master no longer
-correspond to those of CVS.  Technically, this is not a problem, but
-it can become difficult to keep track of what is in the CVS repository
-and what is not.  So we suggest that you return from time to time to
-CVS-only operation, by committing your local changes back to the
-repository using @kbd{C-u C-x v v cvs @key{RET}}.
-
-@node Snapshots
-@subsection Snapshots
-@cindex snapshots and version control
-
-  A @dfn{snapshot} is a named set of file versions (one for each
-registered file) that you can treat as a unit.  One important kind of
-snapshot is a @dfn{release}, a (theoretically) stable version of the
-system that is ready for distribution to users.
-
-@menu
-* Making Snapshots::		The snapshot facilities.
-* Snapshot Caveats::		Things to be careful of when using snapshots.
-@end menu
-
-@node Making Snapshots
-@subsubsection Making and Using Snapshots
-
-  There are two basic commands for snapshots; one makes a
-snapshot with a given name, the other retrieves a named snapshot.
-
-@table @code
-@kindex C-x v s
-@findex vc-create-snapshot
-@item C-x v s @var{name} @key{RET}
-Define the last saved versions of every registered file in or under the
-current directory as a snapshot named @var{name}
-(@code{vc-create-snapshot}).
-
-@kindex C-x v r
-@findex vc-retrieve-snapshot
-@item C-x v r @var{name} @key{RET}
-For all registered files at or below the current directory level, select
-whatever versions correspond to the snapshot @var{name}
-(@code{vc-retrieve-snapshot}).
-
-This command reports an error if any files are locked at or below the
-current directory, without changing anything; this is to avoid
-overwriting work in progress.
-@end table
-
-  A snapshot uses a very small amount of resources---just enough to record
-the list of file names and which version belongs to the snapshot.  Thus,
-you need not hesitate to create snapshots whenever they are useful.
-
-  You can give a snapshot name as an argument to @kbd{C-x v =} or
-@kbd{C-x v ~} (@pxref{Old Versions}).  Thus, you can use it to compare a
-snapshot against the current files, or two snapshots against each other,
-or a snapshot against a named version.
-
-@node Snapshot Caveats
-@subsubsection Snapshot Caveats
-
-@cindex named configurations (RCS)
-  VC's snapshot facilities are modeled on RCS's named-configuration
-support.  They use RCS's native facilities for this, so
-snapshots made using RCS through VC are visible even when you bypass VC.
-
-  With CVS, Meta-CVS, and Subversion, VC also uses the native
-mechanism provided by that back end to make snapshots and retrieve them
-(@dfn{tags} for CVS and Meta-CVS, @dfn{copies} for Subversion).
-
-@c worded verbosely to avoid overfull hbox.
-  For SCCS, VC implements snapshots itself.  The files it uses contain
-name/file/version-number triples.  These snapshots are visible only
-through VC.
-
-  There is no support for VC snapshots using GNU Arch yet.
-
-  A snapshot is a set of checked-in versions.  So make sure that all the
-files are checked in and not locked when you make a snapshot.
-
-  File renaming and deletion can create some difficulties with snapshots.
-This is not a VC-specific problem, but a general design issue in version
-control systems that no one has solved very well yet.
-
-  If you rename a registered file, you need to rename its master along
-with it (the command @code{vc-rename-file} does this automatically).  If
-you are using SCCS, you must also update the records of the snapshot, to
-mention the file by its new name (@code{vc-rename-file} does this,
-too).  An old snapshot that refers to a master file that no longer
-exists under the recorded name is invalid; VC can no longer retrieve
-it.  It would be beyond the scope of this manual to explain enough about
-RCS and SCCS to explain how to update the snapshots by hand.
-
-  Using @code{vc-rename-file} makes the snapshot remain valid for
-retrieval, but it does not solve all problems.  For example, some of the
-files in your program probably refer to others by name.  At the very
-least, the makefile probably mentions the file that you renamed.  If you
-retrieve an old snapshot, the renamed file is retrieved under its new
-name, which is not the name that the makefile expects.  So the program
-won't really work as retrieved.
-
-@node Miscellaneous VC
-@subsection Miscellaneous Commands and Features of VC
-
-  This section explains the less-frequently-used features of VC.
-
-@menu
-* Change Logs and VC::  Generating a change log file from log entries.
-* Renaming and VC::     A command to rename both the source and master
-                          file correctly.
-* Version Headers::     Inserting version control headers into working files.
-@end menu
-
-@node Change Logs and VC
-@subsubsection Change Logs and VC
-
-  If you use RCS or CVS for a program and also maintain a change log
-file for it (@pxref{Change Log}), you can generate change log entries
-automatically from the version control log entries:
-
-@table @kbd
-@item C-x v a
-@kindex C-x v a
-@findex vc-update-change-log
-Visit the current directory's change log file and, for registered files
-in that directory, create new entries for versions checked in since the
-most recent entry in the change log file.
-(@code{vc-update-change-log}).
-
-This command works with RCS or CVS only, not with any of the other
-back ends.
-
-@item C-u C-x v a
-As above, but only find entries for the current buffer's file.
-
-@item M-1 C-x v a
-As above, but find entries for all the currently visited files that are
-maintained with version control.  This works only with RCS, and it puts
-all entries in the log for the default directory, which may not be
-appropriate.
-@end table
-
-  For example, suppose the first line of @file{ChangeLog} is dated
-1999-04-10, and that the only check-in since then was by Nathaniel
-Bowditch to @file{rcs2log} on 1999-05-22 with log text @samp{Ignore log
-messages that start with `#'.}.  Then @kbd{C-x v a} visits
-@file{ChangeLog} and inserts text like this:
-
-@iftex
-@medbreak
-@end iftex
-@smallexample
-@group
-1999-05-22  Nathaniel Bowditch  <nat@@apn.org>
-
-        * rcs2log: Ignore log messages that start with `#'.
-@end group
-@end smallexample
-@iftex
-@medbreak
-@end iftex
-
-@noindent
-You can then edit the new change log entry further as you wish.
-
-  Some of the new change log entries may duplicate what's already in
-ChangeLog.  You will have to remove these duplicates by hand.
-
-  Normally, the log entry for file @file{foo} is displayed as @samp{*
-foo: @var{text of log entry}}.  The @samp{:} after @file{foo} is omitted
-if the text of the log entry starts with @w{@samp{(@var{functionname}):
-}}.  For example, if the log entry for @file{vc.el} is
-@samp{(vc-do-command): Check call-process status.}, then the text in
-@file{ChangeLog} looks like this:
-
-@iftex
-@medbreak
-@end iftex
-@smallexample
-@group
-1999-05-06  Nathaniel Bowditch  <nat@@apn.org>
-
-        * vc.el (vc-do-command): Check call-process status.
-@end group
-@end smallexample
-@iftex
-@medbreak
-@end iftex
-
-  When @kbd{C-x v a} adds several change log entries at once, it groups
-related log entries together if they all are checked in by the same
-author at nearly the same time.  If the log entries for several such
-files all have the same text, it coalesces them into a single entry.
-For example, suppose the most recent check-ins have the following log
-entries:
-
-@flushleft
-@bullet{} For @file{vc.texinfo}: @samp{Fix expansion typos.}
-@bullet{} For @file{vc.el}: @samp{Don't call expand-file-name.}
-@bullet{} For @file{vc-hooks.el}: @samp{Don't call expand-file-name.}
-@end flushleft
-
-@noindent
-They appear like this in @file{ChangeLog}:
-
-@iftex
-@medbreak
-@end iftex
-@smallexample
-@group
-1999-04-01  Nathaniel Bowditch  <nat@@apn.org>
-
-        * vc.texinfo: Fix expansion typos.
-
-        * vc.el, vc-hooks.el: Don't call expand-file-name.
-@end group
-@end smallexample
-@iftex
-@medbreak
-@end iftex
-
-  Normally, @kbd{C-x v a} separates log entries by a blank line, but you
-can mark several related log entries to be clumped together (without an
-intervening blank line) by starting the text of each related log entry
-with a label of the form @w{@samp{@{@var{clumpname}@} }}.  The label
-itself is not copied to @file{ChangeLog}.  For example, suppose the log
-entries are:
-
-@flushleft
-@bullet{} For @file{vc.texinfo}: @samp{@{expand@} Fix expansion typos.}
-@bullet{} For @file{vc.el}: @samp{@{expand@} Don't call expand-file-name.}
-@bullet{} For @file{vc-hooks.el}: @samp{@{expand@} Don't call expand-file-name.}
-@end flushleft
-
-@noindent
-Then the text in @file{ChangeLog} looks like this:
-
-@iftex
-@medbreak
-@end iftex
-@smallexample
-@group
-1999-04-01  Nathaniel Bowditch  <nat@@apn.org>
-
-        * vc.texinfo: Fix expansion typos.
-        * vc.el, vc-hooks.el: Don't call expand-file-name.
-@end group
-@end smallexample
-@iftex
-@medbreak
-@end iftex
-
-  A log entry whose text begins with @samp{#} is not copied to
-@file{ChangeLog}.  For example, if you merely fix some misspellings in
-comments, you can log the change with an entry beginning with @samp{#}
-to avoid putting such trivia into @file{ChangeLog}.
-
-@node Renaming and VC
-@subsubsection Renaming VC Work Files and Master Files
-
-@findex vc-rename-file
-  When you rename a registered file, you must also rename its master
-file correspondingly to get proper results.  Use @code{vc-rename-file}
-to rename the source file as you specify, and rename its master file
-accordingly.  It also updates any snapshots (@pxref{Snapshots}) that
-mention the file, so that they use the new name; despite this, the
-snapshot thus modified may not completely work (@pxref{Snapshot
-Caveats}).
-
-  Some back ends do not provide an explicit rename operation to their
-repositories.  After issuing @code{vc-rename-file}, use @kbd{C-x v v}
-on the original and renamed buffers and provide the necessary edit
-log.
-
-  You cannot use @code{vc-rename-file} on a file that is locked by
-someone else.
-
-@node Version Headers
-@subsubsection Inserting Version Control Headers
-
-   Sometimes it is convenient to put version identification strings
-directly into working files.  Certain special strings called
-@dfn{version headers} are replaced in each successive version by the
-number of that version, the name of the user who created it, and other
-relevant information.  All of the back ends that VC supports have such
-a mechanism, except GNU Arch.
-
-  VC does not normally use the information contained in these headers.
-The exception is RCS---with RCS, version headers are sometimes more
-reliable than the master file to determine which version of the file
-you are editing.  Note that in a multi-branch environment, version
-headers are necessary to make VC behave correctly (@pxref{Multi-User
-Branching}).
-
-  Searching for RCS version headers is controlled by the variable
-@code{vc-consult-headers}.  If it is non-@code{nil} (the default),
-Emacs searches for headers to determine the version number you are
-editing.  Setting it to @code{nil} disables this feature.
-
-  Note that although CVS uses the same kind of version headers as RCS
-does, VC never searches for these headers if you are using CVS,
-regardless of the above setting.
-
-@kindex C-x v h
-@findex vc-insert-headers
-  You can use the @kbd{C-x v h} command (@code{vc-insert-headers}) to
-insert a suitable header string.
-
-@table @kbd
-@item C-x v h
-Insert headers in a file for use with your version-control system.
-@end table
-
-@vindex vc-@var{backend}-header
-  The default header string is @samp{@w{$}Id$} for RCS and
-@samp{@w{%}W%} for SCCS.  You can specify other headers to insert by
-setting the variables @code{vc-@var{backend}-header} where
-@var{backend} is @code{rcs} or @code{sccs}.
-
-  Instead of a single string, you can specify a list of strings; then
-each string in the list is inserted as a separate header on a line of
-its own.
-
-  It may be necessary to use apparently-superfluous backslashes when
-writing the strings that you put in this variable.  For instance, you
-might write @code{"$Id\$"} rather than @code{"$Id@w{$}"}.  The extra
-backslash prevents the string constant from being interpreted as a
-header, if the Emacs Lisp file containing it is maintained with
-version control.
-
-@vindex vc-comment-alist
-  Each header is inserted surrounded by tabs, inside comment delimiters,
-on a new line at point.  Normally the ordinary comment
-start and comment end strings of the current mode are used, but for
-certain modes, there are special comment delimiters for this purpose;
-the variable @code{vc-comment-alist} specifies them.  Each element of
-this list has the form @code{(@var{mode} @var{starter} @var{ender})}.
-
-@vindex vc-static-header-alist
-  The variable @code{vc-static-header-alist} specifies further strings
-to add based on the name of the buffer.  Its value should be a list of
-elements of the form @code{(@var{regexp} . @var{format})}.  Whenever
-@var{regexp} matches the buffer name, @var{format} is inserted as part
-of the header.  A header line is inserted for each element that matches
-the buffer name, and for each string specified by
-@code{vc-@var{backend}-header}.  The header line is made by processing the
-string from @code{vc-@var{backend}-header} with the format taken from the
-element.  The default value for @code{vc-static-header-alist} is as follows:
-
-@example
-@group
-(("\\.c$" .
-  "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
-#endif /* lint */\n"))
-@end group
-@end example
-
-@noindent
-It specifies insertion of text of this form:
-
-@example
-@group
-
-#ifndef lint
-static char vcid[] = "@var{string}";
-#endif /* lint */
-@end group
-@end example
-
-@noindent
-Note that the text above starts with a blank line.
-
-  If you use more than one version header in a file, put them close
-together in the file.  The mechanism in @code{revert-buffer} that
-preserves markers may not handle markers positioned between two version
-headers.
-
-@node Customizing VC
-@subsection Customizing VC
-
-@vindex vc-handled-backends
-The variable @code{vc-handled-backends} determines which version
-control systems VC should handle.  The default value is @code{(RCS CVS
-SVN SCCS Arch MCVS)}, so it contains all six version systems that are
-currently supported.  If you want VC to ignore one or more of these
-systems, exclude its name from the list.  To disable VC entirely, set
-this variable to @code{nil}.
-
-The order of systems in the list is significant: when you visit a file
-registered in more than one system (@pxref{Local Version Control}),
-VC uses the system that comes first in @code{vc-handled-backends} by
-default.  The order is also significant when you register a file for
-the first time, @pxref{Registering} for details.
-
-@menu
-* General VC Options::  Options that apply to multiple back ends.
-* RCS and SCCS::        Options for RCS and SCCS.
-* CVS Options::         Options for CVS.
-@end menu
-
-@node General VC Options
-@subsubsection General Options
-
-@vindex vc-make-backup-files
-  Emacs normally does not save backup files for source files that are
-maintained with version control.  If you want to make backup files even
-for files that use version control, set the variable
-@code{vc-make-backup-files} to a non-@code{nil} value.
-
-@vindex vc-keep-workfiles
-  Normally the work file exists all the time, whether it is locked or
-not.  If you set @code{vc-keep-workfiles} to @code{nil}, then checking
-in a new version with @kbd{C-x v v} deletes the work file; but any
-attempt to visit the file with Emacs creates it again.  (With CVS, work
-files are always kept.)
-
-@vindex vc-follow-symlinks
-  Editing a version-controlled file through a symbolic link can be
-dangerous.  It bypasses the version control system---you can edit the
-file without locking it, and fail to check your changes in.  Also,
-your changes might overwrite those of another user.  To protect against
-this, VC checks each symbolic link that you visit, to see if it points
-to a file under version control.
-
-  The variable @code{vc-follow-symlinks} controls what to do when a
-symbolic link points to a version-controlled file.  If it is @code{nil},
-VC only displays a warning message.  If it is @code{t}, VC automatically
-follows the link, and visits the real file instead, telling you about
-this in the echo area.  If the value is @code{ask} (the default), VC
-asks you each time whether to follow the link.
-
-@vindex vc-suppress-confirm
-  If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x v v}
-and @kbd{C-x v i} can save the current buffer without asking, and
-@kbd{C-x v u} also operates without asking for confirmation.  (This
-variable does not affect @kbd{C-x v c}; that operation is so drastic
-that it should always ask for confirmation.)
-
-@vindex vc-command-messages
-  VC mode does much of its work by running the shell commands for RCS,
-CVS and SCCS.  If @code{vc-command-messages} is non-@code{nil}, VC
-displays messages to indicate which shell commands it runs, and
-additional messages when the commands finish.
-
-@vindex vc-path
-  You can specify additional directories to search for version control
-programs by setting the variable @code{vc-path}.  These directories
-are searched before the usual search path.  It is rarely necessary to
-set this variable, because VC normally finds the proper files
-automatically.
-
-@node RCS and SCCS
-@subsubsection Options for RCS and SCCS
-
-@cindex non-strict locking (RCS)
-@cindex locking, non-strict (RCS)
-  By default, RCS uses locking to coordinate the activities of several
-users, but there is a mode called @dfn{non-strict locking} in which
-you can check-in changes without locking the file first.  Use
-@samp{rcs -U} to switch to non-strict locking for a particular file,
-see the @code{rcs} manual page for details.
-
-  When deducing the version control state of an RCS file, VC first
-looks for an RCS version header string in the file (@pxref{Version
-Headers}).  If there is no header string, VC normally looks at the
-file permissions of the work file; this is fast.  But there might be
-situations when the file permissions cannot be trusted.  In this case
-the master file has to be consulted, which is rather expensive.  Also
-the master file can only tell you @emph{if} there's any lock on the
-file, but not whether your work file really contains that locked
-version.
-
-@vindex vc-consult-headers
-  You can tell VC not to use version headers to determine the file
-status by setting @code{vc-consult-headers} to @code{nil}.  VC then
-always uses the file permissions (if it is supposed to trust them), or
-else checks the master file.
-
-@vindex vc-mistrust-permissions
-  You can specify the criterion for whether to trust the file
-permissions by setting the variable @code{vc-mistrust-permissions}.
-Its value can be @code{t} (always mistrust the file permissions and
-check the master file), @code{nil} (always trust the file
-permissions), or a function of one argument which makes the decision.
-The argument is the directory name of the @file{RCS} subdirectory.  A
-non-@code{nil} value from the function says to mistrust the file
-permissions.  If you find that the file permissions of work files are
-changed erroneously, set @code{vc-mistrust-permissions} to @code{t}.
-Then VC always checks the master file to determine the file's status.
-
-  VC determines the version control state of files under SCCS much as
-with RCS.  It does not consider SCCS version headers, though.  Thus,
-the variable @code{vc-mistrust-permissions} affects SCCS use, but
-@code{vc-consult-headers} does not.
-
-@node CVS Options
-@subsubsection Options specific for CVS
-
-@cindex locking (CVS)
-  By default, CVS does not use locking to coordinate the activities of
-several users; anyone can change a work file at any time.  However,
-there are ways to restrict this, resulting in behavior that resembles
-locking.
-
-@cindex CVSREAD environment variable (CVS)
-  For one thing, you can set the @env{CVSREAD} environment variable
-(the value you use makes no difference).  If this variable is defined,
-CVS makes your work files read-only by default.  In Emacs, you must
-type @kbd{C-x v v} to make the file writable, so that editing works
-in fact similar as if locking was used.  Note however, that no actual
-locking is performed, so several users can make their files writable
-at the same time.  When setting @env{CVSREAD} for the first time, make
-sure to check out all your modules anew, so that the file protections
-are set correctly.
-
-@cindex cvs watch feature
-@cindex watching files (CVS)
-  Another way to achieve something similar to locking is to use the
-@dfn{watch} feature of CVS.  If a file is being watched, CVS makes it
-read-only by default, and you must also use @kbd{C-x v v} in Emacs to
-make it writable.  VC calls @code{cvs edit} to make the file writable,
-and CVS takes care to notify other developers of the fact that you
-intend to change the file.  See the CVS documentation for details on
-using the watch feature.
-
-@vindex vc-stay-local
-@vindex vc-cvs-stay-local
-@cindex remote repositories (CVS)
-  When a file's repository is on a remote machine, VC tries to keep
-network interactions to a minimum.  This is controlled by the variable
-@code{vc-cvs-stay-local}.  There is another variable,
-@code{vc-stay-local}, which enables the feature also for other back
-ends that support it, including CVS.  In the following, we will talk
-only about @code{vc-cvs-stay-local}, but everything applies to
-@code{vc-stay-local} as well.
-
-If @code{vc-cvs-stay-local} is @code{t} (the default), then VC uses
-only the entry in the local CVS subdirectory to determine the file's
-state (and possibly information returned by previous CVS commands).
-One consequence of this is that when you have modified a file, and
-somebody else has already checked in other changes to the file, you
-are not notified of it until you actually try to commit.  (But you can
-try to pick up any recent changes from the repository first, using
-@kbd{C-x v m @key{RET}}, @pxref{Merging}).
-
-  When @code{vc-cvs-stay-local} is @code{t}, VC also makes local
-version backups, so that simple diff and revert operations are
-completely local (@pxref{Version Backups}).
-
-  On the other hand, if you set @code{vc-cvs-stay-local} to @code{nil},
-then VC queries the remote repository @emph{before} it decides what to
-do in @code{vc-next-action} (@kbd{C-x v v}), just as it does for local
-repositories.  It also does not make any version backups.
-
-  You can also set @code{vc-cvs-stay-local} to a regular expression
-that is matched against the repository host name; VC then stays local
-only for repositories from hosts that match the pattern.
-
-@vindex vc-cvs-global-switches
-  You can specify additional command line options to pass to all CVS
-operations in the variable @code{vc-cvs-global-switches}.  These
-switches are inserted immediately after the @code{cvs} command, before
-the name of the operation to invoke.
-
 @node Directories
 @section File Directories
 
--- a/man/frames.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/frames.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -27,7 +27,7 @@
 
   Emacs compiled for MS-DOS emulates some windowing functionality,
 so that you can use many of the features described in this chapter.
-@xref{MS-DOS Mouse}, for more information.
+@xref{MS-DOS Mouse,,,emacs-xtra,Specialized Emacs Features}.
 
 @menu
 * Mouse Commands::      Moving, cutting, and pasting, with the mouse.
--- a/man/gnu.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/gnu.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985, 1986, 1987, 1993, 1995, 2002, 2003, 2004,
 @c   2005, 2006 Free Software Foundation, Inc.
 @ifclear justgnu
-@node Manifesto,, MS-DOS, Top
+@node Manifesto,, Emacs and Microsoft Windows, Top
 @unnumbered The GNU Manifesto
 @end ifclear
 @ifset justgnu
--- a/man/gnus-faq.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/gnus-faq.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -128,7 +128,7 @@
 Jingle please: Gnus 5.10 is released, get it while it's
 hot! As well as the step in version number is rather
 small, Gnus 5.10 has tons of new features which you
-shouldn't miss. The current release (5.10.6) should be at
+shouldn't miss. The current release (5.10.8) should be at
 least as stable as the latest release of the 5.8 series.
 
 @node [1.2]
--- a/man/gnus.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/gnus.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -4043,6 +4043,22 @@
 
 @table @kbd
 
+@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:
+
+@lisp
+(define-key gnus-group-mode-map (kbd "v j d")
+  (lambda ()
+    (interactive)
+    (gnus-group-jump-to-group "nndraft:drafts")))
+@end lisp
+
+On keys reserved for users in Emacs and on keybindings in general
+@xref{Keymaps, Keymaps, , emacs, The Emacs Editor}.
+
 @item ^
 @kindex ^ (Group)
 @findex gnus-group-enter-server-mode
@@ -4438,6 +4454,14 @@
 
 You can have as many summary buffers open as you wish.
 
+@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:
+@lisp
+(define-key gnus-summary-mode-map (kbd "v -") "LrS") ;; lower subthread
+@end lisp
+
 @menu
 * Summary Buffer Format::       Deciding how the summary buffer is to look.
 * Summary Maneuvering::         Moving around the summary buffer.
@@ -11242,6 +11266,11 @@
 buffer displayed while reading.  You can do it all from the article
 buffer.
 
+@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.
+
 A few additional keystrokes are available:
 
 @table @kbd
@@ -12272,6 +12301,12 @@
 
 @table @kbd
 
+@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.
+
 @item a
 @kindex a (Server)
 @findex gnus-server-add-server
--- a/man/macos.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/macos.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -2,7 +2,7 @@
 @c Copyright (C) 2000, 2001, 2002, 2003, 2004,
 @c   2005, 2006 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Mac OS, MS-DOS, Antinews, Top
+@node Mac OS, Emacs and Microsoft Windows, Antinews, Top
 @appendix Emacs and Mac OS
 @cindex Mac OS
 @cindex Macintosh
--- a/man/msdog.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/msdog.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -2,307 +2,28 @@
 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
 @c   2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node MS-DOS, Manifesto, Mac OS, Top
-@appendix Emacs and Microsoft Systems
-@cindex MS-DOG
+@node Emacs and Microsoft Windows, Manifesto, Mac OS, Top
+@appendix Emacs and Microsoft Windows
 @cindex Microsoft Windows
-@cindex MS-DOS peculiarities
-
-  This section briefly describes the peculiarities of using Emacs on
-the MS-DOS ``operating system'' (also known as ``MS-DOG'') and on
-Microsoft Windows.
 
-  If you build Emacs for MS-DOS, the binary will also run on Windows
-3.X, Windows NT, Windows 9X/ME, Windows 2000, or OS/2 as a DOS
-application; all the of this chapter applies for all of those systems,
-if you use an Emacs that was built for MS-DOS.
+  This section describes peculiarities of using Emacs on Microsoft
+Windows.  Information about Emacs and Microsoft's older MS-DOS
+``operating system'' (also known as ``MS-DOG'') is now in a separate
+manual (@inforef{MS-DOG,, emacs-xtra}).
 
-  However, if you want to use Emacs on Windows, you would normally
-build Emacs specifically for Windows.  If you do that, most of this
-chapter does not apply; instead, you get behavior much closer to what
-is documented in the rest of the manual, including support for long
-file names, multiple frames, scroll bars, mouse menus, and
-subprocesses.  However, the section on text files and binary files
-does still apply.  There are also two sections at the end of this
-chapter which apply specifically for the Windows version.
+  Iif you want to use Emacs on Windows, you would normally build Emacs
+specifically for Windows.  If you do that, the behavior is reasonably
+similar to what is documented in the rest of the manual, including
+support for long file names, multiple frames, scroll bars, mouse
+menus, and subprocesses.  However, a few special considerations apply,
+and they are described here.
 
 @menu
-* Keyboard: MS-DOS Keyboard.   Keyboard conventions on MS-DOS.
-* Mouse: MS-DOS Mouse.         Mouse conventions on MS-DOS.
-* Display: MS-DOS Display.     Fonts, frames and display size on MS-DOS.
-* Files: MS-DOS File Names.    File name conventions on MS-DOS.
-* Text and Binary::            Text files on MS-DOS use CRLF to separate lines.
-* Printing: MS-DOS Printing.   How to specify the printer on MS-DOS.
-* I18N: MS-DOS and MULE.       Support for internationalization on MS-DOS.
-* Processes: MS-DOS Processes. Running subprocesses on MS-DOS.
+* Text and Binary::            Text files use CRLF to terminate lines.
 * Windows Processes::          Running subprocesses on Windows.
 * Windows System Menu::        Controlling what the ALT key does.
 @end menu
 
-@node MS-DOS Keyboard
-@section Keyboard Usage on MS-DOS
-
-@kindex DEL @r{(MS-DOS)}
-@kindex BS @r{(MS-DOS)}
-  The key that is called @key{DEL} in Emacs (because that's how it is
-designated on most workstations) is known as @key{BS} (backspace) on a
-PC.  That is why the PC-specific terminal initialization remaps the
-@key{BS} key to act as @key{DEL}; the @key{DELETE} key is remapped to act
-as @kbd{C-d} for the same reasons.
-
-@kindex C-g @r{(MS-DOS)}
-@kindex C-BREAK @r{(MS-DOS)}
-@cindex quitting on MS-DOS
-  Emacs built for MS-DOS recognizes @kbd{C-@key{BREAK}} as a quit
-character, just like @kbd{C-g}.  This is because Emacs cannot detect
-that you have typed @kbd{C-g} until it is ready for more input.  As a
-consequence, you cannot use @kbd{C-g} to stop a running command
-(@pxref{Quitting}).  By contrast, @kbd{C-@key{BREAK}} @emph{is} detected
-as soon as you type it (as @kbd{C-g} is on other systems), so it can be
-used to stop a running command and for emergency escape
-(@pxref{Emergency Escape}).
-
-@cindex Meta (under MS-DOS)
-@cindex Hyper (under MS-DOS)
-@cindex Super (under MS-DOS)
-@vindex dos-super-key
-@vindex dos-hyper-key
-  The PC keyboard maps use the left @key{ALT} key as the @key{META} key.
-You have two choices for emulating the @key{SUPER} and @key{HYPER} keys:
-choose either the right @key{CTRL} key or the right @key{ALT} key by
-setting the variables @code{dos-hyper-key} and @code{dos-super-key} to 1
-or 2 respectively.  If neither @code{dos-super-key} nor
-@code{dos-hyper-key} is 1, then by default the right @key{ALT} key is
-also mapped to the @key{META} key.  However, if the MS-DOS international
-keyboard support program @file{KEYB.COM} is installed, Emacs will
-@emph{not} map the right @key{ALT} to @key{META}, since it is used for
-accessing characters like @kbd{~} and @kbd{@@} on non-US keyboard
-layouts; in this case, you may only use the left @key{ALT} as @key{META}
-key.
-
-@kindex C-j @r{(MS-DOS)}
-@vindex dos-keypad-mode
-  The variable @code{dos-keypad-mode} is a flag variable that controls
-what key codes are returned by keys in the numeric keypad.  You can also
-define the keypad @key{ENTER} key to act like @kbd{C-j}, by putting the
-following line into your @file{_emacs} file:
-
-@smallexample
-;; @r{Make the @key{ENTER} key from the numeric keypad act as @kbd{C-j}.}
-(define-key function-key-map [kp-enter] [?\C-j])
-@end smallexample
-
-@node MS-DOS Mouse
-@section Mouse Usage on MS-DOS
-
-@cindex mouse support under MS-DOS
-  Emacs on MS-DOS supports a mouse (on the default terminal only).
-The mouse commands work as documented, including those that use menus
-and the menu bar (@pxref{Menu Bar}).  Scroll bars don't work in
-MS-DOS Emacs.  PC mice usually have only two buttons; these act as
-@kbd{Mouse-1} and @kbd{Mouse-2}, but if you press both of them
-together, that has the effect of @kbd{Mouse-3}.  If the mouse does have
-3 buttons, Emacs detects that at startup, and all the 3 buttons function
-normally, as on X.
-
-  Help strings for menu-bar and pop-up menus are displayed in the echo
-area when the mouse pointer moves across the menu items.
-Highlighting of mouse-sensitive text (@pxref{Mouse References}) is also
-supported.
-
-@cindex mouse, set number of buttons
-@findex msdos-set-mouse-buttons
-  Some versions of mouse drivers don't report the number of mouse
-buttons correctly.  For example, mice with a wheel report that they
-have 3 buttons, but only 2 of them are passed to Emacs; the clicks on
-the wheel, which serves as the middle button, are not passed.  In
-these cases, you can use the @kbd{M-x msdos-set-mouse-buttons} command
-to tell Emacs how many mouse buttons to expect.  You could make such a
-setting permanent by adding this fragment to your @file{_emacs} init
-file:
-
-@example
-;; @r{Treat the mouse like a 2-button mouse.}
-(msdos-set-mouse-buttons 2)
-@end example
-
-@cindex Windows clipboard support
-  Emacs built for MS-DOS supports clipboard operations when it runs on
-Windows.  Commands that put text on the kill ring, or yank text from the
-ring, check the Windows clipboard first, just as Emacs does on the X
-Window System (@pxref{Mouse Commands}).  Only the primary selection and
-the cut buffer are supported by MS-DOS Emacs on Windows; the secondary
-selection always appears as empty.
-
-  Due to the way clipboard access is implemented by Windows, the
-length of text you can put into the clipboard is limited by the amount
-of free DOS memory that is available to Emacs.  Usually, up to 620KB of
-text can be put into the clipboard, but this limit depends on the system
-configuration and is lower if you run Emacs as a subprocess of
-another program.  If the killed text does not fit, Emacs outputs a
-message saying so, and does not put the text into the clipboard.
-
-  Null characters also cannot be put into the Windows clipboard.  If the
-killed text includes null characters, Emacs does not put such text into
-the clipboard, and displays in the echo area a message to that effect.
-
-@vindex dos-display-scancodes
-  The variable @code{dos-display-scancodes}, when non-@code{nil},
-directs Emacs to display the @acronym{ASCII} value and the keyboard scan code of
-each keystroke; this feature serves as a complement to the
-@code{view-lossage} command, for debugging.
-
-@node MS-DOS Display
-@section Display on MS-DOS
-@cindex faces under MS-DOS
-@cindex fonts, emulating under MS-DOS
-
-  Display on MS-DOS cannot use font variants, like bold or italic,
-but it does support
-multiple faces, each of which can specify a foreground and a background
-color.  Therefore, you can get the full functionality of Emacs packages
-that use fonts (such as @code{font-lock}, Enriched Text mode, and
-others) by defining the relevant faces to use different colors.  Use the
-@code{list-colors-display} command (@pxref{Frame Parameters}) and the
-@code{list-faces-display} command (@pxref{Faces}) to see what colors and
-faces are available and what they look like.
-
-  @xref{MS-DOS and MULE}, later in this chapter, for information on
-how Emacs displays glyphs and characters that aren't supported by the
-native font built into the DOS display.
-
-@cindex cursor shape on MS-DOS
-  When Emacs starts, it changes the cursor shape to a solid box.  This
-is for compatibility with other systems, where the box cursor is the
-default in Emacs.  This default shape can be changed to a bar by
-specifying the @code{cursor-type} parameter in the variable
-@code{default-frame-alist} (@pxref{Creating Frames}).  The MS-DOS
-terminal doesn't support a vertical-bar cursor, so the bar cursor is
-horizontal, and the @code{@var{width}} parameter, if specified by the
-frame parameters, actually determines its height.  For this reason,
-the @code{bar} and @code{hbar} cursor types produce the same effect on
-MS-DOS.  As an extension, the bar cursor specification can include the
-starting scan line of the cursor as well as its width, like this:
-
-@example
- '(cursor-type bar @var{width} . @var{start})
-@end example
-
-@noindent
-In addition, if the @var{width} parameter is negative, the cursor bar
-begins at the top of the character cell.
-
-@cindex frames on MS-DOS
-  The MS-DOS terminal can only display a single frame at a time.  The
-Emacs frame facilities work on MS-DOS much as they do on text-only
-terminals (@pxref{Frames}).  When you run Emacs from a DOS window on
-MS-Windows, you can make the visible frame smaller than the full
-screen, but Emacs still cannot display more than a single frame at a
-time.
-
-@cindex frame size under MS-DOS
-@findex mode4350
-@findex mode25
-  The @code{mode4350} command switches the display to 43 or 50
-lines, depending on your hardware; the @code{mode25} command switches
-to the default 80x25 screen size.
-
-  By default, Emacs only knows how to set screen sizes of 80 columns by
-25, 28, 35, 40, 43 or 50 rows.  However, if your video adapter has
-special video modes that will switch the display to other sizes, you can
-have Emacs support those too.  When you ask Emacs to switch the frame to
-@var{n} rows by @var{m} columns dimensions, it checks if there is a
-variable called @code{screen-dimensions-@var{n}x@var{m}}, and if so,
-uses its value (which must be an integer) as the video mode to switch
-to.  (Emacs switches to that video mode by calling the BIOS @code{Set
-Video Mode} function with the value of
-@code{screen-dimensions-@var{n}x@var{m}} in the @code{AL} register.)
-For example, suppose your adapter will switch to 66x80 dimensions when
-put into video mode 85.  Then you can make Emacs support this screen
-size by putting the following into your @file{_emacs} file:
-
-@example
-(setq screen-dimensions-66x80 85)
-@end example
-
-  Since Emacs on MS-DOS can only set the frame size to specific
-supported dimensions, it cannot honor every possible frame resizing
-request.  When an unsupported size is requested, Emacs chooses the next
-larger supported size beyond the specified size.  For example, if you
-ask for 36x80 frame, you will get 40x80 instead.
-
-  The variables @code{screen-dimensions-@var{n}x@var{m}} are used only
-when they exactly match the specified size; the search for the next
-larger supported size ignores them.  In the above example, even if your
-VGA supports 38x80 dimensions and you define a variable
-@code{screen-dimensions-38x80} with a suitable value, you will still get
-40x80 screen when you ask for a 36x80 frame.  If you want to get the
-38x80 size in this case, you can do it by setting the variable named
-@code{screen-dimensions-36x80} with the same video mode value as
-@code{screen-dimensions-38x80}.
-
-  Changing frame dimensions on MS-DOS has the effect of changing all the
-other frames to the new dimensions.
-
-@node MS-DOS File Names
-@section File Names on MS-DOS
-@cindex file names under MS-DOS
-@cindex init file, default name under MS-DOS
-
-  MS-DOS normally uses a backslash, @samp{\}, to separate name units
-within a file name, instead of the slash used on other systems.  Emacs
-on MS-DOS permits use of either slash or backslash, and also knows
-about drive letters in file names.
-
-  On MS-DOS, file names are case-insensitive and limited to eight
-characters, plus optionally a period and three more characters.  Emacs
-knows enough about these limitations to handle file names that were
-meant for other operating systems.  For instance, leading dots @samp{.}
-in file names are invalid in MS-DOS, so Emacs transparently converts
-them to underscores @samp{_}; thus your default init file (@pxref{Init
-File}) is called @file{_emacs} on MS-DOS.  Excess characters before or
-after the period are generally ignored by MS-DOS itself; thus, if you
-visit the file @file{LongFileName.EvenLongerExtension}, you will
-silently get @file{longfile.eve}, but Emacs will still display the long
-file name on the mode line.  Other than that, it's up to you to specify
-file names which are valid under MS-DOS; the transparent conversion as
-described above only works on file names built into Emacs.
-
-@cindex backup file names on MS-DOS
-  The above restrictions on the file names on MS-DOS make it almost
-impossible to construct the name of a backup file (@pxref{Backup
-Names}) without losing some of the original file name characters.  For
-example, the name of a backup file for @file{docs.txt} is
-@file{docs.tx~} even if single backup is used.
-
-@cindex file names under Windows 95/NT
-@cindex long file names in DOS box under Windows 95/NT
-  If you run Emacs as a DOS application under Windows 9X, Windows ME, or
-Windows 2000, you can turn on support for long file names.  If you do
-that, Emacs doesn't truncate file names or convert them to lower case;
-instead, it uses the file names that you specify, verbatim.  To enable
-long file name support, set the environment variable @env{LFN} to
-@samp{y} before starting Emacs.  Unfortunately, Windows NT doesn't allow
-DOS programs to access long file names, so Emacs built for MS-DOS will
-only see their short 8+3 aliases.
-
-@cindex @env{HOME} directory under MS-DOS
-  MS-DOS has no notion of home directory, so Emacs on MS-DOS pretends
-that the directory where it is installed is the value of the @env{HOME}
-environment variable.  That is, if your Emacs binary,
-@file{emacs.exe}, is in the directory @file{c:/utils/emacs/bin}, then
-Emacs acts as if @env{HOME} were set to @samp{c:/utils/emacs}.  In
-particular, that is where Emacs looks for the init file @file{_emacs}.
-With this in mind, you can use @samp{~} in file names as an alias for
-the home directory, as you would on GNU or Unix.  You can also set
-@env{HOME} variable in the environment before starting Emacs; its
-value will then override the above default behavior.
-
-  Emacs on MS-DOS handles the directory name @file{/dev} specially,
-because of a feature in the emulator libraries of DJGPP that pretends
-I/O devices have names in that directory.  We recommend that you avoid
-using an actual directory named @file{/dev} on any disk.
-
 @node Text and Binary
 @section Text Files and Binary Files
 @cindex text and binary files on MS-DOS/MS-Windows
@@ -419,379 +140,6 @@
 the file-name patterns in @code{file-name-buffer-file-type-alist}, the
 EOL conversion is determined by @code{file-name-buffer-file-type-alist}.
 
-@node MS-DOS Printing
-@section Printing and MS-DOS
-
-  Printing commands, such as @code{lpr-buffer} (@pxref{Printing}) and
-@code{ps-print-buffer} (@pxref{PostScript}) can work in MS-DOS and
-MS-Windows by sending the output to one of the printer ports, if a
-Posix-style @code{lpr} program is unavailable.  The same Emacs
-variables control printing on all systems, but in some cases they have
-different default values on MS-DOS and MS-Windows.
-
-@vindex printer-name @r{(MS-DOS)}
-  If you want to use your local printer, printing on it in the usual DOS
-manner, then set the Lisp variable @code{lpr-command} to @code{""} (its
-default value) and @code{printer-name} to the name of the printer
-port---for example, @code{"PRN"}, the usual local printer port (that's
-the default), or @code{"LPT2"}, or @code{"COM1"} for a serial printer.
-You can also set @code{printer-name} to a file name, in which case
-``printed'' output is actually appended to that file.  If you set
-@code{printer-name} to @code{"NUL"}, printed output is silently
-discarded (sent to the system null device).
-
-  On MS-Windows, when the Windows network software is installed, you can
-also use a printer shared by another machine by setting
-@code{printer-name} to the UNC share name for that printer---for example,
-@code{"//joes_pc/hp4si"}.  (It doesn't matter whether you use forward
-slashes or backslashes here.)  To find out the names of shared printers,
-run the command @samp{net view} at a DOS command prompt to obtain a list
-of servers, and @samp{net view @var{server-name}} to see the names of printers
-(and directories) shared by that server.  Alternatively, click the
-@samp{Network Neighborhood} icon on your desktop, and look for machines
-which share their printers via the network.
-
-@cindex @samp{net use}, and printing on MS-Windows
-@cindex networked printers (MS-Windows)
-  If the printer doesn't appear in the output of @samp{net view}, or
-if setting @code{printer-name} to the UNC share name doesn't produce a
-hardcopy on that printer, you can use the @samp{net use} command to
-connect a local print port such as @code{"LPT2"} to the networked
-printer.  For example, typing @kbd{net use LPT2:
-\\joes_pc\hp4si}@footnote{
-Note that the @samp{net use} command requires the UNC share name to be
-typed with the Windows-style backslashes, while the value of
-@code{printer-name} can be set with either forward- or backslashes.}
-causes Windows to @dfn{capture} the LPT2 port and redirect the printed
-material to the printer connected to the machine @code{joes_pc}.
-After this command, setting @code{printer-name} to @code{"LPT2"}
-should produce the hardcopy on the networked printer.
-
-  With some varieties of Windows network software, you can instruct
-Windows to capture a specific printer port such as @code{"LPT2"}, and
-redirect it to a networked printer via the @w{@code{Control
-Panel->Printers}} applet instead of @samp{net use}.
-
-  Some printers expect DOS codepage encoding of non-@acronym{ASCII} text, even
-though they are connected to a Windows machine which uses a different
-encoding for the same locale.  For example, in the Latin-1 locale, DOS
-uses codepage 850 whereas Windows uses codepage 1252.  @xref{MS-DOS and
-MULE}.  When you print to such printers from Windows, you can use the
-@kbd{C-x RET c} (@code{universal-coding-system-argument}) command before
-@kbd{M-x lpr-buffer}; Emacs will then convert the text to the DOS
-codepage that you specify.  For example, @kbd{C-x RET c cp850-dos RET
-M-x lpr-region RET} will print the region while converting it to the
-codepage 850 encoding.  You may need to create the @code{cp@var{nnn}}
-coding system with @kbd{M-x codepage-setup}.
-
-  If you set @code{printer-name} to a file name, it's best to use an
-absolute file name.  Emacs changes the working directory according to
-the default directory of the current buffer, so if the file name in
-@code{printer-name} is relative, you will end up with several such
-files, each one in the directory of the buffer from which the printing
-was done.
-
-@findex print-buffer @r{(MS-DOS)}
-@findex print-region @r{(MS-DOS)}
-@vindex lpr-headers-switches @r{(MS-DOS)}
-  The commands @code{print-buffer} and @code{print-region} call the
-@code{pr} program, or use special switches to the @code{lpr} program, to
-produce headers on each printed page.  MS-DOS and MS-Windows don't
-normally have these programs, so by default, the variable
-@code{lpr-headers-switches} is set so that the requests to print page
-headers are silently ignored.  Thus, @code{print-buffer} and
-@code{print-region} produce the same output as @code{lpr-buffer} and
-@code{lpr-region}, respectively.  If you do have a suitable @code{pr}
-program (for example, from GNU Textutils), set
-@code{lpr-headers-switches} to @code{nil}; Emacs will then call
-@code{pr} to produce the page headers, and print the resulting output as
-specified by @code{printer-name}.
-
-@vindex print-region-function @r{(MS-DOS)}
-@cindex lpr usage under MS-DOS
-@vindex lpr-command @r{(MS-DOS)}
-@vindex lpr-switches @r{(MS-DOS)}
-  Finally, if you do have an @code{lpr} work-alike, you can set the
-variable @code{lpr-command} to @code{"lpr"}.  Then Emacs will use
-@code{lpr} for printing, as on other systems.  (If the name of the
-program isn't @code{lpr}, set @code{lpr-command} to specify where to
-find it.)  The variable @code{lpr-switches} has its standard meaning
-when @code{lpr-command} is not @code{""}.  If the variable
-@code{printer-name} has a string value, it is used as the value for the
-@code{-P} option to @code{lpr}, as on Unix.
-
-@findex ps-print-buffer @r{(MS-DOS)}
-@findex ps-spool-buffer @r{(MS-DOS)}
-@vindex ps-printer-name @r{(MS-DOS)}
-@vindex ps-lpr-command @r{(MS-DOS)}
-@vindex ps-lpr-switches @r{(MS-DOS)}
-  A parallel set of variables, @code{ps-lpr-command},
-@code{ps-lpr-switches}, and @code{ps-printer-name} (@pxref{PostScript
-Variables}), defines how PostScript files should be printed.  These
-variables are used in the same way as the corresponding variables
-described above for non-PostScript printing.  Thus, the value of
-@code{ps-printer-name} is used as the name of the device (or file) to
-which PostScript output is sent, just as @code{printer-name} is used for
-non-PostScript printing.  (There are two distinct sets of variables in
-case you have two printers attached to two different ports, and only one
-of them is a PostScript printer.)
-
-  The default value of the variable @code{ps-lpr-command} is @code{""},
-which causes PostScript output to be sent to the printer port specified
-by @code{ps-printer-name}, but @code{ps-lpr-command} can also be set to
-the name of a program which will accept PostScript files.  Thus, if you
-have a non-PostScript printer, you can set this variable to the name of
-a PostScript interpreter program (such as Ghostscript).  Any switches
-that need to be passed to the interpreter program are specified using
-@code{ps-lpr-switches}.  (If the value of @code{ps-printer-name} is a
-string, it will be added to the list of switches as the value for the
-@code{-P} option.  This is probably only useful if you are using
-@code{lpr}, so when using an interpreter typically you would set
-@code{ps-printer-name} to something other than a string so it is
-ignored.)
-
-  For example, to use Ghostscript for printing on an Epson printer
-connected to the @samp{LPT2} port, put this in your @file{_emacs} file:
-
-@example
-(setq ps-printer-name t)  ; Ghostscript doesn't understand -P
-(setq ps-lpr-command "c:/gs/gs386")
-(setq ps-lpr-switches '("-q" "-dNOPAUSE"
-			"-sDEVICE=epson"
-			"-r240x72"
-			"-sOutputFile=LPT2"
-			"-Ic:/gs"))
-@end example
-
-@noindent
-(This assumes that Ghostscript is installed in the @file{"c:/gs"}
-directory.)
-
-@vindex dos-printer
-@vindex dos-ps-printer
-  For backwards compatibility, the value of @code{dos-printer}
-(@code{dos-ps-printer}), if it has a value, overrides the value of
-@code{printer-name} (@code{ps-printer-name}), on MS-DOS and MS-Windows
-only.
-
-
-@node MS-DOS and MULE
-@section International Support on MS-DOS
-@cindex international support @r{(MS-DOS)}
-
-  Emacs on MS-DOS supports the same international character sets as it
-does on GNU, Unix and other platforms (@pxref{International}), including
-coding systems for converting between the different character sets.
-However, due to incompatibilities between MS-DOS/MS-Windows and other systems,
-there are several DOS-specific aspects of this support that you should
-be aware of.  This section describes these aspects.
-
-  The description below is largely specific to the MS-DOS port of
-Emacs, especially where it talks about practical implications for
-Emacs users.  For other operating systems, see the @file{code-pages.el}
-package, which implements support for MS-DOS- and MS-Windows-specific
-encodings for all platforms other than MS-DOS.
-
-@table @kbd
-@item M-x dos-codepage-setup
-Set up Emacs display and coding systems as appropriate for the current
-DOS codepage.
-
-@item M-x codepage-setup
-Create a coding system for a certain DOS codepage.
-@end table
-
-@cindex codepage, MS-DOS
-@cindex DOS codepages
-  MS-DOS is designed to support one character set of 256 characters at
-any given time, but gives you a variety of character sets to choose
-from.  The alternative character sets are known as @dfn{DOS codepages}.
-Each codepage includes all 128 @acronym{ASCII} characters, but the other 128
-characters (codes 128 through 255) vary from one codepage to another.
-Each DOS codepage is identified by a 3-digit number, such as 850, 862,
-etc.
-
-  In contrast to X, which lets you use several fonts at the same time,
-MS-DOS normally doesn't allow use of several codepages in a single
-session.  MS-DOS was designed to load a single codepage at system
-startup, and require you to reboot in order to change
-it@footnote{Normally, one particular codepage is burnt into the
-display memory, while other codepages can be installed by modifying
-system configuration files, such as @file{CONFIG.SYS}, and rebooting.
-While there is third-party software that allows changing the codepage
-without rebooting, we describe here how a stock MS-DOS system
-behaves.}.  Much the same limitation applies when you run DOS
-executables on other systems such as MS-Windows.
-
-@cindex unibyte operation @r{(MS-DOS)}
-  If you invoke Emacs on MS-DOS with the @samp{--unibyte} option
-(@pxref{Initial Options}), Emacs does not perform any conversion of
-non-@acronym{ASCII} characters.  Instead, it reads and writes any non-@acronym{ASCII}
-characters verbatim, and sends their 8-bit codes to the display
-verbatim.  Thus, unibyte Emacs on MS-DOS supports the current codepage,
-whatever it may be, but cannot even represent any other characters.
-
-@vindex dos-codepage
-  For multibyte operation on MS-DOS, Emacs needs to know which
-characters the chosen DOS codepage can display.  So it queries the
-system shortly after startup to get the chosen codepage number, and
-stores the number in the variable @code{dos-codepage}.  Some systems
-return the default value 437 for the current codepage, even though the
-actual codepage is different.  (This typically happens when you use the
-codepage built into the display hardware.)  You can specify a different
-codepage for Emacs to use by setting the variable @code{dos-codepage} in
-your init file.
-
-@cindex language environment, automatic selection on @r{MS-DOS}
-  Multibyte Emacs supports only certain DOS codepages: those which can
-display Far-Eastern scripts, like the Japanese codepage 932, and those
-that encode a single ISO 8859 character set.
-
-  The Far-Eastern codepages can directly display one of the MULE
-character sets for these countries, so Emacs simply sets up to use the
-appropriate terminal coding system that is supported by the codepage.
-The special features described in the rest of this section mostly
-pertain to codepages that encode ISO 8859 character sets.
-
-  For the codepages which correspond to one of the ISO character sets,
-Emacs knows the character set name based on the codepage number.  Emacs
-automatically creates a coding system to support reading and writing
-files that use the current codepage, and uses this coding system by
-default.  The name of this coding system is @code{cp@var{nnn}}, where
-@var{nnn} is the codepage number.@footnote{The standard Emacs coding
-systems for ISO 8859 are not quite right for the purpose, because
-typically the DOS codepage does not match the standard ISO character
-codes.  For example, the letter @samp{@,{c}} (@samp{c} with cedilla) has
-code 231 in the standard Latin-1 character set, but the corresponding
-DOS codepage 850 uses code 135 for this glyph.}
-
-@cindex mode line @r{(MS-DOS)}
-  All the @code{cp@var{nnn}} coding systems use the letter @samp{D} (for
-``DOS'') as their mode-line mnemonic.  Since both the terminal coding
-system and the default coding system for file I/O are set to the proper
-@code{cp@var{nnn}} coding system at startup, it is normal for the mode
-line on MS-DOS to begin with @samp{-DD\-}.  @xref{Mode Line}.
-Far-Eastern DOS terminals do not use the @code{cp@var{nnn}} coding
-systems, and thus their initial mode line looks like the Emacs default.
-
-  Since the codepage number also indicates which script you are using,
-Emacs automatically runs @code{set-language-environment} to select the
-language environment for that script (@pxref{Language Environments}).
-
-  If a buffer contains a character belonging to some other ISO 8859
-character set, not the one that the chosen DOS codepage supports, Emacs
-displays it using a sequence of @acronym{ASCII} characters.  For example, if the
-current codepage doesn't have a glyph for the letter @samp{@`o} (small
-@samp{o} with a grave accent), it is displayed as @samp{@{`o@}}, where
-the braces serve as a visual indication that this is a single character.
-(This may look awkward for some non-Latin characters, such as those from
-Greek or Hebrew alphabets, but it is still readable by a person who
-knows the language.)  Even though the character may occupy several
-columns on the screen, it is really still just a single character, and
-all Emacs commands treat it as one.
-
-@cindex IBM graphics characters (MS-DOS)
-@cindex box-drawing characters (MS-DOS)
-@cindex line-drawing characters (MS-DOS)
-  Not all characters in DOS codepages correspond to ISO 8859
-characters---some are used for other purposes, such as box-drawing
-characters and other graphics.  Emacs maps these characters to two
-special character sets called @code{eight-bit-control} and
-@code{eight-bit-graphic}, and displays them as their IBM glyphs.
-However, you should be aware that other systems might display these
-characters differently, so you should avoid them in text that might be
-copied to a different operating system, or even to another DOS machine
-that uses a different codepage.
-
-@vindex dos-unsupported-character-glyph
-  Emacs supports many other characters sets aside from ISO 8859, but it
-cannot display them on MS-DOS.  So if one of these multibyte characters
-appears in a buffer, Emacs on MS-DOS displays them as specified by the
-@code{dos-unsupported-character-glyph} variable; by default, this glyph
-is an empty triangle.  Use the @kbd{C-u C-x =} command to display the
-actual code and character set of such characters.  @xref{Position Info}.
-
-@findex codepage-setup
-  By default, Emacs defines a coding system to support the current
-codepage.  To define a coding system for some other codepage (e.g., to
-visit a file written on a DOS machine in another country), use the
-@kbd{M-x codepage-setup} command.  It prompts for the 3-digit code of
-the codepage, with completion, then creates the coding system for the
-specified codepage.  You can then use the new coding system to read and
-write files, but you must specify it explicitly for the file command
-when you want to use it (@pxref{Text Coding}).
-
-  These coding systems are also useful for visiting a file encoded using
-a DOS codepage, using Emacs running on some other operating system.
-
-@cindex MS-Windows codepages
-  MS-Windows provides its own codepages, which are different from the
-DOS codepages for the same locale.  For example, DOS codepage 850
-supports the same character set as Windows codepage 1252; DOS codepage
-855 supports the same character set as Windows codepage 1251, etc.
-The MS-Windows version of Emacs uses the current codepage for display
-when invoked with the @samp{-nw} option.  Support for codepages in the
-Windows port of Emacs is part of the @file{code-pages.el} package.
-
-@node MS-DOS Processes
-@section Subprocesses on MS-DOS
-
-@cindex compilation under MS-DOS
-@cindex inferior processes under MS-DOS
-@findex compile @r{(MS-DOS)}
-@findex grep @r{(MS-DOS)}
-  Because MS-DOS is a single-process ``operating system,''
-asynchronous subprocesses are not available.  In particular, Shell
-mode and its variants do not work.  Most Emacs features that use
-asynchronous subprocesses also don't work on MS-DOS, including
-Shell mode and GUD.  When in doubt, try and see; commands that
-don't work output an error message saying that asynchronous processes
-aren't supported.
-
-  Compilation under Emacs with @kbd{M-x compile}, searching files with
-@kbd{M-x grep} and displaying differences between files with @kbd{M-x
-diff} do work, by running the inferior processes synchronously.  This
-means you cannot do any more editing until the inferior process
-finishes.
-
-  Spell checking also works, by means of special support for synchronous
-invocation of the @code{ispell} program.  This is slower than the
-asynchronous invocation on other platforms
-
-  Instead of the Shell mode, which doesn't work on MS-DOS, you can use
-the @kbd{M-x eshell} command.  This invokes the Eshell package that
-implements a Posix-like shell entirely in Emacs Lisp.
-
-  By contrast, Emacs compiled as a native Windows application
-@strong{does} support asynchronous subprocesses.  @xref{Windows
-Processes}.
-
-@cindex printing under MS-DOS
-  Printing commands, such as @code{lpr-buffer} (@pxref{Printing}) and
-@code{ps-print-buffer} (@pxref{PostScript}), work in MS-DOS by sending
-the output to one of the printer ports.  @xref{MS-DOS Printing}.
-
-  When you run a subprocess synchronously on MS-DOS, make sure the
-program terminates and does not try to read keyboard input.  If the
-program does not terminate on its own, you will be unable to terminate
-it, because MS-DOS provides no general way to terminate a process.
-Pressing @kbd{C-c} or @kbd{C-@key{BREAK}} might sometimes help in these
-cases.
-
-  Accessing files on other machines is not supported on MS-DOS.  Other
-network-oriented commands such as sending mail, Web browsing, remote
-login, etc., don't work either, unless network access is built into
-MS-DOS with some network redirector.
-
-@cindex directory listing on MS-DOS
-@vindex dired-listing-switches @r{(MS-DOS)}
-  Dired on MS-DOS uses the @code{ls-lisp} package where other
-platforms use the system @code{ls} command.  Therefore, Dired on
-MS-DOS supports only some of the possible options you can mention in
-the @code{dired-listing-switches} variable.  The options that work are
-@samp{-A}, @samp{-a}, @samp{-c}, @samp{-i}, @samp{-r}, @samp{-S},
-@samp{-s}, @samp{-t}, and @samp{-u}.
-
 @node Windows Processes
 @section Subprocesses on Windows 9X/ME and Windows NT/2K
 
--- a/man/mule.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/mule.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -605,7 +605,7 @@
 @key{RET}}@footnote{
 In the MS-DOS port of Emacs, you need to create a @code{cp@var{nnn}}
 coding system with @kbd{M-x codepage-setup}, before you can use it.
-@xref{MS-DOS and MULE}.}.
+@xref{MS-DOS and MULE,,,emacs-extra,Specialized Emacs Features}.}.
 
   In addition to converting various representations of non-@acronym{ASCII}
 characters, a coding system can perform end-of-line conversion.  Emacs
--- a/man/org.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/org.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -4,8 +4,8 @@
 @setfilename ../info/org
 @settitle Org Mode Manual
 
-@set VERSION 4.10
-@set DATE March 2006
+@set VERSION 4.23
+@set DATE April 2006
 
 @dircategory Emacs
 @direntry
@@ -22,8 +22,7 @@
 
 @c Macro definitions
 
-@c FIXME: does not look good in html
-@c Subheadings inside a table.  Need a difference between info and the rest.
+@c Subheadings inside a table.
 @macro tsubheading{text}
 @ifinfo
 @subsubheading \text\
@@ -82,6 +81,7 @@
 * Hyperlinks::                  Notes in context
 * TODO items::                  Every tree branch can be a TODO item
 * Timestamps::                  Assign date and time to items
+* Tags::                        Tagging headlines and matching sets of tags
 * Agenda Views::                Collecting information into views
 * Exporting::                   Sharing and publishing of notes
 * Miscellaneous::               All the rest which did not fit elsewhere
@@ -94,7 +94,7 @@
 Introduction
 
 * Summary::                     Brief summary of what Org-mode does
-* Installation and Activation::  How to install Org-mode
+* Installation and activation::  How to install Org-mode
 * Feedback::                    Bug reports, ideas, patches etc.
 
 Document Structure
@@ -106,12 +106,12 @@
 * Structure editing::           Changing sequence and level of headlines
 * Archiving::                   Move done task trees to a different place
 * Sparse trees::                Matches embedded in context
-* Tags::                        Tagging headlines and matching sets of tags
 * Plain Lists::                 Editing hand-formatted lists
 
 Tables
 
 * Built-in table editor::       Simple tables
+* Narrow columns::              Stop wasting space in tables   
 * Table calculations::          Compute a field from other fields
 * orgtbl-mode::                 The table editor as minor mode
 * table.el::                    Complex tables
@@ -127,13 +127,14 @@
 
 Hyperlinks
 
-* Internal Links::              Links to other places in the current file
-* External Links::              URL-like links to the world
+* Link format::                 How links in Org-mode are formatted
+* Internal links::              Links to other places in the current file
+* External links::              URL-like links to the world
 * Managing links::              Creating, inserting and following
 * Search Options::              Linking to a specific location
 * Remember::                    Org-trees store quick notes
 
-Internal Links
+Internal links
 
 * Radio targets::               Make targets trigger links in plain text.
 * CamelCase links::             Activating CamelCase words as links
@@ -141,7 +142,7 @@
 TODO items
 
 * TODO basics::                 Marking and displaying TODO entries
-* Progress Logging::            Document your productivity
+* Progress logging::            Document your productivity
 * TODO extensions::             Workflow and assignments
 * Priorities::                  Some things are more important than others
 
@@ -156,6 +157,12 @@
 * Time stamps::                 Assigning a time to a tree entry
 * Creating timestamps::         Commands which insert timestamps
 
+Tags
+
+* Tag inheritance::             Tags use the tree structure of the outline
+* Setting tags::                How to assign tags to a headline
+* Tag searches::                Searching for combinations of tags
+
 Agenda Views
 
 * Agenda files::                Files being searched for agenda information
@@ -175,20 +182,24 @@
 
 Exporting
 
-* ASCII export::                Export as a structured ASCII file
-* HTML export::                 Export as an HTML file
-* iCalendar export::            Create calendar entries.
-
-HTML export
-
-* HTML formatting::             Interpretation of the buffer content
-* Export options::              How to influence exports
-* Comment lines::               Lines which will not be exported
+* ASCII export::                Exporting to plain ASCII
+* HTML export::                 Exporting to HTML
+* XML export::                  Exporting to XML
+* iCalendar export::            Exporting in iCalendar format
+* Text interpretation::         How the exporter looks at the file
+
+Text interpretation by the exporter
+
+* Comment lines::               Some lines will not be exported
+* Enhancing text::              Subscripts, symbols and more
+* Export options::              How to influence the export settings
 
 Miscellaneous
 
 * Completion::                  M-TAB knows what you need
 * Customization::               Adapting Org-mode to your taste
+* Summary of in-buffer settings::  Using special lines to set options
+* The very busy C-c C-c key::   When in doubt, press C-c C-c
 * Clean view::                  Getting rid of leading stars in the outline
 * TTY keys::                    Using Org-mode on a tty
 * FAQ::                         Frequently asked questions
@@ -205,11 +216,11 @@
 
 @menu
 * Summary::                     Brief summary of what Org-mode does
-* Installation and Activation::  How to install Org-mode
+* Installation and activation::  How to install Org-mode
 * Feedback::                    Bug reports, ideas, patches etc.
 @end menu
 
-@node Summary, Installation and Activation, Introduction, Introduction
+@node Summary, Installation and activation, Introduction, Introduction
 @section Summary
 @cindex summary
 
@@ -234,7 +245,7 @@
 feel like a simple but easy to use outliner.  Complexity is not
 imposed, but a large amount of functionality is available when you
 need it.  Org-mode can be used on different levels and in different
-ways, for example
+ways, for example:
 
 @example
 @r{@bullet{} as an outline extension with visibility cycling and structure editing}
@@ -255,7 +266,7 @@
 
 @page
 
-@node Installation and Activation, Feedback, Summary, Introduction
+@node Installation and activation, Feedback, Summary, Introduction
 @section Installation and Activation
 @cindex installation
 @cindex autoload
@@ -301,9 +312,9 @@
 
 @noindent which will select Org-mode for this buffer no matter what
 the file's name is.  See also the variable
-@code{org-insert-mode-line-in-empty-file'}.
-
-@node Feedback,  , Installation and Activation, Introduction
+@code{org-insert-mode-line-in-empty-file}.
+
+@node Feedback,  , Installation and activation, Introduction
 @section Feedback
 @cindex feedback
 @cindex bug reports
@@ -316,16 +327,17 @@
 
 For bug reports, please provide as much information as possible,
 including the version information of Emacs (@kbd{C-h v emacs-version
-@key{RET}}) and Org-mode (@kbd{M-x org-version}), as well as the
-Org-mode related setup in @file{.emacs}.  If an error occurs, a
+@key{RET}}) and Org-mode (@kbd{C-h v org-version @key{RET}}), as well as
+the Org-mode related setup in @file{.emacs}.  If an error occurs, a
 traceback can be very useful.  Often a small example file helps, along
 with clear information about:
+
 @enumerate
 @item What exactly did you do?
 @item What did you expect to happen?
 @item What happened instead?
 @end enumerate
-@noindent Thanks for helping to improve this mode.
+@noindent Thank you for helping to improve this mode.
 
 @node Document Structure, Tables, Introduction, Top
 @chapter Document Structure
@@ -343,7 +355,6 @@
 * Structure editing::           Changing sequence and level of headlines
 * Archiving::                   Move done task trees to a different place
 * Sparse trees::                Matches embedded in context
-* Tags::                        Tagging headlines and matching sets of tags
 * Plain Lists::                 Editing hand-formatted lists
 @end menu
 
@@ -367,9 +378,9 @@
 @cindex headlines
 @cindex outline tree
 
-Headlines define the structure of an outline tree.  The Headlines in
+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
+example:
 
 @example
 * Top level headline
@@ -380,6 +391,7 @@
     more text
 * Another top level headline
 @end example
+
 @noindent Some people find the many stars too noisy and would prefer an
 outline that has whitespace followed by a single star as headline
 starters.  @ref{Clean view} describes a setup to realize this.
@@ -404,10 +416,12 @@
 @kindex @key{TAB}
 @item @key{TAB}
 Rotate current subtree between the states
+
 @example
 ,-> FOLDED -> CHILDREN -> SUBTREE --.
 '-----------------------------------'
 @end example
+
 At the beginning of the buffer (or when called with @kbd{C-u}), this does
 the same as the command @kbd{S-@key{TAB}} below.
 
@@ -418,10 +432,12 @@
 @kindex S-@key{TAB}
 @item S-@key{TAB}
 Rotate the entire buffer between the states
+
 @example
 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
 '--------------------------------------'
 @end example
+
 Note that inside tables, @kbd{S-@key{TAB}} jumps to the previous field.
 
 @cindex show all, command
@@ -437,9 +453,9 @@
 buffer:
 
 @example
-#+STARTUP: fold
-#+STARTUP: nofold
+#+STARTUP: overview
 #+STARTUP: content
+#+STARTUP: showall
 @end example
 
 @node Motion, Structure editing, Visibility cycling, Document Structure
@@ -499,23 +515,23 @@
 Insert new TODO entry with same level as current heading.
 @kindex M-@key{left}
 @item M-@key{left}
-Promote current heading by one level
+Promote current heading by one level.
 @kindex M-@key{right}
 @item M-@key{right}
-Demote current heading by one level
+Demote current heading by one level.
 @kindex M-S-@key{left}
 @item M-S-@key{left}
-Promote the current subtree by one level
+Promote the current subtree by one level.
 @kindex M-S-@key{right}
 @item M-S-@key{right}
-Demote the current subtree by one level
+Demote the current subtree by one level.
 @kindex M-S-@key{up}
 @item M-S-@key{up}
 Move subtree up (swap with previous subtree of same
-level)
+level).
 @kindex M-S-@key{down}
 @item M-S-@key{down}
-Move subtree down (swap with next subtree of same level)
+Move subtree down (swap with next subtree of same level).
 @kindex C-c C-x C-w
 @kindex C-c C-x C-k
 @item C-c C-x C-w
@@ -567,7 +583,7 @@
 agenda, archiving to a different file is a good way to keep archived
 trees from contributing agenda items.
 
-@node Sparse trees, Tags, Archiving, Document Structure
+@node Sparse trees, Plain Lists, Archiving, Document Structure
 @section Sparse trees
 @cindex sparse trees
 @cindex trees, sparse
@@ -602,11 +618,13 @@
 use the variable @code{org-agenda-custom-commands} to define fast
 keyboard access to specific sparse trees.  These commands will then be
 accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
-For example
+For example:
+
 @lisp
 (setq org-agenda-custom-commands
       '(("f" occur-tree "FIXME")))
 @end lisp
+
 @noindent will define the key @kbd{C-c a f} as a shortcut for creating
 a sparse tree matching the string @samp{FIXME}.
 
@@ -621,97 +639,20 @@
 of the document @footnote{This does not work under XEmacs, because
 XEmacs uses selective display for outlining, not text properties}.
 Or you can use the command @kbd{C-c C-x v} to copy the visible part of
-the document to another file (extension @file{.txt}) which then can be
+the document to another file (extension @file{.txt}) which can then be
 printed in any desired way.
 
-@node Tags, Plain Lists, Sparse trees, Document Structure
-@section Tags
-@cindex tags
-@cindex headline tagging
-@cindex matching, tags
-@cindex sparse tree, tag based
-
-If you wish to implement a tag system to cross-correlate information,
-this can be done as well in Org-mode.  Every headline can contain a
-list of tags, at the end of the headline.  Tags are normal words
-containing letters, numbers, @samp{_}, and @samp{@@}.  Tags must be
-preceded and followed by a single colon; like @samp{:WORK:}.  Several
-tags can be specified like @samp{:WORK:URGENT:}.
-
-@cindex inheritance, of tags
-Tags make use of the hierarchical structure of outline trees.  If a
-heading has a certain tag, all subheadings will inherit the tag as
-well.  For example, in the list
-
-@example
-* Meeting with the French group      :WORK:
-** Summary by Frank                  :BOSS:NOTES:
-*** TODO Prepare slides for him      :ACTION:
-@end example
-@noindent
-the final heading will have the tags @samp{:WORK:}, @samp{:BOSS:},
-@samp{:NOTES:}, and @samp{:ACTION:}.  When executing tag searches and
-Org-mode finds that a certain headline matches the search criterion,
-it will not check any sublevel headline, assuming that these likely
-also match, and that the list of matches can become very long.  You
-can influence inheritance and searching using the variables
-@code{org-use-tag-inheritance} and
-@code{org-tags-match-list-sublevels}.
-
-@kindex M-@key{TAB}
-Tags can simply be typed into the buffer.  After a colon,
-@kbd{M-@key{TAB}} offers completion on all tags being used in the
-current buffer.  There are also special commands for inserting tags,
-and for executing searches based on tags.
-
-@table @kbd
-@kindex C-c C-c
-@item C-c C-c
-@cindex completion, of tags
-Enter new tags for the current headline.  The minibuffer will prompt
-for a list of tags and offer completion with respect to all other tags
-used in the current buffer.  Several tags, separated by colons, may be
-specified at the prompt.  After pressing @key{RET}, the tags will
-be inserted and aligned to @code{org-tags-column}.  When called with a
-@kbd{C-u} prefix, align all tags in the current buffer to that column,
-just to make things look nice.  TAGS are automatically realigned after
-promotion, demotion, and TODO state changes (@pxref{TODO basics}).
-@kindex C-c \
-@item C-c \
-Create a sparse tree with all headlines matching a tags search.
-@kindex C-c a m
-@item C-c a m
-Create a global list of tag matches from all agenda files.
-@xref{Matching headline tags}.
-@kindex C-c a M
-@item C-c a M
-Create a global list of tag matches from all agenda files, but check
-only TODO items and force checking subitems (see variable
-@code{org-tags-match-list-sublevels}).
-@end table
-
-A tags search string can use Boolean operators @samp{&} for AND and
-@samp{|} for OR.  @samp{&} binds more strongly than
-@samp{|}. Parenthesis are currently no implemented.  A tag may also be
-preceded by @samp{-}, to select against it, and @samp{+} is syntactic
-sugar for positive selection.  The AND operator @samp{&} is optional
-when @samp{+} or @samp{-} is present.  For example, @samp{+WORK-BOSS}
-would select all headlines that are tagged @samp{:WORK:}, but discard
-those also tagged @samp{:BOSS:}.  The search string @samp{WORK|LAPTOP}
-selects all lines tagged @samp{:WORK:} or @samp{:LAPTOP:}. The string
-@samp{WORK|LAPTOP&NIGHT} requires that the @samp{:LAPTOP:} lines are
-also tagged @samp{NIGHT}.
-
-@node Plain Lists,  , Tags, Document Structure
+
+@node Plain Lists,  , Sparse trees, Document Structure
 @section Plain Lists
 @cindex plain lists
 @cindex lists, plain
 @cindex lists, ordered
 @cindex ordered lists
 
-Headlines define the structure of the Org-mode file, and also lists
-(for example TODO items (@pxref{TODO items}) should be created using
-headline levels.  However, when taking notes, the plain text is
+Headlines define both the structure of the Org-mode file, and also lists
+(for example, TODO items (@pxref{TODO items}) should be created using
+headline levels).  However, when taking notes, the plain text is
 sometimes easier to read with hand-formatted lists.  Org-mode supports
 editing such lists, and the HTML exporter (@pxref{Exporting}) does
 parse and format them.
@@ -721,11 +662,11 @@
 bullet, lines must be indented or they will be seen as top-level
 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{*}
+indistinguishable from true headlines.  In short: even though @samp{*}
 is supported, it may be better to not 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.}, also
+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
@@ -792,12 +733,13 @@
 
 @menu
 * Built-in table editor::       Simple tables
+* Narrow columns::              Stop wasting space in tables   
 * Table calculations::          Compute a field from other fields
 * orgtbl-mode::                 The table editor as minor mode
 * table.el::                    Complex tables
 @end menu
 
-@node Built-in table editor, Table calculations, Tables, Tables
+@node Built-in table editor, Narrow columns, Tables, Tables
 @section The built-in table editor
 @cindex table editor, builtin
 
@@ -826,6 +768,7 @@
 |Name|Phone|Age
 |-
 @end example
+
 @noindent and then press @key{TAB} to align the table and start filling in
 fields.
 
@@ -840,18 +783,16 @@
 
 @table @kbd
 @tsubheading{Creation and conversion}
-@item M-x org-table-create
-Creates an empty Org-mode table.  However, it is much easier to just
-start typing, like @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}
-
-@kindex C-c C-c
-@item C-c C-c
-Convert region to table.  Works when the cursor is not in an existing
-table, and when there is a region defined.  If every line contains at
-least one TAB character, the function assumes that the material is tab
-separated.  If not, lines are split at whitespace into fields.  You
-can use a prefix argument to indicate how many consecutive spaces are
-at least required to indicate a field separator (default: just one).
+@kindex C-c |
+@item C-c |
+Convert the active region to table. If every line contains at least one
+TAB character, the function assumes that the material is tab separated.
+If not, lines are split at whitespace into fields.  You can use a prefix
+argument to indicate the minimum number of consecutive spaces required
+to identify a field separator (default: just one).@* 
+If there is no active region, this command creates an empty Org-mode
+table.  However, it's easier to just start typing, like
+@kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
 
 @tsubheading{Re-aligning and field motion}
 @kindex C-c C-c
@@ -878,7 +819,7 @@
 @kindex M-@key{right}
 @item M-@key{left}
 @itemx M-@key{right}
-Move the current column left/right
+Move the current column left/right.
 
 @kindex M-S-@key{left}
 @item M-S-@key{left}
@@ -892,7 +833,7 @@
 @kindex M-@key{down}
 @item M-@key{up}
 @itemx M-@key{down}
-Move the current row up/down
+Move the current row up/down.
 
 @kindex M-S-@key{up}
 @item M-S-@key{up}
@@ -940,7 +881,7 @@
 is no region, the current field is split at the cursor position and the
 text fragment to the right of the cursor is prepended to the field one
 line down. If there is no region, but you specify a prefix ARG, the
-current field gets blank, and the content is appended to the field
+current field is made blank, and the content is appended to the field
 above.
 
 @tsubheading{Calculations}
@@ -1000,36 +941,87 @@
 (@pxref{Interaction}).
 
 @tsubheading{Miscellaneous}
-@kindex C-c |
-@item C-c |
-Toggle the visibility of vertical lines in tables.  The lines are
-still there, only made invisible with a text property.  Any @samp{|}
-added by hand will become invisible on the next align.
+@kindex C-c `
+@item C-c `
+Edit the current field in a separate window.  This is useful for fields
+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.
+
+@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.
 
 @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
+separated.  Useful, for example, to import an Excel table or data from a
 database, because these programs generally can write TAB-separated text
 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 M-x org-table-export
-Export the table as a TAB-separated file.  Useful for data exchange with
-for example Excel or database programs.
+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 into your
-way in lines which you would like to start with @samp{|}, you can turn
+If you don't like the automatic table editor because it gets in your
+way on lines which you would like to start with @samp{|}, you can turn
 it off with
+
 @lisp
 (setq org-enable-table-editor nil)
 @end lisp
+
 @noindent The only table command which then still works is
 @kbd{C-c C-c} to do a manual re-align.
 
-@node Table calculations, orgtbl-mode, Built-in table editor, Tables
+@node Narrow columns, Table calculations, Built-in table editor, Tables
+@section Narrow columns
+@cindex narrow columns in tables
+
+The width of columns is automatically determined by the table editor.
+Sometimes a single field or a few fields need to carry more text,
+leading to inconveniently wide columns.  To limit@footnote{This feature
+does not work on XEmacs.} the width of a column, one field anywhere in
+the column must carry the string @samp{<N>} where @samp{N} is an integer
+specifying the width of the column in characters.  The next re-align
+will then set the width of this column to no more than this value.
+
+@example
+|---+------------------------------|               |---+--------|
+|   |                              |               |   | <6>    |
+| 1 | one                          |               | 1 | one    |
+| 2 | two                          |     ----\     | 2 | two    |
+| 3 | This is a long chunk of text |     ----/     | 3 | This=> |
+| 4 | four                         |               | 4 | four   |
+|---+------------------------------|               |---+--------|
+@end example
+
+@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
+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
+C-c}.
+
+When visiting a file containing a table with narrowed columns, the
+necessary character hiding has not yet happened, and the table needs to
+be aligned before it looks nice.  Setting the option
+@code{org-startup-align-all-tables} will realign all tables in a file
+upon visiting, but also slow down startup.  You can also set this option
+on a per-file basis with:
+
+@example
+#+STARTUP: align
+#+STARTUP: noalign
+@end example
+
+@node Table calculations, orgtbl-mode, Narrow columns, Tables
 @section Calculations in tables
 @cindex calculations, in tables
 @cindex spreadsheet capabilities
@@ -1062,7 +1054,7 @@
 
 A formula can be any algebraic expression understood by the Emacs
 @file{calc} package.  Note that @file{calc} has the slightly
-non-standard conversion that @samp{/} has lower precedence than
+non-standard convention that @samp{/} has lower precedence than
 @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.  Before
 evaluation by @code{calc-eval} (@pxref{Calling Calc from Your Lisp
 Programs,calc-eval,Calling calc from Your Lisp Programs,calc,GNU Emacs
@@ -1091,7 +1083,7 @@
 @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, units like @samp{$km} for kilometers.  Column names and
+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}.
 
@@ -1106,10 +1098,11 @@
 @code{org-calc-default-modes}.} during execution, e.g.  @samp{p20} to
 switch the internal precision to 20 digits, @samp{n3}, @samp{s3},
 @samp{e2} or @samp{f4} to switch to normal, scientific, engineering,
-or fix display format, respectively, and @samp{D}, @samp{R}, @samp{F},
+or fixed display format, respectively, and @samp{D}, @samp{R}, @samp{F},
 and @samp{S} to turn on degrees, radians, fraction and symbolic modes,
 respectively.  In addition, you may provide a @code{printf} format
 specifier to reformat the final result.  A few examples:
+
 @example
   $1+$2                @r{Sum of first and second field}
   $1+$2;%.2f           @r{Same, format result to two decimals}
@@ -1120,7 +1113,7 @@
   tan($1);Dp3s1        @r{Compute in degrees, precision 3, display SCI 1}
   sin($1);Dp3%.1e      @r{Same, but use printf specifier for display}
   vmean($2..$7)        @r{Compute column range mean, using vector function}
-  vsum(&III)           @r{Sum numbers from 3rd hline above to here}
+  vsum(&III)           @r{Sum numbers from 3rd hline above, up to here}
   taylor($3,x=7,2)     @r{taylor series of $3, at x=7, second degree}
 @end example
 
@@ -1164,12 +1157,13 @@
 @node Advanced features, Named-field formulas, Column formulas, Table calculations
 @subsection Advanced features
 
-If you want want the recalculation of fields to happen automatically,
+If you want the recalculation of fields to happen automatically,
 or if you want to be able to assign a formula to an individual field
 (instead of an entire column) you need to reserve the first column of
 the table for special marking characters.  Here is an example of a
 table that collects exam results of students and makes use of these
 features:
+
 @example
 @group
 |---+---------+--------+--------+--------+-------+------|
@@ -1192,7 +1186,7 @@
 @end example
 
 @noindent @b{Important}: Please note that for these special tables,
-recalculating the table with @kbd{C-u C-c *} does only affect rows
+recalculating the table with @kbd{C-u C-c *} will only affect rows
 which are marked @samp{#} or @samp{*}, and named fields.  The column
 formulas are not applied in rows with empty first field.
 
@@ -1209,7 +1203,7 @@
 associated with them.
 @item _
 Similar to @samp{^}, but defines names for the fields in the row
-@emph{below}. 
+@emph{below}.
 @item $
 Fields in this row can define @emph{parameters} for formulas.  For
 example, if a field in a @samp{$} row contains @samp{max=50}, then
@@ -1226,8 +1220,8 @@
 Selects this line for global recalculation with @kbd{C-u C-c *}, but
 not for automatic recalculation.  Use this when automatic
 recalculation slows down editing too much.
-@item  
-Unmarked lines are exempted from recalculation with @kbd{C-u C-c *}.
+@item
+Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
 All lines that should be recalculated should be marked with @samp{#}
 or @samp{*}.
 @end table
@@ -1240,7 +1234,7 @@
 A named field can have its own formula associated with it.  In the
 example above, this is used for the @samp{at} field that contains
 the average result of the students.  To enter a formula for a named
-field, just type it onto the buffer, preceded by @samp{:=}.  Or use
+field, just type it into the buffer, preceded by @samp{:=}.  Or use
 @kbd{C-u C-c =}.  This equation will be stored below the table like
 @samp{$name=...}.  Any recalculation in the table (even if only
 requested for the current line) will also update all named field
@@ -1251,9 +1245,9 @@
 @cindex formula editing
 @cindex editing, of table formulas
 
-To edit a column or field formula, you can use the commands @kbd{C-c
+To edit a column or field formula, use the commands @kbd{C-c
 =} and @kbd{C-u C-c =}, respectively.  The currently active expression
-is then presented as default in the minibuffer, were it may be edited.
+is then presented as default in the minibuffer, where it may be edited.
 
 Note that making a table field blank does not remove the formula
 associated with the field - during the next recalculation the field
@@ -1264,7 +1258,7 @@
 @kindex C-c C-c
 You may edit the @samp{#+TBLFM} directly and re-apply
 the changed equations with @kbd{C-c C-c} in that line, or with the
-normal recalculation commands in the table.  
+normal recalculation commands in the table.
 
 @kindex C-c '
 @kindex C-c C-c
@@ -1283,8 +1277,8 @@
 When the evaluation of a formula leads to an error, the field content
 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 menu and repeat the calculation
-by pressing, for example by pressing @kbd{C-c = @key{RET}} in a field.
+bug, turn on formula debugging in the menu and repeat the calculation,
+for example by pressing @kbd{C-c = @key{RET}} in a field.
 Detailed information will be displayed.
 
 @node Appetizer,  , Editing/debugging formulas, Table calculations
@@ -1320,6 +1314,7 @@
 The minor mode Orgtbl-mode makes this possible.  You can always toggle
 the mode with @kbd{M-x orgtbl-mode}.  To turn it on by default, for
 example in mail mode, use
+
 @lisp
 (add-hook 'mail-mode-hook 'turn-on-orgtbl)
 @end lisp
@@ -1362,46 +1357,81 @@
 links to other files, Usenet articles, emails and much more.
 
 @menu
-* Internal Links::              Links to other places in the current file
-* External Links::              URL-like links to the world
+* Link format::                 How links in Org-mode are formatted
+* Internal links::              Links to other places in the current file
+* External links::              URL-like links to the world
 * Managing links::              Creating, inserting and following
 * Search Options::              Linking to a specific location
 * Remember::                    Org-trees store quick notes
 @end menu
 
-@node Internal Links, External Links, Hyperlinks, Hyperlinks
-@section Internal Links
+@node Link format, Internal links, Hyperlinks, Hyperlinks
+@section Link format
+@cindex link format
+@cindex format, of links
+
+Org-mode will recognize plain URL-like links and activate them as
+clickable links.  However, the general link format looks like this:
+
+@example
+[[link][description]]       @r{or alternatively}           [[link]]  
+@end example
+
+Once a link in the buffer is complete (all brackets present), Org-mode
+will change the display so that @samp{description} is displayed instead
+of @samp{[[link][description]]} and @samp{link} is displayed instead of
+@samp{[[link]]}.  Links will be highlighted in the face @code{org-link},
+which by default is an underlined face.  You can directly edit the
+visible part of a link.  Note that this can be either the @samp{link}
+part (if there is not description) or the @samp{description} part.  To
+edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
+cursor on the link.
+
+If you place the cursor at the beginning or just behind the end of the
+displayed text and press @key{BACKSPACE}, you will remove the
+(invisible) bracket at that location.  This makes the link incomplete
+and the internals are again displayed as plain text.  Inserting the
+missing bracket does hide the link internals again.  To show the
+internal structure of all links, use the menu entry
+@code{Org->Hyperlinks->Literal links}.
+
+@node Internal links, External links, Link format, Hyperlinks
+@section Internal links
 @cindex internal links
 @cindex links, internal
 @cindex CamelCase links
 
-Strings inside double brackets like @samp{[[My Target]]} are links
-that lead to a text search in the current file.  The link can be
-followed with @kbd{C-c C-o} or with a mouse click (@pxref{Managing
-links}).  The preferred match for such a link is a dedicated target:
-The same string in double angular brackets.  Targets may be located
-anywhere, often it is convenient to put them into a comment line, for
-example
+If the link text does not look like a URL, links are considered to be
+internal in the current file.  Links such as @samp{[[My Target]]} or
+@samp{[[My Target][Find my target]]} lead to a text search in the
+current file.  The link can be followed with @kbd{C-c C-o} when the
+cursor is on the link, or with a mouse click (@pxref{Managing links}).
+The preferred match for such a link is a dedicated target: The same
+string in double angular brackets.  Targets may be located anywhere,
+often it is convenient to put them into a comment line, for example
+
 @example
 # <<My Target>>
 @end example
 
-If no dedicated target exists, Org-mode will search for the words in
-the link, in the above example for @samp{my target}.  Links starting
-with a star like @samp{*My Target} restrict the search to headlines.
-When searching, Org-mode will first try an exact match, but then move
-on to more and more lenient searches.  For example, the link
-@samp{[[*My Targets]]} will find any of the following
+If no dedicated target exists, Org-mode will search for the words in the
+link, often removing the need for a dedicated target.  In the above
+example the search would be for @samp{my target}.  Links starting with a
+star like @samp{*My Target} restrict the search to headlines.  When
+searching, Org-mode will first try an exact match, but then move on to
+more and more lenient searches.  For example, the link @samp{[[*My
+Targets]]} will find any of the following:
+
 @example
 ** My targets
 ** TODO my targets are bright
 ** my 20 targets are
 @end example
-It is therefore often not necessary to set a dedicated target.  To
-insert a link targeting a headline, in-buffer completion can be used.
-Just type a star followed by a few optional letters into the buffer
-and press @kbd{M-@key{TAB}}.  All headlines in the current buffer will
-be offered as completions.  @xref{Managing links}, for more commands
+
+To insert a link targeting a headline, in-buffer completion can be used.
+Just type a star followed by a few optional letters into the buffer and
+press @kbd{M-@key{TAB}}.  All headlines in the current buffer will be
+offered as completions.  @xref{Managing links}, for more commands
 creating links.
 
 Following a link pushes a mark onto Org-mode's own mark ring.  You can
@@ -1414,7 +1444,7 @@
 * CamelCase links::             Activating CamelCase words as links
 @end menu
 
-@node Radio targets, CamelCase links, Internal Links, Internal Links
+@node Radio targets, CamelCase links, Internal links, Internal links
 @subsection Radio targets
 
 You can configure Org-mode to link any occurrences of certain target
@@ -1427,24 +1457,20 @@
 loaded into Emacs.  To update the target list during editing, press
 @kbd{C-c C-c} with the cursor on or at a target.
 
-@node CamelCase links,  , Radio targets, Internal Links
+@node CamelCase links,  , Radio targets, Internal links
 @subsection CamelCase words as links
 @cindex completion, of CamelCase links
 @cindex CamelCase links, completion of
 
-As an alternative to @samp{[[...]]} links, Org-mode also supports
-CamelCase words as links.  This feature is not turned on by default
-because of the occasional inconsistencies this system suffers from.
-To activate CamelCase words as links, and to make headline completion
-offer CamelCase version of headlines, the following customization is
-needed:
-@lisp
-(setq org-activate-camels t
-      org-file-link-context-use-camel-case t)
-@end lisp
-
-@node External Links, Managing links, Internal Links, Hyperlinks
-@section External Links
+Org-mode also supports CamelCase words as links.  This feature is not
+turned on by default because of the inconsistencies this system suffers
+from.  To activate CamelCase words as links, you need to customize
+the option @code{org-activate-links}.  A CamelCase word then leads to a
+text search such that @samp{CamelCaseLink} is equivalent to
+@samp{[[camel case link]]}.
+
+@node External links, Managing links, Internal links, Hyperlinks
+@section External links
 @cindex links, external
 @cindex external links
 @cindex links, external
@@ -1460,39 +1486,46 @@
 @cindex SHELL links
 
 Org-mode supports links to files, websites, Usenet and email messages;
-and BBDB database entries.  Links are just plain-text URL-like
-locators, optionally enclosed by angular brackets.  The following list
-shows examples for each link type.
+and BBDB database entries.  External links are URL-like locators.  The
+following list shows examples for each link type.
 
 @example
-<http://www.astro.uva.nl/~dominik>         @r{on the web}
-<file:/home/dominik/images/jupiter.jpg>    @r{file, absolute path}
-<file:papers/last.pdf>                     @r{file, relative path}
-<news:comp.emacs>                          @r{Usenet link}
-<mailto:adent@@galaxy.net>                  @r{Mail link}
-<vm:folder>                                @r{VM folder link}
-<vm:folder#id>                             @r{VM message link}
-<vm://myself@@some.where.org/folder#id>     @r{VM on remote machine}
-<wl:folder>                                @r{WANDERLUST folder link}
-<wl:folder#id>                             @r{WANDERLUST message link}
-<mhe:folder>                               @r{MH-E folder link}
-<mhe:folder#id>                            @r{MH-E message link}
-<rmail:folder>                             @r{RMAIL folder link}
-<rmail:folder#id>                          @r{RMAIL message link}
-<gnus:group>                               @r{GNUS group link}
-<gnus:group#id>                            @r{GNUS article link}
-<bbdb:Richard Stallman>                    @r{BBDB link}
-<shell:ls *.org>@footnote{Note that @samp{<} and @samp{>} cannot be part of a link, and therefore of a shell command.  If you need redirection, use @@@{ and @@@} instead.}                          @r{A shell command}
+http://www.astro.uva.nl/~dominik         @r{on the web}
+file:/home/dominik/images/jupiter.jpg    @r{file, absolute path}
+file:papers/last.pdf                     @r{file, relative path}
+news:comp.emacs                          @r{Usenet link}
+mailto:adent@@galaxy.net                  @r{Mail link}
+vm:folder                                @r{VM folder link}
+vm:folder#id                             @r{VM message link}
+vm://myself@@some.where.org/folder#id     @r{VM on remote machine}
+wl:folder                                @r{WANDERLUST folder link}
+wl:folder#id                             @r{WANDERLUST message link}
+mhe:folder                               @r{MH-E folder link}
+mhe:folder#id                            @r{MH-E message link}
+rmail:folder                             @r{RMAIL folder link}
+rmail:folder#id                          @r{RMAIL message link}
+gnus:group                               @r{GNUS group link}
+gnus:group#id                            @r{GNUS article link}
+bbdb:Richard Stallman                    @r{BBDB link}
+shell:ls *.org                           @r{A shell command}
 @end example
 
-A link may contain space characters and is terminated by @samp{>} or by
-the end of a line.  In tables, the end of a table field also terminates
-a link.  Angle brackets around a link are not required, but are
-recommended to avoid problems with punctuation and other text following
-the link.  See also the variable @code{org-allow-space-in-links}.
-
-
-@node Managing links, Search Options, External Links, Hyperlinks
+A link should be enclosed in double brackets and may contain a
+descriptive text to be displayed instead of the url (@pxref{Link
+format}), for example:
+
+@example
+[[http://www.gnu.org/software/emacs/][GNU Emacs]]
+@end example
+
+@cindex angular brackets, around links
+@cindex plain text external links
+Org-mode also finds external links in the normal text and activates them
+as links.  If spaces must be part of the link (for example in
+@samp{bbdb:Richard Stallman}) or to remove ambiguities about the end of
+the link, enclose them in angular brackets.
+
+@node Managing links, Search Options, External links, Hyperlinks
 @section Managing links
 
 Org-mode provides methods to create a link in the correct syntax, to
@@ -1504,53 +1537,63 @@
 @item C-c l
 Store a link to the current location.  This is a @emph{global} command
 which can be used in any buffer to create a link.  The link will be
-stored for later insertion into an Org-mode buffer (see below).  For
-VM, RMAIL, WANDERLUST, GNUS and BBDB buffers, the link will point to
-the current article/entry.  For W3 and W3M buffer, the link goes to
-the current URL.  For Org-mode files, the current headline is
-targeted.  For any other files, the link will point to the file, with
-a search string (@pxref{Search Options}) pointing to the
-contents of the current line.  If there is an active region, the
-selected words will form the basis of the search string.  The key
-binding @kbd{C-c l} is only a suggestion - see @ref{Installation and
-Activation}.
+stored for later insertion into an Org-mode buffer (see below).  For VM,
+RMAIL, WANDERLUST, MH-E, GNUS and BBDB buffers, the link will point to
+the current article/entry.  For W3 and W3M buffers, the link goes to the
+current URL.  For Org-mode files, the current headline is targeted.  For
+any other files, the link will point to the file, with a search string
+(@pxref{Search Options}) pointing to the contents of the current line.
+If there is an active region, the selected words will form the basis of
+the search string.  The key binding @kbd{C-c l} is only a suggestion -
+see @ref{Installation and activation}.
 
 @kindex C-c C-l
 @cindex link completion
-@cindex file name completion
 @cindex completion, of links
-@cindex completion, of file names
 @cindex inserting links
 @item C-c C-l
-Insert a link.  This prompts for a link to be inserted into the
-buffer.  You can just type a link, using one of the link type prefixes
-mentioned in the examples above.  Through completion, all links stored
-during the current session can be accessed.  When called with prefix
-arg, you can use file name completion to enter a file link.  The link
+Insert a link.  This prompts for a link to be inserted into the buffer.
+You can just type a link, using text for an internal link, or one of the
+link type prefixes mentioned in the examples above.  Through completion,
+all links stored during the current session can be accessed.  The link
 will be formatted as given in the variable @code{org-link-format} and
-inserted into the buffer.  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.
+inserted into the buffer, along with a descriptive text.  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.
+
+@kindex C-u C-c C-l
+@cindex file name completion
+@cindex completion, of file names
+@item C-u C-c C-l
+When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
+a file will be inserted and you may use file name completion to select
+the name of the file.  The path to the file is inserted relative to the
+directory of the current org file, if the linked file is in the current
+directory or in a subdirectory of it.  Otherwise an absolute path, if
+possible with @samp{~/} for your home directory is used.  You can force
+an absolute path with two @kbd{C-u} prefixes.
+
+@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 to edit the
+link and description parts of the link.
 
 @cindex following links
 @kindex C-c C-o
 @item C-c C-o
 Open link at point.  This will launch a web browser for URLs (using
-@command{browse-url-at-point}), run vm/gnus/bbdb for the corresponding
-links, and execute the command in a shell link.  When the cursor is on
-a CamelCase link, this commands runs the corresponding search.  When
-the cursor is on a TAGS list in a headline, it creates the
-corresponding TAGS view.  Furthermore, it will visit text files in
-@samp{file:} links with Emacs and select a suitable application for
-non-text files.  Classification of files is based on file extension
-only.  See option @code{org-file-apps}.  If there is no link at point,
-the current subtree will be searched for one.  If you want to override
-the default application and visit the file with Emacs, use a @kbd{C-u}
-prefix.  If the cursor is on a time stamp, compiles the agenda for
-that date.
-
-@strong{IMPORTANT}: Be careful not to use any dangerous commands in a
-shell link.
+@command{browse-url-at-point}), run vm/mh-e/wanderlust/rmail/gnus/bbdb
+for the corresponding links, and execute the command in a shell link.
+When the cursor is on an internal link, this commands runs the
+corresponding search.  When the cursor is on a TAGS list in a headline,
+it creates the corresponding TAGS view.  If the cursor is on a time
+stamp, it compiles the agenda for that date.  Furthermore, it will visit
+text files in @samp{file:} links with Emacs and select a suitable
+application for non-text files.  Classification of files 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.
 
 @kindex mouse-2
 @kindex mouse-1
@@ -1589,12 +1632,14 @@
 line number or a search option after a double@footnote{For backward
 compatibility, line numbers can also follow a single colon.} colon.
 For example:
+
 @example
-<file:~/code/main.c::255>
-<file:~/xx.org::My Target>
-<file:~/xx.org::*My Target>
-<file:~/xx.org::/regexp/>
+[[file:~/code/main.c::255]]
+[[file:~/xx.org::My Target]]
+[[file:~/xx.org::*My Target]]
+[[file:~/xx.org::/regexp/]]
 @end example
+
 @noindent Here is what these options do.
 
 @table @code
@@ -1603,7 +1648,7 @@
 @item My Target
 Search for a link target @samp{<<My Target>>}, or do a text search for
 @samp{my target}, similar to the search in internal links, see
-@ref{Internal Links}.
+@ref{Internal links}.
 @item *My Target
 In an Org-mode file, restrict search to headlines.
 @item /regexp/
@@ -1632,29 +1677,65 @@
 different ways, and Org-mode files are a good target.  Org-mode allows
 to file away notes either to a default file, or directly to the
 correct location in your Org-mode outline tree.  The following
-customization@footnote{The two autoload forms are only necessary if
+customization@footnote{The three autoload forms are only necessary if
 @file{org.el} is not part of the Emacs distribution or an XEmacs
 package.} will tell @emph{Remember} to use org files as target, and to
 create annotations compatible with Org-mode links.
 
 @example
-(autoload 'org-remember-annotation "org")
-(autoload 'org-remember-handler "org")
 (setq org-directory "~/path/to/my/orgfiles/")
 (setq org-default-notes-file "~/.notes")
+(autoload 'org-remember-annotation "org")
+(autoload 'org-remember-apply-template "org")
+(autoload 'org-remember-handler "org")
 (setq remember-annotation-functions '(org-remember-annotation))
 (setq remember-handler-functions '(org-remember-handler))
+(add-hook 'remember-mode-hook 'org-remember-apply-template)
 @end example
 
-When you compose a note with remember, you have to press @kbd{C-c C-c}
-to exit remember-mode and to file away the note.  The handler first
-prompts for a target file - if you press @key{RET}, the value of
+@cindex templates, for remember
+In combination with Org-mode, you can use templates to generate
+different types of remember notes.  For example, if you would like to
+use one template to create general TODO entries, and another one for
+journal entries, you could use:
+
+@example
+(setq org-remember-templates
+      '((?t "* TODO %?\n  %i\n  %a" "~/org/TODO.org")
+        (?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org")))
+@end example
+
+@noindent In these entries, the character specifies how to select the
+template, the first string specifies the template, and the (optional)
+second string specifies a default file (overruling
+@code{org-default-notes-file}) as a target for this note.
+
+When you call @kbd{M-x remember} to remember something, org will prompt
+for a key to select the template and then prepare the buffer like
+@example
+* TODO
+  <file:link to where you called remember>
+@end example
+
+@noindent or
+
+@example
+* [2006-03-21 Tue 15:37]
+
+  <file:link to where you called remember>
+@end example
+
+@noindent See the variable @code{org-remember-templates} for more details.
+
+When you are finished composing a note with remember, you have to press
+@kbd{C-c C-c} to file the note away.  The handler first prompts for a
+target file - if you press @key{RET}, the value of
 @code{org-default-notes-file} is used.  Then the command offers the
 headings tree of the selected file.  You can either immediately press
-@key{RET} to get the note appended to the file.  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} leads to the following result.
+@key{RET} to get the note appended to the file.  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} leads to the following result.
 
 @multitable @columnfractions 0.2 0.1 0.7
 @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
@@ -1680,6 +1761,7 @@
 non-nil, the entire text is also indented so that it starts in the
 same column as the headline (after the asterisks).
 
+
 @node TODO items, Timestamps, Hyperlinks, Top
 @chapter TODO items
 @cindex TODO items
@@ -1697,16 +1779,16 @@
 
 @menu
 * TODO basics::                 Marking and displaying TODO entries
-* Progress Logging::            Document your productivity
+* Progress logging::            Document your productivity
 * TODO extensions::             Workflow and assignments
 * Priorities::                  Some things are more important than others
 @end menu
 
-@node TODO basics, Progress Logging, TODO items, TODO items
+@node TODO basics, Progress logging, TODO items, TODO items
 @section Basic TODO functionality
 
 Any headline can become a TODO item by starting it with the word TODO,
-for example
+for example:
 
 @example
 *** TODO Write letter to Sam Fortune
@@ -1720,10 +1802,12 @@
 @cindex cycling, of TODO states
 @item C-c C-t
 Rotate the TODO state of the current item between
+
 @example
 ,-> (unmarked) -> TODO -> DONE --.
 '--------------------------------'
 @end example
+
 The same rotation can also be done ``remotely'' from the timeline and
 agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
 @kindex C-c C-v
@@ -1746,15 +1830,17 @@
 agenda, customize the variable @code{org-agenda-include-all-todo}.
 @end table
 
-@node Progress Logging, TODO extensions, TODO basics, TODO items
+@node Progress logging, TODO extensions, TODO basics, TODO items
 @section Progress Logging
 @cindex progress logging
 @cindex logging, of progress
 If you want to keep track of @emph{when} a certain TODO item was
 finished, turn on logging with
+
 @lisp
 (setq org-log-done t)
 @end lisp
+
 @noindent
 Then each time you turn a TODO entry into DONE using either @kbd{C-c
 C-t} in the Org-mode buffer or @kbd{t} in the agenda buffer, a line
@@ -1765,16 +1851,18 @@
 you can then use the @kbd{L} key to display the TODO items closed on
 each day, giving you an overview of what has been done on a day.
 
-@node TODO extensions, Priorities, Progress Logging, TODO items
+@node TODO extensions, Priorities, Progress logging, 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.
+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.
+
+Note that @i{tags} are another way to classify headlines in general and
+TODO items in particular (@pxref{Tags}).
 
 @menu
 * Workflow states::             From TODO to DONE in steps
@@ -1788,7 +1876,7 @@
 @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
+of working on an item, for example:
 
 @lisp
 (setq org-todo-keywords '("TODO" "FEEDBACK" "VERIFY" "DONE")
@@ -1836,7 +1924,7 @@
 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
-collect Lucy's items from all agenda files into a single buffer, you
+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}.
 
@@ -1922,7 +2010,7 @@
 (@pxref{Interaction}).
 @end table
 
-@node Timestamps, Agenda Views, TODO items, Top
+@node Timestamps, Tags, TODO items, Top
 @chapter Timestamps
 
 Items can be labeled with timestamps to make them useful for project
@@ -1945,7 +2033,7 @@
 A time stamp is a specification of a date (possibly with time) in a
 special format, either @samp{<2003-09-16 Tue>} or @samp{<2003-09-16
 Tue 09:39>}.  A time stamp can appear anywhere in the headline or body
-of an org-tree entry.  Its presence allows to show entries on specific
+of an org-tree entry.  Its presence allows entries to be shown on specific
 dates in the agenda (@pxref{Weekly/Daily Agenda}).  We distinguish:
 
 @table @var
@@ -2011,12 +2099,13 @@
 @kindex C-u C-c .
 @item C-u C-c .
 Like @kbd{C-c .}, but use the alternative format which contains date
-and time.
+and time.  The default time can be rounded to multiples of 5 minutes,
+see the option @code{org-time-stamp-rounding-minutes}.
 
 @kindex C-c !
 @item C-c !
 Like @kbd{C-c .}, but insert an inactive time stamp not triggering the
-agenda. 
+agenda.
 
 @kindex C-c <
 @item C-c <
@@ -2118,18 +2207,123 @@
 Choose date in calendar (only if nothing typed into minibuffer).
 @end table
 
-@node Agenda Views, Exporting, Timestamps, Top
+@node Tags, Agenda Views, Timestamps, Top
+@chapter Tags
+@cindex tags
+@cindex headline tagging
+@cindex matching, tags
+@cindex sparse tree, tag based
+
+If you wish to implement a system to cross-correlate information, an
+excellent way is to assign @i{tags} to headline.  Org-mode has
+extensive support for using tags.
+
+Every headline can contain a list of tags, at the end of the headline.
+Tags are normal words containing letters, numbers, @samp{_}, and
+@samp{@@}.  Tags must be preceded and followed by a single colon; like
+@samp{:WORK:}.  Several tags can be specified like @samp{:WORK:URGENT:}.
+
+@menu
+* Tag inheritance::             Tags use the tree structure of the outline
+* Setting tags::                How to assign tags to a headline
+* Tag searches::                Searching for combinations of tags
+@end menu
+
+@node Tag inheritance, Setting tags, Tags, Tags
+@section Tag inheritance
+@cindex inheritance, of tags
+
+@i{Tags} make use of the hierarchical structure of outline trees.  If a
+heading has a certain tag, all subheadings will inherit the tag as
+well.  For example, in the list
+
+@example
+* Meeting with the French group      :WORK:
+** Summary by Frank                  :BOSS:NOTES:
+*** TODO Prepare slides for him      :ACTION:
+@end example
+
+@noindent
+the final heading will have the tags @samp{:WORK:}, @samp{:BOSS:},
+@samp{:NOTES:}, and @samp{:ACTION:}.  When executing tag searches and
+Org-mode finds that a certain headline matches the search criterion, it
+will not check any sublevel headline, assuming that these likely also
+match, and that the list of matches can become very long.  However, this
+may not be what you want, and you can influence inheritance and
+searching using the variables @code{org-use-tag-inheritance} and
+@code{org-tags-match-list-sublevels}.
+
+@node Setting tags, Tag searches, Tag inheritance, Tags
+@section Setting tags
+@cindex setting tags
+
+@kindex M-@key{TAB}
+As Org-mode deals with plain text files, tags can simply be typed into
+the buffer.  After a colon, @kbd{M-@key{TAB}} offers completion on all
+tags being used in the current buffer.  There is also a special command
+for inserting tags:
+
+@table @kbd
+@kindex C-c C-c
+@item C-c C-c
+@cindex completion, of tags
+Enter new tags for the current headline.  The minibuffer will prompt for
+a list of tags and offer completion with respect to all other tags used
+in the current buffer.  Several tags, separated by colons, may be
+specified at the prompt.  After pressing @key{RET}, the tags will be
+inserted and aligned to @code{org-tags-column}.  When called with a
+@kbd{C-u} prefix, all tags in the current buffer will be aligned to that
+column, just to make things look nice.  TAGS are automatically realigned
+after promotion, demotion, and TODO state changes (@pxref{TODO basics}).
+@end table
+
+@node Tag searches,  , Setting tags, Tags
+@section Tag searches
+@cindex tag searches
+
+Once a tags system has been set up, it can be used to collect related
+information into special lists.
+
+@table @kbd
+@kindex C-c \
+@item C-c \
+Create a sparse tree with all headlines matching a tags search.
+@kindex C-c a m
+@item C-c a m
+Create a global list of tag matches from all agenda files.
+@xref{Matching headline tags}.
+@kindex C-c a M
+@item C-c a M
+Create a global list of tag matches from all agenda files, but check
+only TODO items and force checking subitems (see variable
+@code{org-tags-match-list-sublevels}).
+@end table
+
+A @i{tags} search string can use Boolean operators @samp{&} for AND and
+@samp{|} for OR.  @samp{&} binds more strongly than @samp{|}.
+Parenthesis are currently not implemented.  A tag may also be preceded
+by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
+positive selection.  The AND operator @samp{&} is optional when @samp{+}
+or @samp{-} is present.  For example, @samp{+WORK-BOSS} would select all
+headlines that are tagged @samp{:WORK:}, but discard those also tagged
+@samp{:BOSS:}.  The search string @samp{WORK|LAPTOP} selects all lines
+tagged @samp{:WORK:} or @samp{:LAPTOP:}.  The string
+@samp{WORK|LAPTOP&NIGHT} requires that the @samp{:LAPTOP:} lines are
+also tagged @samp{NIGHT}.
+
+@node Agenda Views, Exporting, Tags, Top
 @chapter Agenda Views
 @cindex agenda views
 
-Due to the way Org-mode works, TODO items and time-stamped items can
-be scattered throughout a file or even a number of files.  To get an
-overview over open action items, or over events that are important for
-a particular date, this information must be collected, sorted and
-displayed in an organized way.
+Due to the way Org-mode works, TODO items, time-stamped items, and
+tagged headlines can be scattered throughout a file or even a number of
+files.  To get an overview over open action items, or over events that
+are important for a particular date, this information must be collected,
+sorted and displayed in an organized way.
 
 Org-mode can select items based on various criteria, and display them
 in a separate buffer.  Three different views are provided:
+
 @itemize @bullet
 @item
 an @emph{agenda} that is like a calendar and shows information
@@ -2141,6 +2335,7 @@
 a @emph{tags view} that shows information based on
 the tags associated with headlines in the outline tree.
 @end itemize
+
 @noindent
 The extracted information is displayed in a special @emph{agenda
 buffer}.  This buffer is read-only, but provides commands to visit the
@@ -2161,7 +2356,9 @@
 @section Agenda files
 
 The information to be shown is collected from all @emph{agenda files},
-the files listed in the variable @code{org-agenda-files}.  Thus even
+the files listed in the variable @code{org-agenda-files}@footnote{If the
+value of that variable is not a list, but a single file name, then the
+list of agenda files will be maintained in that external file.}.  Thus even
 if you only work with a single Org-mode file, this file should be put
 into that list@footnote{When using the dispatcher pressing @kbd{1}
 before selecting a command will actually limit the command to the
@@ -2181,8 +2378,9 @@
 Remove current file from the list of agenda files.
 @kindex C-,
 @item C-,
-Cycle through agenda file list.
+Cycle through agenda file list, visiting one file after the other.
 @end table
+
 @noindent
 The Org menu contains the current list of files and can be used
 to visit any of them.
@@ -2195,7 +2393,7 @@
 @cindex agenda commands, custom
 The views are created through a dispatcher that should be bound to a
 global key, for example @kbd{C-c a} (@pxref{Installation and
-Activation}).  In the following we will assume that @kbd{C-c a} is
+activation}).  In the following we will assume that @kbd{C-c a} is
 indeed how the dispatcher is accessed and list keyboard access to
 commands accordingly.  After pressing @kbd{C-c a}, an additional
 letter is required to execute a command.  The dispatcher offers the
@@ -2206,7 +2404,7 @@
 @item t / T
 Create a list of all TODO items (@pxref{Global TODO list}).
 @item m / M
-Create a list of headline matching a TAGS expression (@pxref{Matching
+Create a list of headlines matching a TAGS expression (@pxref{Matching
 headline tags}).
 @end table
 
@@ -2222,6 +2420,7 @@
 @code{org-agenda-custom-commands}.  You can customize this variable,
 for example by pressing @kbd{C-c a C}.  You can also directly set it
 with Emacs Lisp in @file{.emacs}.  For example:
+
 @lisp
 (setq org-agenda-custom-commands
       '(("w" todo "WAITING")
@@ -2229,8 +2428,9 @@
         ("U" tags-tree "+BOSS-URGENT")
         ("f" occur-tree "\\<FIXME\\>")))
 @end lisp
+
 @noindent will define @kbd{C-c a w} as a global search for
-TODO entries with @samp{WAITING} as todo keyword, @kbd{C-c a u} as a
+TODO entries with @samp{WAITING} as the TODO keyword, @kbd{C-c a u} as a
 global tags search for headlines marked @samp{:BOSS:} but not
 @samp{:URGENT:}, @kbd{C-c a U} to do the same search but only in the
 current buffer and display the result as a sparse tree, and @kbd{C-c a
@@ -2252,11 +2452,11 @@
 Compile an agenda for the current week from a list of org files.  The
 agenda shows the entries for each day.  With a @kbd{C-u} prefix (or
 when the variable @code{org-agenda-include-all-todo} is @code{t}), all
-unfinished TODO items (also those without a date) are also listed at
+unfinished TODO items (including those without a date) are also listed at
 the beginning of the buffer, before the first date.@*
 @end table
 
-Remote editing from the agenda buffer means for example that you can
+Remote editing from the agenda buffer means, for example, that you can
 change the dates of deadlines and appointments from the agenda buffer.
 The commands available in the Agenda buffer are listed in @ref{Agenda
 commands}.
@@ -2275,12 +2475,15 @@
 In the agenda buffer, each entry is preceded by a @emph{category},
 which is derived from the file name.  The category can also be set
 with a special line anywhere in the buffer, looking like this:
+
 @example
 #+CATEGORY: Thesis
 @end example
+
 If there are several such lines in a file, each specifies the category
-for the text below it.  The display in the agenda buffer looks best if
-the category is not longer than 10 characters.
+for the text below it (but the first category also applies to any text
+before the first CATEGORY line).  The display in the agenda buffer looks
+best if the category is not longer than 10 characters.
 
 @node Time-of-day specifications, Calendar/Diary integration, Categories, Weekly/Daily Agenda
 @subsection Time-of-Day Specifications
@@ -2337,7 +2540,7 @@
 
 Emacs contains the calendar and diary by Edward M. Reingold.  The
 calendar displays a three-month calendar with holidays from different
-countries and cultures.  The diary allows to keep track of
+countries and cultures.  The diary allows you to keep track of
 anniversaries, lunar phases, sunrise/set, recurrent appointments
 (weekly, monthly) and more.  In this way, it is quite complementary to
 Org-mode.  It can be very useful to combine output from Org-mode with
@@ -2349,13 +2552,12 @@
 @lisp
 (setq org-agenda-include-diary t)
 @end lisp
-@noindent
 
 @noindent After that, everything will happen automatically.  All diary
 entries including holidays, anniversaries etc will be included in the
 agenda buffer created by Org-mode.  @key{SPC}, @key{TAB}, and
 @key{RET} can be used from the agenda buffer to jump to the diary
-file, in order to edit existing diary entries.  The @kbd{i} command to
+file in order to edit existing diary entries.  The @kbd{i} command to
 insert new entries for the current date works in the agenda buffer, as
 well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
 Sunrise/Sunset times, show lunar phases and to convert to other
@@ -2399,7 +2601,7 @@
 @xref{Global TODO list}, for more information.
 @kindex C-c a T
 @item C-c a T
-Like the above, but allow to select a specific TODO keyword.  You can
+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.
@@ -2452,7 +2654,7 @@
 items from a single Org-mode file.  But it also uses the agenda buffer
 and provides similar commands, so we discuss it here.  The timeline
 shows all time-stamped items in a single Org-mode file (or the
-selected part of it), in @emph{time-sorted view}.  The main purpose of
+selected part of it), in a @emph{time-sorted view}.  The main purpose of
 this command is to give an overview over events in a project.
 
 @table @kbd
@@ -2462,8 +2664,8 @@
 When called with a @kbd{C-u} prefix, all unfinished TODO entries
 (scheduled or not) are also listed under the current date.
 @end table
+
 @noindent
-
 The commands available in the timeline buffer are listed in
 @ref{Agenda commands}.
 
@@ -2476,7 +2678,7 @@
 buffer itself, but commands are provided to show and jump to the
 original entry location, and to edit the org-files ``remotely'' from
 the agenda buffer.  In this way, all information is stored only once,
-and you don't risk that your agenda and note files diverge.
+removing the risk that your agenda and note files may diverge.
 
 Some commands can be executed with mouse clicks on agenda lines.  For
 the other commands, the cursor needs to be in the desired line.
@@ -2507,7 +2709,7 @@
 @itemx mouse-1
 @itemx @key{TAB}
 Go to the original location of the item in another window.  Under Emacs
-22, also @kbd{mouse-1} will works for this.
+22, @kbd{mouse-1} will also works for this.
 
 @kindex @key{RET}
 @itemx @key{RET}
@@ -2531,11 +2733,11 @@
 
 @kindex w
 @item w
-Switch to weekly view (7 days displayed together)
+Switch to weekly view (7 days displayed together).
 
 @kindex d
 @item d
-Switch to daily view (just one day displayed)
+Switch to daily view (just one day displayed).
 
 @kindex D
 @item D
@@ -2580,7 +2782,7 @@
 
 @kindex T
 @item T
-Show all tags assiciated with the current item.  Because of
+Show all tags associated with the current item.  Because of
 inheritance, this may be more than the tags listed in the line itself.
 
 @kindex :
@@ -2650,7 +2852,7 @@
 
 @kindex M
 @item M
-Show the phases of the moon for three month around current date.
+Show the phases of the moon for the three months around current date.
 
 @kindex S
 @item S
@@ -2673,7 +2875,7 @@
 @tsubheading{Quit and Exit}
 @kindex q
 @item q
-Quit Agenda, remove the agenda buffer.
+Quit agenda, remove the agenda buffer.
 
 @kindex x
 @cindex agenda files, removing buffers
@@ -2688,21 +2890,34 @@
 @chapter Exporting
 @cindex exporting
 
-For printing and sharing of notes, Org-mode documents can be exported
-as ASCII or HTML files.  To incorporate entries with associated times
-like deadlines or appointments into a desktop calendar program like
-iCal, Org-mode can also produce extracts in the iCalendar format.
+Org-mode documents can be exported into a variety of other formats.  For
+printing and sharing of notes, ASCII export produces a readable and
+simple version of an Org-mode file.  HTML export allows to publish a
+notes file on the web, while the XML format provides a solid base for
+exchange with a broad range of other applications.  To incorporate
+entries with associated times like deadlines or appointments into a
+desktop calendar program like iCal, Org-mode can also produce extracts
+in the iCalendar format.  Currently Org-mode only supports export, not
+import of these different formats.
+
+When exporting, Org-mode uses special conventions to enrich the output
+produced.  @xref{Text interpretation}, for more details.
 
 @menu
-* ASCII export::                Export as a structured ASCII file
-* HTML export::                 Export as an HTML file
-* iCalendar export::            Create calendar entries.
+* ASCII export::                Exporting to plain ASCII
+* HTML export::                 Exporting to HTML
+* XML export::                  Exporting to XML
+* iCalendar export::            Exporting in iCalendar format
+* Text interpretation::         How the exporter looks at the file
 @end menu
 
 @node ASCII export, HTML export, Exporting, Exporting
 @section ASCII export
 @cindex ASCII export
 
+ASCII export produces an simple and very readable version of an Org-mode
+file.
+
 @cindex region, active
 @cindex active region
 @cindex transient-mark-mode
@@ -2718,17 +2933,17 @@
 @cindex headline levels, for exporting
 In the exported version, the first 3 outline levels will become
 headlines, defining a general document structure.  Additional levels
-will be exported as itemize lists.  If you want that transition to occur
+will be exported as itemized lists.  If you want that transition to occur
 at a different level, specify it with a prefix argument.  For example,
+
 @example
 @kbd{C-1 C-c C-x a org-export-as-ascii}
 @end example
+
 @noindent
-creates only top level headlines and does the rest as items.  Lines
-starting with @samp{#} and subtrees starting with the word @samp{COMMENT}
-will not be exported.
-
-@node HTML export, iCalendar export, ASCII export, Exporting
+creates only top level headlines and does the rest as items.
+
+@node HTML export, XML export, ASCII export, Exporting
 @section HTML export
 @cindex HTML export
 
@@ -2746,136 +2961,25 @@
 @kindex C-c C-x b
 @item C-c C-x b
 Export as HTML file and open it with a browser.
-@kindex C-c C-x t
-@item C-c C-x t
-Insert template with export options, see below.
-@kindex C-c :
-@item C-c :
-Toggle fixed-width for entry (QUOTE) or region, see below.
 @end table
 
 @cindex headline levels, for exporting
 In the exported version, the first 3 outline levels will become
 headlines, defining a general document structure.  Additional levels
-will be exported as itemize lists.  If you want that transition to occur
+will be exported as itemized lists.  If you want that transition to occur
 at a different level, specify it with a prefix argument.  For example,
+
 @example
 @kbd{C-2 C-c C-x b}
 @end example
+
 @noindent
 creates two levels of headings and does the rest as items.
 
-@menu
-* HTML formatting::             Interpretation of the buffer content
-* Export options::              How to influence exports
-* Comment lines::               Lines which will not be exported
-@end menu
-
-@node HTML formatting, Export options, HTML export, HTML export
-@subsection HTML formatting
-
-Not all text is transferred literally to the exported HTML file.  The
-exporter implements the following interpretation:
-
-@itemize @bullet
-
-@cindex hand-formatted lists
-@cindex lists, hand-formatted
-@item
-Hand-formatted lists with @samp{-}, @samp{*} or @samp{+} as
-bullet, or with @samp{1.} or @samp{2)} as enumerator will be recognized and
-transformed into HTML lists.  See @xref{Plain Lists}.
-
-@cindex underlined text
-@cindex bold text
-@cindex italic text
-@item
-You can make words @b{*bold*}, @i{/italic/}, and _underlined_
-
-@cindex @TeX{} interpretation
-@item
-Simple @TeX{}-like math constructs are interpreted:
-
-@cindex completion, of @TeX{} symbols
-@itemize @minus
-@item
-@samp{10^22} and @samp{J_n} are super- and subscripts.  You can quote
-@samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}
-@item
-@samp{\alpha} indicates a Greek letter, @samp{\to} an arrow.  You can
-use completion for these macros, just type @samp{\} and maybe a few
-letters, and press @kbd{M-@key{TAB}} to see possible completions.
-@end itemize
-
-@cindex tables, export to HTML
-@item
-Tables are transformed into HTML tables.  Data fields before the first
-horizontal separator line will be formatted as table header fields.
-
-@cindex fixed width
-@item
-If a headline starts with the word @samp{QUOTE}, the text below the
-headline will be typeset as fixed-width, to allow quoting of computer
-codes etc.  Lines starting with @samp{:} are also typeset in
-fixed-width font.
-
-@cindex HTML tags
-@item
 If you want to include HTML tags which should be interpreted as such,
 mark them with a @samp{@@} like in @samp{@@<b>bold text@@</b>}.
 Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
 @samp{&gt;} in HTML export.
-@end itemize
-
-If these conversions conflict with your habits of typing ASCII text,
-they can all be turned off with corresponding variables.
-
-@node Export options, Comment lines, HTML formatting, HTML export
-@subsection Export options
-@cindex options, for export
-
-@cindex completion, of option keywords
-The exporter recognizes special lines in the buffer which provide
-additional information.  These lines may be put anywhere in the file.
-The whole set of lines can be inserted into the buffer with @kbd{C-c
-C-x t}.  For individual lines, a good way to make sure the keyword is
-correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
-(@pxref{Completion}).
-
-@example
-#+TITLE:     the title to be shown (default is the buffer name)
-#+AUTHOR:    the author (default taken from @code{user-full-name})
-#+EMAIL:     his/her email address (default from @code{user-mail-address})
-#+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
-@end example
-@noindent
-The OPTIONS line is a compact form to specify export settings.  Here
-you can
-@cindex headline levels
-@cindex section-numbers
-@cindex table of contents
-@cindex linebreak preservation
-@cindex quoted html tags
-@cindex fixed-width sections
-@cindex tables
-@cindex @TeX{}-like syntax for sub- and superscripts
-@cindex emphasized text
-@cindex @TeX{} macros
-@example
-H:      @r{set the number of headline levels for export}
-num:    @r{turn on/off section-numbers}
-toc:    @r{turn on/off table of contents}
-\n:     @r{turn on/off linebreak-preservation}
-@@:      @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 emphasized text (bold, italic, underlined)}
-TeX:    @r{turn on/off @TeX{} macros}
-@end example
 
 You can also give style information for the exported file.  The
 default specification can be configured through the option
@@ -2886,7 +2990,7 @@
 @example
 * COMMENT HTML style specifications
 
-# Local Variables: 
+# Local Variables:
 # org-export-html-style: "   <style type=\"text/css\">
        p @{font-weight: normal; color: gray; @}
        h1 @{color: black; @}
@@ -2895,26 +2999,25 @@
 @end example
 
 Remember to execute @kbd{M-x normal-mode} after changing this to make
-the new style visible to Emacs.
-
-@node Comment lines,  , Export options, HTML export
-@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.  This applies also for
-ASCII export.
+the new style visible to Emacs.  This command restarts org-mode for the
+current buffer and forces Emacs to re-evaluate the local variables
+section in the buffer.
+
+@node XML export, iCalendar export, HTML export, Exporting
+@section XML export
+@cindex XML export
+
+Org-mode contains an XML exporter that produces XOXO-style XML.
+Currently, this exporter only handles the general outline structure and
+does not interpret any additional Org-mode features.
 
 @table @kbd
-@kindex C-c ;
-@item C-c ;
-Toggle the COMMENT keyword at the beginning of an entry.
+@kindex C-c C-x C-x
+@item C-c C-x C-x
+Export as XML file @file{myfile.xml}.
 @end table
 
-@node iCalendar export,  , HTML export, Exporting
+@node iCalendar export, Text interpretation, XML export, Exporting
 @section iCalendar export
 @cindex iCalendar export
 
@@ -2963,12 +3066,164 @@
    "osascript -e 'tell application \"iCal\" to reload calendars'")))
 @end lisp
 
+@node Text interpretation,  , iCalendar export, Exporting
+@section Text interpretation by the exporter
+
+The exporter backends interpret additional structure in the Org-mode file
+in order to produce better output.
+
+@menu
+* Comment lines::               Some lines will not be exported
+* 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
+@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.
+
+@table @kbd
+@kindex C-c ;
+@item C-c ;
+Toggle the COMMENT keyword at the beginning of an entry.
+@end table
+
+
+
+@node Enhancing text, Export options, Comment lines, Text interpretation
+@subsection Enhancing text for export
+@cindex enhancing text
+@cindex richer text
+
+Some of the export backends of Org-mode allow for sophisticated text
+formatting, this is true in particular for the HTML backend.  Org-mode
+has a number of typing conventions that allow to produce a richly
+formatted output.
+
+
+@itemize @bullet
+
+@cindex hand-formatted lists
+@cindex lists, hand-formatted
+@item
+Plain lists @samp{-}, @samp{*} or @samp{+} as bullet, or with @samp{1.}
+or @samp{2)} as enumerator will be recognized and transformed if the
+backend supports lists.  See @xref{Plain Lists}.
+
+@cindex underlined text
+@cindex bold text
+@cindex italic text
+@item
+You can make words @b{*bold*}, @i{/italic/}, and _underlined_
+
+@cindex @TeX{} interpretation
+@item
+Simple @TeX{}-like math constructs are interpreted:
+
+@cindex completion, of @TeX{} symbols
+@itemize @minus
+@item
+@samp{10^22} and @samp{J_n} are super- and subscripts.  You can quote
+@samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}
+@item
+@samp{\alpha} indicates a Greek letter, @samp{\to} an arrow.  You can
+use completion for these macros, just type @samp{\} and maybe a few
+letters, and press @kbd{M-@key{TAB}} to see possible completions.
+@end itemize
+
+@cindex tables, export
+@item
+Tables are transformed into native tables under the exporter, if the
+export backend supports this. Data fields before the first horizontal
+separator line will be formatted as table header fields.
+
+@cindex fixed width
+@item
+If a headline starts with the word @samp{QUOTE}, the text below the
+headline will be typeset as fixed-width, to allow quoting of computer
+codes etc.  Lines starting with @samp{:} are also typeset in
+fixed-width font.
+@table @kbd
+@kindex C-c :
+@item C-c :
+Toggle fixed-width for entry (QUOTE) or region, see below.
+@end table
+@end itemize
+
+If these conversions conflict with your habits of typing ASCII text,
+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.
+
+@node Export options,  , Enhancing text, Text interpretation
+@subsection Export options
+@cindex options, for export
+
+@cindex completion, of option keywords
+The exporter recognizes special lines in the buffer which provide
+additional information.  These lines may be put anywhere in the file.
+The whole set of lines can be inserted into the buffer with @kbd{C-c
+C-x t}.  For individual lines, a good way to make sure the keyword is
+correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
+(@pxref{Completion}).
+
+@table @kbd
+@kindex C-c C-x t
+@item C-c C-x t
+Insert template with export options, see example below.
+@end table
+
+@example
+#+TITLE:     the title to be shown (default is the buffer name)
+#+AUTHOR:    the author (default taken from @code{user-full-name})
+#+EMAIL:     his/her email address (default from @code{user-mail-address})
+#+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
+@end example
+
+@noindent
+The OPTIONS line is a compact form to specify export settings.  Here
+you can:
+@cindex headline levels
+@cindex section-numbers
+@cindex table of contents
+@cindex linebreak preservation
+@cindex quoted html tags
+@cindex fixed-width sections
+@cindex tables
+@cindex @TeX{}-like syntax for sub- and superscripts
+@cindex emphasized text
+@cindex @TeX{} macros
+@example
+H:      @r{set the number of headline levels for export}
+num:    @r{turn on/off section-numbers}
+toc:    @r{turn on/off table of contents}
+\n:     @r{turn on/off linebreak-preservation}
+@@:      @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 emphasized text (bold, italic, underlined)}
+TeX:    @r{turn on/off @TeX{} macros}
+@end example
+
 @node Miscellaneous, Index, Exporting, Top
 @chapter Miscellaneous
 
 @menu
 * Completion::                  M-TAB knows what you need
 * Customization::               Adapting Org-mode to your taste
+* Summary of in-buffer settings::  Using special lines to set options
+* The very busy C-c C-c key::   When in doubt, press C-c C-c
 * Clean view::                  Getting rid of leading stars in the outline
 * TTY keys::                    Using Org-mode on a tty
 * FAQ::                         Frequently asked questions
@@ -3021,7 +3276,7 @@
 @end table
 
 
-@node Customization, Clean view, Completion, Miscellaneous
+@node Customization, Summary of in-buffer settings, Completion, Miscellaneous
 @section Customization
 @cindex customization
 @cindex options, for customization
@@ -3031,16 +3286,119 @@
 Org-mode.  For the sake of compactness of the manual, we are not
 describing the variables here.  A structured overview of customization
 variables is available with @kbd{M-x org-customize}.  Or select
-@code{Browse Org Group} from the @code{Org->Customization} menu.
-
-@node Clean view, TTY keys, Customization, Miscellaneous
+@code{Browse Org Group} from the @code{Org->Customization} menu.  Many
+settings can also be activated on a per-file basis, by putting special
+lines into the buffer (@pxref{Summary of in-buffer settings}).
+
+@node Summary of in-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
+@section Summary of in-buffer settings
+@cindex in-buffer settings
+@cindex special keywords
+
+Org-mode uses special lines in the buffer to define settings on a
+per-file basis.  These lines start with a @samp{#+} followed by a
+keyword, a colon, and then individual words defining a setting.  Several
+settings words con be in the same line, but you can also have multiple
+lines for the keyword.  While these settings are described throughout
+the manual, here is a summary.  After changing any of those lines in the
+buffer, press @kbd{C-c C-c} with the cursor still in the line to
+activate the changes immediately.  Otherwise they become effective only
+when the file is visited again in a new Emacs session.
+
+@table @kbd
+@item #+STARTUP:
+This line sets options to be used at startup of org-mode, when an
+Org-mode file is being visited.  The first set of options deals with the
+initial visibility of the outline tree.  The corresponding variable for
+global default settings is @code{org-startup-folded}, with a default
+value @code{t}, which means @code{overview}.
+@example
+overview   @r{top-level headlines only}
+content    @r{all headlines}
+showall    @r{no folding at all, show everything}
+@end example
+Then there are options for aligning tables upon visiting a file.  This
+is useful in files containing narrowed table columns.  The corresponding
+variable is @code{org-startup-align-all-tables}, with a default value
+@code{nil}. 
+@example
+align      @r{align all tables}
+noalign    @r{don't align table on startup}
+@end example
+Here are the options for hiding leading stars in outline headings.  The
+corresponding variables are @code{org-hide-leading-stars} and
+@code{org-odd-levels-only}, both with a default setting @code{nil}
+(meaning @code{showstars} and @code{oddeven}).
+@example
+hidestars  @r{make all but one of the stars starting a headline invisible.}
+showstars  @r{show all stars starting a headline}
+odd        @r{allow only odd outline levels (1,3,...)}
+oddeven    @r{allow all outline levels}
+@end example
+@item #+SEQ_TODO:   #+TYP_TODO:
+These lines that the TODO keywords and their interpretation in the
+current file.  The corresponding variables are @code{org-todo-keywords}
+and @code{org-todo-interpretation}.
+@item #+CATEGORY:
+This line sets the category for the agenda file.  The category applies
+for all subsequent lines until the next @samp{#+CATEGORY} line, or the
+end of the file.
+@item #+TBLFM:
+This line contains the formulas for the table directly above the line.
+@item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS:
+These line provide setting for exporting files.  For more details see
+@ref{Export options}.
+@end table
+
+@node The very busy C-c C-c key, Clean view, Summary of in-buffer settings, Miscellaneous
+@section The very busy C-c C-c key
+@kindex C-c C-c
+
+The key @kbd{C-c C-c} has many purposes in org-mode, which are all
+mentioned scattered throughout this manual.  One specific function of
+this key is to add @emph{tags} to a headline (@pxref{Tags}).  In many
+other circumstances it means something like @emph{Hey Org-mode, look
+here and update according to what you see here}.  Here is a summary what
+this means in different contexts.
+
+@itemize @minus
+@c @item
+@c If the cursor is in a headline, prompt for tags and insert them
+@c into the current line, aligned to `org-tags-column'.  When called
+@c with prefix arg, realign all tags in the current buffer.
+@item
+If the cursor is in one of the special #+KEYWORD lines, this
+triggers scanning the buffer for these lines and updating the
+information. 
+@item
+If the cursor is inside a table, realign the table.  This command
+works even if the automatic table editor has been turned off.
+@item
+If the cursor is on a #+TBLFM line, re-apply the formulas to
+the entire table.
+@item
+If the cursor is inside a table created by the @file{table.el} package,
+activate that table.
+@item
+If the current buffer is a remember buffer, close note and file it.
+with a prefix argument, file it without further interaction to the default
+location.
+@item
+If the cursor is on a <<<target>>>, update radio targets and corresponding
+links in this buffer.
+@item
+If the cursor is on a numbered item in a plain list, renumber the
+ordered list.
+@end itemize
+
+@node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
 @section A cleaner outline view
 @cindex hiding leading stars
 @cindex clean outline view
 
 Some people find it noisy and distracting that the Org-mode headlines
-are starting with a potentially large number of stars.  For example in
-the example tree from @ref{Headlines}:
+are starting with a potentially large number of stars.  For example
+the tree from @ref{Headlines}:
 
 @example
 * Top level headline
@@ -3071,9 +3429,10 @@
 #+STARTUP: showstars
 #+STARTUP: hidestars
 @end example
+
 @noindent
 Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
-the modifications.  
+the modifications.
 
 With stars hidden, the tree becomes:
 
@@ -3128,12 +3487,10 @@
 #+STARTUP: oddeven
 @end example
 
-You can convert an Org-mode file from single-star-per-level to
+You can convert an Org-mode file from single-star-per-level to the
 double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
-RET} in that file.  There is no command for the back conversion because
-such a command might merge levels and in this way destroy the
-structure of the tree.
-@c FIXME: Maybe we should have such a command...
+RET} in that file.  The reverse operation is @kbd{M-x
+org-convert-to-oddeven-levels}.
 
 @node TTY keys, FAQ, Clean view, Miscellaneous
 @section Using org-mode on a tty
@@ -3179,36 +3536,78 @@
 @enumerate
 @item @b{Org-mode seems to be a useful default mode for the various
 @file{README} files I have scattered through my directories.  How do I
-turn it on for all @file{README} files?}
+turn it on for all @file{README} files?}@*
+@c
 @example
 (add-to-list 'auto-mode-alist '("README$" . org-mode))
 @end example
 
+@item @b{Some of my links stopped working after I upgraded to a version
+4.20 or later.  Why is this, and how can I fix it?}@*
+@c
+These must be links in plain text, containing white space, such as
+@samp{bbdb:Richard Stallman}.  You need to protect these links by
+putting double brackets around them, like @samp{[[bbdb:Richard
+Stallman]]}.
+
+@item @b{I see that Org-mode now creates links using the double bracket
+convention that hides the link part and the brackets, only showing the
+description part.  How can I convert my old links to this new format?}@*
+@c
+Execute once in each Org-mode file: @kbd{M-x org-upgrade-old-links}.
+The replaces angular brackets with the link format.
+
+@item @b{I don't care if you find the new bracket links great, I am
+attached to the old style using angular brackets and no hiding of the
+link text.  Please give them back to me, don't tell me it is not
+possible!}@*
+@c
+Would I let you down like that?  If you must, you can do this
+
+@lisp
+(setq org-link-style 'plain
+      org-link-format "<%s>")
+@end lisp
+
+@item @b{When I am executing shell links I always get a 
+confirmation prompt and need to type @kbd{yes @key{RET}}, thats 4 key
+presses!  Can I get rid of this?}@*
+@c
+@cindex shell links, confirmation
+@cindex dangerous commands
+The confirmation is there to protect you from unwantingly execute
+potentially dangerous commands.  For example, imagine a link
+@samp{[[shell:rm -rf ~/*][Google Search]]}.  In an Org-mode buffer, this
+command would look like @samp{Google Search}, but really it would remove
+your home directory.  If you wish, you can make it easier to respond to
+the query by setting @code{org-confirm-shell-links} to @code{y-or-n-p}.
+Then a single @kbd{y} keypress will be enough to confirm shell links.
+It is also possible to turn off this check entirely, but I do not
+recommend to do this.  Be warned.
+
 @item @b{All these stars are driving me mad, I just find the Emacs
 outlines unreadable. Can't you just put white space and a single star as a
 starter for headlines?}@*
+@c
 See @ref{Clean view}.
 
 @item @b{I would like to have two windows on the same Org-mode
 file, but with different outline visibility.  Is that possible?}@*
+@c
 @cindex @code{make-indirect-buffer}
 @cindex indirect buffers
-In GNU Emacs, you may use @emph{indirect buffers} which do exactly
-this.  See the documentation on the command
-@code{make-indirect-buffer}.  In XEmacs, this is currently not
-possible because of the different outline implementation.
-
-@item @b{Is there an easy way to insert links to web locations?}@*
-@cindex URL, paste into buffer
-Sure, just type or paste them into the buffer.  A plain-text URL-like
-string is directly interpreted as a link.
+In GNU Emacs, you may use @emph{indirect buffers} which do exactly this.
+See the documentation on the command @code{make-indirect-buffer}.  In
+XEmacs, this is currently not possible because of the different outline
+implementation.
 
 @item @b{When I export my TODO list, every TODO item becomes a
 separate section.  How do I enforce these items to be exported as an
 itemized list?}@*
+@c
 If you plan to use ASCII or HTML export, make sure things you want to
 be exported as item lists are level 4 at least, even if that does mean
-there is a level jump.  For example
+there is a level jump.  For example:
 
 @example
 * Todays top priorities
@@ -3225,27 +3624,22 @@
 +OPTIONS:   H:2; ...
 @end example
 
-@item @b{I would like to export only a subtree of my file to HTML.  How?}@*
+@item @b{I would like to export only a subtree of my file to HTML.
+How?}@*
+@c
 @cindex exporting a subtree
 If you want to export a subtree, mark the subtree as region and then
 export.  Marking can be done with @kbd{C-c @@ C-x C-x}, for example.
 
 @item @b{Org-mode takes over the S-cursor keys.  I also want to use
 CUA-mode, is there a way to fix this conflict?}@*
-Yes, see @ref{Interaction}
-
-@item @b{Is there an easy way to insert an empty table template with a
-default number of rows and columns?}@*
-@cindex table, empty template
-To insert an empty table template, just type @samp{|-} and use
-@key{TAB}.  The default size can be changed with the variable
-@code{org-table-default-size}.  However, just starting to type the
-first line is usually much easier.
+Yes, see @ref{Interaction}.
 
 @item @b{One of my table columns has started to fill up with
 @samp{#ERROR}.  What is going on?}@*
+@c
 Org-mode tried to compute the column from other fields using a
-formula stored in the @samp{#+TBLFMT:} line just below the table, and
+formula stored in the @samp{#+TBLFM:} line just below the table, and
 the evaluation of the formula fails.  Fix the fields used in the
 formula, or fix the formula, or remove it!
 
@@ -3253,23 +3647,26 @@
 horizontal line in the table, pressing TAB creates a new table line
 @i{before} the horizontal line.  How can I quickly move to the line
 @i{below} the horizontal line instead?}@*
+@c
 Press @key{down} (to get on the separator line) and then @key{TAB}.
 Or configure the variable @code{org-table-tab-jumps-over-hlines}.
 
 @item @b{How can I change the indentation of an entire table without
 fixing every line by hand?}@*
+@c
 @cindex indentation, of tables
 The indentation of a table is set by the first line.  So just fix the
 indentation of the first line and realign with @key{TAB}.
 
 @item @b{Is it possible to include entries from org-mode files into my
-emacs diary?}@* 
+emacs diary?}@*
+@c
 Since the org-mode agenda is much more powerful and can contain the
 diary (@pxref{Calendar/Diary integration}), you should think twice
-before deciding to do this.  Inegrating org-mode information into the
+before deciding to do this.  Integrating Org-mode information into the
 diary is, however, possible.  The following steps are necessary:
 Autoload the function @command{org-diary} as shown above under
-@ref{Installation and Activation}.  You also need to use @emph{fancy
+@ref{Installation and activation}.  You also need to use @emph{fancy
 diary display} by setting in @file{.emacs}:
 
 @lisp
@@ -3291,12 +3688,14 @@
 &%%(org-diary) ~/path/to/another/org-file.org
 @end example
 
-If you now launch the calendar and press @kbd{d} to display a diary,
-the headlines of entries containing a timestamp, date range, schedule,
-or deadline referring to the selected date will be listed.  Just like
-in Org-mode's agenda view, the diary for @emph{today} contains
-additional entries for overdue deadlines and scheduled items.  See
-also the documentation of the @command{org-diary} function.
+If you now launch the calendar and press @kbd{d} to display a diary, the
+headlines of entries containing a timestamp, date range, schedule, or
+deadline referring to the selected date will be listed.  Just like in
+Org-mode's agenda view, the diary for @emph{today} contains additional
+entries for overdue deadlines and scheduled items.  See also the
+documentation of the @command{org-diary} function.  Under XEmacs, it is
+not possible to jump back from the diary to the org, this works only in
+the agenda buffer.
 
 @end enumerate
 
@@ -3310,10 +3709,10 @@
 @cindex @file{org-mouse.el}
 @item @file{org-mouse.el} by Piotr Zielinski
 This package implements extended mouse functionality for Org-mode.  It
-allows to cycle visibility and to edit the document structure with the
-mouse.  It also provides a context-sensitive menu that changes depending
-on the context of a mouse-click.  Use a search engine to find this
-package on the web.
+allows you to cycle visibility and to edit the document structure with
+the mouse.  Best of all, it provides a context-sensitive menu on
+@key{mouse-3} that changes depending on the context of a mouse-click.
+Use a search engine to find this package on the web.
 @cindex @file{table.el}
 @item @file{table.el} by Takaaki Ota
 Org mode cooperates with table.el, see @ref{table.el}.  @file{table.el}
@@ -3331,7 +3730,7 @@
 @cindex @file{constants.el}
 @item @file{constants.el} by Carsten Dominik
 In a table formula (@pxref{Table calculations}), it is possible to use
-names for natural constants or units.  Instead of defining you own
+names for natural constants or units.  Instead of defining your own
 constants in the variable @code{org-table-formula-constants}, install
 the @file{constants} package which defines a large number of constants
 and units, and lets you use unit prefixes like @samp{M} for
@@ -3350,38 +3749,40 @@
 @code{org-CUA-compatible}.  When set, Org-mode will move the following
 keybindings in org-mode files, and in the agenda buffer (but not
 during date selection).
+
 @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
 to have other replacement keys, look at the variable
 @code{org-disputed-keys}.
 @item @file{remember.el} by John Wiegley
 Org mode cooperates with remember, see @ref{Remember}.
 @file{Remember.el} is not part of Emacs, find it on the web.
-@cindex @file{planner.el}
-@item @file{planner.el} by John Wiegley
-Planner is another tool to plan work and keep track of tasks.  Planner
-uses a multi-file approach with project pages and day pages.  Is based
-on Emacs-Wiki.  If Planner is your primary tool, it can be useful to
-display the agenda entries resulting from org files in day-pages of
-the planner.  This can be done through the diary of the calendar:
-Integrate org files into the diary as described above, and then turn
-on the diary support of planner.  Planner is not part of Emacs, find it
-on the web.
 @end table
 
 @node Bugs, Acknowledgments, Interaction, Miscellaneous
 @section Bugs
 @cindex bugs
 
-Here is a list of things which should work differently, but which I
+Here is a list of things that should work differently, but which I
 have found too hard to fix.
 
 @itemize @bullet
 @item
+If a table field starts with a link, and if the corresponding table
+column is narrowed (@pxref{Narrow columns}) to a width too small to
+display the link, the field would look entirely empty even though it is
+not.  To prevent this, Org-mode throws an error.  The work-around is to
+make the column wide enough to fit the link, or to add some text (at
+least 2 characters) before the link in the same field.
+@item
+Narrowing table columns does not work on XEmacs, because the
+@code{format} function does not transport text properties.
+@item
 Text in an entry protected with the @samp{QUOTE} keyword should not
 autowrap.
 @item
@@ -3402,12 +3803,6 @@
 If a formula uses @emph{calculated} fields further down the row,
 multiple recalculation may be needed to get all fields consistent.
 @item
-Under XEmacs, if Org-mode entries are included into the diary, it is
-not possible to jump back from the diary to the org file.  Apparently,
-the text properties are lost when the fancy-diary-display is used.
-However, from Org-mode's timeline and agenda buffers (created with
-@kbd{C-c C-r} and @kbd{C-c a}), things do work correctly.
-@item
 You can only make a single word boldface or italic.  To emphasize
 several words in a row, each must have the emphasize markers, like in
 @samp{*three* *bold* *words*}.
@@ -3415,8 +3810,6 @@
 The exporters work well, but could be made more efficient.
 @end itemize
 
-@page
-
 @node Acknowledgments,  , Bugs, Miscellaneous
 @section Acknowledgments
 @cindex acknowledgments
@@ -3432,37 +3825,41 @@
 @item
 Thomas Baumann contributed the code for links to the MH-E email system.
 @item
-Pavel Chalmoviansky reported bugs and suggested improvements
-related to the agenda treatment of items with specified time.
+Alex Bochannek provided a patch for rounding time stamps.
 @item
-Sacha Chua, the current maintainer of Planner, suggested to copy
-linking code from Planner (I took code for RMAIL and Wanderlust).
+Charles Caves' suggestion sparked the implementation of templates for
+Remember.
+@item
+Pavel Chalmoviansky influenced the agenda treatment of items with
+specified time.
 @item
-Christian Egli converted the documentation into TeXInfo format and
-patched basic CSS formatting support into the HTML exporter.  He also
-inspired the agenda by showing me his plans for a multifile summary.
+Sacha Chua suggested to copy some linking code from Planner.
+@item
+Christian Egli converted the documentation into TeXInfo format, patched
+CSS formatting into the HTML exporter, and inspired the agenda.
 @item
-Kai Grossjohann pointed out that a number of key bindings in Org-mode
-conflict with other packages.
+Nic Ferrier contributed mailcap and XML support.
 @item
-Stefan Monnier provided a patch with lots of little fixes to keep the
-Emacs-Lisp compiler happy.
+Kai Grossjohann pointed out key-binding conflicts caused by Org-mode.
+@item
+Stefan Monnier provided a patch to keep the Emacs-Lisp compiler happy.
 @item
 Tim O'Callaghan suggested in-file links, search options for
 general file links, and TAGS.
 @item
 Oliver Oppitz suggested multi-state TODO items.
 @item
-Pete Phillips helped the development of the TAGS feature with beta
-testing and suggestions.
+Scott Otterson sparked the introduction of descriptive text for links,
+among other things.
 @item
-Matthias Rempe (Oelde) provided ideas, a patch introducing Windows
-NT/2000 support, and quality control.
+Pete Phillips helped the development of the TAGS feature.
+@item
+Matthias Rempe (Oelde) provided ideas, Windows support, and quality
+control.
 @item
 Kevin Rogers contributed code to access VM files on remote hosts.
 @item
-Philip Rooke created the Org-mode reference card.  He also helped with
-beta testing and contributed a number of very useful ideas.
+Philip Rooke created the Org-mode reference card and provided lots of feedback.
 @item
 Christian Schlauer proposed angular brackets around links, among other
 things.
@@ -3470,28 +3867,31 @@
 Linking to VM/BBDB/GNUS was inspired by Tom Shannon's
 @file{organizer-mode.el}.
 @item
-Juergen Vollmer contributed code generating the table of contents
-in HTML output, and other export improvements.
+J@"urgen Vollmer contributed code generating the table of contents
+in HTML output.
 @item
 Chris Wallace provided a patch implementing the @samp{QUOTE} keyword.
 @item
-David Wainberg suggested the archiving mechanism and shaped the
-internal link system with many suggestions and ideas.
+David Wainberg suggested archiving, and improvements to the linking
+system.
 @item
-Scheduling TODO items was inspired by John Wiegley's @file{planner.el}.
+John Wiegley wrote @file{emacs-wiki.el} and @file{planner.el}.  The
+development of Org-mode was fully independent, and both systems are
+really different beasts in their basic ideas and implementation details.
+However, I have later looked at John's code and learned from his
+implementation of (i) links where the link itself is hidden and only a
+description is shown, and (ii) popping up a calendar to select a date.
 @item
 Carsten Wimmer suggested some changes and helped fix a bug in linking
 to GNUS.
-@item 
-Roland Winkler pointed out that additional keybindings are needed to
-use Org-mode on a tty.
+@item
+Roland Winkler requested additional keybindings to make Org-mode
+work on a tty.
 @item
-Piotr Zielinski wrote @file{org-mouse.el} and pointed out to me that
-Emacs 22 can be made to follow links using mouse-1 clicks.
-@c @item
-@c Nic Ferrier and Christian Egli implemented XML export.
+Piotr Zielinski wrote @file{org-mouse.el} and showed how to follow links
+with mouse-1.
 @end itemize
-
+ 
 @node Index, Key Index, Miscellaneous, Top
 @chapter Index
 
--- a/man/search.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/search.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -750,8 +750,10 @@
 the numbering of the groups that are meant to be referred to.
 
 @item \@var{d}
+@cindex back reference, in regexp
 matches the same text that matched the @var{d}th occurrence of a
-@samp{\( @dots{} \)} construct.
+@samp{\( @dots{} \)} construct.  This is called a @dfn{back
+reference}.
 
 After the end of a @samp{\( @dots{} \)} construct, the matcher remembers
 the beginning and end of the text matched by that construct.  Then,
@@ -1002,15 +1004,17 @@
 Replace every match for @var{regexp} with @var{newstring}.
 @end table
 
+@cindex back reference, in regexp replacement
   In @code{replace-regexp}, the @var{newstring} need not be constant:
 it can refer to all or part of what is matched by the @var{regexp}.
 @samp{\&} in @var{newstring} stands for the entire match being
 replaced.  @samp{\@var{d}} in @var{newstring}, where @var{d} is a
 digit, stands for whatever matched the @var{d}th parenthesized
-grouping in @var{regexp}.  @samp{\#} refers to the count of
-replacements already made in this command, as a decimal number.  In
-the first replacement, @samp{\#} stands for @samp{0}; in the second,
-for @samp{1}; and so on.  For example,
+grouping in @var{regexp}.  (This is called a ``back reference''.)
+@samp{\#} refers to the count of replacements already made in this
+command, as a decimal number.  In the first replacement, @samp{\#}
+stands for @samp{0}; in the second, for @samp{1}; and so on.  For
+example,
 
 @example
 M-x replace-regexp @key{RET} c[ad]+r @key{RET} \&-safe @key{RET}
--- a/man/sending.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/sending.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -459,7 +459,7 @@
 is @code{sendmail-send-it}, which delivers mail using the Sendmail
 installation on the local host.  To send mail through a SMTP server,
 set it to @code{smtpmail-send-it} and set up the Emacs SMTP library
-(@pxref{Top,,Emacs SMTP Library, Sending mail via SMTP,smtpmail}).  A
+(@pxref{Top,,Emacs SMTP Library, smtpmail, Sending mail via SMTP}).  A
 third option is @code{feedmail-send-it}, see the commentary section of
 the @file{feedmail.el} package for more information.
 
--- a/man/trouble.texi	Sun Apr 09 01:43:22 2006 +0000
+++ b/man/trouble.texi	Mon Apr 17 08:41:12 2006 +0000
@@ -58,7 +58,8 @@
 like @kbd{C-g}.  The reason is that it is not feasible, on MS-DOS, to
 recognize @kbd{C-g} while a command is running, between interactions
 with the user.  By contrast, it @emph{is} feasible to recognize
-@kbd{C-@key{BREAK}} at all times.  @xref{MS-DOS Keyboard}.
+@kbd{C-@key{BREAK}} at all times.  @xref{MS-DOS Keyboard,,,emacs-xtra,
+Specialized Emacs Features}.
 
 @findex keyboard-quit
   @kbd{C-g} works by setting the variable @code{quit-flag} to @code{t}
--- a/src/ChangeLog	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/ChangeLog	Mon Apr 17 08:41:12 2006 +0000
@@ -1,3 +1,191 @@
+2006-04-17  Kim F. Storm  <storm@cua.dk>
+
+	* window.c (coordinates_in_window): On the vertical border,
+	calculate the row number measured from the top of the window, not
+	the top of the frame.
+
+2006-04-16  Eli Zaretskii  <eliz@gnu.org>
+
+	* s/ms-w32.h (SYSTEM_PURESIZE_EXTRA): Reduce to 24000.
+
+2006-04-16  Romain Francoise  <romain@orebokech.com>
+
+	* puresize.h (BASE_PURESIZE): Decrement back to 1200000.
+
+2006-04-16  Andreas Schwab  <schwab@suse.de>
+
+	* puresize.h (PURESIZE_RATIO): Reduce to 10/6.
+
+2006-04-15  Romain Francoise  <romain@orebokech.com>
+
+	* puresize.h (BASE_PURESIZE): Increment to 1210000.
+
+2006-04-13  Micha,Ak(Bl Cadilhac  <michael.cadilhac@lrde.org>  (tiny change)
+
+	* print.c (Fprin1_to_string): Mention in the `doc' that the
+	behavior is modified by `print-level' and `print-length'.
+
+2006-04-13  Kenichi Handa  <handa@m17n.org>
+
+	* coding.c (setup_coding_system): If eol-type is not yet decided
+	and system_eol_type is not LF, set CODING_REQUIRE_ENCODING_MASK.
+	If coding_system is nil, return 0.
+	(code_convert_region1): Even if coding_system is nil, don't skip
+	conversion if system_eol_type is not LF.
+	(code_convert_string1): Likewise.
+	(code_convert_string_norecord): Likewise.
+
+2006-04-13  Kenichi Handa  <handa@m17n.org>
+
+	* coding.c (setup_coding_system): Fix previous change.
+	(encode_coding): If eol_type is not yet decided, use
+	system_eol_type.
+	(shrink_encoding_region): If eol_type is not yet decided and
+	system_eol_type is not LF, don't shrink.
+
+2006-04-13  Nick Roberts  <nickrob@snap.net.nz>
+
+	* xdisp.c (note_mouse_highlight): Add help echo for dragging vertical
+	line.
+
+2006-04-12  Richard Stallman  <rms@gnu.org>
+
+	* keyboard.c (read_key_sequence): Explicitly avoid keybuf[-1].
+
+	* process.c (conv_lisp_to_sockaddr): If FAMILY unknown, just return.
+	(Fprocess_send_eof): Abort if fail to open null device.
+
+2006-04-12  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* fns.c [HAVE_MENUS && MAC_OS]: Include macterm.h.
+
+	* image.c [MAC_OS] (xpm_load_image): Add parentheses around
+	assignment used as truth value.  Add explicit braces to avoid
+	ambiguous `else'.
+	[MAC_OS] (gif_load): Remove unused variable `gcpro1'.
+
+	* lisp.h (syms_of_fontset, Fset_fontset_font): Put extern and
+	EXFUN in #ifdef HAVE_WINDOW_SYSTEM.
+	(syms_of_xfns, syms_of_xsmfns, syms_of_xselect, syms_of_xterm):
+	Put externs in #ifdef HAVE_X_WINDOWS.
+	(syms_of_macfns, syms_of_macselect, syms_of_macterm)
+	(syms_of_macmenu, syms_of_mac) [MAC_OS]: Add externs.
+	(init_mac_osx_environment) [MAC_OSX]: Add extern.
+
+	* mac.c (init_process): Remove undef.
+	(select) [MAC_OSX]: Undefine before including sysselect.h.
+	(posix_pathname_to_fsspec, fsspec_to_posix_pathname) [MAC_OSX]:
+	Remove functions and prototypes.
+	(parse_value): Add parentheses around + inside shift.
+	(path_from_vol_dir_name): Make static.
+	(get_temp_dir_name): Remove unused variables `cpb' and `dir_name'.
+	[!MAC_OSX] (get_path_to_system_folder): Likewise.
+	(Fmac_get_file_creator, Fmac_get_file_type): Remove unused
+	variable `cCode'.
+	(Fmac_coerce_ae_data): Remove unused variables `fref' and `fs'.
+	(Fmac_get_preference): Add explicit braces to avoid ambiguous `else'.
+
+	* macfns.c (x_to_mac_color): Remove unused variable `tail'.
+	(x_set_mouse_color): Remove unused variable `dpy'.
+	(Fx_create_frame): Remove unused variable `x_frame_count'.
+	(Fx_server_version): Add explicit braces to avoid ambiguous `else'.
+	(x_sync): Move from macterm.c.
+	(Fx_file_dialog): Remove unused variable `default_filter_index'.
+
+	* macmenu.c (min_menu_id): Make element type explicit.
+
+	* macselect.c (get_flavor_type_from_symbol): Remove unused
+	variable `val'.
+	(get_scrap_private_timestamp, x_get_foreign_selection)
+	(copy_scrap_flavor_data): Add explicit braces to avoid ambiguous `else'.
+	(Fmac_process_deferred_apple_events): Remove unused variables
+	`keyword', `reply', `apple_event', `count', and `err'.
+
+	* macterm.c: Don't include gnu.h.
+	(x_io_error_quitter, x_draw_image_foreground_1): Remove prototypes.
+	(x_sync): Move to macfns.c.
+	[USE_CG_DRAWING] (mac_define_fringe_bitmap): Remove unused
+	variable `mask_bits'.
+	(mac_compute_glyph_string_overhangs): Avoid ambiguous `else'.
+	(x_draw_image_glyph_string): Remove unused variable `pixmap'.
+	(x_mac_to_emacs_modifiers): Remove function.
+	(XTset_vertical_scroll_bar, mac_handle_visibility_change)
+	(x_make_frame_visible, xlfdpat_create, mac_handle_command_event):
+	Add explicit braces to avoid ambiguous `else'.
+	(x_make_frame_visible): Remove unused variables `type',
+	`original_top', and `original_left'.
+	(mac_do_list_fonts, XTread_socket): Add parentheses around && within ||.
+	(x_load_font): Remove unused variables `full_name', and `value'.
+	(do_get_menus, do_init_managers, do_check_ram_size) [!MAC_OS8]:
+	Remove functions.
+	(do_zoom_window): Reorganize variables with respect to conditionals.
+	(init_command_handler): Remove unused variable `err'.
+	[MAC_OSX] (mac_check_bundle): Remove unused variable `child'.
+
+	* macterm.h (x_set_mouse_position, x_set_mouse_pixel_position)
+	(x_make_frame_invisible, x_iconify_frame, x_free_frame_resources)
+	(x_destroy_window, x_wm_set_size_hint, x_delete_display, XFreeGC)
+	(do_menu_choice, have_menus_p, x_real_positions)
+	(x_set_menu_bar_lines, x_pixel_width, x_pixel_height, x_char_width)
+	(x_char_height, x_sync, x_set_tool_bar_lines, x_activate_menubar)
+	(free_frame_menubar): Add externs.
+
+	* unexmacosx.c: Include config.h before using HAVE_MALLOC_MALLOC_H.
+	(malloc, realloc, free): Add undefs.
+	(read_load_commands): Remove unused variable `n' and `j'.
+	(copy_data_segment): Remove unused variable `r'.
+
+	* xdisp.c (get_glyph_string_clip_rects): Add parentheses around &&
+	within ||.  Add explicit braces to avoid ambiguous `else'.
+	(dump_glyph_row): Remove label for `inverse_p' from legend.
+
+	* xfaces.c (Finternal_merge_in_global_face, try_font_list): Add
+	explicit braces to avoid ambiguous `else'.
+
+2006-04-11  Micha,Ak(Bl Cadilhac  <michael.cadilhac@lrde.org>  (tiny change)
+
+	* dispnew.c (init_display): Don't init X display if the user asked
+	for a non-X display.
+
+2006-04-12  Kenichi Handa  <handa@m17n.org>
+
+	* coding.c (setup_coding_system): Use system_eol_type for default
+	coding->eol_type.
+
+2006-04-11  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* lisp.h (wrong_type_argument): Mark as NO_RETURN.
+
+	* data.c (wrong_type_argument): Try to avoid compiler warnings due
+	to the fact the function is now marked as NO_RETURN.
+
+2006-04-10  Eli Zaretskii  <eliz@gnu.org>
+
+	* s/ms-w32.h (pid_t) [_MSC_VER]: New typedef.
+
+2006-04-10  Romain Francoise  <romain@orebokech.com>
+
+	* xrdb.c (gethomedir): Use xstrdup.
+
+2006-04-10  Andreas Schwab  <schwab@suse.de>
+
+	* xrdb.c (gethomedir): Make sure to always return a pointer that
+	can be passed to free.
+
+2006-04-09  Richard Stallman  <rms@gnu.org>
+
+	* lisp.h (Fkill_emacs): Undo previous change.
+
+2006-04-08  Richard Stallman  <rms@gnu.org>
+
+	* search.c (boyer_moore): Test ch >= 0400, not >.
+
+2006-04-09  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* puresize.h (pure_write_error): Mark as NO_RETURN.
+
+	* lisp.h (args_out_of_range, args_out_of_range_3)
+
 2006-04-08  Eli Zaretskii  <eliz@gnu.org>
 
 	* w32fns.c (w32_wnd_proc) <WM_MOUSEMOVE>: Ignore mouse movements
--- a/src/data.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/data.c	Mon Apr 17 08:41:12 2006 +0000
@@ -125,7 +125,14 @@
       tem = call1 (predicate, value);
     }
   while (NILP (tem));
+  /* This function is marked as NO_RETURN, gcc would warn if it has a
+     return statement or if falls off the function.  Other compilers
+     warn if no return statement is present.  */
+#ifndef __GNUC__
   return value;
+#else
+  abort ();
+#endif
 }
 
 void
--- a/src/dispnew.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/dispnew.c	Mon Apr 17 08:41:12 2006 +0000
@@ -6640,7 +6640,7 @@
      try to use X, and die with an error message if that doesn't work.  */
 
 #ifdef HAVE_X_WINDOWS
-  if (! display_arg)
+  if (! inhibit_window_system && ! display_arg)
     {
       char *display;
 #ifdef VMS
--- a/src/fns.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/fns.c	Mon Apr 17 08:41:12 2006 +0000
@@ -48,8 +48,12 @@
 #include "frame.h"
 #include "window.h"
 #include "blockinput.h"
-#if defined (HAVE_MENUS) && defined (HAVE_X_WINDOWS)
+#ifdef HAVE_MENUS
+#if defined (HAVE_X_WINDOWS)
 #include "xterm.h"
+#elif defined (MAC_OS)
+#include "macterm.h"
+#endif
 #endif
 
 #ifndef NULL
--- a/src/image.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/image.c	Mon Apr 17 08:41:12 2006 +0000
@@ -4379,7 +4379,7 @@
 	  if (color == NULL)
 	    goto failure;
 
-	  while (str = strtok (NULL, " \t"))
+	  while ((str = strtok (NULL, " \t")) != NULL)
 	    {
 	      next_key = xpm_str_to_color_key (str);
 	      if (next_key >= 0)
@@ -4407,17 +4407,21 @@
 	  Lisp_Object specified_color = Fassoc (symbol_color, color_symbols);
 
 	  if (CONSP (specified_color) && STRINGP (XCDR (specified_color)))
-	    if (xstricmp (SDATA (XCDR (specified_color)), "None") == 0)
-	      color_val = Qt;
-	    else if (x_defined_color (f, SDATA (XCDR (specified_color)),
-				      &cdef, 0))
-	      color_val = make_number (cdef.pixel);
+	    {
+	      if (xstricmp (SDATA (XCDR (specified_color)), "None") == 0)
+		color_val = Qt;
+	      else if (x_defined_color (f, SDATA (XCDR (specified_color)),
+					&cdef, 0))
+		color_val = make_number (cdef.pixel);
+	    }
 	}
       if (NILP (color_val) && max_key > 0)
-	if (xstricmp (max_color, "None") == 0)
-	  color_val = Qt;
-	else if (x_defined_color (f, max_color, &cdef, 0))
-	  color_val = make_number (cdef.pixel);
+	{
+	  if (xstricmp (max_color, "None") == 0)
+	    color_val = Qt;
+	  else if (x_defined_color (f, max_color, &cdef, 0))
+	    color_val = make_number (cdef.pixel);
+	}
       if (!NILP (color_val))
 	(*put_color_table) (color_table, beg, chars_per_pixel, color_val);
 
@@ -7846,7 +7850,6 @@
   int width, height;
   XImagePtr ximg;
   TimeValue time;
-  struct gcpro gcpro1;
   int ino;
   CGrafPtr old_port;
   GDHandle old_gdh;
--- a/src/keyboard.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/keyboard.c	Mon Apr 17 08:41:12 2006 +0000
@@ -1418,7 +1418,7 @@
   Lisp_Object keybuf[30];
   int i;
   int no_direct;
-  int prev_modiff;
+  int prev_modiff = 0;
   struct buffer *prev_buffer = NULL;
 #ifdef MULTI_KBOARD
   int was_locked = single_kboard;
@@ -9478,6 +9478,7 @@
   /* Don't downcase the last character if the caller says don't.
      Don't downcase it if the result is undefined, either.  */
   if ((dont_downcase_last || first_binding >= nmaps)
+      && t > 0
       && t - 1 == original_uppercase_position)
     keybuf[t - 1] = original_uppercase;
 
--- a/src/lisp.h	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/lisp.h	Mon Apr 17 08:41:12 2006 +0000
@@ -2253,9 +2253,10 @@
 extern Lisp_Object indirect_variable P_ ((Lisp_Object));
 extern Lisp_Object long_to_cons P_ ((unsigned long));
 extern unsigned long cons_to_long P_ ((Lisp_Object));
-extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object));
-extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
-extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object));
+extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
+extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object,
+				     Lisp_Object)) NO_RETURN;
+extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
 extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object,
 					 Lisp_Object, struct buffer *));
 extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object));
@@ -3235,11 +3236,15 @@
 extern void syms_of_term P_ ((void));
 extern void fatal () NO_RETURN;
 
-#ifdef HAVE_X_WINDOWS
+#ifdef HAVE_WINDOW_SYSTEM
 /* Defined in fontset.c */
 extern void syms_of_fontset P_ ((void));
 EXFUN (Fset_fontset_font, 5);
 EXFUN (Fnew_fontset, 2);
+
+/* Defined in xfns.c, w32fns.c, or macfns.c */
+EXFUN (Fxw_display_color_p, 1);
+EXFUN (Fx_file_dialog, 5);
 #endif
 
 /* Defined in xfaces.c */
@@ -3253,12 +3258,6 @@
 #ifdef HAVE_X_WINDOWS
 /* Defined in xfns.c */
 extern void syms_of_xfns P_ ((void));
-#endif /* HAVE_X_WINDOWS */
-#ifdef HAVE_WINDOW_SYSTEM
-/* Defined in xfns.c, w32fns.c, or macfns.c */
-EXFUN (Fxw_display_color_p, 1);
-EXFUN (Fx_file_dialog, 5);
-#endif /* HAVE_WINDOW_SYSTEM */
 
 /* Defined in xsmfns.c */
 extern void syms_of_xsmfns P_ ((void));
@@ -3268,11 +3267,32 @@
 
 /* Defined in xterm.c */
 extern void syms_of_xterm P_ ((void));
+#endif /* HAVE_X_WINDOWS */
 
 #ifdef MSDOS
 /* Defined in msdos.c */
 EXFUN (Fmsdos_downcase_filename, 1);
 #endif
+
+#ifdef MAC_OS
+/* Defined in macfns.c */
+extern void syms_of_macfns P_ ((void));
+
+/* Defined in macselect.c */
+extern void syms_of_macselect P_ ((void));
+
+/* Defined in macterm.c */
+extern void syms_of_macterm P_ ((void));
+
+/* Defined in macmenu.c */
+extern void syms_of_macmenu P_ ((void));
+
+/* Defined in mac.c */
+extern void syms_of_mac P_ ((void));
+#ifdef MAC_OSX
+extern void init_mac_osx_environment P_ ((void));
+#endif /* MAC_OSX */
+#endif /* MAC_OS */
 
 /* Nonzero means Emacs has already been initialized.
    Used during startup to detect startup of dumped Emacs.  */
--- a/src/mac.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/mac.c	Mon Apr 17 08:41:12 2006 +0000
@@ -28,7 +28,9 @@
 
 #include "lisp.h"
 #include "process.h"
-#undef init_process
+#ifdef MAC_OSX
+#undef select
+#endif
 #include "systime.h"
 #include "sysselect.h"
 #include "blockinput.h"
@@ -79,8 +81,10 @@
 /* The single script context used for all script executions.  */
 static OSAID as_script_context;
 
+#ifndef MAC_OSX
 static OSErr posix_pathname_to_fsspec P_ ((const char *, FSSpec *));
 static OSErr fsspec_to_posix_pathname P_ ((const FSSpec *, char *, int));
+#endif
 
 /* When converting from Mac to Unix pathnames, /'s in folder names are
    converted to :'s.  This function, used in copying folder names,
@@ -1222,7 +1226,7 @@
 		       && '0' <= P[1] && P[1] <= '7'
 		       && '0' <= P[2] && P[2] <= '7')
 		{
-		  *q++ = (P[0] - '0' << 6) + (P[1] - '0' << 3) + (P[2] - '0');
+		  *q++ = ((P[0] - '0') << 6) + ((P[1] - '0') << 3) + (P[2] - '0');
 		  P += 3;
 		}
 	      else
@@ -2789,7 +2793,7 @@
 /* Determine the path name of the file specified by VREFNUM, DIRID,
    and NAME and place that in the buffer PATH of length
    MAXPATHLEN.  */
-int
+static int
 path_from_vol_dir_name (char *path, int man_path_len, short vol_ref_num,
 			long dir_id, ConstStr255Param name)
 {
@@ -2834,6 +2838,8 @@
 }
 
 
+#ifndef MAC_OSX
+
 static OSErr
 posix_pathname_to_fsspec (ufn, fs)
      const char *ufn;
@@ -2866,8 +2872,6 @@
     return fnfErr;
 }
 
-#ifndef MAC_OSX
-
 int
 readlink (const char *path, char *buf, int bufsiz)
 {
@@ -3124,8 +3128,7 @@
   short vol_ref_num;
   long dir_id;
   OSErr err;
-  Str255 dir_name, full_path;
-  CInfoPBRec cpb;
+  Str255 full_path;
   char unix_dir_name[MAXPATHLEN+1];
   DIR *dir;
 
@@ -3217,8 +3220,7 @@
   short vol_ref_num;
   long dir_id;
   OSErr err;
-  Str255 dir_name, full_path;
-  CInfoPBRec cpb;
+  Str255 full_path;
   static char system_folder_unix_name[MAXPATHLEN+1];
   DIR *dir;
 
@@ -3947,7 +3949,6 @@
 #else
   FSSpec fss;
 #endif
-  OSType cCode;
   Lisp_Object result = Qnil;
   CHECK_STRING (filename);
 
@@ -4002,7 +4003,6 @@
 #else
   FSSpec fss;
 #endif
-  OSType cCode;
   Lisp_Object result = Qnil;
   CHECK_STRING (filename);
 
@@ -4296,11 +4296,6 @@
   Lisp_Object result = Qnil;
   DescType src_desc_type, dst_desc_type;
   AEDesc dst_desc;
-#ifdef MAC_OSX
-  FSRef fref;
-#else
-  FSSpec fs;
-#endif
 
   CHECK_STRING (src_data);
   if (EQ (src_type, Qundecoded_file_name))
@@ -4422,18 +4417,20 @@
     }
 
   if (NILP (key))
-    if (EQ (format, Qxml))
-      {
-	CFDataRef data = CFPropertyListCreateXMLData (NULL, plist);
-	if (data == NULL)
-	  goto out;
-	result = cfdata_to_lisp (data);
-	CFRelease (data);
-      }
-    else
-      result =
-	cfproperty_list_to_lisp (plist, EQ (format, Qt),
-				 NILP (hash_bound) ? -1 : XINT (hash_bound));
+    {
+      if (EQ (format, Qxml))
+	{
+	  CFDataRef data = CFPropertyListCreateXMLData (NULL, plist);
+	  if (data == NULL)
+	    goto out;
+	  result = cfdata_to_lisp (data);
+	  CFRelease (data);
+	}
+      else
+	result =
+	  cfproperty_list_to_lisp (plist, EQ (format, Qt),
+				   NILP (hash_bound) ? -1 : XINT (hash_bound));
+    }
 
  out:
   if (app_plist)
@@ -4701,7 +4698,6 @@
 
 
 #ifdef MAC_OSX
-#undef select
 
 extern int inhibit_window_system;
 extern int noninteractive;
--- a/src/macfns.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/macfns.c	Mon Apr 17 08:41:12 2006 +0000
@@ -1024,7 +1024,7 @@
 x_to_mac_color (colorname)
      char * colorname;
 {
-  register Lisp_Object tail, ret = Qnil;
+  register Lisp_Object ret = Qnil;
 
   BLOCK_INPUT;
 
@@ -1359,7 +1359,6 @@
      Lisp_Object arg, oldval;
 {
   struct x_output *x = f->output_data.x;
-  Display *dpy = FRAME_MAC_DISPLAY (f);
   Cursor cursor, nontext_cursor, mode_cursor, hand_cursor;
   Cursor hourglass_cursor, horizontal_drag_cursor;
   unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
@@ -2387,7 +2386,6 @@
   struct mac_display_info *dpyinfo = NULL;
   Lisp_Object parent;
   struct kboard *kb;
-  static int x_frame_count = 2;  /* begins at 2 because terminal frame is F1 */
 
   check_mac ();
 
@@ -2910,23 +2908,25 @@
   BLOCK_INPUT;
   err = Gestalt (gestaltSystemVersion, &response);
   if (err == noErr)
-    if (response >= 0x00001040)
-      {
-	err = Gestalt ('sys1', &major); /* gestaltSystemVersionMajor */
-	if (err == noErr)
-	  err = Gestalt ('sys2', &minor); /* gestaltSystemVersionMinor */
-	if (err == noErr)
-	  err = Gestalt ('sys3', &bugfix); /* gestaltSystemVersionBugFix */
-      }
-    else
-      {
-	bugfix = response & 0xf;
-	response >>= 4;
-	minor = response & 0xf;
-	response >>= 4;
-	/* convert BCD to int */
-	major = response - (response >> 4) * 6;
-      }
+    {
+      if (response >= 0x00001040)
+	{
+	  err = Gestalt ('sys1', &major); /* gestaltSystemVersionMajor */
+	  if (err == noErr)
+	    err = Gestalt ('sys2', &minor); /* gestaltSystemVersionMinor */
+	  if (err == noErr)
+	    err = Gestalt ('sys3', &bugfix); /* gestaltSystemVersionBugFix */
+	}
+      else
+	{
+	  bugfix = response & 0xf;
+	  response >>= 4;
+	  minor = response & 0xf;
+	  response >>= 4;
+	  /* convert BCD to int */
+	  major = response - (response >> 4) * 6;
+	}
+    }
   UNBLOCK_INPUT;
 
   if (err != noErr)
@@ -3210,6 +3210,14 @@
   return Qnil;
 }
 
+/* x_sync is a no-op on Mac.  */
+
+void
+x_sync (f)
+     FRAME_PTR f;
+{
+}
+
 
 /***********************************************************************
                            Window properties
@@ -4187,7 +4195,6 @@
   int count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
   char filename[MAXPATHLEN];
-  int default_filter_index = 1; /* 1: All Files, 2: Directories only  */
   static NavEventUPP mac_nav_event_callbackUPP = NULL;
 
   GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p);
--- a/src/macmenu.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/macmenu.c	Mon Apr 17 08:41:12 2006 +0000
@@ -72,7 +72,7 @@
   MAC_MENU_END			/* 32768          */
 };
 
-static const min_menu_id[] = {0, 1, 235, 236, 256, 16384, 32768};
+static const int min_menu_id[] = {0, 1, 235, 236, 256, 16384, 32768};
 
 #define DIALOG_WINDOW_RESOURCE 130
 
--- a/src/macselect.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/macselect.c	Mon Apr 17 08:41:12 2006 +0000
@@ -153,7 +153,6 @@
 get_flavor_type_from_symbol (sym)
      Lisp_Object sym;
 {
-  ScrapFlavorType val;
   Lisp_Object str = Fget (sym, Qmac_ostype);
 
   if (STRINGP (str) && SBYTES (str) == 4)
@@ -322,17 +321,19 @@
 
   err = GetScrapFlavorFlags (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, &flags);
   if (err == noErr)
-    if (!(flags & kScrapFlavorMaskSenderOnly))
-      err = noTypeErr;
-    else
-      {
-	Size size = sizeof (*timestamp);
+    {
+      if (!(flags & kScrapFlavorMaskSenderOnly))
+	err = noTypeErr;
+      else
+	{
+	  Size size = sizeof (*timestamp);
 
-	err = GetScrapFlavorData (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP,
-				  &size, timestamp);
-	if (err == noErr && size != sizeof (*timestamp))
-	  err = noTypeErr;
-      }
+	  err = GetScrapFlavorData (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP,
+				    &size, timestamp);
+	  if (err == noErr && size != sizeof (*timestamp))
+	    err = noTypeErr;
+	}
+    }
 #else  /* !TARGET_API_MAC_CARBON */
   Handle handle;
   SInt32 size, offset;
@@ -683,18 +684,20 @@
 
   err = get_scrap_from_symbol (selection_symbol, 0, &scrap);
   if (err == noErr && scrap)
-    if (EQ (target_type, QTARGETS))
-      {
-	result = get_scrap_target_type_list (scrap);
-	result = Fvconcat (1, &result);
-      }
-    else
-      {
-	result = get_scrap_string (scrap, target_type);
-	if (STRINGP (result))
-	  Fput_text_property (make_number (0), make_number (SBYTES (result)),
-			      Qforeign_selection, target_type, result);
-      }
+    {
+      if (EQ (target_type, QTARGETS))
+	{
+	  result = get_scrap_target_type_list (scrap);
+	  result = Fvconcat (1, &result);
+	}
+      else
+	{
+	  result = get_scrap_string (scrap, target_type);
+	  if (STRINGP (result))
+	    Fput_text_property (make_number (0), make_number (SBYTES (result)),
+				Qforeign_selection, target_type, result);
+	}
+    }
 
   UNBLOCK_INPUT;
 
@@ -1009,7 +1012,7 @@
   /* Mac OS 10.3 Xcode manual says AESuspendTheCurrentEvent makes
      copies of the Apple event and the reply, but Mac OS 10.4 Xcode
      manual says it doesn't.  Anyway we create copies of them and save
-     it in `deferred_apple_events'.  */
+     them in `deferred_apple_events'.  */
   if (err == noErr)
     {
       if (deferred_apple_events.buf == NULL)
@@ -1123,11 +1126,8 @@
        doc: /* Process Apple events that are deferred at the startup time.  */)
   ()
 {
-  OSErr err;
   Lisp_Object result = Qnil;
-  long i, count;
-  AppleEvent apple_event, reply;
-  AEKeyword keyword;
+  long i;
 
   if (mac_ready_for_apple_events)
     return Qnil;
@@ -1207,14 +1207,16 @@
 	break;
     }
   if (err == noErr)
-    if (buf == NULL)
-      err = memFullErr;
-    else
-      {
-	err = PutScrapFlavor (to_scrap, flavor_type, kScrapFlavorMaskNone,
-			      size, buf);
-	xfree (buf);
-      }
+    {
+      if (buf == NULL)
+	err = memFullErr;
+      else
+	{
+	  err = PutScrapFlavor (to_scrap, flavor_type, kScrapFlavorMaskNone,
+				size, buf);
+	  xfree (buf);
+	}
+    }
 
   return err;
 }
--- a/src/macterm.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/macterm.c	Mon Apr 17 08:41:12 2006 +0000
@@ -77,7 +77,6 @@
 #include "termhooks.h"
 #include "termopts.h"
 #include "termchar.h"
-#include "gnu.h"
 #include "disptab.h"
 #include "buffer.h"
 #include "window.h"
@@ -217,7 +216,6 @@
 
 struct mac_display_info *mac_display_info_for_display (Display *);
 static void x_update_window_end P_ ((struct window *, int, int));
-static int x_io_error_quitter P_ ((Display *));
 int x_catch_errors P_ ((Display *));
 void x_uncatch_errors P_ ((Display *, int));
 void x_lower_frame P_ ((struct frame *));
@@ -1699,14 +1697,6 @@
 #endif
 }
 
-/* x_sync is a no-op on Mac.  */
-void
-x_sync (f)
-     void *f;
-{
-}
-
-
 /* Flush display of frame F, or of all frames if F is null.  */
 
 static void
@@ -2082,7 +2072,6 @@
      unsigned short *bits;
      int h, wd;
 {
-  unsigned short *mask_bits;
   int i;
   CGDataProviderRef provider;
 
@@ -2368,7 +2357,6 @@
 static void x_draw_image_glyph_string P_ ((struct glyph_string *));
 static void x_draw_image_relief P_ ((struct glyph_string *));
 static void x_draw_image_foreground P_ ((struct glyph_string *));
-static void x_draw_image_foreground_1 P_ ((struct glyph_string *, Pixmap));
 static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int,
 					   int, int, int));
 static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int,
@@ -2569,34 +2557,36 @@
 mac_compute_glyph_string_overhangs (s)
      struct glyph_string *s;
 {
-  if (s->cmp == NULL
-      && s->first_glyph->type == CHAR_GLYPH)
-    if (!s->two_byte_p
+  if (!(s->cmp == NULL
+	&& s->first_glyph->type == CHAR_GLYPH))
+    return;
+
+  if (!s->two_byte_p
 #if USE_ATSUI
-	|| s->font->mac_style
-#endif
-	)
-      {
-	XCharStruct cs;
-
-	mac_text_extents_16 (s->font, s->char2b, s->nchars, &cs);
-	s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0;
-	s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0;
-      }
-    else
-      {
-	Rect r;
-	MacFontStruct *font = s->font;
-
-	TextFont (font->mac_fontnum);
-	TextSize (font->mac_fontsize);
-	TextFace (font->mac_fontface);
-
-	QDTextBounds (s->nchars * 2, (char *)s->char2b, &r);
-
-	s->right_overhang = r.right > s->width ? r.right - s->width : 0;
-	s->left_overhang = r.left < 0 ? -r.left : 0;
-      }
+      || s->font->mac_style
+#endif
+      )
+    {
+      XCharStruct cs;
+
+      mac_text_extents_16 (s->font, s->char2b, s->nchars, &cs);
+      s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0;
+      s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0;
+    }
+  else
+    {
+      Rect r;
+      MacFontStruct *font = s->font;
+
+      TextFont (font->mac_fontnum);
+      TextSize (font->mac_fontsize);
+      TextFace (font->mac_fontface);
+
+      QDTextBounds (s->nchars * 2, (char *)s->char2b, &r);
+
+      s->right_overhang = r.right > s->width ? r.right - s->width : 0;
+      s->left_overhang = r.left < 0 ? -r.left : 0;
+    }
 }
 
 
@@ -3432,7 +3422,6 @@
   int box_line_hwidth = abs (s->face->box_line_width);
   int box_line_vwidth = max (s->face->box_line_width, 0);
   int height;
-  Pixmap pixmap = 0;
 
   height = s->height - 2 * box_line_vwidth;
 
@@ -4178,142 +4167,6 @@
 
 
 
-/* Keyboard processing - modifier keys, vendor-specific keysyms, etc.  */
-
-#if 0 /* MAC_TODO */
-/* Initialize mode_switch_bit and modifier_meaning.  */
-static void
-x_find_modifier_meanings (dpyinfo)
-     struct x_display_info *dpyinfo;
-{
-  int min_code, max_code;
-  KeySym *syms;
-  int syms_per_code;
-  XModifierKeymap *mods;
-
-  dpyinfo->meta_mod_mask = 0;
-  dpyinfo->shift_lock_mask = 0;
-  dpyinfo->alt_mod_mask = 0;
-  dpyinfo->super_mod_mask = 0;
-  dpyinfo->hyper_mod_mask = 0;
-
-#ifdef HAVE_X11R4
-  XDisplayKeycodes (dpyinfo->display, &min_code, &max_code);
-#else
-  min_code = dpyinfo->display->min_keycode;
-  max_code = dpyinfo->display->max_keycode;
-#endif
-
-  syms = XGetKeyboardMapping (dpyinfo->display,
-			      min_code, max_code - min_code + 1,
-			      &syms_per_code);
-  mods = XGetModifierMapping (dpyinfo->display);
-
-  /* Scan the modifier table to see which modifier bits the Meta and
-     Alt keysyms are on.  */
-  {
-    int row, col;	/* The row and column in the modifier table.  */
-
-    for (row = 3; row < 8; row++)
-      for (col = 0; col < mods->max_keypermod; col++)
-	{
-	  KeyCode code
-	    = mods->modifiermap[(row * mods->max_keypermod) + col];
-
-	  /* Zeroes are used for filler.  Skip them.  */
-	  if (code == 0)
-	    continue;
-
-	  /* Are any of this keycode's keysyms a meta key?  */
-	  {
-	    int code_col;
-
-	    for (code_col = 0; code_col < syms_per_code; code_col++)
-	      {
-		int sym = syms[((code - min_code) * syms_per_code) + code_col];
-
-		switch (sym)
-		  {
-		  case XK_Meta_L:
-		  case XK_Meta_R:
-		    dpyinfo->meta_mod_mask |= (1 << row);
-		    break;
-
-		  case XK_Alt_L:
-		  case XK_Alt_R:
-		    dpyinfo->alt_mod_mask |= (1 << row);
-		    break;
-
-		  case XK_Hyper_L:
-		  case XK_Hyper_R:
-		    dpyinfo->hyper_mod_mask |= (1 << row);
-		    break;
-
-		  case XK_Super_L:
-		  case XK_Super_R:
-		    dpyinfo->super_mod_mask |= (1 << row);
-		    break;
-
-		  case XK_Shift_Lock:
-		    /* Ignore this if it's not on the lock modifier.  */
-		    if ((1 << row) == LockMask)
-		      dpyinfo->shift_lock_mask = LockMask;
-		    break;
-		  }
-	      }
-	  }
-	}
-  }
-
-  /* If we couldn't find any meta keys, accept any alt keys as meta keys.  */
-  if (! dpyinfo->meta_mod_mask)
-    {
-      dpyinfo->meta_mod_mask = dpyinfo->alt_mod_mask;
-      dpyinfo->alt_mod_mask = 0;
-    }
-
-  /* If some keys are both alt and meta,
-     make them just meta, not alt.  */
-  if (dpyinfo->alt_mod_mask & dpyinfo->meta_mod_mask)
-    {
-      dpyinfo->alt_mod_mask &= ~dpyinfo->meta_mod_mask;
-    }
-
-  XFree ((char *) syms);
-  XFreeModifiermap (mods);
-}
-
-#endif /* MAC_TODO */
-
-/* Convert between the modifier bits X uses and the modifier bits
-   Emacs uses.  */
-
-static unsigned int
-x_mac_to_emacs_modifiers (dpyinfo, state)
-     struct x_display_info *dpyinfo;
-     unsigned short state;
-{
-  return (((state & shiftKey) ? shift_modifier : 0)
-	  | ((state & controlKey) ? ctrl_modifier : 0)
-	  | ((state & cmdKey) ? meta_modifier : 0)
-	  | ((state & optionKey) ? alt_modifier : 0));
-}
-
-#if 0 /* MAC_TODO */
-static unsigned short
-x_emacs_to_x_modifiers (dpyinfo, state)
-     struct x_display_info *dpyinfo;
-     unsigned int state;
-{
-  return (  ((state & alt_modifier)	? dpyinfo->alt_mod_mask   : 0)
-	  | ((state & super_modifier)	? dpyinfo->super_mod_mask : 0)
-	  | ((state & hyper_modifier)	? dpyinfo->hyper_mod_mask : 0)
-	  | ((state & shift_modifier)	? ShiftMask        : 0)
-	  | ((state & ctrl_modifier)	? ControlMask      : 0)
-	  | ((state & meta_modifier)	? dpyinfo->meta_mod_mask  : 0));
-}
-#endif /* MAC_TODO */
-
 /* Convert a keysym to its name.  */
 
 char *
@@ -5104,41 +4957,43 @@
 
 #ifdef USE_TOOLKIT_SCROLL_BARS
   if (NILP (bar->track_top))
-    if (sb_width >= disp_height)
-      {
-	XSETINT (bar->track_top, 0);
-	XSETINT (bar->track_height, 0);
-      }
-    else
-      {
-	ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
-	Rect r0, r1;
-
-	BLOCK_INPUT;
-
-	SetControl32BitMinimum (ch, 0);
-	SetControl32BitMaximum (ch, 1);
-	SetControlViewSize (ch, 1);
-
-	/* Move the scroll bar thumb to the top.  */
-	SetControl32BitValue (ch, 0);
-	get_control_part_bounds (ch, kControlIndicatorPart, &r0);
-
-	/* Move the scroll bar thumb to the bottom.  */
-	SetControl32BitValue (ch, 1);
-	get_control_part_bounds (ch, kControlIndicatorPart, &r1);
-
-	UnionRect (&r0, &r1, &r0);
-	XSETINT (bar->track_top, r0.top);
-	XSETINT (bar->track_height, r0.bottom - r0.top);
-
-	/* Don't show the scroll bar if its height is not enough to
-	   display the scroll bar thumb.  */
-	if (r0.bottom - r0.top > 0)
-	  ShowControl (ch);
-
-	UNBLOCK_INPUT;
-      }
+    {
+      if (sb_width >= disp_height)
+	{
+	  XSETINT (bar->track_top, 0);
+	  XSETINT (bar->track_height, 0);
+	}
+      else
+	{
+	  ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
+	  Rect r0, r1;
+
+	  BLOCK_INPUT;
+
+	  SetControl32BitMinimum (ch, 0);
+	  SetControl32BitMaximum (ch, 1);
+	  SetControlViewSize (ch, 1);
+
+	  /* Move the scroll bar thumb to the top.  */
+	  SetControl32BitValue (ch, 0);
+	  get_control_part_bounds (ch, kControlIndicatorPart, &r0);
+
+	  /* Move the scroll bar thumb to the bottom.  */
+	  SetControl32BitValue (ch, 1);
+	  get_control_part_bounds (ch, kControlIndicatorPart, &r1);
+
+	  UnionRect (&r0, &r1, &r0);
+	  XSETINT (bar->track_top, r0.top);
+	  XSETINT (bar->track_height, r0.bottom - r0.top);
+
+	  /* Don't show the scroll bar if its height is not enough to
+	     display the scroll bar thumb.  */
+	  if (r0.bottom - r0.top > 0)
+	    ShowControl (ch);
+
+	  UNBLOCK_INPUT;
+	}
+    }
 
   x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
 #else /* not USE_TOOLKIT_SCROLL_BARS */
@@ -6224,10 +6079,12 @@
   struct input_event buf;
 
   if (IsWindowVisible (wp))
-    if (IsWindowCollapsed (wp))
-      iconified = 1;
-    else
-      visible = 1;
+    {
+      if (IsWindowCollapsed (wp))
+	iconified = 1;
+      else
+	visible = 1;
+    }
 
   if (!f->async_visible && visible)
     {
@@ -6273,9 +6130,6 @@
 x_make_frame_visible (f)
      struct frame *f;
 {
-  Lisp_Object type;
-  int original_top, original_left;
-
   BLOCK_INPUT;
 
   if (! FRAME_VISIBLE_P (f))
@@ -6286,27 +6140,29 @@
 	 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 (!(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
+				  kWindowCascadeStartAtParentWindowScreen
 #else
-				kWindowCascadeOnParentWindowScreen
-#endif
-				);
-	    x_real_positions (f, &f->left_pos, &f->top_pos);
-	  }
-	else
-#endif
-	  x_set_offset (f, f->left_pos, f->top_pos, 0);
+				  kWindowCascadeOnParentWindowScreen
+#endif
+				  );
+	      x_real_positions (f, &f->left_pos, &f->top_pos);
+	    }
+	  else
+#endif
+	    x_set_offset (f, f->left_pos, f->top_pos, 0);
+	}
 
       f->output_data.mac->asked_for_visible = 1;
 
@@ -6749,15 +6605,17 @@
 	else
 	  {
 	    if (last_char == '?')
-	      if (anychar_head > pat->buf && *(anychar_head - 1) == '*')
-		/*  ...*??* -> ...*??  */
-		continue;
-	      else
-		/*  ...a??* -> ...a*??  */
-		{
-		  *anychar_head++ = '*';
-		  c = '?';
-		}
+	      {
+		if (anychar_head > pat->buf && *(anychar_head - 1) == '*')
+		  /*  ...*??* -> ...*??  */
+		  continue;
+		else
+		  /*  ...a??* -> ...a*??  */
+		  {
+		    *anychar_head++ = '*';
+		    c = '?';
+		  }
+	      }
 	    nblocks++;
 	  }
       else if (c == '?')
@@ -7588,7 +7446,7 @@
       if (xlfdpat_match (pat, font_name_table[i]))
 	{
 	  font_list = Fcons (build_string (font_name_table[i]), font_list);
-	  if (exact || maxnames > 0 && ++n_fonts >= maxnames)
+	  if (exact || (maxnames > 0 && ++n_fonts >= maxnames))
 	    break;
 	}
       else if (scl_val[XLFD_SCL_PIXEL_SIZE] > 0
@@ -7611,7 +7469,7 @@
 	    {
 	      font_list = Fcons (build_string (scaled), font_list);
 	      xfree (scaled);
-	      if (exact || maxnames > 0 && ++n_fonts >= maxnames)
+	      if (exact || (maxnames > 0 && ++n_fonts >= maxnames))
 		  break;
 	    }
 	  else
@@ -8260,10 +8118,8 @@
 
   /* Load the font and add it to the table.  */
   {
-    char *full_name;
     struct MacFontStruct *font;
     struct font_info *fontp;
-    unsigned long value;
     int i;
 
     fontname = (char *) SDATA (XCAR (font_names));
@@ -8777,6 +8633,7 @@
 
 #endif
 
+#ifdef MAC_OS8
 static void
 do_get_menus (void)
 {
@@ -8838,6 +8695,7 @@
       exit (1);
     }
 }
+#endif /* MAC_OS8 */
 
 static void
 do_window_update (WindowPtr win)
@@ -9019,42 +8877,41 @@
 static void
 do_zoom_window (WindowPtr w, int zoom_in_or_out)
 {
-  GrafPtr save_port;
   Rect zoom_rect, port_rect;
-  Point top_left;
-  int w_title_height, columns, rows, width, height;
+  int columns, rows, width, height;
   struct frame *f = mac_window_to_frame (w);
   struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
-
 #if TARGET_API_MAC_CARBON
-  {
-    Point standard_size;
-
-    standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
-    standard_size.v = dpyinfo->height;
-
-    if (IsWindowInStandardState (w, &standard_size, &zoom_rect))
-      zoom_in_or_out = inZoomIn;
-    else
-      {
-	/* Adjust the standard size according to character boundaries.  */
-
-	columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
-	rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
-	standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
-	standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
-	GetWindowBounds (w, kWindowContentRgn, &port_rect);
-	if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
-	    && port_rect.left == zoom_rect.left
-	    && port_rect.top == zoom_rect.top)
-	  zoom_in_or_out = inZoomIn;
-	else
-	  zoom_in_or_out = inZoomOut;
-      }
-
-    ZoomWindowIdeal (w, zoom_in_or_out, &standard_size);
-  }
+  Point standard_size;
+
+  standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
+  standard_size.v = dpyinfo->height;
+
+  if (IsWindowInStandardState (w, &standard_size, &zoom_rect))
+    zoom_in_or_out = inZoomIn;
+  else
+    {
+      /* Adjust the standard size according to character boundaries.  */
+
+      columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
+      rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
+      standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
+      standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
+      GetWindowBounds (w, kWindowContentRgn, &port_rect);
+      if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
+	  && port_rect.left == zoom_rect.left
+	  && port_rect.top == zoom_rect.top)
+	zoom_in_or_out = inZoomIn;
+      else
+	zoom_in_or_out = inZoomOut;
+    }
+
+  ZoomWindowIdeal (w, zoom_in_or_out, &standard_size);
 #else /* not TARGET_API_MAC_CARBON */
+  GrafPtr save_port;
+  Point top_left;
+  int w_title_height;
+
   GetPort (&save_port);
 
   SetPortWindowPort (w);
@@ -9189,26 +9046,27 @@
   mac_find_apple_event_spec (0, command.commandID,
 			     &class_key, &id_key, &binding);
   if (!NILP (binding) && !EQ (binding, Qundefined))
-    if (INTEGERP (binding))
-      return XINT (binding);
-    else
-      {
-	AppleEvent apple_event;
-	UInt32 modifiers;
-	static EventParamName names[] = {kEventParamDirectObject,
-					 kEventParamKeyModifiers};
-	static EventParamType types[] = {typeHICommand,
-					 typeUInt32};
-	err = create_apple_event_from_event_ref (event, 2, names, types,
-						 &apple_event);
-	if (err == noErr)
-	  {
-	    err = mac_store_apple_event (class_key, id_key, &apple_event);
-	    AEDisposeDesc (&apple_event);
-	  }
-	if (err == noErr)
-	  return noErr;
-      }
+    {
+      if (INTEGERP (binding))
+	return XINT (binding);
+      else
+	{
+	  AppleEvent apple_event;
+	  static EventParamName names[] = {kEventParamDirectObject,
+					   kEventParamKeyModifiers};
+	  static EventParamType types[] = {typeHICommand,
+					   typeUInt32};
+	  err = create_apple_event_from_event_ref (event, 2, names, types,
+						   &apple_event);
+	  if (err == noErr)
+	    {
+	      err = mac_store_apple_event (class_key, id_key, &apple_event);
+	      AEDisposeDesc (&apple_event);
+	    }
+	  if (err == noErr)
+	    return noErr;
+	}
+    }
 
   return eventNotHandledErr;
 }
@@ -9216,7 +9074,6 @@
 static OSErr
 init_command_handler ()
 {
-  OSErr err = noErr;
   EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}};
   static EventHandlerUPP handle_command_eventUPP = NULL;
 
@@ -10092,18 +9949,18 @@
 		    XSETINT (inev.x, mouse_loc.h);
 		    XSETINT (inev.y, mouse_loc.v);
 
-		    if (dpyinfo->grabbed && tracked_scroll_bar
-			|| ch != 0
+		    if ((dpyinfo->grabbed && tracked_scroll_bar)
+			|| (ch != 0
 #ifndef USE_TOOLKIT_SCROLL_BARS
-			/* control_part_code becomes kControlNoPart if
- 			   a progress indicator is clicked.  */
-			&& control_part_code != kControlNoPart
+			    /* control_part_code becomes kControlNoPart if
+			       a progress indicator is clicked.  */
+			    && control_part_code != kControlNoPart
 #else  /* USE_TOOLKIT_SCROLL_BARS */
 #ifdef MAC_OSX
-			&& control_kind.kind == kControlKindScrollBar
+			    && control_kind.kind == kControlKindScrollBar
 #endif	/* MAC_OSX */
 #endif	/* USE_TOOLKIT_SCROLL_BARS */
-			)
+			    ))
 		      {
 			struct scroll_bar *bar;
 
@@ -10903,7 +10760,6 @@
   extern int inhibit_window_system;
   extern int noninteractive;
   CFBundleRef appsBundle;
-  pid_t child;
 
   /* No need to test if already -nw*/
   if (inhibit_window_system || noninteractive)
--- a/src/macterm.h	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/macterm.h	Mon Apr 17 08:41:12 2006 +0000
@@ -550,7 +550,15 @@
 /* Defined in macterm.c.  */
 
 extern void x_set_window_size P_ ((struct frame *, int, int, int));
+extern void x_set_mouse_position P_ ((struct frame *, int, int));
+extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int));
 extern void x_make_frame_visible P_ ((struct frame *));
+extern void x_make_frame_invisible P_ ((struct frame *));
+extern void x_iconify_frame P_ ((struct frame *));
+extern void x_free_frame_resources P_ ((struct frame *));
+extern void x_destroy_window P_ ((struct frame *));
+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,
 				 unsigned int, unsigned int));
@@ -560,6 +568,7 @@
 					       unsigned int));
 extern void XFreePixmap P_ ((Display *, Pixmap));
 extern GC XCreateGC P_ ((Display *, Window, unsigned long, XGCValues *));
+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));
@@ -571,6 +580,7 @@
 extern OSErr install_window_handler P_ ((WindowPtr));
 extern void remove_window_handler P_ ((WindowPtr));
 extern Lisp_Object mac_make_lispy_event_code P_ ((int));
+extern void do_menu_choice P_ ((SInt32));
 #if USE_CG_DRAWING
 extern void mac_prepare_for_quickdraw P_ ((struct frame *));
 #endif
@@ -584,6 +594,24 @@
 
 extern void x_clear_frame_selections P_ ((struct frame *));
 
+/* Defined in macfns.c */
+
+extern int have_menus_p P_ ((void));
+
+extern void x_real_positions P_ ((struct frame *, int *, int *));
+extern void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
+extern int x_pixel_width P_ ((struct frame *));
+extern int x_pixel_height P_ ((struct frame *));
+extern int x_char_width P_ ((struct frame *));
+extern int x_char_height P_ ((struct frame *));
+extern void x_sync P_ ((struct frame *));
+extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
+
+/* Defined in macmenu.c */
+
+extern void x_activate_menubar P_ ((struct frame *));
+extern void free_frame_menubar P_ ((struct frame *));
+
 /* Defined in mac.c.  */
 
 extern void mac_clear_font_name_table P_ ((void));
--- a/src/print.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/print.c	Mon Apr 17 08:41:12 2006 +0000
@@ -759,7 +759,8 @@
        doc: /* Return a string containing the printed representation of OBJECT.
 OBJECT can be any Lisp object.  This function outputs quoting characters
 when necessary to make output that `read' can handle, whenever possible,
-unless the optional second argument NOESCAPE is non-nil.
+unless the optional second argument NOESCAPE is non-nil.  For complex objects,
+the behavior is controlled by `print-level' and `print-length', which see.
 
 OBJECT is any of the Lisp data types: a number, a string, a symbol,
 a list, a buffer, a window, a frame, etc.
--- a/src/process.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/process.c	Mon Apr 17 08:41:12 2006 +0000
@@ -2323,7 +2323,11 @@
 }
 
 /* Convert an address object (vector or string) to an internal sockaddr.
-   Format of address has already been validated by size_lisp_to_sockaddr.  */
+
+   The address format has been basically validated by
+   get_lisp_to_sockaddr_size, but this does not mean FAMILY is valid;
+   it could have come from user data.  So if FAMILY is not valid,
+   we return after zeroing *SA.  */
 
 static void
 conv_lisp_to_sockaddr (family, address, sa, len)
@@ -2337,7 +2341,6 @@
   register int i;
 
   bzero (sa, len);
-  sa->sa_family = family;
 
   if (VECTORP (address))
     {
@@ -2349,6 +2352,7 @@
 	  i = XINT (p->contents[--len]);
 	  sin->sin_port = htons (i);
 	  cp = (unsigned char *)&sin->sin_addr;
+	  sa->sa_family = family;
 	}
 #ifdef AF_INET6
       else if (family == AF_INET6)
@@ -2364,9 +2368,10 @@
 		int j = XFASTINT (p->contents[i]) & 0xffff;
 		ip6[i] = ntohs (j);
 	      }
-	  return;
+	  sa->sa_family = family;
 	}
 #endif
+      return;
     }
   else if (STRINGP (address))
     {
@@ -2377,6 +2382,7 @@
 	  cp = SDATA (address);
 	  for (i = 0; i < sizeof (sockun->sun_path) && *cp; i++)
 	    sockun->sun_path[i] = *cp++;
+	  sa->sa_family = family;
 	}
 #endif
       return;
@@ -6229,6 +6235,8 @@
       emacs_close (XINT (XPROCESS (proc)->outfd));
 #endif /* not HAVE_SHUTDOWN */
       new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0);
+      if (new_outfd < 0)
+	abort ();
       old_outfd = XINT (XPROCESS (proc)->outfd);
 
       if (!proc_encode_coding_system[new_outfd])
--- a/src/puresize.h	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/puresize.h	Mon Apr 17 08:41:12 2006 +0000
@@ -49,7 +49,7 @@
 /* Increase BASE_PURESIZE by a ratio depending on the machine's word size.  */
 #ifndef PURESIZE_RATIO
 #if BITS_PER_EMACS_INT > 32
-#define PURESIZE_RATIO 9/5	/* Don't surround with `()'. */
+#define PURESIZE_RATIO 10/6	/* Don't surround with `()'. */
 #else
 #define PURESIZE_RATIO 1
 #endif
@@ -65,7 +65,7 @@
   { if (PURE_P (obj))	  \
       pure_write_error (); }
 
-extern void pure_write_error P_ ((void));
+extern void pure_write_error P_ ((void)) NO_RETURN;
 
 /* Define PURE_P.  */
 
--- a/src/s/ms-w32.h	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/s/ms-w32.h	Mon Apr 17 08:41:12 2006 +0000
@@ -365,6 +365,9 @@
 #define ftruncate _chsize
 #define getw	  _getw
 #define getpid    _getpid
+#ifdef _MSC_VER
+typedef int pid_t;
+#endif
 #define isatty    _isatty
 #define logb      _logb
 #define _longjmp  longjmp
@@ -462,8 +465,10 @@
 #endif
 #include <string.h>
 
-/* We need a little extra space, see ../../lisp/loadup.el */
-#define SYSTEM_PURESIZE_EXTRA 137500
+/* We need a little extra space, see ../../lisp/loadup.el.
+   The number below comes from 22038 bytes worth (as of 2006-04)
+   of w32-specific files loaded by loadup.el, plus 2K spare.  */
+#define SYSTEM_PURESIZE_EXTRA 24000
 
 /* For unexec to work on Alpha systems, we need to put Emacs'
    initialized data into a separate section from the CRT initialized
--- a/src/search.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/search.c	Mon Apr 17 08:41:12 2006 +0000
@@ -1699,7 +1699,7 @@
 		ch = -1;
 	    }
 
-	  if (ch > 0400)
+	  if (ch >= 0400)
 	    j = (ch & 0x3F) | 0200;
 	  else
 	    j = *ptr;
@@ -1718,7 +1718,7 @@
 	      while (1)
 		{
 		  TRANSLATE (ch, inverse_trt, ch);
-		  if (ch > 0400)
+		  if (ch >= 0400)
 		    j = (ch & 0x3F) | 0200;
 		  else
 		    j = ch;
--- a/src/unexmacosx.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/unexmacosx.c	Mon Apr 17 08:41:12 2006 +0000
@@ -100,7 +100,11 @@
 #if defined (__ppc__)
 #include <mach-o/ppc/reloc.h>
 #endif
-#if defined (HAVE_MALLOC_MALLOC_H)
+#include <config.h>
+#undef malloc
+#undef realloc
+#undef free
+#ifdef HAVE_MALLOC_MALLOC_H
 #include <malloc/malloc.h>
 #else
 #include <objc/malloc.h>
@@ -558,7 +562,7 @@
 static void
 read_load_commands ()
 {
-  int n, i, j;
+  int i;
 
   if (!unexec_read (&mh, sizeof (struct mach_header)))
     unexec_error ("cannot read mach-o header");
@@ -680,7 +684,6 @@
   struct section *sectp;
   int j;
   unsigned long header_offset, file_offset, old_file_offset;
-  struct region_t *r;
 
   printf ("Writing segment %-16.16s at %#8x - %#8x (sz: %#8x)\n",
 	  scp->segname, scp->fileoff, scp->fileoff + scp->filesize,
--- a/src/window.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/window.c	Mon Apr 17 08:41:12 2006 +0000
@@ -661,12 +661,20 @@
 	  || WINDOW_RIGHTMOST_P (w))
 	{
 	  if (!WINDOW_LEFTMOST_P (w) && abs (*x - x0) < grabbable_width)
-	    return ON_VERTICAL_BORDER;
+	    {
+	      *x = max (0, *x - x0);
+	      *y -= top_y;
+	      return ON_VERTICAL_BORDER;
+	    }
 	}
       else
 	{
 	  if (abs (*x - x1) < grabbable_width)
-	    return ON_VERTICAL_BORDER;
+	    {
+	      *x = min (x1, *x) - x0;
+	      *y -= top_y;
+	      return ON_VERTICAL_BORDER;
+	    }
 	}
 
       if (*x < x0 || *x >= x1)
@@ -708,7 +716,11 @@
 	  && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)
 	  && !WINDOW_RIGHTMOST_P (w)
 	  && (abs (*x - right_x) < grabbable_width))
-	return ON_VERTICAL_BORDER;
+	{
+	  *x = min (right_x, *x) - left_x;
+	  *y -= top_y;
+	  return ON_VERTICAL_BORDER;
+	}
     }
   else
     {
@@ -720,6 +732,8 @@
 	{
 	  /* On the border on the right side of the window?  Assume that
 	     this area begins at RIGHT_X minus a canonical char width.  */
+	  *x = min (right_x, *x) - left_x;
+	  *y -= top_y;
 	  return ON_VERTICAL_BORDER;
 	}
     }
--- a/src/xdisp.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/xdisp.c	Mon Apr 17 08:41:12 2006 +0000
@@ -1913,7 +1913,7 @@
     }
 
   if ((s->for_overlaps & OVERLAPS_BOTH) == 0
-      || (s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1)
+      || ((s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1))
     {
 #ifdef CONVERT_FROM_XRECT
       CONVERT_FROM_XRECT (r, *rects);
@@ -1939,23 +1939,27 @@
 	{
 	  rs[i] = r;
 	  if (r.y + r.height > row_y)
-	    if (r.y < row_y)
-	      rs[i].height = row_y - r.y;
-	    else
-	      rs[i].height = 0;
+	    {
+	      if (r.y < row_y)
+		rs[i].height = row_y - r.y;
+	      else
+		rs[i].height = 0;
+	    }
 	  i++;
 	}
       if (s->for_overlaps & OVERLAPS_SUCC)
 	{
 	  rs[i] = r;
 	  if (r.y < row_y + s->row->visible_height)
-	    if (r.y + r.height > row_y + s->row->visible_height)
-	      {
-		rs[i].y = row_y + s->row->visible_height;
-		rs[i].height = r.y + r.height - rs[i].y;
-	      }
-	    else
-	      rs[i].height = 0;
+	    {
+	      if (r.y + r.height > row_y + s->row->visible_height)
+		{
+		  rs[i].y = row_y + s->row->visible_height;
+		  rs[i].height = r.y + r.height - rs[i].y;
+		}
+	      else
+		rs[i].height = 0;
+	    }
 	  i++;
 	}
 
@@ -14959,7 +14963,7 @@
 {
   if (glyphs != 1)
     {
-      fprintf (stderr, "Row Start   End Used oEI><\\CTZFesm     X    Y    W    H    V    A    P\n");
+      fprintf (stderr, "Row Start   End Used oE><\\CTZFesm     X    Y    W    H    V    A    P\n");
       fprintf (stderr, "======================================================================\n");
 
       fprintf (stderr, "%3d %5d %5d %4d %1.1d%1.1d%1.1d%1.1d\
@@ -22529,7 +22533,10 @@
     }
 
   if (part == ON_VERTICAL_BORDER)
-    cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor;
+    {
+      cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor;
+      help_echo_string = make_string ("drag-mouse-1: resize", 20);
+    }
   else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE
 	   || part == ON_SCROLL_BAR)
     cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
--- a/src/xfaces.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/xfaces.c	Mon Apr 17 08:41:12 2006 +0000
@@ -5063,10 +5063,12 @@
   gvec = XVECTOR (global_lface)->contents;
   for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
     if (! UNSPECIFIEDP (gvec[i]))
-      if (IGNORE_DEFFACE_P (gvec[i]))
-	lvec[i] = Qunspecified;
-      else
-	lvec[i] = gvec[i];
+      {
+	if (IGNORE_DEFFACE_P (gvec[i]))
+	  lvec[i] = Qunspecified;
+	else
+	  lvec[i] = gvec[i];
+      }
 
   return Qnil;
 }
--- a/src/xrdb.c	Sun Apr 09 01:43:22 2006 +0000
+++ b/src/xrdb.c	Mon Apr 17 08:41:12 2006 +0000
@@ -315,7 +315,7 @@
     }
 
   if (ptr == NULL)
-    return "/";
+    return xstrdup ("/");
 
   copy = (char *) malloc (strlen (ptr) + 2);
   strcpy (copy, ptr);