changeset 83509:24cf4bf418dc

Merged from emacs@sv.gnu.org Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-207 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-208 Sync from erc--emacs--0 * emacs@sv.gnu.org/emacs--devo--0--patch-209 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-210 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-211 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-212 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-213 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-214 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-215 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-81 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-82 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-83 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-549
author Karoly Lorentey <lorentey@elte.hu>
date Wed, 12 Apr 2006 17:40:36 +0000
parents cc8354d6fe87 (current diff) d0312c3f2374 (diff)
children 2d2f6f096f6e
files admin/FOR-RELEASE lisp/ChangeLog lisp/emacs-lisp/bytecomp.el lisp/files.el lisp/international/mule-cmds.el lisp/progmodes/gdb-ui.el lisp/startup.el lisp/vc.el lispref/ChangeLog man/ChangeLog man/emacs.texi src/data.c src/lisp.h
diffstat 52 files changed, 4868 insertions(+), 3470 deletions(-) [+]
line wrap: on
line diff
--- a/admin/FOR-RELEASE	Mon Apr 10 15:09:46 2006 +0000
+++ b/admin/FOR-RELEASE	Wed Apr 12 17:40:36 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)
--- a/etc/ChangeLog	Mon Apr 10 15:09:46 2006 +0000
+++ b/etc/ChangeLog	Wed Apr 12 17:40:36 2006 +0000
@@ -1,3 +1,17 @@
+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	Mon Apr 10 15:09:46 2006 +0000
+++ b/etc/NEWS	Wed Apr 12 17:40:36 2006 +0000
@@ -3692,6 +3692,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:
@@ -3961,6 +3967,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
@@ -10784,9 +10796,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	Mon Apr 10 15:09:46 2006 +0000
+++ b/etc/PROBLEMS	Wed Apr 12 17:40:36 2006 +0000
@@ -991,7 +991,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 some 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
@@ -1005,6 +1005,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/orgcard.tex	Mon Apr 10 15:09:46 2006 +0000
+++ b/etc/orgcard.tex	Wed Apr 12 17:40:36 2006 +0000
@@ -1,4 +1,6 @@
-% Reference Card for Org Mode 4.10
+% Reference Card for Org Mode
+\def\orgversionnumber{4.21}
+\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/lisp/ChangeLog	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/ChangeLog	Wed Apr 12 17:40:36 2006 +0000
@@ -1,3 +1,152 @@
+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
@@ -94,12 +243,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.
@@ -132,8 +280,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>
 
@@ -146,21 +293,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.
@@ -231,8 +377,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>
 
@@ -245,8 +391,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/cus-edit.el	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/cus-edit.el	Wed Apr 12 17:40:36 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,18 @@
 (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 that maps packages to alists of package to Emacs versions.
+The value alists map all package versions used with
+the :package-version keyword to Emacs versions.  Packages are
+symbols and versions are strings.
+
+For example:
+  '((MH-E (\"7.4\" \"22.1\") (\"8.0\" \"22.1\"))
+    (Gnus (\"5.11\" \"22.1\")))")
+
 ;;;###autoload
 (defalias 'customize-changed 'customize-changed-options)
 
@@ -1119,7 +1131,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 +1152,31 @@
       (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
+                 (cadr (assoc (cadr package-version) package-versions)))
+           (unless emacs-version
+             (message "Package version of %s not found in %s" symbol
+                      "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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/custom.el	Wed Apr 12 17:40:36 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,16 @@
 
         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'.
 :tag LABEL
         Use LABEL, a string, instead of the item's name, to label the item
         in customization menus and buffers.
@@ -286,8 +295,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 +323,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 +375,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 +433,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 +491,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 +544,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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Wed Apr 12 17:40:36 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/find-func.el	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/emacs-lisp/find-func.el	Wed Apr 12 17:40:36 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-\\|$\\|\(\\|\)\\)")
@@ -229,7 +229,7 @@
 	    (goto-char (point-min))
 	    (if (or (re-search-forward regexp nil t)
 		    (re-search-forward
-		     (concat "^([^ ]+" find-function-space-re "['(]"
+		     (concat "^([^ ]+" find-function-space-re "['(]?"
 			     (regexp-quote (symbol-name symbol))
 			     "\\_>")
 		     nil t))
--- a/lisp/erc/ChangeLog	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/erc/ChangeLog	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/erc/erc-backend.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/erc/erc-ezbounce.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/erc/erc-join.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/erc/erc-netsplit.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/erc/erc.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/files.el	Wed Apr 12 17:40:36 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 -*-.)
 
@@ -2414,8 +2419,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)
@@ -2427,9 +2431,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)
@@ -2617,13 +2619,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)
--- a/lisp/finder.el	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/finder.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/gnus/ChangeLog	Wed Apr 12 17:40:36 2006 +0000
@@ -1,3 +1,56 @@
+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-12  Kenichi Handa  <handa@m17n.org>
+
+	* rfc2231.el (rfc2231-decode-encoded-string): Work on unibyte
+	buffer and then decode the buffer text if necessary.
+	(rfc2231-encode-string): Be sure to work on multibyte buffer at
+	first, and after mm-encode-body, change the buffer to unibyte.
+
+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/gnus-art.el	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/gnus/gnus-art.el	Wed Apr 12 17:40:36 2006 +0000
@@ -4477,19 +4477,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 +5982,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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/gnus/gnus-sieve.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/gnus/gnus-sum.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/gnus/gnus-uu.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/gnus/message.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/gnus/mm-decode.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/gnus/mm-extern.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/gnus/nnslashdot.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/gnus/rfc2047.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/hexl.el	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/international/mule-cmds.el	Wed Apr 12 17:40:36 2006 +0000
@@ -2531,7 +2531,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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/loadhist.el	Wed Apr 12 17:40:36 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/progmodes/gdb-ui.el	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/progmodes/gdb-ui.el	Wed Apr 12 17:40:36 2006 +0000
@@ -524,6 +524,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 +581,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 +2746,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 +3143,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 +3163,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 +3284,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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/progmodes/perl-mode.el	Wed Apr 12 17:40:36 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/startup.el	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/startup.el	Wed Apr 12 17:40:36 2006 +0000
@@ -1536,9 +1536,15 @@
 	  ;; Display the input that we set up in the buffer.
 	  (set-buffer-modified-p nil)
 	  (goto-char (point-min))
-	  (save-window-excursion
-	    (switch-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/textmodes/org.el	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/textmodes/org.el	Wed Apr 12 17:40:36 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.21
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -81,6 +81,30 @@
 ;;
 ;; Changes since version 4.00:
 ;; ---------------------------
+;; Version 4.21
+;;    - Bug fixes.
+;;
+;; 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 +122,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 +161,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.21"
   "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 +203,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 +291,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 +349,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 +377,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 +438,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 +470,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 +480,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 +521,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 +534,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 +573,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 +609,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 +630,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 +748,793 @@
   :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-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-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-window-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-window-setup
+  :type 'boolean)
+
+(defcustom org-fit-agenda-window t
+  "Non-nil means, change window size of agenda to fit content."
+  :group 'org-agenda-window-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 +1548,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 +1559,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 +1796,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 +1813,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 +1821,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 +1902,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 +1922,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 +1930,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 +1938,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 +1947,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 +1955,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 +1963,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 +1971,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 +1979,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 +1987,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 +1996,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 +2005,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 +2015,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 +2023,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 +2032,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 +2041,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 +2065,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 +2073,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 +2081,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 +2089,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)
@@ -1962,6 +2171,8 @@
 			   ("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 +2225,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 +2310,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 +2343,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 +2354,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,20 +2368,44 @@
 (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)
+  (if (featurep 'xemacs) [button3] [mouse-3]) 'org-find-file-at-mouse)
 (define-key org-mouse-map [follow-link] 'mouse-face)
 (when org-tab-follows-link
   (define-key org-mouse-map [(tab)] 'org-open-at-point)
@@ -2171,26 +2416,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 +2485,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 +2547,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 +2590,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 +2614,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 +2645,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 +2679,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 +2700,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 +2715,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 +2766,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 +2879,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 +2975,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 +3050,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 +3295,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 +3601,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 +3718,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 +3949,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 +4044,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 +4195,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 +4209,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 +4221,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,7 +4241,10 @@
 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
@@ -3933,20 +4253,18 @@
 		  (- (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 +4276,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 +4327,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 +4443,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 +4659,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 +4695,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,9 +4766,9 @@
   "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)
+  (if (featurep 'xemacs) [(button3)] [(mouse-3)]) 'org-agenda-show-mouse)
 (define-key org-agenda-keymap [follow-link] 'mouse-face)
 (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
   '("Agenda"
@@ -4553,7 +4876,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 +4937,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 +5107,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 +5142,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))
@@ -4784,7 +5156,7 @@
 			 (d (- nt n1)))
 		    (- sd (+ (if (< d 0) 7 0) d)))))
 	 (day-numbers (list start))
-	 (inhibit-redisplay t)
+;FIXME	 (inhibit-redisplay t)
 	 s e rtn rtnall file date d start-pos end-pos todayp nd)
     (setq org-agenda-redo-command
 	  (list 'org-agenda-list (list 'quote include-all) start-day ndays t))
@@ -4808,7 +5180,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 +5192,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 +5202,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 +5228,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 +5299,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 +5311,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 +5321,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 +5444,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 ()
@@ -5176,11 +5545,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 +5584,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 +5607,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 +5618,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 +5635,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 +5644,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 +5662,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 +5749,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 +5796,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 +5897,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 +5955,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 +6014,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 +6062,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 +6119,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 +6163,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.
@@ -5946,14 +6272,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 +6300,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 +6401,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 +6693,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 +6898,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 +7001,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 +7042,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 +7056,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 +7099,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 +7109,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 +7146,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 +7166,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 +7187,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 +7202,6 @@
       (cond
 
        ((member type '("http" "https" "ftp" "mailto" "news"))
-	;; give these to some browser
 	(browse-url (concat type ":" path)))
 
        ((string= type "tags")
@@ -6971,7 +7278,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 +7354,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 +7512,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)
@@ -7409,7 +7719,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 +7760,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 +7796,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 +7804,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 +7817,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 +7831,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 +7863,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 +7896,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 +7915,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 +7924,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 +7982,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 +8076,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 +8091,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 +8177,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 +8262,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 +8305,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 +8397,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 +8438,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 +8530,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 +8553,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 +8587,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 +8601,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 +8665,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 +8678,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 +8737,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 +8748,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 +8908,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 +9166,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 +9183,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 +9439,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 +9512,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 +9539,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 +9567,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 +9578,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 +9834,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))))
 
@@ -9797,7 +10269,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 +10420,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 +10459,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 +10542,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 +10574,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 +10585,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 +10593,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 +10625,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 +10671,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 +11017,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 +11030,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 +11140,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 +11199,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 +11258,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 +11354,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
@@ -10922,6 +11380,7 @@
    (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 +11482,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 +11511,7 @@
 	 table-open type
 	 table-buffer table-orig-buffer
 	 ind start-is-num starter
+	 rpl path desc desc1 desc2 link
 	 )
     (message "Exporting...")
 
@@ -11118,7 +11578,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 +11661,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 +11672,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 +11683,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 +11713,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 +11779,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 +11803,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 +11987,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 +12065,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."
@@ -11761,14 +12202,14 @@
 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 +12370,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 +12448,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 +12470,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 +12488,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 +12509,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
@@ -12303,6 +12758,9 @@
   (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 +12786,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 +12827,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 +12867,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 +12943,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 +12978,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 +12992,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
 
@@ -12650,7 +13118,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 +13127,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 +13263,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.
@@ -12934,5 +13402,114 @@
 
 (run-hooks 'org-load-hook)
 
+;; Experimental code
+;; FIXME: Move this code when it is ready.
+
+(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-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) nil)
+      (save-buffer)
+      (goto-char (point-min))
+      )))
+
 ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
 ;;; org.el ends here
+
--- a/lisp/vc.el	Mon Apr 10 15:09:46 2006 +0000
+++ b/lisp/vc.el	Wed Apr 12 17:40:36 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)
@@ -3087,15 +3117,19 @@
 	      ;; 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)))
+    (message "Annotating... done")))
 
 (defun vc-annotate-prev-version (prefix)
   "Visit the annotation of the version previous to this one.
@@ -3191,7 +3225,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 +3253,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 +3310,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	Mon Apr 10 15:09:46 2006 +0000
+++ b/lispref/ChangeLog	Wed Apr 12 17:40:36 2006 +0000
@@ -1,3 +1,7 @@
+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
--- a/lispref/customize.texi	Mon Apr 10 15:09:46 2006 +0000
+++ b/lispref/customize.texi	Wed Apr 12 17:40:36 2006 +0000
@@ -130,6 +130,25 @@
 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 @var{package} and @var{version} must appear in the alist
+@code{customize-package-emacs-version-alist}.  This alist maps packages
+to alists that map all package versions used with the
+@code{:package-version} keyword to Emacs versions.  Packages are
+symbols and 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
+
 @end table
 
 @node Group Definitions
--- a/man/ChangeLog	Mon Apr 10 15:09:46 2006 +0000
+++ b/man/ChangeLog	Wed Apr 12 17:40:36 2006 +0000
@@ -1,3 +1,40 @@
+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.
--- a/man/cmdargs.texi	Mon Apr 10 15:09:46 2006 +0000
+++ b/man/cmdargs.texi	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/man/custom.texi	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/man/emacs-xtra.texi	Wed Apr 12 17:40:36 2006 +0000
@@ -57,12 +57,14 @@
 @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::
@@ -273,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
@@ -1889,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
--- a/man/emacs.texi	Mon Apr 10 15:09:46 2006 +0000
+++ b/man/emacs.texi	Wed Apr 12 17:40:36 2006 +0000
@@ -399,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
 
--- a/man/files.texi	Mon Apr 10 15:09:46 2006 +0000
+++ b/man/files.texi	Wed Apr 12 17:40:36 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/gnus-faq.texi	Mon Apr 10 15:09:46 2006 +0000
+++ b/man/gnus-faq.texi	Wed Apr 12 17:40:36 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	Mon Apr 10 15:09:46 2006 +0000
+++ b/man/gnus.texi	Wed Apr 12 17:40:36 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/org.texi	Mon Apr 10 15:09:46 2006 +0000
+++ b/man/org.texi	Wed Apr 12 17:40:36 2006 +0000
@@ -4,8 +4,8 @@
 @setfilename ../info/org
 @settitle Org Mode Manual
 
-@set VERSION 4.10
-@set DATE March 2006
+@set VERSION 4.21
+@set DATE April 2006
 
 @dircategory Emacs
 @direntry
@@ -82,6 +82,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 +95,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 +107,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 +128,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 +143,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 +158,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
@@ -189,6 +197,7 @@
 
 * Completion::                  M-TAB knows what you need
 * Customization::               Adapting Org-mode to your taste
+* Updating settings::           How to tell Org-mode that settings have changed
 * Clean view::                  Getting rid of leading stars in the outline
 * TTY keys::                    Using Org-mode on a tty
 * FAQ::                         Frequently asked questions
@@ -205,11 +214,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 +243,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 +264,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 +310,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 +325,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 +353,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 +376,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 +389,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 +414,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 +430,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
@@ -499,23 +513,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 +581,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 +616,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 +637,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 +660,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 +731,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 +766,7 @@
 |Name|Phone|Age
 |-
 @end example
+
 @noindent and then press @key{TAB} to align the table and start filling in
 fields.
 
@@ -840,18 +781,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 consequtive spaces required
+to indentify 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 +817,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 +831,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 +879,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 +939,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 unconveniently 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,9 +1052,9 @@
 
 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
+evaluation by @code{calc-eval} (@pxref{Calling Calc from Your Lisp
 Programs,calc-eval,Calling calc from Your Lisp Programs,calc,GNU Emacs
 Calc Manual}), variable substitution takes place:
 
@@ -1091,7 +1081,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 +1096,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 +1111,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 +1155,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 +1184,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 +1201,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 +1218,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 +1232,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 +1243,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 +1256,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 +1275,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 +1312,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 +1355,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 +1442,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 +1455,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 +1484,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 +1535,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 +1630,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 +1646,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 +1675,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 +1759,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 +1777,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 +1800,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 +1828,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 +1849,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 +1874,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 +1922,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 +2008,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 +2031,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 +2097,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 +2205,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 +2333,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 +2354,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 +2376,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 +2391,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 +2402,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 +2418,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 +2426,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 +2450,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 +2473,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 +2538,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 +2550,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 +2599,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 +2652,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 +2662,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 +2676,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 +2707,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 +2731,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 +2780,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 +2850,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 +2873,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
@@ -2718,11 +2918,13 @@
 @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}
@@ -2757,11 +2959,13 @@
 @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.
 
@@ -2851,9 +3055,10 @@
 #+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
+you can:
 @cindex headline levels
 @cindex section-numbers
 @cindex table of contents
@@ -2886,7 +3091,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,7 +3100,9 @@
 @end example
 
 Remember to execute @kbd{M-x normal-mode} after changing this to make
-the new style visible to Emacs.
+the new style visible to Emacs.  This command reastarts org-mode for the
+current buffer and forces Emacs to re-evaluate the loval variables
+section in the buffer.
 
 @node Comment lines,  , Export options, HTML export
 @subsection Comment lines
@@ -2969,6 +3176,7 @@
 @menu
 * Completion::                  M-TAB knows what you need
 * Customization::               Adapting Org-mode to your taste
+* Updating settings::           How to tell Org-mode that settings have changed
 * Clean view::                  Getting rid of leading stars in the outline
 * TTY keys::                    Using Org-mode on a tty
 * FAQ::                         Frequently asked questions
@@ -3021,7 +3229,7 @@
 @end table
 
 
-@node Customization, Clean view, Completion, Miscellaneous
+@node Customization, Updating settings, Completion, Miscellaneous
 @section Customization
 @cindex customization
 @cindex options, for customization
@@ -3033,14 +3241,48 @@
 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
+@node Updating settings, Clean view, Customization, Miscellaneous
+@section Updating settings after changes
+@cindex updating, after setting changes
+@kindex C-c C-c
+
+Org-mode uses special lines in the buffer to set file-local values for a
+number of user options.  When such settings are changed, you need to
+inform Org-mode that something has be modified and that it should
+recheck the buffer for setting.  This is done with the command @kbd{C-c
+C-c} in the following situations:
+
+@itemize @bullet
+@item
+After changing any of the special buffer lines starting with @samp{#+},
+for example @samp{#+STARTUP}, @samp{#+CATEGORY}.  Org-mode will then
+read these settings and activate them (see @ref{Visibility cycling},
+@ref{Narrow columns}, @ref{Clean view}, @ref{Per file keywords},
+@ref{Categories})
+@item
+After editing by hand a @samp{#+TBLFM} line containing formulas for a
+table.  When pressing @kbd{C-c C-c} in that line, all formulas are
+re-applied to the entire table (@pxref{Editing/debugging formulas}).
+@item
+In a table, @kbd{C-c C-c} does force a re-align, even if the table
+editor is turned off (@pxref{Built-in table editor})
+@item
+In an ordered plain list, @kbd{C-c C-c} forces a renumbering of the list
+(@pxref{Plain Lists}).
+@item
+After adding a new radio target @samp{<<<New target>>>}, @kbd{C-c C-c}
+must be used with the cursor on that target to activate it throughout
+the buffer.
+@end itemize
+
+@node Clean view, TTY keys, Updating settings, 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 +3313,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:
 
@@ -3129,7 +3372,7 @@
 @end example
 
 You can convert an Org-mode file from single-star-per-level to
-double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
+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.
@@ -3179,36 +3422,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 (even if I don't understand
+why), 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 +3510,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 +3533,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
@@ -3310,10 +3593,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.  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.
 @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 +3614,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 +3633,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
@@ -3415,8 +3700,6 @@
 The exporters work well, but could be made more efficient.
 @end itemize
 
-@page
-
 @node Acknowledgments,  , Bugs, Miscellaneous
 @section Acknowledgments
 @cindex acknowledgments
@@ -3432,37 +3715,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 +3757,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/src/ChangeLog	Mon Apr 10 15:09:46 2006 +0000
+++ b/src/ChangeLog	Wed Apr 12 17:40:36 2006 +0000
@@ -1,3 +1,23 @@
+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.
--- a/src/data.c	Mon Apr 10 15:09:46 2006 +0000
+++ b/src/data.c	Wed Apr 12 17:40:36 2006 +0000
@@ -126,7 +126,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/lisp.h	Mon Apr 10 15:09:46 2006 +0000
+++ b/src/lisp.h	Wed Apr 12 17:40:36 2006 +0000
@@ -2246,7 +2246,7 @@
 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));
+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));
--- a/src/s/ms-w32.h	Mon Apr 10 15:09:46 2006 +0000
+++ b/src/s/ms-w32.h	Wed Apr 12 17:40:36 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
--- a/src/xrdb.c	Mon Apr 10 15:09:46 2006 +0000
+++ b/src/xrdb.c	Wed Apr 12 17:40:36 2006 +0000
@@ -315,7 +315,7 @@
     }
 
   if (ptr == NULL)
-    return "/";
+    return xstrdup ("/");
 
   copy = (char *) malloc (strlen (ptr) + 2);
   strcpy (copy, ptr);