changeset 90072:cb67264d6096

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-2 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-83 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-84 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-3 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-4 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-5 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-6 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-11 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-12 Remove "-face" suffix from lazy-highlight face name * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-13 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-16 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-17 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-18 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-21 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-22 <no summary provided> * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-23 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-39 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-40 Fix regressions from latest reftex update * miles@gnu.org--gnu-2005/gnus--rel--5.10--base-0 tag of miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-82 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-1 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-2 Merge from miles@gnu.org--gnu-2004 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-3 Merge from emacs--cvs-trunk--0
author Miles Bader <miles@gnu.org>
date Sun, 16 Jan 2005 03:40:12 +0000
parents f6b4d0ebf147 (current diff) a588c86a429c (diff)
children f02550ff43d0
files etc/ChangeLog etc/MORE.STUFF etc/NEWS etc/TUTORIAL.nl lisp/ChangeLog lisp/add-log.el lisp/battery.el lisp/calc/calc-embed.el lisp/calc/calc-ext.el lisp/calc/calc-help.el lisp/calc/calc-mode.el lisp/calc/calc-prog.el lisp/calc/calc-sel.el lisp/calc/calc-units.el lisp/calc/calc-yank.el lisp/calc/calc.el lisp/cus-edit.el lisp/cus-face.el lisp/custom.el lisp/desktop.el lisp/ebuff-menu.el lisp/electric.el lisp/emacs-lisp/autoload.el lisp/emacs-lisp/elint.el lisp/emacs-lisp/find-func.el lisp/emacs-lisp/lisp-mnt.el lisp/emacs-lisp/lisp-mode.el lisp/emacs-lisp/re-builder.el lisp/facemenu.el lisp/files.el lisp/gnus/ChangeLog lisp/help-fns.el lisp/help-macro.el lisp/imenu.el lisp/info-look.el lisp/info.el lisp/isearch.el lisp/loadhist.el lisp/mail/mailabbrev.el lisp/mail/rmail.el lisp/man.el lisp/mouse.el lisp/progmodes/ebrowse.el lisp/progmodes/hideshow.el lisp/progmodes/perl-mode.el lisp/progmodes/sh-script.el lisp/replace.el lisp/simple.el lisp/startup.el lisp/textmodes/ispell.el lisp/textmodes/org.el lisp/textmodes/reftex-auc.el lisp/textmodes/reftex-cite.el lisp/textmodes/reftex-dcr.el lisp/textmodes/reftex-global.el lisp/textmodes/reftex-index.el lisp/textmodes/reftex-parse.el lisp/textmodes/reftex-ref.el lisp/textmodes/reftex-sel.el lisp/textmodes/reftex-toc.el lisp/textmodes/reftex-vars.el lisp/textmodes/reftex.el lisp/textmodes/sgml-mode.el lisp/type-break.el lisp/uniquify.el lisp/vc-arch.el lisp/vc-cvs.el lisp/vc-mcvs.el lisp/vc-svn.el lisp/vc.el lisp/woman.el lisp/xt-mouse.el lispref/ChangeLog lispref/commands.texi lispref/display.texi lispref/keymaps.texi lispref/modes.texi lispref/os.texi lispref/text.texi man/ChangeLog man/calc.texi man/commands.texi man/custom.texi man/display.texi man/faq.texi man/message.texi man/programs.texi man/reftex.texi man/rmail.texi man/search.texi man/widget.texi src/ChangeLog src/alloc.c src/dispextern.h src/fns.c src/fringe.c src/gtkutil.c src/keyboard.c src/keymap.c src/macfns.c src/macterm.c src/macterm.h src/term.c src/w32bdf.c src/w32fns.c src/w32term.c src/window.c src/xdisp.c src/xfaces.c src/xmenu.c src/xselect.c src/xterm.h
diffstat 125 files changed, 6779 insertions(+), 3300 deletions(-) [+]
line wrap: on
line diff
--- a/admin/FOR-RELEASE	Sun Jan 02 09:21:32 2005 +0000
+++ b/admin/FOR-RELEASE	Sun Jan 16 03:40:12 2005 +0000
@@ -11,6 +11,9 @@
 gracefully if something isn't supported over Tramp.
 To be done by Andre Spiegel <spiegel@gnu.org>.
 
+** define-minor-mode should not put :require into defcustom.
+See msg from rms to emacs-devel on 21 Dec.
+
 * FATAL ERRORS
 
 ** Investigate face cache related crash.
@@ -32,6 +35,9 @@
 
 ** Fix up url-ldap.el.
 
+** url/*.el has lots of `(declare (special ...))' which
+are meaningless.  What's that trying to do?
+
 * BUGS
 
 ** Incomplete overlay mouse-face highlight bug (Ralf Angeli, Oct 18)
@@ -62,42 +68,6 @@
 I think in the near future we will see more of this problem, so it might be
 time to make anfe-ftp more intelligent.
 
-** Bug in url-http-parse-headers, reported in
-From: Vivek Dasmohapatra <vivek@zeus.com>
-Date: Tue, 28 Sep 2004 16:13:13 +0100
-
-Fetching a url with url-retrieve can reult in an anrbitrary buffer
-being killed if a 401 (or possibly a 407) result is encountered:
-
-url-http-parse-headers calls url-http-handle-authentication,
-which can call url-retrieve.
-
-This results in the current buffer being killed, and a new http buffer
-being generated. However, when the old http buffer is killed, emacs
-picks the top buffer from the list as the new current buffer, so by the
-time we get to the end of url-http-parse-headers, _that_ buffer is marked
-as dead even though it is not necessarily a url buffer, so next time the
-url libraries reap their dead buffers, an innocent bystander buffer is
-killed instead (and an obsolete http buffer may be left lying around too).
-
-A possible fix (which I am currently using) is to call set-buffer
-on the return value of url-http-parse-headers:
-
-      (case url-http-response-status
-	(401
-	 ;; The request requires user authentication.  The response
-	 ;; MUST include a WWW-Authenticate header field containing a
-	 ;; challenge applicable to the requested resource.  The
-	 ;; client MAY repeat the request with a suitable
-	 ;; Authorization header field.
-	 (url-mark-buffer-as-dead (current-buffer))
-	 (set-buffer (url-http-handle-authentication nil)))
-etc ....
-
-which makes sure that it is the right http buffer that is current when
-we come to mark the http buffers as dead.
-
-
 
 * GTK RELATED BUGS
 
@@ -183,22 +153,6 @@
 Update: Maybe only reveals itself when compiled with GTK+
 
 
-** line-spacing and Electric-pop-up-window
-
-From: SAITO Takuya <tabmore@rivo.mediatti.net>
-Date: Mon, 31 May 2004 02:08:10 +0900 (JST)
-
-Electric-pop-up-window does not work well
-if truncate long lines disabled and/or
-`line-spacing' is set to positive integer.
-
-For example, start emacs -Q --line-spacing 1, and type M-` .
-Then, the last line of *Completions* buffer is not visible.
-
-fit-window-to-buffer works well for me, so I guess
-Electric-pop-up-window can use it.
-
-
 ** Partial highlighting of wrapped overlay
 
 From: Ralf Angeli <angeli@iwi.uni-sb.de>
@@ -245,9 +199,10 @@
 
 ** Check the Emacs manual.
 
-Each manual section should be proof-read by at least two people.
-After each file name, on the same line or the following line, come the
-names of the people who have checked it.
+Each manual section should be checked for factual correctness
+regarding recent changes by at least two people.  After each file
+name, on the same line or the following line, come the names of the
+people who have checked it.
 
 
 SECTION             READERS
@@ -283,7 +238,7 @@
 man/mule.texi       "Luc Teirlinck"
 man/m-x.texi        "Luc Teirlinck"
 man/picture.texi
-man/programs.texi
+man/programs.texi   "Stephen Eglen"
 man/regs.texi       "Luc Teirlinck"
 man/rmail.texi
 man/screen.texi     "Luc Teirlinck"
@@ -296,9 +251,10 @@
 
 ** Check the Emacs Lisp manual.
 
-Each manual section should be proof-read by at least two people.
-After each file name, on the same line or the following line, come the
-names of the people who have checked it.
+Each manual section should be checked for factual correctness
+regarding recent changes by at least two people.  After each file
+name, on the same line or the following line, come the names of the
+people who have checked it.
 
 SECTION                  READERS
 ----------------------------------
--- a/etc/ChangeLog	Sun Jan 02 09:21:32 2005 +0000
+++ b/etc/ChangeLog	Sun Jan 16 03:40:12 2005 +0000
@@ -1,3 +1,16 @@
+2005-01-15  Frederik Fouvry  <fouvry@CoLi.Uni-SB.DE>
+
+	* TUTORIAL.nl: Correct translation and the Dutch text (typos).
+	More consistent use of terminology.
+
+2005-01-13  Cheng Gao  <chenggao@gmail.com>
+
+	* MORE.STUFF: Add entries of some well known and widely used packages.
+	
+2005-01-07  Lars Hansen  <larsh@math.ku.dk>
+
+	* NEWS: Describe desktop package lazy restore feature.
+
 2004-12-21  Richard M. Stallman  <rms@gnu.org>
 
 	* DISTRIB: Don't say "freeware".
--- a/etc/MORE.STUFF	Sun Jan 02 09:21:32 2005 +0000
+++ b/etc/MORE.STUFF	Sun Jan 16 03:40:12 2005 +0000
@@ -34,7 +34,7 @@
 
 You might find bug-fixes or enhancements in these places.
 
- * Ada: <URL:http://libre.act-europe.fr/adamode>
+ * Ada-mode: <URL:http://libre.act-europe.fr/adamode>
 
  * Battery and Info Look: <URL:ftp://ftp.ul.bawue.de/pub/purple/emacs>
 
@@ -80,6 +80,8 @@
 
  * Iswitchb: <URL:http://www.anc.ed.ac.uk/%7Estephen/emacs/iswitchb.el>
 
+ * MH-E: <URL:http://mh-e.sourceforge.net/>
+
  * PC Selection: <URL:ftp://ftp.thp.uni-duisburg.de/pub/source/elisp/>
 
  * PS mode: <URL:http://odur.let.rug.nl/%7Ekleiweg/postscript/>
@@ -133,6 +135,12 @@
    emacs-mule, say by adding `("\\.bbdb\\'" . emacs-mule)' to
    `file-coding-system-alist' for non-ASCII characters.]
 
+ * Boxquote: <URL:http://www.davep.org/emacs/>
+
+ * CEDET: Collection of Emacs Development Environment Tools, including
+   EIEIO, Semantic, Speedbar, EDE, and COGRE:
+   <URL:http://cedet.sourceforge.net/>
+
  * CJK-emacs: Converting MULE-encoded text to TeX:
    <URL:ftp://ctan.tug.org/tex-archive/language/chinese/CJK/> and
    mirrors of the `CTAN' TeX archives.
@@ -140,14 +148,13 @@
  * Dismal: spreadsheet:
    <URL:http://acs.ist.psu.edu/dismal/dismal.html>
 
+ * ECB: Emacs Code Browser: <URL:http://ecb.sourceforge.net/>
+
  * EDB: database: <URL:http://www.glug.org/people/ttn/software/edb/>
 
  * Ee: categorizing information manager:
    <URL:http://www.jurta.org/emacs/ee/>
 
- * EIEIO (object system), ETalk (interface to Internet talk):
-   <URL:http://cedet.sourceforge.net/eieio.shtml>
-
  * EFS: enhanced version of ange-ftp:
    <URL:http://www-uk.hpl.hp.com/people/ange/efs>
    Version 1.16 is said not to work properly with Emacs 20.
@@ -156,12 +163,25 @@
    From GNU distribution mirrors.  (Much of this functionality is now
    in Emacs.)
 
+ * EMacro: <URL:http://emacro.sourceforge.net/>
+   EMacro is a portable configuration file that configures itself.
+
  * Emacs statistical system (ESS): statistical programming within Emacs
    <URL:http://ess.r-project.org>
 
  * Emacspeak -- A Speech Output Subsystem For Emacs:
    <URL:http://emacspeak.sourceforge.net/>
 
+ * Emacs-w3m : <URL:http://emacs-w3m.namazu.org/>
+   A simple Emacs interface to w3m, which is a text-mode
+   WWW browser
+
+ * Emacs Wiki Mode: <URL:http://mwolson.org/projects/EmacsWiki.html>
+   A wiki-like publishing tool and personal information manager
+
+ * ERC: IRC client:
+   <URL:http://www.emacswiki.org/cgi-bin/wiki?EmacsIRCClient>
+
  * Gnuserv:
    <URL:ftp://ftp.splode.com/pub/users/friedman/packages/fgnuserv-1.0.tar.gz>
    Enhanced emacsclient/emacsserver.  See also
@@ -184,14 +204,29 @@
    Provides an interactive environment for manipulating an inferior
    process running some form of Lisp.
 
- * JDE: <URL:http://jdee.sunsite.dk/>
+ * JDEE: <URL:http://jdee.sunsite.dk/>
    Provides a Java development environment for Emacs.
 
  * Mailcrypt:
-   <URL:http://www.pobox.com/%7Elbudney/linux/software/mailcrypt.html>
+   <URL:http://mailcrypt.sourceforge.net/>
    PGP and GPG support.  PGP isn't free software, but GPG, the GNU
    Privacy Guard, is a free replacement <URL:http://www.gnupg.org/>.
 
+ * Mew: <URL:http://www.mew.org/>
+   A MIME mail reader for Emacs/XEmacs.
+
+ * MMM Mode: <URL:http://mmm-mode.sourceforge.net/>
+   MMM Mode is an emacs add-on package providing a minor mode that
+   allows Multiple Major Modes to coexist in one buffer.
+
+ * nXML Mode: New mode for XML:
+   <URL:http://www.thaiopensource.com/nxml-mode/>
+   nXML mode is an addon for GNU Emacs, which makes GNU Emacs into a
+   powerful XML editor.
+
+ * Planner Mode:
+   <URL:http://sacha.free.net.ph/notebook/wiki/PlannerMode.php>
+
  * Pointers to MIME packages:
    <URL:http://bmrc.berkeley.edu/%7Etrey/emacs/mime.html>
 
@@ -201,6 +236,18 @@
  * PSGML: <URL:http://www.lysator.liu.se/projects/about_psgml.html>
    DTD-aware serious SGML/XML editing.
 
+ * Quack: <URL:http://www.neilvandyke.org/quack/>
+   Quack enhances Emacs support for Scheme
+
+ * Remember:
+   <URL:http://sacha.free.net.ph/notebook/wiki/RememberEl.php>
+
+ * Session: <URL:http://emacs-session.sourceforge.net/>
+   Session Management for Emacs.
+
+ * SLIME: The Superior Lisp Interaction Mode for Emacs:
+   <URL:http://common-lisp.net/project/slime/>
+
  * Tamago: Chinese/Japanese/Korean input method
    <URL:ftp://m17n.org/pub/tamago/>
    Emacs Lisp package to provide input methods for CJK characters.
@@ -209,6 +256,8 @@
 	Wnn6,
 	SJ3 Ver.2
 
+ * Tiny Tools: <URL:http://tiny-tools.sourceforge.net/>
+
  * VM (View Mail): <URL:http://www.wonderworks.com/vm/> Alternative
    mail reader.  There is a VM newsgroup: <URL:news:gnu.emacs.vm.info>
 
@@ -217,6 +266,14 @@
    <URL:news://sunsite.auc.dk/emacs.w3> and a W3 development mail
    list/newsgroup <URL:news://sunsite.auc.dk/emacs.w3.dev>.
 
+ * Wanderlust: <URL:http://www.gohome.org/wl/>
+   Yet Another Message Interface on Emacsen. Wanderlust is a mail/news
+   reader supporting IMAP4rev1 for emacsen.
+
+ * WhizzyTex: <URL:http://pauillac.inria.fr/whizzytex/>
+   WhizzyTeX provides a minor mode for Emacs or XEmacs, a (bash)
+   shell-script daemon and some LaTeX macros.
+
  * X-Symbol: <URL:http://x-symbol.sf.net/>
    Quasi-WYSIWYG editing of TeX & al.  (It will be improved to take
    better advantage of Emacs 21 features.)
--- a/etc/NEWS	Sun Jan 02 09:21:32 2005 +0000
+++ b/etc/NEWS	Sun Jan 16 03:40:12 2005 +0000
@@ -1,5 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.  2003-05-21
-Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+          Free Software Foundation, Inc.
 See the end for copying conditions.
 
 Please send Emacs bug reports to bug-gnu-emacs@gnu.org.
@@ -173,6 +174,21 @@
 
 * Changes in Emacs 21.4
 
+** Control characters and escape glyphs are now shown in the new
+escape-glyph face.
+
+** Non-breaking space and hyphens are now prefixed with an escape
+character, unless the new user variable `show-nonbreak-escape' is set
+to nil.
+
+---
+** The type-break package now allows `type-break-file-name' to be nil
+and if so, doesn't store any data across sessions.  This is handy if
+you don't want the .type-break file in your home directory or are
+annoyed by the need for interaction when you kill Emacs.
+
+** display-battery has been replaced by display-battery-mode.
+
 ** calculator.el now has radix grouping mode, which is available when
 `calculator-output-radix' is non-nil.  In this mode a separator
 character is used every few digits, making it easier to see byte
@@ -266,6 +282,9 @@
 will start up Emacs on an initial frame of 100x20 with red background,
 irrespective of geometry or background setting on the Windows registry.
 
+** The terminal emulation code in term.el has been improved, it can
+run most curses applications now.
+
 ** New features in evaluation commands
 
 +++
@@ -467,20 +486,30 @@
 *** Buffers are saved in the desktop file in the same order as that in the
 buffer list.
 
+*** The desktop package can be customized to restore only some buffers immediately,
+remaining buffers are restored lazily (when Emacs is idle).
+
 *** New commands:
   - desktop-revert reverts to the last loaded desktop.
   - desktop-change-dir kills current desktop and loads a new.
   - desktop-save-in-desktop-dir saves desktop in the directory from which
     it was loaded.
+  - desktop-lazy-complete runs the desktop load to completion.
+  - desktop-lazy-abort aborts lazy loading of the desktop.
 
 *** New customizable variables:
   - desktop-save. Determins whether the desktop should be saved when it is
     killed.
-  - desktop-file-name-format.
+  - desktop-file-name-format. Format in which desktop file names should be saved.
   - desktop-path. List of directories in which to lookup the desktop file.
-  - desktop-locals-to-save.
-  - desktop-globals-to-clear.
-  - desktop-clear-preserve-buffers-regexp.
+  - desktop-locals-to-save. List of local variables to save.
+  - desktop-globals-to-clear. List of global variables that `desktop-clear' will clear.
+  - desktop-clear-preserve-buffers-regexp. Regexp identifying buffers that `desktop-clear'
+    should not delete.
+  - desktop-restore-eager. Number of buffers to restore immediately. Remaining buffers are
+    restored lazily (when Emacs is idle).
+  - desktop-lazy-verbose. Verbose reporting of lazily created buffers.
+  - desktop-lazy-idle-delay. Idle delay before starting to create buffers.
 
 *** New command line option --no-desktop
 
@@ -697,11 +726,6 @@
 doublequotes make no difference in the shell, but they prevent
 special treatment in `dired-do-shell-command'.
 
-+++
-*** Dired's v command now runs external viewers to view certain
-types of files.  The variable `dired-view-command-alist' controls
-what external viewers to use and when.
-
 *** In Dired, the w command now copies the current line's file name
 into the kill ring.  With a zero prefix arg, copies absolute file names.
 
@@ -737,7 +761,7 @@
 ** Info mode:
 
 *** A numeric prefix argument of `info' selects an Info buffer
-with the number appended to the *info* buffer name.
+with the number appended to the *info* buffer name (e.g. "*info*<2>").
 
 *** Regexp isearch (C-M-s and C-M-r) can search through multiple nodes.
 Failed isearch wraps to the top/final node.
@@ -746,6 +770,10 @@
 `Info-search-backward', and `Info-search-next' which repeats the last
 search without prompting for a new search string.
 
+*** New command `Info-history-forward' (bound to r and new toolbar icon)
+moves forward in history to the node you returned from after using
+`Info-history-back' (renamed from `Info-last').
+
 *** New command `Info-history' (bound to L) displays a menu of visited nodes.
 
 *** New command `Info-toc' (bound to T) creates a node with table of contents
@@ -1905,7 +1933,7 @@
 modes set require-final-newline.  By default that's C, C++ and
 Objective-C.
 
-The specified modes set require-final-newline based on 
+The specified modes set require-final-newline based on
 mode-require-final-newline, as usual.
 
 *** Format change for syntactic context elements.
@@ -2168,6 +2196,14 @@
 ---
 ** Rmail now displays 5-digit message ids in its summary buffer.
 
++++
+** Support for `movemail' from GNU mailutils was added to Rmail.
+This version of `movemail' allows to read mail from a wide range of
+mailbox formats, including remote POP3 and IMAP4 mailboxes with or
+without TLS encryption.  If GNU mailutils is installed on the system
+and its version of `movemail' can be found in exec-path, it will be
+used instead of the native one.
+
 ---
 ** On MS Windows, the "system caret" now follows the cursor.
 This enables Emacs to work better with programs that need to track
@@ -2501,6 +2537,13 @@
 ** `cfengine-mode' is a major mode for editing GNU Cfengine
 configuration files.
 
+* Incompatible Lisp Changes in Emacs 21.4
+
++++
+** Mode line display ignores text properties as well as the
+:propertize and :eval forms in the value of a variable whose
+`risky-local-variable' property is nil.
+
 * Lisp Changes in Emacs 21.4
 
 +++
@@ -2687,7 +2730,7 @@
 A newline may now have line-height and line-spacing text or overlay
 properties that control the height of the corresponding display row.
 
-If the line-height property value is 0, the newline does not
+If the line-height property value is t, the newline does not
 contribute to the height of the display row; instead the height of the
 newline glyph is reduced.  Also, a line-spacing property on this
 newline is ignored.  This can be used to tile small images or image
@@ -2701,10 +2744,19 @@
 is calculated by multiplying the default frame line height by the
 given value.
 
-If the line-height property value is a cons (RATIO . FACE), the
+If the line-height property value is a cons (FACE . RATIO), the
 minimum line height is calculated as RATIO * height of named FACE.
 RATIO is int or float.  If FACE is t, it specifies the current face.
 
+If the line-height property value is a cons (nil . RATIO), the line
+height is calculated as RATIO * actual height of the line's contents.
+
+If the line-height value is a cons (HEIGHT . TOTAL), HEIGHT specifies
+the line height as described above, while TOTAL is any of the forms
+described above and specifies the total height of the line, causing a
+varying number of pixels to be inserted after the line to make it line
+exactly that many pixels high.
+
 If the line-spacing property value is an positive integer, the value
 is used as additional pixels to insert after the display line; this
 overrides the default frame line-spacing and any buffer local value of
@@ -2713,11 +2765,6 @@
 If the line-spacing property may be a float or cons, the line spacing
 is calculated as specified above for the line-height property.
 
-If the line-spacing value is a cons (total . SPACING) where SPACING is
-any of the forms described above, the value of SPACING is used as the
-total height of the line, i.e. a varying number of pixels are inserted
-after each line to make each line exactly that many pixels high.
-
 ** The buffer local line-spacing variable may now have a float value,
 which is used as a height relative to the default frame line height.
 
@@ -3925,11 +3972,6 @@
 used to add text properties to mode-line elements.
 
 +++
-** Mode line display ignores text properties as well as the
-:propertize and :eval forms in the value of a variable whose
-`risky-local-variable' property is nil.
-
-+++
 ** The new `%i' and `%I' constructs for `mode-line-format' can be used
 to display the size of the accessible part of the buffer on the mode
 line.
--- a/etc/TUTORIAL.nl	Sun Jan 02 09:21:32 2005 +0000
+++ b/etc/TUTORIAL.nl	Sun Jan 16 03:40:12 2005 +0000
@@ -1,35 +1,35 @@
-Copyright (c) 1985 Free Software Foundation, Inc;  Zie de voorwaarden onderaan.
-Je leest nu de Emacs uitleg, zoals vertaald door Pieter Schoenmakers.
+Copyright (c) 1985, 2004, 2005 Free Software Foundation, Inc;  Zie de voorwaarden onderaan.
+Je leest nu de Emacs-inleiding, zoals vertaald door Pieter Schoenmakers.
 
-De meeste Emacs commando's gebruiken de CONTROL toets (soms CTRL of CTL
-genaamd) en/of de META toets (soms genaamd EDIT of ALT).  In plaats van
+De meeste Emacs-commando's gebruiken de CONTROL-toets (soms CTRL of CTL
+genaamd) en/of de META-toets (soms genaamd EDIT of ALT).  In plaats van
 steeds de volledige naam te noemen, gebruiken we de volgende afkortingen:
 
- C-<chr>  betekent: houd de CONTROL toets ingedrukt en type de toets <chr>
-	  Dus C-f wordt: houd de CONTROL toets ingedrukt en type f.
- M-<chr>  betekent: houd de META, EDIT of ALT toets ingedrukt en type de
+ C-<ltr>  betekent: houd de CONTROL-toets ingedrukt en tik de toets <ltr>
+	  Dus C-f wordt: houd de CONTROL-toets ingedrukt en tik f.
+ M-<ltr>  betekent: houd de META-, EDIT- of ALT-toets ingedrukt en tik de
 	  toets <chr>.  Als er geen toets META, EDIT of ALT is, kun je ook
-	  eerst de ESC toets typen, gevolgd door <chr>.  We refereren aan
+	  eerst de ESC-toets tikken, gevolgd door <ltr>.  We verwijzen naar
 	  de ESC toets als <ESC>.
 
-BELANGRIJK: om Emacs te verlaten, type C-x C-c (twee tekens).
-De tekens ">>" tegen de linker kantlijn nodigen je uit om een
+BELANGRIJK: om Emacs te verlaten, tik C-x C-c (twee tekens).
+De tekens ">>" tegen de linkerkantlijn nodigen je uit om een
 bepaald commando te proberen.  Bijvoorbeeld:
 <<Blank lines inserted here by startup of help-with-tutorial>>
->>  Type nu C-v (volgend scherm) om naar het volgende scherm te gaan.
-	(Geef nu het commando door de control toets ingedrukt te houden
-	terwijl je de v typt.)
+>>  Tik nu C-v (volgend scherm) om naar het volgende scherm te gaan.
+	(Geef nu het commando door de CONTROL-toets ingedrukt te houden
+	terwijl je de v tikt.)
 	Vanaf nu moet je dit steeds herhalen als je klaar bent met het
 	lezen van een scherm.
 
-Merk op dat er een tweeregelige overlap is als je van een scherm naar
-het volgende scherm gaat; dit zorgt voor continuïteit bij het lezen van
+Merk op dat er een overlapping van twee regels is als je van een scherm naar
+het volgende gaat; dat zorgt voor continuïteit bij het lezen van 
 de tekst.
 
-Het eerste wat je moet weten is hoe je naar verschillende plaatsen in de
-tekst kunt bewegen.  Je weet al hoe je een scherm vooruit moet gaan: met
-C-v.  Om een scherm terug te gaan, type M-v (houd de META toets ingedrukt
-en type v, of type <ESC>v als je geen META, EDIT of ALT toets hebt).
+Het eerste wat je moet weten, is hoe je je naar verschillende plaatsen in de
+tekst kan bewegen.  Je weet al hoe je een scherm vooruit moet gaan: met
+C-v.  Om een scherm terug te gaan, tik je M-v (houd de META-toets ingedrukt
+en tik v, of tik <ESC>-v als je geen META, EDIT of ALT toets hebt).
 
 >>  Probeer nu een paar keer M-v, steeds gevolgd door C-v.
 
@@ -43,22 +43,24 @@
 	M-v	ga een scherm terug
 	C-l	maak het scherm schoon en teken alle tekst
 		 opnieuw, waarbij de regel waarop de cursor
-		 staat op het midden van het scherm terecht
-		 komt.  (C-l is control-L, niet control-1.)
+		 staat, op het midden van het scherm terecht
+		 komt.  (C-l is CONTROL-L, niet CONTROL-1.)
 
->> Kijk waar de cursor is en onthoud de tekst in zijn omgeving.
-   Type C-l.
-   Zoek de cursor en merk op dat 'ie nog steeds bij dezelfde tekst staat.
+>> Kijk waar de cursor staat, en onthoud de tekst errond.
+   Tik C-l.
+   Zoek de cursor en merk op dat hij nog steeds bij dezelfde tekst staat.
 
 
 * BASISCOMMANDO'S CURSORBEWEGINGEN
 ----------------------------------
 
-Het is handig om per scherm te bewegen, maar hoe beweeg je nu
+Het is handig om je per scherm te bewegen, maar hoe beweeg je je nu
 naar een specifieke plaats op het scherm?
 
-Er is een aantal manieren waarop je dit kunt doen.  De basismanier is
-m.b.v de commando's C-p, C-b, C-f en C-n.  Elk van deze commando's
+Er is een aantal manieren waarop je dit kan doen.  Je kan de
+pijltjestoetsen gebruiken, maar het is efficïenter om je handen in de
+standaardhouding te laten, en de commando's C-p, C-b, C-f en C-n te
+gebruiken.  Elk van deze commando's 
 verplaatst de cursor precies een regel of teken in een bepaalde richting
 op het scherm.  Hier volgt een figuur met de vier commando's en de
 richting waarin ze de cursor bewegen:
@@ -71,85 +73,86 @@
 				  :
 			 volgende regel, C-n
 
->> Verplaats, m.b.v. C-n of C-p, de cursor naar de middelste regel van
-   de figuur.  Type dan C-l om de hele figuur in het midden van het
+>> Verplaats, met C-n of C-p, de cursor naar de middelste regel van
+   de figuur.  Tik dan C-l om de hele figuur in het midden van het
    centrum te plaatsen.
 
 Met een beetje kennis van het Engels zijn deze commando's gemakkelijk te
-onthouden: de P komt van previous (vorige), de N van next (volgende), de
-B van backward (achteruit) en de F van forward (vooruit).  Dit zijn de
-basiscommando's om de cursor te bewegen, dus je zult ze CONTINUE
-gebruiken: Het is slim als je ze nu leert te gebruiken.
+onthouden: de p komt van "previous" (vorige), de n van "next" (volgende), de
+b van "backward" (achteruit) en de f van "forward" (vooruit).  Dit zijn de
+basiscommando's om de cursor te bewegen, dus je zult ze VOORTDUREND
+gebruiken: het is vooruitziend als je ze nu leert te gebruiken.
 
->> Type een paar keer C-n om de cursor op deze regel te krijgen.
+>> Tik een paar keer C-n om de cursor op deze regel te krijgen.
 
->> Beweeg binnen de regel met C-f (herhaaldelijk) en terug omhoog met C-p
+>> Beweeg je binnen de regel met C-f (herhaaldelijk) en terug omhoog met C-p.
    Let op wat C-p doet als de cursor midden in een regel staat.
 
-Elke regel eindigt met een Newline teken (het Engelse `new line' betekent
-`nieuwe regel'); dit teken scheidt elke regel van de volgende.  De laatste
-regel in een bestand moet eigenlijk ook met een Newline eindigen (maar dat
-is niet noodzakelijk voor Emacs ).
+Elke regel eindigt met een Newline-teken (het Engelse "new line" betekent
+"nieuwe regel"); dit teken scheidt elke regel van de volgende.  De laatste
+regel in een bestand zou eigenlijk ook met een Newline moeten eindigen (maar dat
+is niet noodzakelijk voor Emacs).
 
->> Type het commando C-b terwijl de cursor aan het begin van een regel
-   staat.  De cursor zal naar het eind van de vorige regel bewegen,
+>> Probeer C-b aan het begin van een regel.
+   De cursor zal zich naar het eind van de vorige regel bewegen,
    omdat je achteruit over het Newline teken gaat.
 
-Net als C-b kan ook C-f over Newline tekens heen bewegen.
+Net als C-b kan ook C-f zich over Newline-tekens heen bewegen.
 
->> Type nog een aantal keren het commando C-b, zodat je door krijgt waar de
+>> Tik nog een aantal keren het commando C-b, zodat je een gevoel krijgt waar de
    cursor is.
-   Type dan enkele keren C-f om de cursor terug naar het einde van de regel
+   Tik dan enkele keren C-f om de cursor terug naar het einde van de regel
    te bewegen.
-   Een C-f commnado beweegt de cursor dan naar de volgende regel.
+   Een verder C-f commando beweegt de cursor dan naar de volgende regel.
 
-Wanneer je de cursor voorbij het begin of het einde van het scherm beweegt
-zal de tekst over het scherm heen schuiven.  Dit heet `scrollen', of
-`schuiven' in goed Nederlands.  Door te scrollen zorgt Emacs ervoor dat de
-cursor de gewenste beweging kan doen zonder dat de cursor van het scherm
+Wanneer je de cursor voorbij het begin of het einde van het scherm beweegt,
+zal de tekst over het scherm heen schuiven.  Dit heet "scrollen", of
+"schuiven" in goed Nederlands.  Door te scrollen zorgt Emacs ervoor dat de
+cursor de gewenste beweging kan maken zonder dat de cursor van het scherm
 af beweegt.
 
 >> Probeer de cursor voorbij de onderkant van het scherm te bewegen met
    C-n en zie wat er gebeurt.
 
-Als beweging op letterteken te langzaam gaat, kun je de cursor ook per
-woord bewegen.  M-f (Meta-f) beweegt de cursor een woord vooruit en M-b
+Als de beweging per teken te langzaam gaat, kan je de cursor ook per
+woord bewegen.  M-f (META-f) beweegt de cursor een woord vooruit en M-b
 een woord achteruit.
 
->> Type enkele keren M-f en M-b.
+>> Tik enkele keren M-f en M-b.
 
-Als je midden in een woord staat beweegt M-f de cursor naar het eind van
-het woord.  Als je op een witte ruimte tussen woorden staat beweegt M-f de
+Als je midden in een woord staat, beweegt M-f de cursor naar het eind van
+het woord.  Als je op een witte ruimte tussen twee woorden staat, beweegt M-f de
 cursor naar het eind van het volgende woord.  Het commando M-b beweegt
-analoog, de andere kant op.
+de cursor analoog de andere kant op.
 
->> Type enkele keren M-f en M-b en daar tussendoor enkele keren C-f en C-b,
+>> Tik enkele keren M-f en M-b en daar tussendoor een paar maal C-f en C-b,
    zodat je ziet wat M-f en M-b doen vanaf bepaalde plaatsen in een
    woord en tussen twee woorden.
 
-Merk op dat er een analogie zit tussen enerzijds C-f en C-b en
-anderzijds M-f en M-b.  Het is bij veel commando's zo dat Meta tekens
+Merk op dat er een analogie bestaat tussen enerzijds C-f en C-b en
+anderzijds M-f en M-b.  Het is bij veel commando's zo dat META-tekens
 gebruikt worden om iets te doen in eenheden van de taal (woorden,
-zinnen, alinea's) terwijl Control tekens te maken hebben met dingen die
-los staan van wat je aan het editten bent (tekens, regels, etc).
+zinnen, alinea's) terwijl Control-tekens te maken hebben met dingen die
+los staan van wat je aan het editeren bent (tekens, regels, enz.).
 
 Deze analogie gaat ook op voor regels en zinnen: C-a en C-e bewegen de
 cursor naar het begin of eind van een regel, terwijl met M-a,
-respectievelijk M-e, de cursor naar het begin of eind van een zin gaat.
+respectievelijk M-e, de cursor naar het begin, respectievelijk het eind,
+van een zin gaat.
 
->> Type enkele keren C-a en dan enkele keren C-e.
-   Type enkele keren M-a en dan  enkele keren M-e.
+>> Tik enkele keren C-a, en dan een enkele keren C-e.
+   Tik een paar maal M-a, en dan enkele keren M-e.
 
-Zie hoe herhaalde C-a commando's niets doen, terwijl herhaalde M-a
-commando's steeds een zin terug bewegen.  Alhoewel ze niet volledig
-overeenkomen is het gedrag van allebei niet onnatuurlijk.
+Bemerk hoe herhaalde C-a commando's niets doen, terwijl herhaalde M-a
+commando's de cursor steeds een zin achteruit bewegen.  Alhoewel ze niet volledig
+overeenkomen, is het gedrag van beide heel natuurlijk.
 
-De plaats van de cursor in de tekst wordt `punt' genoemd (zonder
-lidwoord, `point' in het Engels).  Anders gezegd: de cursor laat op het
-scherm de plek zien waarop punt in de tekst staat.
+De plaats van de cursor in de tekst wordt "punt" genoemd (zonder
+lidwoord, "point" in het Engels).  Anders gezegd: de cursor laat op het
+scherm de plek zien waar punt in de tekst staat.
 
-Nu volgt een samenvatting van eenvoudige cursorbewegingsoperaties,
-inclusief die commando's die per woord of zin bewegen:
+Nu volgt een samenvatting van eenvoudige cursorbewegingen,
+met inbegrip van de commando's die de cursor per woord of zin bewegen:
 
 	C-f	ga een teken vooruit
 	C-b	ga een teken achteruit
@@ -167,439 +170,444 @@
 	M-e	ga vooruit naar het eind van de zin
 
 >> Probeer al deze commando's een paar keer als oefening.
-   Deze commando's worden het frequentst gebruikt.
+   Deze commando's worden het vaakst gebruikt.
 
-Er zijn nog twee belangrijk cursorbewegingsoperaties: M-<
-(Meta kleiner-dan) beweegt de cursor naar het begin van het bestand,
-en M-> (Meta groter-dan) beweegt de cursor naar het eind.
+Er zijn nog twee belangrijke cursorbewegingen: M-<
+(META kleiner-dan) beweegt de cursor naar het begin van het bestand,
+en M-> (META groter-dan) beweegt hem naar het eind.
 
-Op de meeste toetsenborden zit de '<' boven de komma, zodat je de Shift
-toets (ook wel bekend als de hoofdlettertoets) moet gebruiken om het '<'
-teken in te typen.  Op deze toetsenborden moet je ook de shift gebruiken
-om M-< in te typen: zonder shift zou je M-, (Meta komma) typen.
+Op de meeste toetsenborden zit de '<' boven de komma, zodat je de
+Shift-toets (ook wel bekend als de hoofdlettertoets) moet gebruiken om het
+'<'-teken in te tikken.  Op deze toetsenborden moet je ook de shift
+gebruiken om M-< in te tikken: zonder shift zou je M-, (META komma) tikken.
 
->> Type nu M-< om naar het begin van dit bestand te gaan.
+>> Tik nu M-< om naar het begin van dit bestand te gaan.
    Gebruik daarna C-v om hier weer terug te komen.
 
->> Type nu M-> om naar het eind van het bestand te springen.
+>> Tik nu M-> om naar het eind van het bestand te springen.
    Gebruik daarna M-v om hier weer terug te komen.
 
-Als je toetsenbord pijltjestoetsen heeft kun je ook die gebruiken om de
-cursor te verplaatsen.  We raden je aan om C-b, C-f, C-n en C-p op zijn
-minst te leren, om drie redenen.  Ten eerste werken ze op alle
+Als je toetsenbord pijltjestoetsen heeft, kan je die ook gebruiken om de
+cursor te verplaatsen.  We raden je aan om C-b, C-f, C-n en C-p
+te leren, om drie redenen.  Ten eerste werken ze op alle 
 toetsenborden, ook die zonder pijltjestoetsen.  Ten tweede zul je merken
-dat, wanneer je eenmaal wat ervaring hebt opgedaan in het omgaan met
-Emacs, het gebruik van deze CTRL tekens sneller gaat dan het werken met
-pijltjestoetsen (omdat je handen in de typehouding kunnen blijven).  Ten
-derde, als je eenmaal gewend bent aan deze commando's met CTRL tekens,
-kun je makkelijk andere geavanceerde cursorbewegingscommando's leren.
+dat wanneer je eenmaal wat ervaring hebt opgedaan in de omgang met 
+Emacs, het gebruik van de CTRL-tekens sneller is dan werken met de 
+pijltjestoetsen (omdat je handen in de normale tikpositie kunnen blijven).  Ten 
+derde, als je eenmaal gewend bent aan deze commando's met CTRL-tekens, 
+kan je makkelijk andere gevorderde cursorbewegingscommando's leren.
 
-De meeste Emacs commando's accepteren een numeriek argument.  Voor de
+De meeste Emacs-commando's accepteren een numeriek argument.  Voor de
 meeste commando's is dit argument het aantal keren dat het commando
-herhaald moet worden.  Je geeft dit numerieke argument aan, dat vooraf
-gegaan wordt door het commando C-u, de cijfers van het getal te typen.
-Als je toetsenbord een META (of EDIT of ALT) toets heeft, is er ook
-een andere manier om het getal aan te geven: type de cijfers terwijl
+herhaald moet worden.  Je geeft dit numerieke argument aan met C-u en 
+vervolgens de cijfers van het getal, vóór het commando.  
+Als je toetsenbord een META- (of EDIT- of ALT-) toets hebt, is er ook
+een andere manier om het getal aan te geven: tik de cijfers terwijl
 je de META toets ingedrukt houdt.  We raden je aan de C-u manier te
-leren omdat die werkt op elk willekeurig toetsenbord.
+leren omdat die beschikbaar is op elke terminal.
 
 Bijvoorbeeld, C-u 8 C-f beweegt de cursor 8 plaatsen naar voren.
 
->> Probeer eens om met C-n of C-p en één numeriek argument de cursor
+>> Probeer eens om met C-n of C-p en een numeriek argument de cursor
    met slechts een commando naar een regel in de buurt van deze zin te
    bewegen.
 
 Voor de meeste commando's is het numerieke argument het aantal keren dat
-het commando herhaald moet worden.  Voor sommige commando's betekent het
-echter iets anders, en C-v en M-v vallen hier ook onder.  Met een numeriek
+het commando herhaald moet worden.  Voor sommige commando's  betekent het
+echter iets anders.  Verschillende commando's (die je totnogtoe niet 
+geleerd hebt) gebruiken het als een vlag -- de aanwezigheid van een 
+prefix-argument, ongeacht zijn waarde, maakt dat het commando iets anders
+doet.
+
+C-v en M-v vormen een andere uitzondering.  Met een numeriek
 argument verschuiven deze commando's de tekst het aangegeven aantal regels
 in plaats van (bijna) een heel scherm.  Bijvoorbeeld, C-u 4 C-v verschuift
 de tekst 4 regels.
 
 >> Probeer nu C-u 8 C-v.
 
-Als het goed is is de tekst daarmee 8 regels opgeschoven.  Als je weer
-terug omlaag wil scrollen kun je een argument aan M-v geven.
+Daarmee zou je tekst 8 regels opgeschoven moeten zijn.  Als je terug
+omlaag wil scrollen, kan je M-v een argument geven.
 
-Als je een windowing systeem gebruikt, zoals X Windows, dan zou je een
-lange rechthoek moeten zien aan de linkerkant van het Emacs window.  Deze
-rechthoek heet een scrollbar (misschien is `verschuifbalk' een goede
-vertaling).  Je kunt de tekst scrollen door met de muis in de scrollbar te
-klikken.
+Als je een scherm met vensters gebruikt, zoals X Windows of MS-Windows,
+zou je een grote rechthoek moeten zien aan de linkerkant van het
+Emacs-venster.  Deze rechthoek heet een schuifbalk ("scrollbar").  Je kan
+de tekst scrollen door met de muis in de schuifbalk te klikken.
 
->> Klik met de middelste muisknop bovenaan het donkere gebied in de
-   scrollbar.  Dit zou de tekst moeten scrollen naar een positie die
+>> Klik met de middelste muisknop bovenaan het heldere gebied in de
+   schuifbalk.  Dit zou de tekst moeten verschuiven naar een positie die
    afhankelijk is van hoe hoog of laag je klikt.
 
->> Beweeg de muis heen en weer terwijl je de middelste muisknop ingedrukt
-   houdt.  Je zult zien dat de tekst met de muis mee heen en weer scrollt.
+>> Beweeg de muis op en neer terwijl je de middelste muisknop ingedrukt
+   houdt.  Je zal zien dat de tekst met de muis mee heen en weer scrollt.
 
 
 * ALS EMACS HANGT
 -----------------
 
-Als Emacs niet meer op commando's reageert kun je haar veilig onderbreken
-door C-g te typen.  Je kunt C-g gebruiken om een commando te stoppen als
-het te lang duurt om het uit te voeren.
+Als Emacs niet meer op commando's reageert, kan je het veilig onderbreken
+door C-g te tikken.  Je kan C-g gebruiken om een commando te stoppen als
+het te lang duurt om uit te voeren.
 
-Je kunt C-g ook gebruiken om een numeriek argument weg te gooien of
-om het begin van een commando dat je niet wilt afmaken te vergeten.
+Je kan C-g ook gebruiken om een numeriek argument te verwijderen of om het
+begin van een commando dat je niet wilt afmaken, te verwijderen.
 
->> Type nu C-u 100 om een numeriek argument te maken met de waarde 100, en
-   type dan C-g.  Type vervolgens C-f.  Als het goed is is de cursor maar
-   één positie verplaatst, omdat je het argument weggegooid hebt met C-g.
+>> Tik nu C-u 100 om een numeriek argument te maken met de waarde 100, en
+   tik dan C-g.  Tik vervolgens C-f.  Het zou de cursor maar
+   één positie mogen verplaatsen, omdat je het argument verwijderd hebt met C-g.
 
-Als je per ongeluk een <ESC> typt kun je dat ongedaan maken met het
+Als je per ongeluk een <ESC> tikt, kan je dat ongedaan maken met het
 commando C-g.
 
 
 * ONMOGELIJKE COMMANDO'S
 ------------------------
 
-Sommige Emacs commando's zijn onmogelijk gemaakt zodat beginnende
-gebruikers ze niet per ongeluk kunnen uitvoeren.
+Sommige Emacs-commando's zijn uitgeschakeld zodat beginnende gebruikers ze
+niet per ongeluk kunnen uitvoeren.
 
-Als je één van de onmogelijke commando's intypt laat Emacs uitleg zien
-over het commando dat je gegeven hebt en vraagt of je het werkelijk uit
-wilt voeren.
+Als je een van de uitgeschakelde commando's intikt, laat Emacs uitleg zien
+over het commando dat je gegeven hebt, en vraagt of je het werkelijk wil
+uitvoeren.
 
-Wanneer je het commando echt wilt uitvoeren, type dan Spatie (de
-spatiebalk) als antwoord op de vraag.  Normaliter wil je het commando niet
-uitvoeren en beantwoord je de vraag met "n" (van `no' of `nee').
+Wanneer je het commando echt wil uitvoeren, tik dan Spatie (de
+spatiebalk) als antwoord op de vraag.  Normaal wil je het commando niet
+uitvoeren en beantwoord je de vraag met "n" (van "no" of "nee").
 
->> Type C-x C-l (een onmogelijk commando),
-   en type dan n als antwoord op de vraag.
+>> Tik C-x C-l (een uitgeschakeld commando),
+   en tik dan n als antwoord op de vraag.
 
 
 * VENSTERS
 ----------
 
 Emacs kan meerdere vensters laten zien, elk venster met zijn eigen tekst.
-We zullen later uitleggen hoe je met meerdere vensters om kunt gaan.  Op
+We zullen later uitleggen hoe je met meerdere vensters om kan gaan.  Op
 dit moment willen we slechts uitleggen hoe je van extra vensters af kunt
-komen en terug kunt keren naar simpelweg editten met 1 venster.  Het is
+komen en terug kan keren naar eenvoudig editeren met één venster.  Het is
 eenvoudig:
 
-	C-x 1	een enkel venster (i.e. gooi alle andere vensters weg)
+	C-x 1	een enkel venster (dat wil zeggen: verwijder alle andere vensters)
 
-Het commando is Control-x gevolgd door het cijfer 1.  C-x 1 vergroot het
+Het commando is CONTROL-x gevolgd door het cijfer 1.  C-x 1 vergroot het
 venster waar de cursor in staat tot het hele scherm.  Alle andere vensters
-worden weggegooid.
+worden verwijderd.
 
->> Zet de cursor op deze regel en type C-u 0 C-l.
->> Type nu Control-h k Control-f.
-   Zie hoe dit venster kleiner wordt, terwijl een nieuw venster verschijnt
+>> Zet de cursor op deze regel en tik C-u 0 C-l.
+>> Tik nu Control-h k Control-f.
+   Zie hoe dit venster kleiner is geworden, terwijl een nieuw venster verschijnt
    om de documentatie van het Control-f commando te laten zien.
 
->> Type nu C-x 1 en zie het documentatievenster verdwijnen.
+>> Tik nu C-x 1 en zie het documentatievenster verdwijnen.
 
 
 * TOEVOEGEN EN WEGHALEN
 -----------------------
 
-Als je tekst toe wilt voegen type je die eenvoudigweg in.  Tekens die je
-kunt zien, zoals A, 7, *, en dergelijke, worden door Emacs als tekst
-geïnterpreteerd en meteen aan de tekst.  Type <Return> (de `volgende regel'
-toets) om een Newline toe te voegen en dus een nieuwe regel te beginnen.
+Als je tekst toe wil voegen, tik je die eenvoudigweg in.  Tekens die je
+kan zien, zoals A, 7, * en dergelijke, worden door Emacs als tekst
+geïnterpreteerd en meteen aan de tekst toegevoegd.  Tik <Return> (de
+"volgende regel"-toets) om een Newline toe te voegen en dus een nieuwe
+regel te beginnen.
 
-Je kunt het laatste teken dat je intypte weghalen door <Delback> te typen.
-<Delback> is een toets op het toetsenbord--dezelfde toets die je normaal
-gesproken gebruikt, buiten Emacs, om het laatst ingetypte teken te wissen.
-Het is meestal een grote toets, een paar rijen boven de <Return> toets,
+Je kan het laatste teken dat je hebt ingetikt weghalen door <Delback> te tikken.
+<Delback> is een toets op het toetsenbord -- dezelfde toets die je normaal
+gesproken gebruikt, buiten Emacs, om het laatst ingetikte teken te wissen.
+Het is meestal een grote toets, een paar rijen boven de <Return>-toets,
 waar "Delete", "Del" of "Backspace" op staat.
 
 Als er op die grote toets "Backspace" staat, dan is dat degene die je
 gebruikt voor <Delback>.  Er kan op een andere plaats ook nog een andere
 toets zijn waarop "Delete" staat, maar dat is niet <Delback>.
 
-In het algemeen haalt <Delback> het teken dat juist voor de cursorpositie
-staat weg.
+In het algemeen haalt <Delback> het teken weg dat juist voor de cursorpositie
+staat.
 
->> Probeer dit nu: type een paar letters en haal ze weer weg door een paar
+>> Probeer dit nu: tik een paar letters en haal ze weer weg door een paar
    keer op <Delback> te drukken.  Maak je niet druk over het feit dat dit
-   bestand verandert; je zult niets veranderen aan de originele versie van
-   deze uitleg.  Je zit slechts je eigen kopie te wijzigen.
+   bestand verandert; je zal niets veranderen aan de originele versie van
+   deze inleiding.  Je zit slechts je eigen kopie te wijzigen.
 
-Als een regel tekst te lang wordt om de regel op het scherm te laten
-zien dan gaat de regel verder op een volgende schermregel.  Een backslash
-("\") in de rechtermarge laat dan zien dat de regel op de volgende
-schermregel verder gaat.
+Als een regel tekst te lang wordt om helemaal op het scherm getoond
+te worden, dan gaat hij verder op de volgende schermregel.  Een backslash
+("\") in de rechtermarge (of, als je een scherm met vensters
+gebruikt, een kleine gebogen pijl) laat dan zien dat de regel op de
+volgende schermregel verder gaat.
 
 >> Voeg nu tekst toe totdat je de rechter kantlijn raakt, en blijf
-   toevoegen.  Je zult zien dat er een vervolgregel verschijnt.
+   toevoegen.  Je zal zien dat er een vervolgregel verschijnt.
 
->> Type weer enkele keren <Delback> om zoveel tekens weg te halen tot
+>> Tik weer enkele keren <Delback> om zoveel tekens weg te halen tot
    de regel weer op een schermregel past.  De vervolgregel zal verdwijnen.
 
-Je kunt een Newline weggooien als elk ander teken.  Als je een Newline
-weggooit voeg je de twee regels waar de Newline tussen staat samen tot een
+Je kan een Newline zoals elk ander teken verwijderen.  Als je een Newline
+verwijdert, voeg je de twee regels waar de Newline tussen staat samen tot een
 enkele regel.  Als de regel die het resultaat is van deze operatie niet op
-een schermregel past zal hij getoond worden met een vervolgregel.
+een schermregel past, zal hij getoond worden met een vervolgregel.
 
->> Beweeg de cursor naar het begin van een regel en type <Delback>.  Dit
+>> Beweeg de cursor naar het begin van een regel en tik <Delback>.  Dit
    voegt de huidige en vorige regel samen.
 
->> Type <Return> om de Newline die je net weggooide weer toe te voegen.
+>> Tik <Return> om de Newline die je net verwijderd hebt weer toe te voegen.
 
-Je herinnert je dat je bij de meeste Emacs commando's het aantal keren dat
-iets herhaald moet worden, op kunt geven.  Dit geldt ook voor gewone tekens.
-Als je een gewoon teken herhaalt wordt dat teken herhaaldelijk toegevoegd.
+Je herinnert je dat je bij de meeste Emacs-commando's het aantal keren op kan 
+geven, dat ze herhaald moeten worden.  Dit geldt ook voor gewone tekens.
+Als je een gewoon teken herhaalt, wordt dat teken herhaaldelijk toegevoegd.
 
->> Probeer dat nu: type C-u 8 * om ******** toe te voegen.
+>> Probeer dat nu: tik C-u 8 * om ******** toe te voegen.
 
-Je hebt nu de basismanier geleerd om iets in Emacs te typen en fouten te
-corrigeren.  Je kunt tekst ook per woord of regel weggooien.  Hier volgt
+Je hebt nu de eenvoudigste manier geleerd om iets in Emacs te tikken en fouten te
+verbeteren.  Je kan tekst ook per woord of regel verwijderen.  Hier volgt
 een samenvatting van de commando's om tekst te verwijderen:
 
 	<Delback>    haal het teken weg dat voor de cursor staat
-	C-d	     haal het teken weg dat achter de cursor staat
+	C-d   	     haal het teken weg dat achter de cursor staat
 
-	M-<Delback>  gooi het woord weg dat voor de cursor staat
-	M-d	     gooi het woord weg dat achter de cursor staat
+	M-<Delback>  verwijder het woord dat voor de cursor staat
+	M-d	     verwijder het woord dat achter de cursor staat
 
-	C-k	     gooi alles weg van de cursor tot het eind van de regel
-	M-k	     gooi alles weg van de cursor tot het eind van de zin
+	C-k	     verwijder alles van de cursor tot het eind van de regel
+	M-k	     verwijder alles van de cursor tot het eind van de zin
 
-Merk op dat <Delback> en C-d met M-<Delback> en M-d de analogie die begon
-met C-f en M-f verder trekken (waarbij we voor het gemak even vergeten dat
+Merk op dat <Delback> en C-d, met M-<Delback> en M-d de analogie verder 
+trekken, die begon met C-f en M-f  (waarbij we voor het gemak even vergeten dat
 <Delback> niet echt een control teken is).  C-k en M-k lijken enigzins op
 C-e en M-e in hun relatie tot regels en zinnen.
 
-Als je meer dan een enkel teken tegelijk weghaalt bewaart Emacs de tekst
-die je weggooit zodat je hem weer terug kunt halen.  Weggegooide tekst
-terughalen heet "yanken".  Je kunt weggegooide tekst terugbrengen op de
-plaats waar je hem hebt weggegooid of op een andere plaats in de tekst.
-Je kunt ook meerdere keren yanken om er meedere kopieën van te maken.  Het
+Als je meer dan een enkel teken tegelijk weghaalt, bewaart Emacs de tekst
+die je verwijdert, zodat je hem weer terug kan halen.  Verwijderde tekst
+terughalen heet "yanken".  Je kan verwijderde tekst terugbrengen op de
+plaats waar je hem hebt verwijderd of op een andere plaats in de tekst.
+Je kan ook meerdere keren yanken om er meedere kopieën van te maken.  Het
 yank-commando is C-y.
 
-Merk op dat er een verschil is tussen het weghalen en weggooien van iets:
-iets dat je hebt weggooid kun je terugbrengen, maar iets dat je hebt
-weggehaald niet.  (In het Engels is het verschil tussen `killing' en
-`deleting' duidelijker dan tussen de Nederlandse vertaling `weggooien' en
-`weghalen'.)  In het algemeen geldt dat de commando's die meer tekst dan
-een enkel teken, Newline of spatie verwijderen deze tekst bewaren zodat die
+Merk op dat er een verschil is tussen iets weghalen en iets verwijderen:
+iets dat je hebt verwijderd, kan je terugbrengen, maar iets dat je hebt
+weggehaald niet.  (In het Engels is het verschil tussen "killing" en
+"deleting" duidelijker dan tussen de Nederlandse vertalingen "verwijderen" en
+"weghalen".)  In het algemeen geldt dat de commando's die meer tekst dan
+een enkel teken, Newline of spatie verwijderen, deze tekst bewaren zodat hij
 geyankt kan worden, terwijl dat niet geldt voor commando's die slechts een
 enkel teken weghalen.
 
 >> Zet de cursor op het begin van een regel die niet leeg is.
-   Type C-k om de tekst op die regel weg te gooien.
->> Type C-k een tweede keer.  Nu gooit dit commando het Newline teken
-   weg.
+   Tik C-k om de tekst op die regel te verwijderen.
+>> Tik C-k een tweede keer.  Nu verwijdert dit commando het Newline-teken.
 
-Merk op hoe een enkel C-k commando de inhoud van een regel weggooit, een
+Merk op hoe een enkel C-k commando de inhoud van een regel verwijdert, een
 tweede C-k commando de regel zelf zodat alle volgende regels een regel
-omhoog komen.  Het numerieke argument is voor C-k bijzonder: het aangegeven
-aantal regels zal worden weggegooid, inclusief de inhoud.  Dit is meer dan
-simpelweg herhaling: C-u 2 C-k gooit twee regels weg, terwijl tweemaal
-C-k typen dat niet doet.
+omhoog komen.  Het numerieke argument is voor C-k bijzonder: het aangegeven 
+aantal regels zal worden verwijderd, inclusief de inhoud.  Dit is meer dan
+simpelweg herhaling: C-u 2 C-k verwijdert twee regels, terwijl tweemaal
+C-k tikken dat niet doet.
 
-Om de laatst weggegooide tekst terug te halen naar de plaats waar de
-cursor nu op staat (te yanken), type C-y.
+Om de laatst verwijderde tekst terug te halen naar de plaats waar de
+cursor nu op staat (te yanken), tik C-y.
 
->> Probeer het nu: type C-y om de tekst te yanken.
+>> Probeer het nu: tik C-y om de tekst te yanken.
 
 Het is alsof je met C-y iets uit de prullenbak haalt wat je net had
-weggegooid.  Merk op dat verschillende C-k's achter elkaar alle regels
-die weggegooid worden bij elkaar bewaart zodat een enkele C-y die regels
+verwijderd.  Merk op dat verschillende C-k's achter elkaar alle regels
+die verwijderd worden, bij elkaar bewaart zodat een enkele C-y die regels
 in een keer terugbrengt.
 
->> Probeer het nu: type C-k een paar keer.
+>> Probeer het nu: tik C-k een paar keer.
 
-Om de weggegooide tekst terug te halen:
+Om de verwijderde tekst terug te halen:
 
->> Type C-y.  Beweeg de cursor enkele regels naar beneden en type weer C-y.
-   Je ziet nu hoe je tekst kunt kopiëren.
+>> Tik C-y.  Beweeg de cursor enkele regels naar beneden en tik weer C-y.
+   Je ziet nu hoe je tekst kan kopiëren.
 
-Wat nu te doen als je tekst terug wilt brengen, maar je hebt intussen al
-iets anders weggegooid?  C-y zou datgene terugbrengen wat je het
-recentst hebt weggegooid.  Gelukkig is de voorgaande tekst niet verloren
-gegaan.  Je kunt die tekst terughalen met M-y.  Nadat je C-y hebt getypt
+Wat moet je doen als je wat tekst terug wilt brengen, maar je intussen
+al iets anders verwijderd hebt?  C-y zou datgene terugbrengen wat je het
+recentst hebt verwijderd.  Gelukkig is de voorgaande tekst niet verloren
+gegaan.  Je kunt die tekst terughalen met M-y.  Nadat je C-y hebt getikt
 om de recentst weggegooide tekst terug te halen, vervangt M-y die tekst
 met de tekst die je daarvoor had weggegooid.  Je kunt M-y herhalen om
-tekst terug te halen die je reeds langer geleden hebt weggegooid.  Als
-je de tekst te pakken hebt die je zocht hoef je niets te doen om die
-daar te houden.  Je kunt gewoon verder werken en de teruggehaalde tekst
+tekst terug te halen die je al langer geleden hebt weggegooid.  Als
+je de tekst te pakken hebt die je zocht, hoef je niets te doen om die
+daar te houden.  Je kan gewoon verder werken en de teruggehaalde tekst
 met rust laten.
 
-Als je M-y vaak genoeg typt kom je terug waar je begon, bij de recentst
-weggegooide tekst.
+Als je M-y vaak genoeg tikt kom je terug waar je begon, bij de laatst
+verwijderde tekst.
 
->> Gooi een regel weg, beweeg de cursor wat, en gooi nog een regel weg.
-   Type C-y om de tweede regel die je weggooide terug te halen.
-   Type nog een M-y en die regel wordt vervangen door de eerste regel
-   die je weggooide.
-   Type nog enkele keren M-y en zie wat er langs komt.  Herhaal dit tot de
+>> Verwijder een regel, beweeg de cursor wat, en verwijder nog een regel.
+   Tik C-y om de tweede regel die je verwijderde, terug te halen.
+   Tik nog een M-y en die regel wordt vervangen door de eerste regel
+   die je verwijderde.
+   Tik nog enkele keren M-y en zie wat er langs komt.  Herhaal dit tot de
    tweede regel weer langs komt, en dan nog een paar keer.
-   Je kunt ook experimenteren met positieve en negatieve argumenten aan
+   Je kan ook experimenteren met positieve en negatieve argumenten bij
    M-y.
 
 
 * HERSTELLEN
 ------------
 
-Als je de tekst veranderd hebt en als je daar toch niet tevreden mee bent,
-dan kun je de verandering ongedaan maken met het herstel commando, C-x u.
+Als je de tekst veranderd hebt en je daar toch niet tevreden mee bent,
+dan kan je de verandering ongedaan maken met het herstelcommando, C-x u.
 
 Normaal gesproken herstelt C-x u de veranderingen die het gevolg zijn van
-een enkel commando; door herhaaldelijk C-x u te typen, worden steeds
+een enkel commando; door herhaaldelijk C-x u te tikken, worden steeds
 eerdere commando's hersteld.
 
 Er zijn echter twee uitzonderingen: commando's die de tekst niet wijzigen,
 zoals cursorbewegingen, worden overgeslagen, en commando's die simpelweg
-de ingetypte letter aan de tekst toevoegen worden meestal gegroepeerd
+het ingetikte teken aan de tekst toevoegen, worden meestal gegroepeerd
 in groepjes van maximaal 20 tekens, zodat je minder vaak het commando
-C-x u hoeft te typen om het toevoegen van tekst te herstellen.
+C-x u hoeft te tikken om teksttoevoegingen te herstellen.
 
 >> Gooi deze regel weg met C-k; met C-x u zou hij weer moeten verschijnen.
 
 C-_ is een alternatief voor C-x u.  Het levert exact hetzelfde resultaat
-op, maar het is makkelijker om dat een paar keer achter elkaar te typen.
-Een nadeel van C-_ is dat op sommige toetsenborden het intypen ervan
-niet triviaal is.  Dat is ook de reden voor het alternatief, C-x u.  Op
-sommige terminals kun je C-_ typen door te doen alsof je C-/ typt.
+op, maar is makkelijker om een paar keer achter elkaar te tikken.  Een
+nadeel van C-_ is dat op sommige toetsenborden het intikken ervan niet
+gebruiksvriendelijk is.  Dat is ook de reden voor het alternatief, C-x u.
+Op sommige terminals kan je C-_ tikken door "/" te tikken terwijl je de
+CONTROL-toets ingedrukt houdt.
 
-Een numeriek argument aan C-_ of C-x u duidt het aantal herhalingen aan.
+Een numeriek argument bij C-_ of C-x u duidt het aantal herhalingen aan.
 
 
 * BESTANDEN
 -----------
 
-Om een tekst die je gemaakt of veranderd hebt op te slaan moet je de
-tekst in een bestand bewaren (`to save a file' in het Engels).  Als je
-dat niet doet ben je die veranderingen kwijt op het moment dat je uit
-Emacs gaat.  Je kunt een bestand veranderen door het bestand te `bezoeken'.
-(Ook wel `vinden'; `finding' of `visiting' in het Engels.)
+Om een tekst die je gemaakt of veranderd hebt op te slaan, moet je de tekst
+in een bestand stoppen ("to save a file" in het Engels).  Als je dat niet
+doet, ben je die veranderingen kwijt op het moment dat je Emacs verlaat.
+Je kan een bestand veranderen door het bestand te "bezoeken".  (Ook wel
+"vinden"; "finding" of "visiting" in het Engels.)
 
-Het bezoeken van een bestand betekent dat je de inhoud van dat bestand
-in Emacs ziet.  Het lijkt er dan op alsof je het bestand aan het
-veranderen bent.  Echter, deze veranderingen zijn slechts tijdelijk
-zolang je het bestand niet bewaart.  Op deze manier kun je nooit per
-ongeluk een half gewijzigd bestand op het systeem achterlaten.  Zelfs
-als je het bestand bewaart, zorgt Emacs ervoor dat het originele
-bestand onder een gewijzigde naam nog steeds beschikbaar is, voor het
-geval je later besluit dat de veranderingen toch niet zo'n goed plan
-waren.
+Een bestand bezoeken betekent dat je de inhoud van dat bestand in
+Emacs ziet.  Het lijkt er dan op alsof je het bestand aan het veranderen
+bent.  Deze veranderingen zijn echter slechts tijdelijk zolang je het
+bestand niet opslaat.  Op deze manier kan je nooit per ongeluk een half
+gewijzigd bestand op het systeem achterlaten.  Zelfs als je het bestand
+opslaat, zorgt Emacs ervoor dat het originele bestand onder een gewijzigde
+naam nog steeds beschikbaar is, voor het geval je later besluit dat de
+veranderingen toch niet zo goed waren.
 
-In de buurt van de onderkant van het scherm zie je een regel die begint en
+Bij de onderkant van het scherm zie je een regel die begint en 
 eindigt met streepjes, met aan het begin "--:-- TUTORIAL.nl" of iets
 dergelijks.  Dit deel van het scherm laat normaal de naam van het bestand
 zien dat je op dat moment bezoekt.  Op dit moment bezoek je een bestand
 dat "TUTORIAL.nl" heet; het is je eigen kopie van de Nederlandstalige
-Emacs uitleg (`tutorial' in het Engels).  Als je in Emacs een bestand
+Emacs-inleiding ("tutorial" in het Engels).  Als je in Emacs een bestand
 bezoekt dan staat de naam van het bestand altijd op deze plaats.
 
-De commando's om een bestand te bezoeken of te bewaren zijn anders dan de
+De commando's om een bestand te bezoeken of op te slaan zijn anders dan de
 commando's die je tot nu toe geleerd hebt; ze bestaan namelijk uit twee
 tekens.  Beide commando's beginnen met het teken Control-x.  Er zijn een
 heleboel commando's die met Control-x beginnen.  Veel van die commando's
-hebben te maken met bestanden, buffers, en daaraan gerelateerde zaken.
+hebben te maken met bestanden, buffers, en gelijkaardige dingen.
 Dergelijke commando's bestaan uit twee, drie of vier tekens.
 
-Nog iets bijzonders aan het commando om een bestand te bezoeken is dat
-je aan moet geven welk bestand je wilt.  Dit heet dat het commando "een
+Nog iets bijzonders aan het commando om een bestand te bezoeken, is dat je
+aan moet geven welk bestand je wil.  Dit heet dat het commando "een
 argument van de gebruiker vraagt"; in dit geval de naam van het bestand.
 Nadat je het commando
 
-	C-x C-f		bezoek bestand (met de f van `find file')
+	C-x C-f		bezoek bestand (met de f van "find file")
 
-hebt getypt vraagt Emacs om de naam van het bestand.  De naam die je
-intypt verschijnt op de onderste regel van het scherm.  Wanneer die regel
-voor dit soort invoer gebruikt wordt, heet ze de minibuffer.  Je kunt de
-gebruikelijke Emacs commando's gebruiken om de filename in te typen.
+hebt getikt vraagt Emacs om de naam van het bestand.  De naam die je
+intikt verschijnt op de onderste regel van het scherm.  Wanneer die regel
+voor dit soort invoer gebruikt wordt, heet hij de minibuffer.  Je kan gewone
+Emacs commando's gebruiken om de bestandsnaam te veranderen.
 
-Tijdens het invoeren van de naam van het bestand (of willekeurig wat
-voor minibuffer invoer) kun je het commando afbreken met C-g.
+Tijdens het invoeren van de bestandsnaam (of om het even welke
+invoer in de minibuffer) kan je het commando afbreken met C-g.
 
->> Type C-x C-f gevolgd door C-g.  Dit commando breekt de minibuffer af en
+>> Tik C-x C-f gevolgd door C-g.  Dit commando breekt de minibuffer af en
    ook het C-x C-f commando dat van de minibuffer gebruik maakte.
-   Netto resultaat is dat je geen bestand bezoekt.
+   Het resultaat is dat je geen bestand bezoekt.
 
-Als je de naam van een bestand hebt ingevoerd, type dan <Return> om het
-af te sluiten.  Hierna gaat het C-x C-f commando aan het werk en haalt
+Als je de naam van een bestand hebt ingevoerd, tik dan <Return> om het
+commando af te sluiten.  Hierna gaat het C-x C-f commando aan het werk en haalt
 het bestand op dat je aangegeven hebt.  Als het C-x C-f commando daarmee
-klaar is,verdwijnt de minibuffer.
+klaar is, verdwijnt de minibuffer.
 
-Na korte tijd verschijnt de inhoud van het bestand op het scherm en kun
-je de inhoud wijzigen.  Als je de wijzigingen op wilt slaan, type dan het
+Na korte tijd verschijnt de inhoud van het bestand op het scherm en kan
+je de inhoud wijzigen.  Als je de wijzigingen op wilt slaan, tik dan het
 commando
 
-	C-x C-s   bewaar bestand (met de s van `save file')
+	C-x C-s   sla bestand op (met de s van "save file")
 
-Dit commando bewaart de tekst zoals Emacs die nu heeft in het bestand.
-De eerstekeer dat je dit doet bewaart Emacs het originele bestand onder een
-andere naam zodat het nog niet verloren is.  De nieuwe naam bestaat uit de
-oude naam gevolgd door een "~".
+Dit commando slaat de tekst zoals Emacs die nu heeft in het bestand op. 
+De eerste keer dat je dit doet, slaat Emacs het originele bestand onder een
+andere naam op, zodat het niet verloren gaat.  De nieuwe naam bestaat uit de
+oude bestandsnaam gevolgd door een "~".
 
-Als Emacs klaar is het bestand te bewaren laat ze de naam van het bestand
-zien.  Het is een goede gewoonte een bestand redelijk vaak te bewaren
+Als Emacs het bestand heeft opgeslagen, laat het de naam van het
+bestand zien.  Het is een goede gewoonte een bestand regelmatig te op te slaan
 zodat er niet teveel werk verloren gaat als het systeem hangt of crasht.
 
->> Type C-x C-s, om je kopie van deze uitleg te bewaren.  Als het goed is
+>> Tik C-x C-s, om je kopie van deze inleiding op te slaan.  Als het goed is
    verschijnt "Wrote ...TUTORIAL" op de onderste schermregel.
 
 OPMERKING: Op sommige systemen gebeurt er helemaal niets als je C-x C-s
-typt, en daarna ook niets meer.  Dit komt door een eigenschap van de
-machine waarop je werkt die te maken heeft met `flow control'.  Met C-s
-stopt de `flow' en komt niets meer van wat je typt bij Emacs terecht.  Om
-deze situatie te herstellen, type C-q.  Lees daarna de "Spontaneous Entry
-to Incremental Search" sectie in het Emacs handboek over hoe om te gaan
-met deze situatie.
+tikt, en daarna ook niets meer.  Dit komt door een eigenschap van de
+machine waarop je werkt die te maken heeft met "flow control".  Met C-s
+stopt de "flow" en komt niets meer van wat je tikt bij Emacs terecht.  Om
+deze situatie te herstellen, tik C-q.  Lees daarna het hoofdstuk
+"Spontaneous Entry to Incremental Search" in het Emacs-handboek over hoe
+je moet omgaan met deze situatie.
 
-Je kunt een bestaand bestand bezoeken, om het te bekijken of het te
-wijzigen.  Je kunt ook een bestand bezoeken dat nog niet bestaat.  Dit is
-dé manier om met Emacs een nieuw bestand te maken: bezoek het bestand, dat
-initieel leeg zal zijn, en voeg tekst toe.  Zodra je de tekst bewaart
-wordt het bestand werkelijk gecreëerd, met de tekst als inhoud.  Vanaf dat
+Je kan een bestaand bestand bezoeken om het te bekijken of het te
+wijzigen.  Je kan ook een bestand bezoeken dat nog niet bestaat.  Dit is
+de manier om met Emacs een nieuw bestand te maken: bezoek het bestand, dat
+eerst leeg zal zijn, en voeg tekst toe.  Zodra je de tekst opslaat, wordt
+het bestand werkelijk gecreëerd, met de tekst als inhoud.  Vanaf dat
 moment ben je dus bezig met een bestaand bestand.
 
 
 * BUFFERS
 ---------
 
-Als je een tweede bestand bezoekt met C-x C-f blijft het eerste bestand
-gewoon in Emacs.  Je kunt naar dat bestand terug door het gewoon nog een
-keer te bezoeken met C-x C-f.  Op deze manier kun je een behoorlijk aantal
+Als je een tweede bestand bezoekt met C-x C-f, blijft het eerste bestand
+gewoon in Emacs.  Je kan naar dat bestand terug door het gewoon nog een
+keer te bezoeken met C-x C-f.  Op deze manier kan je een behoorlijk aantal
 bestanden in Emacs krijgen.
 
->> Creëer een bestand dat "foo" heet door te typen: C-f C-f foo
-   <Return>.  Voeg hieraan wat tekst toe en bewaar "foo"
-   door C-x C-s te typen.  Type hierna C-x C-f TUTORIAL <Return> om
-   weer hier, in de uitleg, terug te komen.
+>> Creëer een bestand dat "foo" heet door te tikken: C-f C-f foo
+   <Return>.  Voeg hieraan wat tekst toe, wijzig hem, en sla "foo" op
+   door C-x C-s te tikken.  Tik hierna C-x C-f TUTORIAL <Return> om
+   weer hier, in de inleiding, terug te komen.
 
 Emacs bewaart intern de tekst van elk bestand in een ding dat een "buffer"
 genoemd wordt.  Als je een bestand bezoekt wordt er een nieuwe buffer
-gemaakt.  Om een lijst van de huidige buffers te zien, type
+gemaakt.  Om een lijst van de huidige buffers te zien, tik
 
 	C-x C-b   laat de bufferlijst zien
 
 >> Probeer C-x C-b nu.
 
-Zie dat elke buffer een naam heeft en mogelijk ook een bestandsnaam; dit
+Bemerk dat elke buffer een naam heeft en mogelijk ook een bestandsnaam; dit
 is de naam van het bestand waarmee de buffer overeenkomt.  Sommige buffers
 hebben niets met een bestand te maken.  Bijvoorbeeld, de buffer die
 "*Buffer List*" heet heeft geen bestand.  Die buffer is de buffer die de
 lijst bevat die door C-x C-b gemaakt wordt.  ALLE tekst die je in een
 Emacs venster ziet is altijd onderdeel van een of andere buffer.
 
->> Type C-x 1 om de bufferlijst te verwijderen.
+>> Tik C-x 1 om de bufferlijst te verwijderen.
 
 Als je de tekst van het ene bestand verandert en dan een ander bestand
-bezoekt dan wordt het eerste bestand niet bewaard.  De wijzigingen blijven
+bezoekt, wordt het eerste bestand niet opgeslagen.  De wijzigingen blijven
 in Emacs, in de buffer die bij het bestand hoort.  Het creëren of
-modificeren van de buffer van het tweede bestand heeft geen effect op de
+veranderen van de buffer van het tweede bestand heeft geen effect op de
 eerste buffer.  Dit is erg nuttig, maar betekent ook dat er een eenvoudige
 manier nodig is om het eerste bestand te bewaren.  Het zou erg vervelend
 zijn om er eerst naar terug te moeten gaan met C-x C-f om het dan te
 kunnen bewaren met C-x C-s.  Dus hebben we het commando:
 
-	C-x s	bewaar een paar buffers
+	C-x s	  sla een paar buffers op
 
 C-x s vraagt voor elke buffer die veranderingen heeft die nog niet
 opgeslagen zijn, of je de buffer wilt bewaren.
 
->> Voeg wat tekst toe en type C-x s.
+>> Voeg wat tekst toe en tik C-x s.
    Emacs vraagt nu of je de buffer die TUTORIAL.nl heet wilt bewaren.
-   Beantwoord deze vraag positief door een "y" in te typen (de y van
+   Beantwoord deze vraag positief door een "y" in te tikken (de y van
    "yes", Engels voor "ja").
 
 
@@ -609,28 +617,28 @@
 Er zijn veel meer Emacs commando's dan er op de toetsen van het
 toetsenbord passen, zelfs als we hun aantal kunnen vergroten door de
 control of meta toets te gebruiken.  Emacs lost dit probleem op met het X
-commando (met de X van eXtensie of uitbreiding).  Het X commando komt in
-twee smaken voor:
+commando (met de X van eXtensie of uitbreiding).  Het X commando komt voor in
+twee smaken:
 
-	C-x	teken eXtensie; wordt gevolgd door een teken
-	M-x	genaamd commando eXtensie; wordt gevolgd door een naam.
+	C-x	Tekenuitbreiding.  Bevolgd door een teken.
+	M-x	Commando-naam-uitbreiding.  Wordt gevolgd door een naam.
 
 Deze commando's zijn in het algemeen nuttig, maar worden minder gebruikt
-dan de commando's die tot nu toe uitgelegd zijn.  Je hebt al twee van deze
+dan de commando's die je tot nu toe al geleerd hebt.  Je hebt al twee van deze
 commando's gezien: C-x C-f om een bestand te bezoeken, en C-x C-s om het
 te bewaren.  Een ander voorbeeld is het commando om Emacs te verlaten: dit
 is C-x C-c.  (Maak je geen zorgen over het verloren gaan van veranderingen
-die niet bewaard zijn; C-x C-c vraagt of je veranderde buffers wilt
-bewaren voordat Emacs daadwerkelijk eindigt.)
+die niet opgeslagen zijn; C-x C-c vraagt of je veranderde buffers wilt
+bewaren voordat Emacs helemaal eindigt.)
 
 C-z is het commando om Emacs *tijdelijk* te verlaten, zodat je daarna weer
-terug kunt keren in dezelfde Emacs sessie.
+terug kan keren in dezelfde Emacs-sessie.
 
 Op systemen die deze mogelijkheid bieden, zet C-z Emacs stil: je komt weer
-terug in de shell, maar Emacs is nog aanwezig.  In de meeste shells kun je
+terug in de shell, maar Emacs is nog aanwezig.  In de meeste shells kan je
 Emacs weer activeren met het "fg" commando, of met "%emacs".
 
-Op systemen die niet de mogelijkheid bieden om programma's stil te zetten
+Op systemen die niet de mogelijkheid bieden om programma's stil te zetten,
 creëert C-z een subshell onder Emacs om je zo in de gelegenheid te
 stellen andere programma's uit te voeren en daarna weer in Emacs terug te
 keren; Emacs wordt dus niet werkelijk verlaten.  In dit geval is het
@@ -639,7 +647,7 @@
 
 Het moment om C-x C-c te gebruiken is wanneer je uit gaat loggen.  Het is
 ook het juiste commando om Emacs te beëindigen wanneer Emacs opgestart
-was door een mail programma of iets dergelijks, aangezien die misschien
+was door een mail-programma of iets dergelijks, aangezien die misschien
 niet met een stilgezette Emacs om kunnen gaan.  Normaal gezien is het
 echter beter Emacs stil te zetten met C-z dan om Emacs te verlaten,
 behalve als je uit wilt loggen natuurlijk.
@@ -648,278 +656,278 @@
 kent:
 
 	C-x C-f		bezoek bestand
-	C-x C-s		bewaar bestand
+	C-x C-s		sla bestand op
 	C-x C-b		laat bufferlijst zien
 	C-x C-c		verlaat Emacs
 	C-x u		herstel
 
-Commando's waaraan een uitgebreid commando wordt toegevoegd, worden nog
-minder vaak gebruikt, of worden alleen onder bepaalde omstandigheden gebruikt.
+Commando-naam-bevelen worden nog minder vaak gebruikt, of alleen onder bepaalde omstandigheden. 
 Een voorbeeld is het commando replace-string, dat in de hele tekst een string
-vervangt door een andere string (`to replace' betekent `vervangen').
-Als je M-x typt echoot Emacs onderaan het scherm `M-x' en moet je de naam van
-het commando intypen, in dit geval "replace-string".  Als je gewoon
-"repl s<TAB>" typt maakt Emacs de naam zelf af.  Beëindig het commando
+vervangt door een andere string ("to replace" betekent "vervangen").
+Als je M-x tikt, toont Emacs onderaan het scherm "M-x" en moet je de naam van
+het commando intikken, in dit geval "replace-string".  Als je gewoon
+"repl s<TAB>" tikt maakt Emacs de naam zelf af.  Beëindig het commando
 met <Return>.
 
 Het replace-string commando heeft twee argumenten nodig: de string die
 vervangen moet worden en de string waarmee die vervangen moet worden.
 Je sluit elk argument af met <Return>.
 
->> Plaats de cursor op de lege regel twee regels onder deze.
-   Type dan M-x repl s<Return>gewijzigd<Return>veranderd<Return>.
+>> Plaats de cursor op de lege regel twee regels onder deze regel.
+   Tik dan M-x repl s<Return>gewijzigd<Return>veranderd<Return>.
 
-   Zie hoe deze regel daardoor gewijzigd is.  Je hebt elke keer dat het woord
-"g-e-w-i-j-z-i-g-d" voor kwam, vervangen door "veranderd"; beginnend op
+   Zie hoe deze regel daardoor gewijzigd is.  Je hebt elk voorkomen van
+   het woord g-e-w-i-j-z-i-g-d vervangen door "veranderd"; te beginnen op
    de plek waar de cursor staat.
 
 
 * AUTOMATISCH BEWAREN
 ---------------------
 
-Als je een bestand veranderd hebt maar het nog niet bewaard hebt, zouden
+Als je een bestand veranderd hebt maar het nog niet opgeslagen hebt, zouden
 de veranderingen verloren kunnen gaan als het systeem zou hangen of
-herstarten.  Om je hiertegen te beschermen bewaart Emacs om de zoveel tijd
-de veranderde tekst automatisch.  De naam van het bestand waarin de tekst
-automatisch bewaard wordt begint en eindigt met een #.  Bijvoorbeeld, als
-je het bestand "hello.c" aan het bewerken bent dan wordt de tekst
-automatisch bewaard in een bestand dat "#hello.c#" heet.  Zodra je het
-bestand werkelijk bewaart, wordt het automatisch bewaarde bestand weer
-weggegooid.
+herstarten.  Om je hiertegen te beschermen, slaat Emacs regelmatig
+de veranderde tekst automatisch op.  De naam van het bestand waarin de
+tekst automatisch wordt opgeslagen begint en eindigt met een #.
+Bijvoorbeeld, als je het bestand "hello.c" aan het editeren bent, wordt
+de tekst automatisch opgeslagen in een bestand dat "#hello.c#" heet.  Zodra
+je het bestand werkelijk opslaat, wordt het automatisch opgeslagen bestand
+verwijderd.
 
-Als de computer crasht kun je de automatisch bewaarde tekst terugkrijgen
-door de file normaal te bezoeken (de originele file, niet de automatisch
-bewaarde), gevolgd door M-x recover file<Return>.  Als Emacs vraagt om
-bevestiging, antwoord dan:"yes<Return>",  en de automatisch bewaarde
+Als de computer crasht, kan je de automatisch opgeslagen tekst terugkrijgen
+door het bestand gewoon te bezoeken (het originele bestand, niet het automatisch
+opgeslagen), gevolgd door M-x recover-file<Return>.  Als Emacs vraagt om
+bevestiging, antwoord dan met yes<Return> en de automatisch opgeslagen
 informatie wordt teruggehaald.
 
 
-* ECHO GEBIED
+* ECHO-GEBIED
 -------------
 
-Als je een commando langzaam intypt echoot Emacs de tekens aan de
-onderkant van het scherm, in een deel dat het "echo gebied" genoemd wordt.
+Als je een commando langzaam intikt, toont Emacs de tekens aan de
+onderkant van het scherm in een deel dat het "echo-gebied" genoemd wordt.
 Dit gebied omvat de onderste regel van het scherm.
 
 
-* MODE-REGEL
-------------
+* MODUS-REGEL
+-------------
 
-De regel direct boven het echo gebied heet de "mode-regel".  De mode-regel
+De regel direct boven het echo gebied heet de "modusregel".  De modusregel
 ziet er ongeveer zo uit:
 
 --**-Emacs: TUTORIAL.nl       (Fundamental)--68%------------------------
 
 Deze regel geeft interessante informatie over Emacs en de tekst die
-je aan het bewerken bent.
+je aan het editeren bent.
 
 Je weet al wat de bestandsnaam betekent: het is de naam van het bestand
 dat je bezoekt.  -NN%-- geeft je huidige positie in de tekst aan: NN
 procent van de tekst bevindt zich boven het scherm.  Als het bestand vanaf
 het begin op het scherm staat, staat er --Top-- in plaats van --00%--.
 Als het laatste stuk tekst op het scherm staat, zal er --Bot-- staan (van
-`bottom', `onderkant' in het Nederlands).  Als de tekst zo klein is dat die
-volledig op het scherm past staat --All-- in de mode-regel.
+"bottom", "onderkant" in het Nederlands).  Als de tekst zo klein is dat hij
+volledig op het scherm past staat --All-- in de modus-regel.
 
-De sterretjes aan het begin betekenen dat je de tekst gemodificeerd hebt.
-Direct na het bezoeken of bewaren staan er gewoon streepjes.
+De sterretjes aan het begin betekenen dat je de tekst veranderd hebt.
+Direct na het bezoeken of opslaan staan er gewoon streepjes.
 
-In de mode-regel staat tussen haakjes in welke mode je aan het werken
-bent.  Tenzij een andere mode gewenst is, zit je in de "Fundamental" mode
-zoals nu (`fundamental' is `basis' in het Nederlands).  Een dergelijke
-mode heet een hoofdmode (`major mode' in het Engels).
+In de modusregel staat tussen haakjes in welke modus je aan het werken
+bent.  De standaardmodus is de "Fundamental" modus, die je nu gebruikt
+("fundamental" is "basis" in het Nederlands).  Een dergelijke
+modus heet een hoofdmodus ("major mode" in het Engels).
 
-Emacs heeft verschillende hoofdmodes.  Sommige daarvan zijn bedoeld voor
-het bewerken van verschillende talen of soorten tekst, zoals bijvoorbeeld
-Lisp mode, Text mode, etc.  Op elk moment is er altijd precies een mode
-actief, en de naam daarvan staat in de mode-regel, op de plaats waar nu
+Emacs heeft verschillende hoofdmodi.  Sommige daarvan zijn bedoeld voor
+het editeren van verschillende talen of soorten tekst, zoals bijvoorbeeld
+Lisp modus, Text modus, etc.  Op elk moment is er altijd precies een modus
+actief, en de naam daarvan staat in de modusregel, op de plaats waar nu
 "Fundamental" staat.
 
-Het komt voor dat sommige commado's zich in verschillende modes anders
-gedragen.  Zo bestaat er een commando om een commentaar in een programma te
-typen, en aangezien elke programmeertaal een ander idee heeft over hoe
-commentaar eruit moet zien, moet elke hoofdmode op een andere manier het
-commentaar beginnen.  Elke hoofdmode is de naam van een uitgebreid commando,
-en met dat commando schakel je om naar die hoofdmode.  Zo is bijvoorbeeld
-M-x fundamental-mode het commando om naar de basismode om te schakelen.
+Elke hoofdmodus zorgt ervoor dat sommige commando's zich anders gedragen.
+Zo bestaat er een commando om een commentaar in een programma te tikken, en
+aangezien elke programmeertaal een ander idee heeft over hoe commentaar
+eruit moet zien, moet elke hoofdmodus op een andere manier het commentaar
+beginnen.  Elke hoofdmodus is de naam van een uitgebreid commando, en met
+dat commando schakel je om naar die hoofdmodus.  Zo is bijvoorbeeld
+M-x fundamental-mode het commando om naar de basismodus om te schakelen.
 
-Als je Nederlandse of Engelse tekst wil gaan bewerken, zoals bijvoorbeeld
-dit bestand, kun je beter "text mode" gebruiken, de mode om tekst in een
-gewone taal te bewerken:
+Als je Nederlandse of Engelse tekst wil gaan editeren, zoals bijvoorbeeld
+dit bestand, kan je beter "Text mode" gebruiken, de modus om tekst in een
+gewone taal te editeren:
 
->> Type M-x text-mode<Return>.
+>> Tik M-x text-mode<Return>.
 
 Wees gerust; geen van de commando's die je geleerd hebt zorgen voor
-grondige veranderingen in Emacs.  Een van de dingen die je kunt merken is
+grondige veranderingen in Emacs.  Een van de dingen die je kan merken, is
 bijvoorbeeld dat M-f en M-b nu apostrofs als onderdeel van een woord
-beschouwen.  In de vorige, Fundamental, mode behandelen M-f en M-b de
+beschouwen.  In de vorige modus (Fundamental) behandelen M-f en M-b de
 apostrof als ruimte tussen twee woorden.
 
-Het is gebruikelijk dat hoofdmodes dergelijke subtiele verschillen hebben.
-De meeste commando's doen dus min of meer hetzelfde in elke hoofdmode.
+Het is gebruikelijk dat hoofdmodi dergelijke subtiele verschillen hebben.
+De meeste commando's doen dus min of meer hetzelfde in elke hoofdmodus.
 
-Met het commando C-h m kun je de documentatie over de huidige hoofdmode
+Met het commando C-h m kan je de documentatie over de huidige hoofdmodus
 lezen.
 
 >> Gebruik C-u C-v een paar keer om deze zin in de buurt van de bovenkant
    van het scherm te krijgen.
->> Type C-h m om te zien hoe Text mode verschilt van Fundamental mode.
->> Type C-x 1 om de documentatie van het scherm te verwijderen.
+>> Tik C-h m om te zien hoe de tekstmodus verschilt van de basismodus.
+>> Tik C-x 1 om de documentatie van het scherm te verwijderen.
 
-Hoofdmodes heten hoofdmodes omdat er ook bijmodes zijn.  Bijmodes zijn
-geen alternatieven voor hoofdmodes; het zijn slechts kleine modificaties
-daarvan.  Elke bijmode kan aan- of uitgezet worden, onafhankelijk van
-andere bijmodes en onafhankelijk van de hoofdmode.  Je kunt dus nul, een,
-of willekeurig veel minor modes gebruiken.
+Hoofdmodi heten zo omdat er ook bijmodi zijn.  Bijmodi zijn
+geen alternatieven voor hoofdmodi; het zijn slechts kleine aanpassingen
+daarvan.  Elke bijmodus kan aan- of uitgezet worden, onafhankelijk van
+andere bijmodi en onafhankelijk van de hoofdmodus.  Het is dus mogelijk geen bijmodi, één bijmodus
+of een willekeurige combinatie van bijmodi te gebruiken.
 
-Een nuttige bijmode voor het bewerken van tekst in een natuurlijke taal,
-zoals Nederlands, is Auto Fill mode (`auto fill' betekent automatisch
-uitvullen).  Wanneer deze mode aanstaat breekt Emacs automatisch een regel
-tussen twee woorden af als de regel anders te lang zou worden.
+Een nuttige bijmodus voor het editeren van tekst in een natuurlijke taal,
+zoals het Nederlands, is Auto Fill modus ("auto fill" betekent automatisch
+uitvullen).  Wanneer deze modus aanstaat, breekt Emacs automatisch een
+regel tussen twee woorden af als de regel te lang wordt.
 
-Je kunt Auto Fill mode aanzetten met M-x auto-fill-mode<Return>.  Als deze
-mode al aanstaat, kun je hem uitzetten met M-x auto-fill-mode<Return>.
-Als de mode uitstaat zet dit commando de mode aan; als ze aanstaat zet dit
-commando de mode uit.  Het commando zet de mode steeds aan en uit zet (`to
-toggle' in het Engels).
+Je kan Auto Fill modus aanzetten met M-x auto-fill-mode<Return>.  Als deze
+modus al aanstaat, kan je hem uitzetten met M-x auto-fill-mode<Return>.
+Als de modus uitstaat, zet dit commando de modus aan; als ze aanstaat, zet
+dit commando de modus uit.  We zeggen dat het commando de modus "schakelt"
+("to toggle" in het Engels).
 
->> Type nu M-x auto-fill-mode<Return>.  Type nu vele malen asdf op een
-   regel zodat je kunt zien dat de regel in tweeën gesplitst wordt.  Er
-   moeten wel spaties tussen de woorden staan, omdat de Auto Fill mode
-   alleen op spaties de regel afbreekt.
+>> Tik nu M-x auto-fill-mode<Return>.  Tik nu vele malen "asdf " op een
+   regel zodat je kan zien dat de regel in tweeën gesplitst wordt.  Er
+   moeten wel spaties tussen de woorden staan, omdat de Auto Fill modus
+   de regel alleen op spaties breekt.
 
-De rechter kantlijn staat meestal op 70 tekens, maar die kun je veranderen
+De rechterkantlijn staat meestal op 70 tekens, maar die kan je veranderen
 met het C-x f commando.  Dit commando accepteert een numeriek argument
 om de gewenste kantlijn te verkrijgen.
 
->> Type C-x f met 20 als argument (C-u 20 C-x f).
-   Type wat tekst en zie dat Emacs de regels afbreekt bij 20 tekens.
-   Zet de kantlijn nu terug op 70, dus met C-u 70 C-x f.
+>> Tik C-x f met 20 als argument (C-u 20 C-x f).
+   Tik wat tekst en zie dat Emacs de regels afbreekt bij 20 tekens.
+   Zet de kantlijn nu terug op 70, dus met met C-u 70 C-x f.
 
-Als je de tekst midden in een regel verandert vult Auto Fill mode
+Als je de tekst midden in een regel verandert vult Auto Fill modus
 de regel niet opnieuw.
-Om een alinea opnieuw te vullen, type M-q (Meta-q) terwijl de
+Om een alinea opnieuw te vullen, tik M-q (META-q) terwijl de
 cursor in de alinea staat.
 
->> Plaats de cursor in de voorgaande alinea en type M-q.
+>> Plaats de cursor in de voorgaande alinea en tik M-q.
 
 
 * ZOEKEN
 --------
 
-Emacs kan strings zoeken (een string is een rij tekens), zowel volgend op
-de cursorpositie, als eraan voorafgaand.  Het zoeken van een string
+Emacs kan tekenreeksen ("strings") zoeken, zowel volgend op
+de cursorpositie, als eraan voorafgaand.  Het zoeken naar een string
 verplaatst de cursor naar de volgende plaats waar de gezochte string
 voorkomt.
 
 Het zoekcommando van Emacs is anders dan de zoekcommando's van de meeste
 tekstverwerkers; het zoekt incrementeel.  Dit betekent dat het zoeken
-gebeurt tijdens het intypen van de gezochte string.
+gebeurt tijdens het intikken van de gezochte string.
 
-Het commando om vooruit zoeken te starten is C-s (met de `s' van `to
-search', i.e. zoeken); C-r start het zoeken achteruit (met de `r' van
-`reverse' of achteruit).  WACHT nog even met ze te proberen.
+Het commando om het voorwaarts zoeken te starten is C-s (met de "s" van "to
+search", zoeken); C-r start het achterwaarts zoeken (met de "r" van
+"reverse" of achteruit).  MAAR WACHT! Probeer ze nu nog niet.
 
-Als je C-s typt verschijnt de string "I-search" in het echo gebied.  Dit
-betekent dat Emacs bezig is met een `incremental search' (incrementele
-zoekopdracht) en wacht op het intypen van de zoekstring.  <RET> beëindigt
+Als je C-s tikt verschijnt de string "I-search" in het echo-gebied.  Dit
+betekent dat Emacs bezig is met een "incremental search" (incrementele
+zoekopdracht) en wacht op het intikken van de zoekstring.  <RET> beëindigt
 het zoeken.
 
->> Type nu C-s om het zoeken te starten.  Type nu, LANGZAAM, één letter per
-   keer, het woord `cursor', met een pauze na elke letter zodat je kunt
+>> Tik nu C-s om het zoeken te starten.  Tik nu, LANGZAAM, één letter per
+   keer, het woord "cursor", met een pauze na elke letter zodat je kan
    zien wat er met de cursor gebeurt.  Je hebt nu eenmaal naar het woord
-   `cursor' gezocht.
->> Type nogmaals C-s, om het volgende woord `cursor' te zoeken
->> Type nu viermaal <Delback> en let op de cursorbewegingen.
->> Type <RET> om het zoeken te beëindigen.
+   "cursor" gezocht.
+>> Tik nogmaals C-s, om naar het volgende voorkomen van het woord "cursor" te
+   zoeken.
+>> Tik nu viermaal <Delback> en let op de cursorbewegingen.
+>> Tik <RET> om het zoeken te beëindigen.
 
 Zag je wat er gebeurde?  Tijdens incrementeel zoeken probeert Emacs naar
-de eerste plek te gaan waar de string staat die je tot dan toe getypt
-hebt.  Om naar de volgende plek te gaan, type je C-s nog een keer.  Als er
-geen volgende plek is gevonden piept Emacs en vertelt je dat de zoekopdracht
-is beëindigd. (`failing' in het Engels); met C-g kun je het zoeken afbreken.
+de eerste plek te gaan waar de string staat die je tot dan toe getikt
+hebt.  Om naar de volgende plek te gaan, tik je C-s nog een keer.  Als er
+geen volgende plek is gevonden, biept Emacs en vertelt je dat de zoekopdracht
+niets gevonden heeft ("is failing" in het Engels).  C-g zou het zoeken ook afbreken.
 
-Als je tijdens incrementeel zoeken <Delback> typt, zul je zien dat het
-laatste teken dat je in de zoekstring typte weggehaald wordt en dat het
+Als je tijdens incrementeel zoeken <Delback> tikt, zal je zien dat het
+laatste teken dat je aan de zoekstring toegevoegd hebt, weggehaald wordt en dat het
 zoeken teruggaat naar de voorgaande plaats.  Als je bijvoorbeeld begint
-met zoeken en je typt een "c" dan ga je naar de plaats waar de "c" het
-eerst voorkomt.  Type je vervolgens een "u" dan gaat de cursor naar de
-plaats waar de string "cu" het eerst voorkomt".  Als je nu <Delback> typt, dan
-wordt de "u" van de zoekstring afgehaald en gaat de cursor terug naar de
-plaats waar hij stond voordat je de "u" intypte, i.e. de plaats waar "c" het
-eerst voorkomt.
+met zoeken en je tikt een "c", dan ga je naar de plaats waar de "c" het
+eerst voorkomt.  Tik je vervolgens een "u", dan gaat de cursor naar de
+plaats waar de string "cu" het eerst voorkomt.  Als je nu <Delback> tikt, dan
+wordt de "u" van de zoekstring afgehaald, en gaat de cursor terug naar de
+plaats waar hij stond voordat je de "u" intikte, namelijk daar waar "c" het
+eerst voorkwam.
 
-Als je tijdens een zoekoperatie een control- of meta-teken intypt dan
+Als je tijdens een zoekoperatie een CONTROL- of META-teken intikt, dan
 wordt het zoeken beëindigd.  Er zijn een paar uitzonderingen, namelijk
 tekens die tijdens zoeken een speciale betekenis hebben, zoals C-s en C-r.
 
 Met C-s begin je te zoeken naar de plaats waar de zoekstring voor het eerst
 voorkomt NA de huidige cursorpositie.  Als je iets wilt zoeken dat eerder in
-de tekst moet voorkomen, gebruik dan C-r i.p.v.  C-s.  Alles wat we nu weten
-over C-s geldt ook voor C-r, alleen de zoekrichting is omgedraaid.
+de tekst moet voorkomen, gebruik dan C-r in plaats van C-s.  Alles wat we nu weten
+over C-s geldt ook voor C-r, alleen is de zoekrichting omgedraaid.
 
 
 * MEERDERE VENSTERS
 -------------------
 
 Een van Emacs' aardige eigenschappen is dat je meerdere vensters op het
-scherm kunt laten zien.
+scherm kan laten zien.
 
->> Zet de cursor op deze regel en type C-u 0 C-l.
+>> Zet de cursor op deze regel en tik C-u 0 C-l.
 
->> Type C-x 2 om het scherm in twee vensters op te splitsen.
-   Beide vensters laten deze uitleg zien; de cursor blijft in het
+>> Tik C-x 2 om het scherm in twee vensters op te splitsen.
+   Beide vensters laten deze inleiding zien; de cursor blijft in het
    bovenste venster.
 
->> Type C-M-v om de tekst in het onderste venster te verschuiven.
-   (Als je geen Meta toets hebt, type dan ESC C-v.)
+>> Tik C-M-v om de tekst in het onderste venster te verschuiven.
+   (Als je geen META-toets hebt, tik dan ESC C-v.)
 
->> Type C-x o (met de `o' van `other'; `ander' in het Nederlands)
+>> Tik C-x o (met de o van "other"; "ander" in het Nederlands)
    om de cursor naar het andere venster te verplaatsen.
 
->> Verschuif de tekst in het onderste venster, m.b.v. C-v en M-v.
-   Zorg ervoor dat je deze uitleg in het bovenste venster leest.
+>> Verschuif de tekst in het onderste venster, met C-v en M-v.
+   Zorg ervoor dat je deze inleiding in het bovenste venster leest.
 
->> Type weer C-x o om de cursor weer in het bovenste venster
+>> Tik weer C-x o om de cursor weer in het bovenste venster
    te zetten.  De cursor staat weer precies op de plaats waar
    hij stond toen je het venster verliet.
 
-Je kunt C-x o blijven gebruiken om van venster naar venster te gaan.  Elk
-venster heeft zijn eigen cursorpositie; de cursor is altijd maar zichtbaar
+Je kan C-x o blijven gebruiken om van venster naar venster te gaan.  Elk
+venster heeft zijn eigen cursorpositie; de cursor is altijd enkel zichtbaar
 in een daarvan.  Alle normale commando's hebben betrekking op het venster
-waarin de cursor  staat.  Dit venster is het `geselecteerde venster'
-(`selected window' in het Engels).
+waarin de cursor staat.  Dit venster is het "geselecteerde venster"
+("selected window" in het Engels).
 
-Het C-M-v commando is erg nuttig wanneer je tekst aan het bewerken bent in
+Het C-M-v commando is erg nuttig wanneer je tekst aan het editeren bent in
 het ene venster, terwijl je het andere venster als referentie gebruikt.
-Je kunt de cursor dan altijd in het venster houden waarin je bezig bent,
+Je kan de cursor dan altijd in het venster houden waarin je bezig bent,
 terwijl je met C-M-v door de tekst in het andere venster loopt.
 
-C-M-v is een voorbeeld van een CONTROL-META teken.  Als je een echte META
-toets hebt kun je C-M-v intypen door zowel CTRL als META ingedrukt te
-houden terwijl je v typt.  Het maakt niet uit in welke volgorde je de CTRL
-en META indrukt; het gaat erom welke toetsen ingedrukt zijn terwijl je typt.
+C-M-v is een voorbeeld van een CONTROL-META teken.  Als je een echte
+META-toets hebt kan je C-M-v intikken door zowel CTRL als META ingedrukt te
+houden terwijl je v tikt.  Het maakt niet uit in welke volgorde je CTRL en
+META indrukt; het gaat erom welke toetsen ingedrukt zijn terwijl je tikt.
 
-Als je geen echte META toets hebt kun je ESC gebruiken; de volgorde maakt
-dan wel uit.  Je moet dan ESC typen, gevolgd door CTRL-v; CTRL-ESC v zal
-niet werken.  Dit komt doordat ESC zelf een teken is, terwijl CTRL en META
-dat niet zijn.
+Als je geen echte META-toets hebt kan je ESC gebruiken; de volgorde is dan
+wel belangrijk.  Je moet dan eerst ESC tikken, gevolgd door CTRL-v;
+CTRL-ESC v zal niet werken.  Dit komt doordat ESC zelf een teken is,
+terwijl CTRL en META dat niet zijn.
 
->> Type C-x 1 (in het bovenste venster) om het onderste venster te laten
+>> Tik C-x 1 (in het bovenste venster) om het onderste venster te laten
    verdwijnen.
 
-(Als je C-x 1 typt in het onderste venster laat je het bovenste
-verdwijnen.  C-x 1 betekent zoveel als `ik wil maar 1 venster,
-en wel dat venster waar de cursor nu in staat.')
+(Als je C-x 1 tikt in het onderste venster laat je het bovenste
+verdwijnen.  C-x 1 betekent zoveel als "ik wil maar 1 venster,
+en wel dat venster waar de cursor nu in staat.")
 
 Hier is nog een manier om twee venster te krijgen die elk een andere tekst
 laten zien:
 
->> Type C-x 4 C-f gevolgd door de naam van een van je bestanden, gevolgd
+>> Tik C-x 4 C-f gevolgd door de naam van een van je bestanden, gevolgd
    door <Return>.  Het opgegeven bestand zal in het onderste venster
    verschijnen, en de cursor zal in dat venster staan.
 
->> Type C-x o om terug naar het bovenste venster te gaan, en C-x 1 om
+>> Tik C-x o om terug naar het bovenste venster te gaan, en C-x 1 om
    het onderste venster te laten verdwijnen.
 
 
@@ -927,15 +935,15 @@
 ------------------------------
 
 Soms kom je in Emacs in een recursief bewerkingsniveau terecht (Engels:
-`recursive editing level').  Dit is te zien in de moderegel aan de rechte
-haken die om de haakjes van de naam van de hoofdmode staan.  Dan staat er
+"recursive editing level").  Dit is te zien in de modusregel aan de vierkante
+haken die om de haakjes van de naam van de hoofdmodus staan.  Dan staat er
 bijvoorbeeld [(Fundamental)] in plaats van (Fundamental).
 
-Type ESC ESC ESC Om uit een recursief bewerkingsniveau te komen.  Dit is
-een generiek `ontsnappingscommando'.  Je kunt het ook gebruiken om extra
-vensters weg te gooien of om uit de minibuffer te komen.
+Tik ESC ESC ESC Om uit een recursief bewerkingsniveau te komen.  Dit is
+een algemeen "ontsnappingscommando".  Je kan het ook gebruiken om extra
+vensters te verwijderen of om uit de minibuffer te komen.
 
->> Type M-x om in een minibuffer te komen, en type dan ESC ESC ESC
+>> Tik M-x om in een minibuffer te komen, en tik dan ESC ESC ESC
    om er weer uit te komen.
 
 C-g is niet bruikbaar om uit een recursief bewerkingsniveau te komen.  De
@@ -946,127 +954,127 @@
 * MEER INFORMATIE
 -----------------
 
-We hebben geprobeerd je met deze uitleg precies genoeg informatie te geven
-om met Emacs te beginnen.  De mogelijkheden van Emacs zijn zo legio dat
-het onmogelijk is nu alles uit te leggen.  Emacs heeft zoveel nuttige
-mogelijkheden dat je er meer over zou kunnen willen leren.  Emacs heeft
+We hebben geprobeerd je met deze inleiding precies genoeg informatie te leveren
+om met Emacs te beginnen werken.  De mogelijkheden van Emacs zijn zo groot dat
+het onmogelijk is nu alles uit te leggen.  Het kan zijn dat je meer over
+Emacs wil leren omdat het zoveel nuttige mogelijkheden heeft.  Emacs heeft
 commando's om documentatie te laten zien over Emacs commando's.  Deze
-`helpcommando's' beginnen allemaal met C-h: `het Hulpteken'.
+"helpcommando's" beginnen allemaal met C-h: "het Hulpteken".
 
-Om hulp te krijgen, type C-h, gevolgd door een teken om aan te duiden
-welke hulp je wilt.  Als je het echt niet meer weet, type C-h ? en Emacs
-vertelt welke hulp het allemaal te bieden heeft.  Als je C-h hebt getypt
-maar van gedachten veranderd bent, type je gewoon C-g om het af te breken.
+Om hulp te krijgen tik je C-h, gevolgd door een teken om aan te duiden
+welke hulp je wilt.  Als je het echt niet meer weet, tik C-h ? en Emacs
+vertelt welke hulp het allemaal te bieden heeft.  Als je C-h hebt getikt
+maar van gedachten veranderd bent, tik je gewoon C-g om het af te breken.
 
-(Op sommige computers is de betekenis van C-h veranderd.  Dat is een
-slecht plan, zeker als die verandering op alle gebruikers invloed heeft,
-en is dus een geldige reden om je beklag te doen bij de systeembeheerder
-of helpdesk.  Als C-h intussen niet een bericht onderaan het scherm laat
-zien over mogelijke hulp, probeer dan de F1 toets (functietoets 1) of
-gebruik M-x help RET.)
+(In sommige installaties wordt de betekenis van C-h veranderd.  Dat is geen goed
+idee, zeker als die verandering op alle gebruikers invloed heeft, en is
+een geldige reden om je beklag te doen bij de systeembeheerder of de
+helpdesk.  Als C-h intussen niet een bericht onderaan het scherm laat zien
+over mogelijke hulp, probeer dan de F1 toets (functietoets 1) of gebruik
+M-x help RET.)
 
-De eenvoudigste hulp is C-h c.  Type C-h, het teken `c' en een teken of
+De eenvoudigste hulp is C-h c.  Tik C-h, het teken "c" en een teken of
 uitgebreid commando, en Emacs laat een zeer korte beschrijving van het
 commando zien.
 
->> Type C-h c Control-p.
+>> Tik C-h c Control-p.
    De beschrijving die getoond wordt zou zoiets moeten zijn als
 
 	C-p runs the command previous-line
 
    (Nederlands: C-p voert het commando previous-line uit.)
 
-Dit commando vertelt je `de naam van de functie'.  Functies worden vooral
+Dit commando vertelt je "de naam van de functie".  Functies worden vooral
 gebruikt om Emacs uit te breiden of aan de wensen van de gebruiker aan te
 passen.  Aangezien functienamen gekozen zijn om aan te geven wat de
-functie doet, zijn ze ook geschikt als erg korte documentatie; genoeg om
+functie doet, zijn ze ook geschikt als heel korte documentatie; genoeg om
 je te herinneren aan wat de commando's die je al geleerd hebt betekenen.
 
-Uitgebreide commando's zoals C-x C-s en (als je geen META, EDIT or ALT
-toets hebt) <ESC> v kunnen ook getypt worden na C-h c.
+Uitgebreide commando's zoals C-x C-s en (als je geen META-, EDIT- of
+ALT-toets hebt) <ESC> v kunnen ook getikt worden na C-h c.
 
-Om meer informatie over een commando te krijgen, type C-h k in plaats van
+Om meer informatie over een commando te krijgen, tik C-h k in plaats van
 C-h c.
 
->> Type C-h k Control-p.
+>> Tik C-h k C-p.
 
-Dit laat de documentatie van de functie zien, inclusief de naam van de
-functies, in een apart venster.  Als je klaar bent met lezen, type C-x 1
-om van dat venster af te komen.  Je hoeft dat natuurlijk niet meteen te
-doen.  Je kunt ook eerst wat anders doen voordat je C-x 1 typt.
+Dit laat de documentatie van de functie, inclusief de naam van de functie,
+in een apart venster zien.  Als je klaar bent met lezen, tik C-x 1 om van
+dat venster af te komen.  Je hoeft dat natuurlijk niet meteen te doen.  Je
+kan ook eerst wat anders doen voordat je C-x 1 tikt.
 
 Hier zijn nog wat nuttige mogelijkheden van C-h:
 
    C-h f	Beschrijf een functie.  Je moet de naam van de functie
-		intypen.
+		intikken.
 
->> Type C-h f previous-line<Return>
+>> Tik C-h f previous-line<Return>
    Dit laat alle informatie zien die Emacs heeft over de functie die het
    C-p commando implementeert.
 
-   C-h a	Commando Apropos.  Type een woord in en Emacs zal een
+   C-h a	Commando Apropos.  Tik een woord in en Emacs zal een
 		lijst van alle commando's laten zien waarin dat woord
 		voorkomt.  Al deze commando's kunnen aangeroepen worden
 		met M-x.  Bij sommige commando's staat met welke tekens
 		dit commando direct uitgevoerd kan worden.
 
->> Type C-h a file<Return>.
+>> Tik C-h a file<Return>.
 
-Dit laat in een ander venster alle M-x commando's zien met `file' in hun
-naam.  Je zult teken-commando's zien als C-x C-f naast de overeenkomende
+Dit laat in een ander venster alle M-x commando's zien met "file" in hun
+naam.  Je zal teken-commando's zien als C-x C-f naast de overeenkomende
 commandonaam zoals find-file.
 
->> Type C-M-v herhaaldelijk om de tekst in het hulpvenster te verschuiven.
+>> Tik C-M-v herhaaldelijk om de tekst in het hulpvenster te verschuiven.
 
->> Type C-x 1 om het hulpvenster weg te gooien.
+>> Tik C-x 1 om het hulpvenster te verwijderen.
 
 
 * CONCLUSIE
 -----------
 
 Denk eraan dat je met C-x C-c gebruikt om Emacs te verlaten.  Om tijdelijk
-een shell te krijgen en daarna weer in Emacs terug te komen, type C-x.
+een shell te krijgen en daarna weer in Emacs terug te komen, tik C-z.
 
-De bedoeling van deze uitleg is dat ze begrijpelijk is voor alle nieuwe
-Emacs gebruikers.  Als je dus iets onduidelijks bent tegengekomen blijf
-dan niet zitten en maak jezelf geen verwijten.  Klaag erover!
+De bedoeling van deze inleiding is dat ze begrijpelijk is voor alle nieuwe
+Emacs-gebruikers.  Als je dus iets onduidelijks bent tegengekomen, blijf
+dan niet zitten en maak jezelf geen verwijten.  Doe je beklag!
 
 
 * KOPIËREN
 -----------
 
-(De Engelse versie van) deze uitleg is voorafgegaan door een lange reeks
-van Emacs tutorials, die begon met de uitleg die Stuart Cracraft schreef
+(De Engelse versie van) deze inleiding is voorafgegaan door een lange reeks
+van Emacs-inleidingen, die begon met de inleiding die Stuart Cracraft schreef
 voor de originele Emacs.  Deze Nederlandse vertaling is gemaakt door
 Pieter Schoenmakers <tiggr@ics.ele.tue.nl> op basis van de GNU Emacs 20.2
-TUTORIAL.
+TUTORIAL, en verbeterd en verbeterd door Frederik Fouvry.
 
 (Wat nu volgt is een vertaling naar het Nederlands van de condities voor
-gebruik en verspreiding van deze uitleg.  Deze vertaling is niet
+gebruik en verspreiding van deze inleiding.  Deze vertaling is niet
 gecontroleerd door een jurist.  Er kunnen derhalve geen rechten aan de
 vertaling worden ontleend, en de vertaling wordt gevolgd door het Engelse
 origineel.)
 
-Deze versie van de uitleg valt onder copyright, net als GNU Emacs.
-Je mag deze uitleg distribueren onder bepaalde condities:
+Deze versie van de inleiding valt onder copyright, net als GNU Emacs.
+Je mag deze inleiding verdelen onder bepaalde voorwaarden:
 
 Copyright (c) 1985, 1996, 1997 Free Software Foundation
 
    Iedereen mag letterlijke kopieën van dit document, zowel ontvangen als
-   verspreiden, op elke medium, vooropgesteld dat de copyrightmelding en
-   toestemmingsmelding niet aangetast worden en dat de verspreider aan de
+   verspreiden, op elk medium, vooropgesteld dat de copyrightvermelding en
+   de toestemmingsmelding niet veranderd worden en dat de verspreider aan de
    ontvanger dezelfde distributierechten verleent als aan hem verleend
-   door deze melding.
+   worden door deze melding.
 
-   Toestemming wordt verleend om gemodificeerde versies van dit document,
-   of delen daarvan, te verspreiden, onder bovenstaande condities,
-   vooropgesteld dat ze ook duidelijk melding maken van degene die als
-   laatste modificaties doorgevoerd heeft.
+   Toestemming wordt verleend om veranderde versies van dit document,
+   of delen daarvan, te verspreiden, onder bovenstaande voorwaarden,
+   vooropgesteld dat ze ook duidelijk vermelden wie als
+   laatste veranderingen aangebracht heeft.
 
-De condities voor het kopiëren van Emacs zelf zijn complexer dan dit,
+De condities voor het kopiëren van Emacs zelf zijn ingewikkelder dan dit,
 maar gebaseerd op dezelfde gedachte.  Lees het bestand COPYING en geef
 vervolgens kopieën van Emacs aan al je vrienden.  Help bij het uitroeien
-van softwarebeschermingspolitiek (`software eigendom') door vrije software
+van softwarebeschermingspolitiek ("eigendom") door vrije software
 te gebruiken, te schrijven en te delen!
 
 (Engels origineel van de copyrightmelding en condities:
--- a/lisp/ChangeLog	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/ChangeLog	Sun Jan 16 03:40:12 2005 +0000
@@ -1,13 +1,558 @@
+2005-01-15  Richard M. Stallman  <rms@gnu.org>
+
+	* emacs-lisp/lisp-mnt.el (lm-with-file): Use Lisp mode in temp buffer.
+	In non-temp buffer, switch syntax table temporarily.
+
+	* emacs-lisp/lisp-mode.el (indent-pp-sexp): Doc fix.
+
+	* replace.el (occur-accumulate-lines, occur-engine): Avoid warnings.
+
+	* tar-mode.el (tar-extract): Bind buffer-undo-list to t.
+
+	* imenu.el (imenu--split-menu): Copy menulist before sorting.
+	(imenu--generic-function): Use START, not BEG, as pos of definition.
+
+	* simple.el (just-one-space): Argument specifies number of spaces.
+
+	* simple.el (eval-expression-print-format): Avoid warning
+	about edebug-active.
+
+2005-01-15  "James R. Van Zandt"  <jrvz@comcast.net>  (Tiny change)
+
+	* progmodes/sh-script.el: Code copied from make-mode.el
+	with small changes,
+	(sh-mode-map): Bind C-c C-\.
+	(sh-backslash-column, sh-backslash-align): New variables.
+	(sh-backslash-region, sh-append-backslash): New functions.
+	
+2005-01-15  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
+
+	* mail/rmail.el: Updated to work with movemail from GNU Mailutils
+	(rmail-pop-password, rmail-pop-password-required): Moved to
+	rmail-obsolete group.
+	(rmail-set-pop-password): Renamed to rmail-set-remote-password.
+	All callers updated.
+	(rmail-get-pop-password): Renamed to rmail-get-remote-password.
+	Take an argument specifying whether it is POP or IMAP mailbox we
+	are using.  All callers updated.
+	(rmail-pop-password-error): Renamed to
+	rmail-remote-password-error.  Added mailutils-specific error
+	message.
+	(rmail-movemail-search-path)
+	(rmail-movemail-variant-in-use): New variables.
+	(rmail-remote-password, rmail-remote-password-required): New
+	customization variables.
+	(rmail-probe,rmail-autodetect, rmail-movemail-variant-p): New
+	functions.
+	(rmail-parse-url): New function.
+	(rmail-get-new-mail, rmail-insert-inbox-text): Updated for use
+	with GNU mailutils movemail.
+
+2005-01-15  Kevin Ryde  <user42@zip.com.au>
+
+	* info-look.el (c-mode/symbol): Add ^` to prefix, and change
+	suffix to space, $ or '$, to correctly position point when going
+	to @table style constants like DBL_MAX.
+
+2005-01-15  Jorgen Schaefer  <forcer@forcix.cx>  (tiny change)
+
+	* type-break.el (type-break-mode, type-break-file-time)
+	(type-break-file-keystroke-count, type-break-choose-file): Don't
+	store data in or load data from the file if type-break-file-name
+	is nil.
+	(type-break-file-name): Doc update as per the above.
+
+2005-01-15  Stephen Eglen  <S.J.Eglen@damtp.cam.ac.uk>  (tiny change)
+
+	* woman.el (woman-dired-define-key-maybe): If KEY is undefined,
+	lookup-key might return nil; handle that.
+
+2005-01-15  Alan Mackenzie  <acm@muc.de>
+
+	* ebrowse.el (ebrowse-class-in-tree): Return the tail of the tree
+	rather than the element found, thus enabling the tree to be
+	setcar'd.
+
+2005-01-14  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el (org-show-following-heading): New option.
+	(org-show-hierarchy-above): Use `org-show-following-heading'.
+	(org-cycle): Documentation fix.
+
+	* textmodes/org.el (orgtbl-optimized): New option
+	(orgtbl-mode): New command, a minor mode.
+	(orgtbl-mode-map): New variable.
+	(turn-on-orgtbl, orgtbl-mode, orgtbl-make-binding)
+	(orgtbl-error, orgtbl-self-insert-command)
+	(orgtbl-delete-backward-char, orgtbl-delete-char): New functions.
+
+	* textmodes/org.el (org-mode): `org-table-may-need-update' is now
+	a local variable in each org-mode buffer.
+
+	* textmodes/org.el (org-set-regexps-and-options): Renamed from
+	`org-set-regexps'.  Added checking for STARTUP keyword.
+	(org-get-current-options): Added STARTUP options.
+	(org-table-insert-row): Mode mode intelligent about when
+	realignment is needed.
+	(org-self-insert-command, org-delete-backward-char,
+	org-delete-char): New commands.
+	(org-enable-table-editor): new default value `optimized'.
+	(org-table-blank-field): Support blanking regions if active.
+
+
+2005-01-14  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/reftex-cite.el (reftex-bib-sort-year): Catch the case
+	if the year is not given.
+
+	* textmodes/reftex-ref.el (reftex-replace-prefix-escapes): Added
+	new escapes %m and %M, fixed bug with %F by adding
+	save-match-data.
+	(reftex-reference): Removed ?. from list of spaces.
+	(reftex-label-info): Added automatic label prefix recognition
+
+	* textmodes/reftex-index.el (reftex-index-next-phrase): Added
+	slave parameter to call of `reftex-index-this-phrase'
+	(reftex-index-this-phrase): New optional argument
+	(reftex-index-region-phrases): Added slave parameter to call of
+	`reftex-index-this-phrase'
+	(reftex-display-index): New argument redo
+	(reftex-index-rescan): Added 'redo to arguments of
+	`reftex-display-index'
+	(reftex-index-Rescan, reftex-index-revert)
+	(reftex-index-switch-index-tag): Added 'redo to arguments of
+	`reftex-display-index'
+	(reftex-index-make-phrase-regexp): Fixed bug with case-sensitive
+	indexing.  Fixed bug with matching is there is a quote before or
+	after the word.
+
+	* textmodes/reftex-cite.el (reftex-all-used-citation-keys): Fix
+	bug when collecting citation keys in lines with comments.
+	(reftex-citation): Prefix argument no longer rescans the document,
+	but forces prompting for optional arguments of cite macros.
+	(reftex-do-citation): Prompting for optional arguments
+	implemented.
+
+	* textmodes/reftex-vars.el (reftex-cite-format-builtin): Added
+	optional arguments to most cite commands.
+	(reftex-cite-cleanup-optional-args): New option
+	(reftex-cite-prompt-optional-args): New option.
+	(reftex-trust-label-prefix): New option
+
+	* textmodes/reftex-toc.el (reftex-toc-find-section): Added
+	push-mark before changing the position in the buffer.
+
+	* textmodes/reftex.el (reftex-prefix-to-typekey-alist): New
+	variable
+	(reftex-compile-variables): Compute reftex-prefix-to-typekey-alist
+
+2005-01-14  Nick Roberts  <nickrob@snap.net.nz>
+
+	* xt-mouse.el (xterm-mouse-event): Compute window co-ordinates
+	more carefully.
+
+2005-01-13  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* textmodes/sgml-mode.el (sgml-fill-nobreak): New fun.
+	(sgml-mode): Use it.
+	(sgml-get-context): Better keep track of implicitly closed tags.
+
+2005-01-13  Kenichi Handa  <handa@m17n.org>
+
+	* textmodes/ispell.el: These changes are to fix misalignment error
+	caused by equivalent characters of different Emacs charsets.
+	(ispell-unified-chars-table): New variable.
+	(ispell-get-decoded-string): New function.
+	(ispell-get-casechars, ispell-get-not-casechars)
+	(ispell-get-otherchars): Call ispell-get-decoded-string.
+
+2005-01-12  Johan Bockg,Ae(Brd  <bojohan@users.sourceforge.net>
+
+	* custom.el (custom-declare-variable): Just put symbol instead
+	of (defvar . symbol) in `current-load-list'.
+
+2005-01-12  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* emacs-lisp/elint.el: Fixed typo in Commentary section.
+
+2005-01-12  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-help.el (calc-describe-key): Use temporary info buffer
+	to create a Calc summary.
+
+2005-01-12  Kim F. Storm  <storm@cua.dk>
+
+	* mouse.el (mouse-on-link-p): Change functionality and doc
+	string to comply with latest description in lisp ref.
+
+2005-01-12  Nick Roberts  <nickrob@snap.net.nz>
+
+	* xt-mouse.el (xterm-mouse-translate, xterm-mouse-event):
+	Enable mouse clicks on mode-line, header-line and margin.
+	(event-type): Give mouse event symbols an 'event-kind property
+	with value 'mouse-click.
+
+2005-01-12  Juri Linkov  <juri@jurta.org>
+
+	* facemenu.el (list-colors-display): Add new arg buffer-name.
+	Use it.  Fix docstring.  Replace code for identifying duplicate
+	colors by the name with call to `list-colors-duplicates' which
+	identifies duplicate colors by the value unless the color
+	is one of special Windows colors.  Set truncate-lines to t.
+	Print sorted duplicate color names on each line.  Indent to 22
+	\(the longest color name in rgb.txt) instead of 20.  Optimize.
+	(list-colors-duplicates): New function.
+	(facemenu-color-name-equal): Delete function.
+
+	* facemenu.el (list-colors-print): New function created from code
+	in list-colors-display.  Print #RRGGBB at the window right edge.
+	(list-colors-display): When temp-buffer-show-function is not
+	defined, call list-colors-print from temp-buffer-show-hook
+	to get the right value of window-width in list-colors-print
+	after the buffer is displayed.
+
+	* simple.el (pop-mark): Move deactivate-mark out of conditional
+	part to deactivate the active mark regardless of the state of the
+	mark ring.
+
+	* desktop.el (desktop-save): Add `mode: emacs-lisp' to the local
+	variables line in desktop files.
+
+2005-01-12  Juri Linkov  <juri@jurta.org>
+
+	* isearch.el (search-highlight, isearch, isearch-lazy-highlight):
+	Bring together isearch highlight related options.
+	(lazy-highlight): Replace group `replace' by `matching'.
+	(lazy-highlight-cleanup, lazy-highlight-initial-delay)
+	(lazy-highlight-interval, lazy-highlight-max-at-a-time)
+	(lazy-highlight): Add aliases to old names isearch-lazy-highlight-...
+	and declare them obsolete.
+	(lazy-highlight-face): Rename from isearch-lazy-highlight-face.
+	(isearch-faces): Remove defgroup.
+	(isearch-overlay, isearch-highlight, isearch-dehighlight):
+	Move isearch highlighting code closer to lazy highlighting code.
+
+	* replace.el (query-replace-lazy-highlight): Add lazy-highlight group.
+	(query-replace-highlight, query-replace-lazy-highlight)
+	(query-replace): Move definitions to the beginning of the file.
+
+2005-01-11  Juri Linkov  <juri@jurta.org>
+
+	* toolbar/back_arrow.xpm, toolbar/back_arrow.pbm,
+	* toolbar/lc-back_arrow.xpm, toolbar/lc-fwd_arrow.xpm,
+	* toolbar/fwd_arrow.xpm, toolbar/fwd_arrow.pbm: New icons.
+
+	* info.el (Info-history-forward): New variable.
+	(Info-select-node): Reset Info-history-forward to nil.
+	(Info-last): Turn into defalias.
+	(Info-history-back): Rename from Info-last.
+	Add current node to Info-history-forward.
+	(Info-history-forward): New fun.
+	(Info-mode-map): Replace Info-last by Info-history-back.
+	Bind Info-history-forward to "r".
+	(Info-mode-menu): Replace Info-last by Info-history-back.
+	Fix menu item text.  Add menu item for Info-history-forward.
+	(info-tool-bar-map): Replace Info-last by Info-history-back.
+	Replace its icon "undo" by "back_arrow".  Add icon "fwd_arrow"
+	for Info-history-forward.
+	(Info-mode): Replace Info-last by Info-history-back in docstring.
+	Add local variable Info-history-forward.
+	(Info-goto-emacs-command-node): Replace Info-last by Info-history-back.
+
+2005-01-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* mouse.el (mouse-drag-mode-line-1, mouse-drag-vertical-line)
+	(mouse-drag-region, mouse-drag-region-1, mouse-drag-secondary):
+	Ignore select-window events rather than fiddle with
+	mouse-autoselect-window.
+
+2005-01-11  Matthew Mundell  <matt@mundell.ukfsn.org>
+
+	* type-break.el (type-break-mode): Fix previous change.
+
+2005-01-10  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-ext.el (calc-reset): Reset when inside embedded
+	calculator; only reset when point is inside a calculator.
+	Don't adjust the window height if the window takes up the whole height
+	of the frame.
+
+2005-01-10  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* ebuff-menu.el (Electric-buffer-menu-mode):
+	Preserve value of buffer-local var header-line-format.
+
+2005-01-09  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc.el (calc-mode-var-list-restore-saved-values):
+	Make sure settings file exists before accessing it.
+
+	* calc/calc-embed.el (calc-embedded-subst):
+	Replace math-multi-subst-rec, which is only supposed to be called
+	by math-multi-subst, by math-multi-subst.
+
+2005-01-09  Andre Spiegel  <spiegel@gnu.org>
+
+	* vc.el (vc-allow-async-revert): New user option.
+	(vc-disable-async-diff): New internal variable.
+	(vc-revert-buffer): Use them to disable asynchronous diff.
+
+	* vc-cvs.el, vc-arch.el, vc-svn.el, vc-mcvs.el (vc-cvs-diff)
+	(vc-arch-diff, vc-svn-diff, vc-mcvs-diff): Don't diff
+	asynchronously if vc-disable-async-diff is t.
+
+2005-01-09  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc.el (defcalcmodevar): New macro.
+	(calc-mode-var-list-restore-default-values)
+	(calc-mode-var-list-restore-saved-values): New functions.
+	(calc-mode-var-list): Use defcalcmodevar to define it.
+	(calc-always-load-extensions, calc-line-numbering)
+	(calc-line-breaking, calc-display-just, calc-display-origin)
+	(calc-number-radix, calc-leading-zeros, calc-group-digits)
+	(calc-group-char, calc-point-char, calc-frac-format)
+	(calc-prefer-frac, calc-hms-format, calc-date-format)
+	(calc-float-format, calc-full-float-format, calc-complex-format)
+	(calc-complex-mode, calc-infinite-mode, calc-display-strings)
+	(calc-matrix-just, calc-break-vectors, calc-full-vectors)
+	(calc-full-trail-vectors, calc-vector-commas, calc-vector-brackets)
+	(calc-matrix-brackets, calc-language, calc-language-option)
+	(calc-left-label, calc-right-label, calc-word-size)
+	(calc-previous-modulo, calc-simplify-mode, calc-auto-recompute)
+	(calc-display-raw, calc-internal-prec, calc-angle-mode)
+	(calc-algebraic-mode, calc-incomplete-algebraic-mode)
+	(calc-symbolic-mode, calc-matrix-mode, calc-shift-prefix)
+	(calc-window-height, calc-display-trail, calc-show-selections)
+	(calc-use-selections, calc-assoc-selections)
+	(calc-display-working-message, calc-auto-why, calc-timing)
+	(calc-mode-save-mode, calc-standard-date-formats, calc-autorange-units)
+	(calc-was-keypad-mode, calc-full-mode, calc-user-parse-tables)
+	(calc-gnuplot-default-device, calc-gnuplot-default-output)
+	(calc-gnuplot-print-device, calc-gnuplot-print-output)
+	(calc-gnuplot-geometry, calc-graph-default-resolution)
+	(calc-graph-default-resolution-3d, calc-invocation-macro)
+	(calc-show-banner): Use defcalcmodevar to declare them and set
+	their default values.
+
+	* calc/calc-ext.el (calc-reset): Restore saved values of variables
+	instead of default values (but restore default values if there is
+	an argument of 0).
+
+2005-01-09  David Kastrup  <dak@gnu.org>
+
+	* desktop.el (desktop-restore-eager): Fix typo in type.
+
+2005-01-08  Richard M. Stallman  <rms@gnu.org>
+
+	* cus-edit.el (customize): Delete :link.
+
+2005-01-08  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc.el (calc-mode): Remove the extension from the
+	`calc-settings-file' file name when loading it.
+
+2005-01-08  Kim F. Storm  <storm@cua.dk>
+
+	* info.el (Info-mode-map, Info-next-link-keymap)
+	(Info-prev-link-keymap, Info-up-link-keymap):
+	Map follow-link to mouse-face.
+	(Info-fontify-node): Add "mouse-2: " prefix to tooltip.
+
+2005-01-08  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc.el (calc-settings-file): Change default value.
+	Suggested by cgw in a comment in calc-mode.el.
+
+	* calc/calc-mode.el (calc-settings-file-name):
+	Compare calc-settings-file to user-init-file instead of ~/.emacs.
+	Replace ~/.emacs in a prompt by calc-settings-file.
+
+2005-01-07  Lars Hansen  <larsh@math.ku.dk>
+
+	* desktop.el (desktop-restore-eager, desktop-lazy-verbose)
+	(desktop-lazy-idle-delay): New customizable variables.
+	(desktop-buffer-args-list): New variable.
+	(desktop-append-buffer-args): New function.
+	(desktop-save): Call desktop-append-buffer-args for some buffers.
+	(desktop-lazy-create-buffer): New function.
+	(desktop-idle-create-buffers): New function.
+	(desktop-read): Add message about buffers to restore lazily.
+	(desktop-lazy-abort): New command.
+	(desktop-clear): Call desktop-lazy-abort.
+	(desktop-lazy-complete): New command.
+
+2005-01-06  Richard M. Stallman  <rms@gnu.org>
+
+	* emacs-lisp/find-func.el (find-face-definition):
+	Rename from find-face.
+
+2005-01-06  Kim F. Storm  <storm@cua.dk>
+
+	* simple.el (completion-list-mode-map): Map follow-link to mouse-face.
+
+	* man.el (Man-xref-man-page, Man-xref-header-file)
+	(Man-xref-normal-file): Add follow-link property.
+
+2005-01-06  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-units.el: Make sure the proper macro definitions are
+	available when compiling.
+
+2005-01-06  Juri Linkov  <juri@jurta.org>
+
+	* isearch.el (isearch-lazy-highlight-update):
+	Rename `isearch-lazy-highlight-interval' to `lazy-highlight-interval'.
+
+2005-01-06  Miles Bader  <miles@gnu.org>
+
+	* isearch.el (lazy-highlight): Rename from `lazy-highlight-face'.
+	(isearch-lazy-highlight-face): Use new name.
+
+2005-01-05  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* uniquify.el (uniquify-rationalize-file-buffer-names):
+	Re-add an interactive spec.
+	(uniquify-rationalize-file-buffer-names): Fix corner case when renaming
+	to the same name.
+
+	* isearch.el (isearch-dehighlight): Remove unused arg `totally'.
+	(isearch-update, isearch-done): Adjust calls accordingly.
+
+2005-01-05  Richard M. Stallman  <rms@gnu.org>
+
+	* custom.el (custom-set-variables, custom-theme-set-variables):
+	Clarify documentation.
+
+	* emacs-lisp/find-func.el (find-variable)
+	(find-variable-other-window, find-variable-other-frame):
+	Fix the TYPE args to find-function-read and find-function-do-it.
+	(find-function): Doc fix.
+	(find-function-at-point): Replace function-at-point alias.
+
+2005-01-04  Richard M. Stallman  <rms@gnu.org>
+
+	* cus-face.el (custom-declare-face):
+	Record defface in current-load-list.
+
+	* help-fns.el (variable-at-point): New arg ANY-SYMBOL.
+
+	* emacs-lisp/find-func.el: Doc fixes.
+	(find-face-regexp): New variable.
+	(find-function-regexp-alist): New variable.
+	(find-function-C-source): Third arg is now TYPE.
+	(find-function-search-for-symbol): Handle general TYPE.
+	(find-function-read, find-function-do-it): Handle general TYPE.
+	(find-definition-noselect, find-face): New functions.
+	(function-at-point): Alias deleted.
+
+2005-01-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* battery.el (display-battery-mode): Rename from display-battery.
+	Handle the case where it gets turned off.
+
+2005-01-04  Richard M. Stallman  <rms@gnu.org>
+
+	* cus-edit.el (customize): Make :link point to user doc.
+
+	* man.el (Man-fontify-manpage): Turn off undo generation.
+
+	* add-log.el (change-log-font-lock-keywords): Don't match just "From".
+
+2005-01-04  Andreas Schwab  <schwab@suse.de>
+
+	* files.el (insert-directory): Only look for error lines in
+	inserted text.  Don't move too far after processing --dired markers.
+
+2005-01-04  Richard M. Stallman  <rms@gnu.org>
+
+	* mail/mailabbrev.el (sendmail-pre-abbrev-expand-hook):
+	Don't expand if the character is @, period, dash, etc.
+	(define-mail-abbrev): Quote names that contain problem characters.
+
+2005-01-04  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* progmodes/hideshow.el: No longer require `cl'; `dolist' is standard.
+
+2005-01-03  Richard M. Stallman  <rms@gnu.org>
+
+	* replace.el (replace-dehighlight): Use lazy-highlight-cleanup.
+	(query-replace-highlight, query-replace-lazy-highlight)
+	(query-replace): Definitions moved up.  Doc fix.
+
+2005-01-03  Richard M. Stallman  <rms@gnu.org>
+
+	* isearch.el (lazy-highlight): Group renamed from isearch-lazy-...
+	(lazy-highlight-cleanup, lazy-highlight-initial-delay)
+	(lazy-highlight-interval, lazy-highlight-max-at-a-time)
+	(lazy-highlight-face): Rename from isearch-lazy-...
+	Change all references to them.
+
+2005-01-03  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* cus-edit.el (custom-file): Doc fix for defcustom.
+	(custom-file): The function no longer sets the variable
+	`custom-file' to its return value.
+
+	* startup.el (command-line): No longer load `custom-file'.
+
+2005-01-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/find-func.el (find-variable-regexp): Avoid defface.
+
+	* progmodes/perl-mode.el (perl-nochange, perl-calculate-indent):
+	Don't confuse module-prefixed identifiers for labels.
+	Reported by Juan-Leon Lahoz Garcia <juanleon1@gmail.com>.
+
+2005-01-02  Richard M. Stallman  <rms@gnu.org>
+
+	* files.el (basic-save-buffer-1): Fix previous change.
+
+	* loadhist.el (file-loadhist-lookup): New function.
+	(file-provides, file-requires): Use it.
+
+	* electric.el (Electric-pop-up-window): Use fit-window-to-buffer
+	instead of calculating the right size.
+
+2005-01-02  Karl Chen  <quarl@cs.berkeley.edu>  (tiny change)
+
+	* vc-svn.el (vc-svn-diff): Stay local if possible.
+
+2005-01-02  Stefan  <monnier@iro.umontreal.ca>
+
+	* vc-arch.el (vc-arch-workfile-version): Handle the empty-branch case.
+
+	* files.el (hack-local-variables): Fix last change.
+
+2005-01-02  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-yank.el (calc-edit-top): New variable.
+	(calc-edit-mode): Set calc-edit-top to be the beginning of the edited
+	object.  Change header properties.
+	(calc-edit-finish, calc-edit-finish-stack-object)
+	(calc-edit-show-buffer): Use calc-edit-top to find the beginning of the
+	edited object.
+	* calc/calc-sel.el (calc-finish-selection-edit): Use calc-edit-top
+	for the beginning of the edited object.
+	* calc/calc-embed.el (calc-embedded-finish-edit): Use calc-edit-top
+	for the beginning of the edited object.
+	* calc/calc-prog.el (calc-edit-macro-finish-edit)
+	(calc-finish-formula-edit, calc-macro-repeats)
+	(calc-edit-macro-adjust-buffer, calc-edit-format-macro-buffer)
+	(calc-edit-macro-pre-finish-edit): Use calc-edit-top for the
+	beginning of the edited object.
+	(calc-user-define-edit): Change the header for editing macros.
+	Remove unnecessary variable.
+
 2005-01-01  Jay Belanger  <belanger@truman.edu>
 
-	* calc-yank.el (calc-edit-mode): Change default header.
-
-	* calc-store.el (calc-edit-variable): Change title to match new
+	* calc/calc-yank.el (calc-edit-mode): Change default header.
+	(calc-edit-finish, calc-show-edit-buffer): Adjust to handle new header.
+	* calc/calc-store.el (calc-edit-variable): Change title to match new
 	header.
-
-	* calc/calc-prog.el (calc-edit-user-syntax): Change title to edit
+	* calc/calc-prog.el (calc-edit-user-syntax): Change title in edit
 	mode to match new header.
 	(calc-user-define-edit): Change titles to include names of commands.
+	(calc-finish-formula-edit): Adjust to handle new header.
 	(calc-finish-macro-edit): Remove.
 	(calc-edit-macro-repeats, calc-edit-macro-adjust-buffer)
 	(calc-edit-macro-command, calc-edit-macro-command-type)
@@ -2944,7 +3489,7 @@
 	* menu-bar.el (menu-bar-files-menu): Make "Open File..." call
 	find-file-existing.  Add "New File..." that calls find-file.
 
-	* diropen.pbm diropen.xpm: New files.
+	* diropen.pbm, diropen.xpm: New files.
 
 	* toolbar/tool-bar.el (tool-bar-setup): Tool bar item dired uses
 	icon diropen.  New tool bar item find-file-existing uses icon open.
@@ -4044,7 +4589,7 @@
 	(dired-move-to-end-of-filename): Make the " -> " search more specific.
 	(dired-buffers-for-dir): Remove unused var `pattern'.
 
-2004-09-28  Matthew Mundell  <matt@mundell.ukfsn.org>  (tiny change)
+2004-09-28  Matthew Mundell  <matt@mundell.ukfsn.org>
 
 	* calendar/diary-lib.el (list-diary-entries): Save diary buffer
 	from diary display excursion.  Store diary buffer's point for
--- a/lisp/add-log.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/add-log.el	Sun Jan 16 03:40:12 2005 +0000
@@ -248,7 +248,9 @@
     ("<\\([^>\n]+\\)>\\(:\\| (\\)" (1 'change-log-function-face))
     ;;
     ;; Acknowledgements.
-    ("\\(^\t\\|  \\)\\(From\\|Patch\\(es\\)? by\\|Report\\(ed by\\| from\\)\\|Suggest\\(ed by\\|ion from\\)\\)"
+    ;; Don't include plain "From" because that is vague;
+    ;; we want to encourage people to say something more specific.
+    ("\\(^\t\\|  \\)\\(Patch\\(es\\)? by\\|Report\\(ed by\\| from\\)\\|Suggest\\(ed by\\|ion from\\)\\)"
      2 'change-log-acknowledgement-face))
   "Additional expressions to highlight in Change Log mode.")
 
--- a/lisp/battery.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/battery.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,6 @@
 ;;; battery.el --- display battery status information
 
-;; Copyright (C) 1997, 1998, 2000, 2001, 2003, 2004
+;; Copyright (C) 1997, 1998, 2000, 2001, 2003, 2004, 2005
 ;;           Free Software Foundation, Inc.
 
 ;; Author: Ralph Schleicher <rs@nunatak.allgaeu.org>
@@ -108,20 +108,23 @@
 		  "Battery status not available")))
 
 ;;;###autoload
-(defun display-battery ()
+(define-minor-mode display-battery-mode
   "Display battery status information in the mode line.
 The text being displayed in the mode line is controlled by the variables
 `battery-mode-line-format' and `battery-status-function'.
 The mode line will be updated automatically every `battery-update-interval'
 seconds."
-  (interactive)
+  :global t
   (setq battery-mode-line-string "")
   (or global-mode-string (setq global-mode-string '("")))
-  (add-to-list 'global-mode-string 'battery-mode-line-string t)
   (and battery-update-timer (cancel-timer battery-update-timer))
-  (setq battery-update-timer (run-at-time nil battery-update-interval
-					  'battery-update-handler))
-  (battery-update))
+  (if (not display-battery-mode)
+      (setq global-mode-string
+	    (delq 'battery-mode-line-string global-mode-string))
+    (add-to-list 'global-mode-string 'battery-mode-line-string t)
+    (setq battery-update-timer (run-at-time nil battery-update-interval
+					    'battery-update-handler))
+    (battery-update)))
 
 (defun battery-update-handler ()
   (battery-update)
--- a/lisp/calc/calc-embed.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/calc/calc-embed.el	Sun Jan 16 03:40:12 2005 +0000
@@ -308,10 +308,10 @@
   (calc-show-edit-buffer))
 
 (defvar calc-original-buffer)
-
+(defvar calc-edit-top)
 (defun calc-embedded-finish-edit (info)
   (let ((buf (current-buffer))
-	(str (buffer-substring (point) (point-max)))
+	(str (buffer-substring calc-edit-top (point-max)))
 	(start (point))
 	pos)
     (switch-to-buffer calc-original-buffer)
@@ -885,7 +885,7 @@
 	(list 'calcFunc-assign
 	      (nth 1 x)
 	      (calc-embedded-subst (nth 2 x)))
-      (calc-normalize (math-evaluate-expr-rec (math-multi-subst-rec x))))))
+      (calc-normalize (math-evaluate-expr-rec (math-multi-subst x nil nil))))))
 
 (defun calc-embedded-eval-get-var (var base)
   (let ((entry base)
--- a/lisp/calc/calc-ext.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/calc/calc-ext.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1240,36 +1240,54 @@
 
 (defun calc-reset (arg)
   (interactive "P")
-  (save-excursion
-    (or (eq major-mode 'calc-mode)
-	(calc-create-buffer))
-    (if calc-embedded-info
-	(calc-embedded nil))
-    (or arg
-	(setq calc-stack nil))
-    (setq calc-undo-list nil
-	  calc-redo-list nil)
-    (let (calc-stack calc-user-parse-tables calc-standard-date-formats
-		     calc-invocation-macro)
-      (mapcar (function (lambda (v) (set v nil))) calc-local-var-list)
-      (mapcar (function (lambda (v) (set (car v) (nth 1 v))))
-	      calc-mode-var-list))
-    (calc-set-language nil nil t)
-    (calc-mode)
-    (calc-flush-caches t)
-    (run-hooks 'calc-reset-hook))
-  (calc-wrapper
-   (let ((win (get-buffer-window (current-buffer))))
-     (calc-realign 0)
-     (if win
-	 (let ((height (- (window-height win) 2)))
-	   (set-window-point win (point))
-	   (or (= height calc-window-height)
-	       (let ((swin (selected-window)))
-		 (select-window win)
-		 (enlarge-window (- calc-window-height height))
-		 (select-window swin)))))))
-  (message "(Calculator reset)"))
+  (setq arg (if arg (prefix-numeric-value arg) nil))
+  (cond
+   ((and
+     calc-embedded-info
+     (equal (aref calc-embedded-info 0) (current-buffer))
+     (<= (point) (aref calc-embedded-info 5))
+     (>= (point) (aref calc-embedded-info 4)))
+    (let ((cbuf (aref calc-embedded-info 1))
+          (calc-embedded-quiet t))
+      (save-window-excursion
+        (calc-embedded nil)
+        (set-buffer cbuf)
+        (calc-reset arg))
+      (calc-embedded nil)))
+   ((eq major-mode 'calc-mode)
+    (save-excursion
+      (unless (and arg (> (abs arg) 0))
+        (setq calc-stack nil))
+      (setq calc-undo-list nil
+            calc-redo-list nil)
+      (let (calc-stack calc-user-parse-tables calc-standard-date-formats
+                       calc-invocation-macro)
+        (mapcar (function (lambda (v) (set v nil))) calc-local-var-list)
+        (if (and arg (<= arg 0))
+            (calc-mode-var-list-restore-default-values)
+          (calc-mode-var-list-restore-saved-values)))
+      (calc-set-language nil nil t)
+      (calc-mode)
+      (calc-flush-caches t)
+      (run-hooks 'calc-reset-hook))
+    (calc-wrapper
+     (let ((win (get-buffer-window (current-buffer))))
+       (calc-realign 0)
+       ;; Adjust the window height if the window is visible, but doesn't
+       ;; take up the whole height of the frame.
+       (if (and
+            win
+            (< (window-height win) (1- (frame-height))))
+           (let ((height (- (window-height win) 2)))
+             (set-window-point win (point))
+             (or (= height calc-window-height)
+                 (let ((swin (selected-window)))
+                   (select-window win)
+                   (enlarge-window (- calc-window-height height))
+                   (select-window swin)))))))
+    (message "(Calculator reset)"))
+   (t
+    (message "(Not inside a Calc buffer)"))))
 
 ;; What a pain; scroll-left behaves differently when called non-interactively.
 (defun calc-scroll-left (n)
--- a/lisp/calc/calc-help.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/calc/calc-help.el	Sun Jan 16 03:40:12 2005 +0000
@@ -178,15 +178,15 @@
 		       (if (= (buffer-size) 0)
 			   (progn
 			     (message "Reading Calc summary from manual...")
-			     (save-window-excursion
-			       (save-excursion
-				 (calc-info-goto-node "Summary")
-				 (goto-char (point-min))
-				 (forward-line 1)
-				 (copy-to-buffer "*Calc Summary*"
-						 (point) (point-max))
-                                 (if Info-history
-                                     (Info-last))))))
+                             (require 'info nil t)
+                             (with-temp-buffer
+                               (Info-mode)
+                               (Info-goto-node "(Calc)Summary")
+                               (goto-char (point-min))
+                               (forward-line 1)
+                               (copy-to-buffer "*Calc Summary*"
+                                               (point) (point-max)))
+                             (setq buffer-read-only t)))
                        (goto-char (point-min))
                        (setq case-fold-search nil)
                        (re-search-forward "^\\(.*\\)\\[\\.\\. a b")
--- a/lisp/calc/calc-mode.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/calc/calc-mode.el	Sun Jan 16 03:40:12 2005 +0000
@@ -309,25 +309,22 @@
 (defun calc-settings-file-name (name &optional arg)
   (interactive
    (list (read-file-name (format "Settings file name (normally %s): "
-				 (abbreviate-file-name (or user-init-file
-							   "~/.emacs"))))
+				 (abbreviate-file-name calc-settings-file)))
 	 current-prefix-arg))
   (calc-wrapper
    (setq arg (if arg (prefix-numeric-value arg) 0))
-   (if (equal name "")
+   (if (string-equal (file-name-nondirectory name) "")
        (message "Calc settings file is \"%s\"" calc-settings-file)
      (if (< (math-abs arg) 2)
 	 (let ((list calc-mode-var-list))
 	   (while list
 	     (set (car (car list)) (nth 1 (car list)))
 	     (setq list (cdr list)))))
-     ;; FIXME: we should use ~/.calc or so in order to avoid
-     ;; reexecuting ~/.emacs (it's not always idempotent) -cgw 2001.11.12
      (setq calc-settings-file name)
      (or (and
 	  calc-settings-file
-	  (string-match "\\.emacs" calc-settings-file)
-	      (> arg 0))
+          (equal user-init-file calc-settings-file)
+          (> arg 0))
 	 (< arg 0)
 	 (load name t)
 	 (message "New file")))))
--- a/lisp/calc/calc-prog.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/calc/calc-prog.el	Sun Jan 16 03:40:12 2005 +0000
@@ -684,21 +684,16 @@
 		    (eq (car-safe (nth 3 cmd)) 'calc-execute-kbd-macro)))
            (let* ((mac (elt (nth 1 (nth 3 cmd)) 1))
                   (str (edmacro-format-keys mac t))
-                  (macbeg)
                   (kys (nth 3 (nth 3 cmd))))
              (calc-edit-mode 
               (list 'calc-edit-macro-finish-edit cmdname kys)
-              t (format "Editing keyboard macro (%s, bound to %s).\n" 
-                        cmdname kys))
-             (goto-char (point-max))
-             (insert "Original keys: " (elt (nth 1 (nth 3 cmd)) 0)  "\n" )
-             (setq macbeg (point))
+              t (format (concat 
+                         "Editing keyboard macro (%s, bound to %s).\n" 
+                         "Original keys: %s \n")
+                        cmdname kys (elt (nth 1 (nth 3 cmd)) 0)))
              (insert str "\n")
              (calc-edit-format-macro-buffer)
-             (calc-show-edit-buffer)
-             (goto-char (point-min))
-             (search-forward "Original")
-             (forward-line 2)))
+             (calc-show-edit-buffer)))
 	  (t (let* ((func (calc-stack-command-p cmd))
 		    (defn (and func
 			       (symbolp func)
@@ -714,18 +709,16 @@
                        nil
                        (format "Editing formula (%s, %s, bound to %s).\n"
                                intcmd algcmd kys))
-		      (insert (math-showing-full-precision
-			       (math-format-nice-expr defn (frame-width)))
-			      "\n"))
-		     (calc-show-edit-buffer)
-                     (goto-char (point-min))
-                     (forward-line 2))
+		      (insert  (math-showing-full-precision
+                                (math-format-nice-expr defn (frame-width)))
+                               "\n"))
+		     (calc-show-edit-buffer))
 		 (error "That command's definition cannot be edited")))))))
 
 ;; Formatting the macro buffer
 
 (defun calc-edit-macro-repeats ()
-  (goto-char (point-min))
+  (goto-char calc-edit-top)
   (while
       (re-search-forward "^\\([0-9]+\\)\\*" nil t)
     (setq num (string-to-int (match-string 1)))
@@ -738,10 +731,10 @@
 
 (defun calc-edit-macro-adjust-buffer ()
   (calc-edit-macro-repeats)
-  (goto-char (point-min))
+  (goto-char calc-edit-top)
   (while (re-search-forward "^RET$" nil t)
     (delete-char 1))
-  (goto-char (point-min))
+  (goto-char calc-edit-top)
   (while (and (re-search-forward "^$" nil t)
               (not (= (point) (point-max))))
     (delete-char 1)))
@@ -869,11 +862,7 @@
 (defun calc-edit-format-macro-buffer ()
   "Rewrite the Calc macro editing buffer."
   (calc-edit-macro-adjust-buffer)
-  (goto-char (point-min))
-  (search-forward "Original keys:")
-  (forward-line 1)
-  (insert "\n")
-  (skip-chars-forward " \t\n")
+  (goto-char calc-edit-top)
   (let ((type (calc-edit-macro-command-type)))
     (while (not (string-equal type ""))
       (cond
@@ -913,27 +902,25 @@
         (calc-edit-macro-combine-var-name))
        (t (forward-line 1)))
       (setq type (calc-edit-macro-command-type))))
-  (goto-char (point-min)))
+  (goto-char calc-edit-top))
 
 ;; Finish editing the macro
 
 (defun calc-edit-macro-pre-finish-edit ()
-  (goto-char (point-min))
+  (goto-char calc-edit-top)
   (while (re-search-forward "\\(^\\| \\)RET\\($\\|\t\\| \\)" nil t)
     (search-backward "RET")
     (delete-char 3)
     (insert "<return>")))
 
+(defvar calc-edit-top)
 (defun calc-edit-macro-finish-edit (cmdname key)
   "Finish editing a Calc macro.
 Redefine the corresponding command."
   (interactive)
   (let ((cmd (intern cmdname)))
     (calc-edit-macro-pre-finish-edit)
-    (goto-char (point-max))
-    (re-search-backward "^Original keys:")
-    (forward-line 1)
-    (let* ((str (buffer-substring (point) (point-max)))
+    (let* ((str (buffer-substring calc-edit-top (point-max)))
            (mac (edmacro-parse-keys str t)))
       (if (= (length mac) 0)
           (fmakunbound cmd)
@@ -946,10 +933,8 @@
                           'arg key)))))))
 
 (defun calc-finish-formula-edit (func)
-  (goto-char (point-min))
-  (forward-line 2)
   (let ((buf (current-buffer))
-	(str (buffer-substring (point) (point-max)))
+	(str (buffer-substring calc-edit-top (point-max)))
 	(start (point))
 	(body (calc-valid-formula-func func)))
     (set-buffer calc-original-buffer)
--- a/lisp/calc/calc-sel.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/calc/calc-sel.el	Sun Jan 16 03:40:12 2005 +0000
@@ -677,10 +677,11 @@
 ;; The variable calc-edit-disp-trail is local to calc-edit-finish,
 ;; in calc-yank.el.
 (defvar calc-edit-disp-trail)
+(defvar calc-edit-top)
 
 (defun calc-finish-selection-edit (num sel reselect)
   (let ((buf (current-buffer))
-	(str (buffer-substring (point) (point-max)))
+	(str (buffer-substring calc-edit-top (point-max)))
 	(start (point)))
     (switch-to-buffer calc-original-buffer)
     (let ((val (math-read-expr str)))
--- a/lisp/calc/calc-units.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/calc/calc-units.el	Sun Jan 16 03:40:12 2005 +0000
@@ -30,6 +30,8 @@
 
 (require 'calc-ext)
 (require 'calc-macs)
+(eval-when-compile
+  (require 'calc-alg))
 
 ;;; Units operations.
 
--- a/lisp/calc/calc-yank.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/calc/calc-yank.el	Sun Jan 16 03:40:12 2005 +0000
@@ -430,6 +430,7 @@
 (defvar calc-edit-handler)
 (defvar calc-restore-trail)
 (defvar calc-allow-ret)
+(defvar calc-edit-top)
 
 (defun calc-edit-mode (&optional handler allow-ret title)
   "Calculator editing mode.  Press RET, LFD, or C-c C-c to finish.
@@ -464,10 +465,15 @@
                                   (let ((calc-edit-handler nil))
                                     (calc-edit-finish t))
                                   (message "(Cancelled)")) t t)
-    (insert (or title title "Calc Edit Mode. ")
-	    "Press `C-c C-c'"
-            (if allow-ret "" " or RET")
-	    " to finish, `C-x k RET' to cancel.\n")))
+    (insert (propertize
+             (concat 
+              (or title title "Calc Edit Mode. ")
+              "Press `C-c C-c'"
+              (if allow-ret "" " or RET")
+              " to finish, `C-x k RET' to cancel.\n\n")
+             'font-lock-face 'italic 'read-only t 'rear-nonsticky t 'front-sticky t))
+    (make-local-variable 'calc-edit-top)
+    (setq calc-edit-top (point))))
 (put 'calc-edit-mode 'mode-class 'special)
 
 (defun calc-show-edit-buffer ()
@@ -484,8 +490,7 @@
 	  (if win
 	      (delete-window win))))
     (set-buffer-modified-p nil)
-    (goto-char (point-min))
-    (forward-line 1)))
+    (goto-char calc-edit-top)))
 
 (defun calc-edit-return ()
   (interactive)
@@ -519,9 +524,7 @@
 		  (set-buffer original)
 		  (not (eq major-mode 'calc-mode))))
 	(error "Original calculator buffer has been corrupted")))
-    (goto-char (point-min))
-    (when (looking-at "Calc Edit\\|Editing ")
-      (forward-line 1))
+    (goto-char calc-edit-top)
     (if (buffer-modified-p)
 	(eval calc-edit-handler))
     (if one-window
@@ -546,7 +549,7 @@
 
 (defun calc-finish-stack-edit (num)
   (let ((buf (current-buffer))
-	(str (buffer-substring (point) (point-max)))
+	(str (buffer-substring calc-edit-top (point-max)))
 	(start (point))
 	pos)
     (if (and (integerp num) (> num 1))
--- a/lisp/calc/calc.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/calc/calc.el	Sun Jan 16 03:40:12 2005 +0000
@@ -206,8 +206,8 @@
 (require 'calc-macs)
 
 ;;;###autoload
-(defvar calc-settings-file user-init-file
-  "*File in which to record permanent settings; default is `user-init-file'.")
+(defvar calc-settings-file (convert-standard-filename "~/.calc.el")
+  "*File in which to record permanent settings.")
 
 (defvar calc-bug-address "belanger@truman.edu"
   "Address of the author of Calc, for use by `report-calc-bug'.")
@@ -241,128 +241,102 @@
 (defvar calc-loaded-settings-file nil
   "t if `calc-settings-file' has been loaded yet.")
 
-(defvar calc-always-load-extensions)
-(defvar calc-line-numbering)
-(defvar calc-line-breaking)
-(defvar calc-display-just)
-(defvar calc-display-origin)
-(defvar calc-number-radix)
-(defvar calc-leading-zeros)
-(defvar calc-group-digits)
-(defvar calc-group-char)
-(defvar calc-point-char)
-(defvar calc-frac-format)
-(defvar calc-prefer-frac)
-(defvar calc-hms-format)
-(defvar calc-date-format)
-(defvar calc-float-format)
-(defvar calc-full-float-format)
-(defvar calc-complex-format)
-(defvar calc-complex-mode)
-(defvar calc-infinite-mode)
-(defvar calc-display-strings)
-(defvar calc-matrix-just)
-(defvar calc-break-vectors)
-(defvar calc-full-vectors)
-(defvar calc-full-trail-vectors)
-(defvar calc-vector-commas)
-(defvar calc-vector-brackets)
-(defvar calc-matrix-brackets)
-(defvar calc-language)
-(defvar calc-language-option)
-(defvar calc-left-label)
-(defvar calc-right-label)
-(defvar calc-word-size)
-(defvar calc-previous-modulo)
-(defvar calc-simplify-mode)
-(defvar calc-auto-recompute)
-(defvar calc-display-raw)
-(defvar calc-internal-prec)
-(defvar calc-angle-mode)
-(defvar calc-algebraic-mode)
-(defvar calc-incomplete-algebraic-mode)
-(defvar calc-symbolic-mode)
-(defvar calc-matrix-mode)
-(defvar calc-shift-prefix)
-(defvar calc-window-height)
-(defvar calc-display-trail)
-(defvar calc-show-selections)
-(defvar calc-use-selections)
-(defvar calc-assoc-selections)
-(defvar calc-display-working-message)
-(defvar calc-auto-why)
-(defvar calc-timing)
-(defvar calc-mode-save-mode)
-(defvar calc-standard-date-formats)
-(defvar calc-autorange-units)
-(defvar calc-was-keypad-mode)
-(defvar calc-full-mode)
-(defvar calc-user-parse-tables)
-(defvar calc-gnuplot-default-device)
-(defvar calc-gnuplot-default-output)
-(defvar calc-gnuplot-print-device)
-(defvar calc-gnuplot-print-output)
-(defvar calc-gnuplot-geometry)
-(defvar calc-graph-default-resolution)
-(defvar calc-graph-default-resolution-3d)
-(defvar calc-invocation-macro)
-(defvar calc-show-banner)
-
-(defconst calc-mode-var-list '(
-  (calc-always-load-extensions nil
-   "If non-nil, load the calc-ext module automatically when calc is loaded.")
-
-  (calc-line-numbering t
-   "If non-nil, display line numbers in Calculator stack.")
-
-  (calc-line-breaking t
-   "If non-nil, break long values across multiple lines in Calculator stack.")
-
-  (calc-display-just nil
-   "If nil, stack display is left-justified.
+
+(defvar calc-mode-var-list '()
+  "List of variables used in customizing GNU Calc.")
+
+(defmacro defcalcmodevar (var defval &optional doc)
+  `(progn
+     (defvar ,var ,defval ,doc)
+     (add-to-list 'calc-mode-var-list (list (quote ,var) ,defval))))
+
+(defun calc-mode-var-list-restore-default-values ()
+  (mapcar (function (lambda (v) (set (car v) (nth 1 v))))
+          calc-mode-var-list))
+
+(defun calc-mode-var-list-restore-saved-values ()
+  (let ((newvarlist '()))
+    (save-excursion
+      (let (pos
+            (file (substitute-in-file-name calc-settings-file)))
+        (when (and
+               (file-regular-p file)
+               (set-buffer (find-file-noselect file))
+               (goto-char (point-min))
+               (search-forward ";;; Mode settings stored by Calc" nil t)
+               (progn
+                 (forward-line 1)
+                 (setq pos (point))
+                 (search-forward "\n;;; End of mode settings" nil t)))
+          (beginning-of-line)
+          (calc-mode-var-list-restore-default-values)
+          (eval-region pos (point))
+          (let ((varlist calc-mode-var-list))
+            (while varlist
+              (let ((var (car varlist)))
+                (setq newvarlist
+                      (cons (list (car var) (symbol-value (car var)))
+                            newvarlist)))
+              (setq varlist (cdr varlist)))))))
+    (if newvarlist
+        (mapcar (function (lambda (v) (set (car v) (nth 1 v))))
+                newvarlist)
+      (calc-mode-var-list-restore-default-values))))
+
+(defcalcmodevar calc-always-load-extensions nil
+  "If non-nil, load the calc-ext module automatically when calc is loaded.")
+
+(defcalcmodevar  calc-line-numbering t
+  "If non-nil, display line numbers in Calculator stack.")
+
+(defcalcmodevar calc-line-breaking t
+  "If non-nil, break long values across multiple lines in Calculator stack.")
+
+(defcalcmodevar calc-display-just nil
+  "If nil, stack display is left-justified.
 If `right', stack display is right-justified.
 If `center', stack display is centered.")
 
-  (calc-display-origin nil
-   "Horizontal origin of displayed stack entries.
+(defcalcmodevar calc-display-origin nil
+  "Horizontal origin of displayed stack entries.
 In left-justified mode, this is effectively indentation.  (Default 0).
 In right-justified mode, this is effectively window width.
 In centered mode, center of stack entry is placed here.")
 
-  (calc-number-radix 10
-   "Radix for entry and display of numbers in calc-mode, 2-36.")
-
-  (calc-leading-zeros nil
-   "If non-nil, leading zeros are provided to pad integers to calc-word-size.")
-
-  (calc-group-digits nil
-   "If non-nil, group digits in large displayed integers by inserting spaces.
+(defcalcmodevar calc-number-radix 10
+  "Radix for entry and display of numbers in calc-mode, 2-36.")
+
+(defcalcmodevar calc-leading-zeros nil
+  "If non-nil, leading zeros are provided to pad integers to calc-word-size.")
+
+(defcalcmodevar calc-group-digits nil
+  "If non-nil, group digits in large displayed integers by inserting spaces.
 If an integer, group that many digits at a time.
 If t, use 4 for binary and hex, 3 otherwise.")
 
-  (calc-group-char ","
-   "The character (in the form of a string) to be used for grouping digits.
+(defcalcmodevar calc-group-char ","
+  "The character (in the form of a string) to be used for grouping digits.
 This is used only when calc-group-digits mode is on.")
 
-  (calc-point-char "."
-   "The character (in the form of a string) to be used as a decimal point.")
+(defcalcmodevar calc-point-char "."
+  "The character (in the form of a string) to be used as a decimal point.")
   
-  (calc-frac-format (":" nil)
-   "Format of displayed fractions; a string of one or two of \":\" or \"/\".")
-
-  (calc-prefer-frac nil
-   "If non-nil, prefer fractional over floating-point results.")
-
-  (calc-hms-format "%s@ %s' %s\""
-   "Format of displayed hours-minutes-seconds angles, a format string.
+(defcalcmodevar calc-frac-format '(":" nil)
+  "Format of displayed fractions; a string of one or two of \":\" or \"/\".")
+
+(defcalcmodevar calc-prefer-frac nil
+  "If non-nil, prefer fractional over floating-point results.")
+
+(defcalcmodevar calc-hms-format "%s@ %s' %s\""
+  "Format of displayed hours-minutes-seconds angles, a format string.
 String must contain three %s marks for hours, minutes, seconds respectively.")
 
-  (calc-date-format ((H ":" mm C SS pp " ")
-                     Www " " Mmm " " D ", " YYYY)
-   "Format of displayed date forms.")
-
-  (calc-float-format (float 0)
-   "Format to use for display of floating-point numbers in calc-mode.
+(defcalcmodevar calc-date-format '((H ":" mm C SS pp " ")
+                                  Www " " Mmm " " D ", " YYYY)
+  "Format of displayed date forms.")
+
+(defcalcmodevar calc-float-format '(float 0)
+  "Format to use for display of floating-point numbers in calc-mode.
 Must be a list of one of the following forms:
  (float 0)      Floating point format, display full precision.
  (float N)      N > 0: Floating point format, at most N significant figures.
@@ -375,54 +349,54 @@
  (eng N)        N > 0: Engineering notation, N significant figures.
  (eng -N)       -N < 0: Engineering notation, calc-internal-prec - N figs.")
 
-  (calc-full-float-format (float 0)
-   "Format to use when full precision must be displayed.")
-
-  (calc-complex-format nil
-   "Format to use for display of complex numbers in calc-mode.  Must be one of:
+(defcalcmodevar calc-full-float-format '(float 0)
+  "Format to use when full precision must be displayed.")
+
+(defcalcmodevar calc-complex-format nil
+  "Format to use for display of complex numbers in calc-mode.  Must be one of:
   nil            Use (x, y) form.
   i              Use x + yi form.
   j              Use x + yj form.")
 
-  (calc-complex-mode cplx
-   "Preferred form, either `cplx' or `polar', for complex numbers.")
-
-  (calc-infinite-mode nil
-   "If nil, 1 / 0 is left unsimplified.
+(defcalcmodevar calc-complex-mode 'cplx
+  "Preferred form, either `cplx' or `polar', for complex numbers.")
+
+(defcalcmodevar calc-infinite-mode nil
+  "If nil, 1 / 0 is left unsimplified.
 If 0, 1 / 0 is changed to inf (zeros are considered positive).
 Otherwise, 1 / 0 is changed to uinf (undirected infinity).")
 
-  (calc-display-strings nil
-   "If non-nil, display vectors of byte-sized integers as strings.")
-
-  (calc-matrix-just center
-   "If nil, vector elements are left-justified.
+(defcalcmodevar calc-display-strings nil
+  "If non-nil, display vectors of byte-sized integers as strings.")
+
+(defcalcmodevar calc-matrix-just 'center
+  "If nil, vector elements are left-justified.
 If `right', vector elements are right-justified.
 If `center', vector elements are centered.")
 
-  (calc-break-vectors nil
-   "If non-nil, display vectors one element per line.")
-
-  (calc-full-vectors t
-   "If non-nil, display long vectors in full.  If nil, use abbreviated form.")
-
-  (calc-full-trail-vectors t
-   "If non-nil, display long vectors in full in the trail.")
-
-  (calc-vector-commas ","
-   "If non-nil, separate elements of displayed vectors with this string.")
-
-  (calc-vector-brackets "[]"
-   "If non-nil, surround displayed vectors with these characters.")
-
-  (calc-matrix-brackets (R O)
-   "A list of code-letter symbols that control \"big\" matrix display.
+(defcalcmodevar calc-break-vectors nil
+  "If non-nil, display vectors one element per line.")
+
+(defcalcmodevar calc-full-vectors t
+  "If non-nil, display long vectors in full.  If nil, use abbreviated form.")
+
+(defcalcmodevar calc-full-trail-vectors t
+  "If non-nil, display long vectors in full in the trail.")
+
+(defcalcmodevar calc-vector-commas ","
+  "If non-nil, separate elements of displayed vectors with this string.")
+
+(defcalcmodevar calc-vector-brackets "[]"
+  "If non-nil, surround displayed vectors with these characters.")
+
+(defcalcmodevar calc-matrix-brackets '(R O)
+  "A list of code-letter symbols that control \"big\" matrix display.
 If `R' is present, display inner brackets for matrices.
 If `O' is present, display outer brackets for matrices (above/below).
 If `C' is present, display outer brackets for matrices (centered).")
 
-  (calc-language nil
-   "Language or format for entry and display of stack values.  Must be one of:
+(defcalcmodevar calc-language nil
+  "Language or format for entry and display of stack values.  Must be one of:
   nil		Use standard Calc notation.
   flat		Use standard Calc notation, one-line format.
   big		Display formulas in 2-d notation (enter w/std notation).
@@ -435,23 +409,23 @@
   math		Use Mathematica(tm) notation.
   maple		Use Maple notation.")
 
-  (calc-language-option nil
-   "Numeric prefix argument for the command that set `calc-language'.")
-
-  (calc-left-label ""
-   "Label to display at left of formula.")
-
-  (calc-right-label ""
-   "Label to display at right of formula.")
-
-  (calc-word-size 32
-   "Minimum number of bits per word, if any, for binary operations in calc-mode.")
-
-  (calc-previous-modulo nil
-   "Most recently used value of M in a modulo form.")
-
-  (calc-simplify-mode nil
-   "Type of simplification applied to results.
+(defcalcmodevar calc-language-option nil
+  "Numeric prefix argument for the command that set `calc-language'.")
+
+(defcalcmodevar calc-left-label ""
+  "Label to display at left of formula.")
+
+(defcalcmodevar calc-right-label ""
+  "Label to display at right of formula.")
+
+(defcalcmodevar calc-word-size 32
+  "Minimum number of bits per word, if any, for binary operations in calc-mode.")
+
+(defcalcmodevar calc-previous-modulo nil
+  "Most recently used value of M in a modulo form.")
+
+(defcalcmodevar calc-simplify-mode nil
+  "Type of simplification applied to results.
 If `none', results are not simplified when pushed on the stack.
 If `num', functions are simplified only when args are constant.
 If nil, only fast simplifications are applied.
@@ -460,69 +434,69 @@
 If `ext', `math-simplify-extended' is applied.
 If `units', `math-simplify-units' is applied.")
 
-  (calc-auto-recompute t
-   "If non-nil, recompute evalto's automatically when necessary.")
-
-  (calc-display-raw nil
-   "If non-nil, display shows unformatted Lisp exprs.  (For debugging)")
-
-  (calc-internal-prec 12
-   "Number of digits of internal precision for calc-mode calculations.")
-
-  (calc-angle-mode deg
-   "If deg, angles are in degrees; if rad, angles are in radians.
+(defcalcmodevar calc-auto-recompute t
+  "If non-nil, recompute evalto's automatically when necessary.")
+
+(defcalcmodevar calc-display-raw nil
+  "If non-nil, display shows unformatted Lisp exprs.(defcalcmodevar For debugging)")
+
+(defcalcmodevar calc-internal-prec 12
+  "Number of digits of internal precision for calc-mode calculations.")
+
+(defcalcmodevar calc-angle-mode 'deg
+  "If deg, angles are in degrees; if rad, angles are in radians.
 If hms, angles are in degrees-minutes-seconds.")
 
-  (calc-algebraic-mode nil
-   "If non-nil, numeric entry accepts whole algebraic expressions.
+(defcalcmodevar calc-algebraic-mode nil
+  "If non-nil, numeric entry accepts whole algebraic expressions.
 If nil, algebraic expressions must be preceded by \"'\".")
 
-  (calc-incomplete-algebraic-mode nil
-   "Like calc-algebraic-mode except only affects ( and [ keys.")
-
-  (calc-symbolic-mode nil
-   "If non-nil, inexact numeric computations like sqrt(2) are postponed.
+(defcalcmodevar calc-incomplete-algebraic-mode nil
+  "Like calc-algebraic-mode except only affects ( and [ keys.")
+
+(defcalcmodevar calc-symbolic-mode nil
+  "If non-nil, inexact numeric computations like sqrt(2) are postponed.
 If nil, computations on numbers always yield numbers where possible.")
 
-  (calc-matrix-mode nil
-   "If `matrix', variables are assumed to be matrix-valued.
+(defcalcmodevar calc-matrix-mode nil
+  "If `matrix', variables are assumed to be matrix-valued.
 If a number, variables are assumed to be NxN matrices.
 If `scalar', variables are assumed to be scalar-valued.
 If nil, symbolic math routines make no assumptions about variables.")
 
-  (calc-shift-prefix nil
-   "If non-nil, shifted letter keys are prefix keys rather than normal meanings.")
-
-  (calc-window-height 7
-   "Initial height of Calculator window.")
-
-  (calc-display-trail t
-   "If non-nil, M-x calc creates a window to display Calculator trail.")
-
-  (calc-show-selections t
-   "If non-nil, selected sub-formulas are shown by obscuring rest of formula.
+(defcalcmodevar calc-shift-prefix nil
+  "If non-nil, shifted letter keys are prefix keys rather than normal meanings.")
+
+(defcalcmodevar calc-window-height 7
+  "Initial height of Calculator window.")
+
+(defcalcmodevar calc-display-trail t
+  "If non-nil, M-x calc creates a window to display Calculator trail.")
+
+(defcalcmodevar calc-show-selections t
+  "If non-nil, selected sub-formulas are shown by obscuring rest of formula.
 If nil, selected sub-formulas are highlighted by obscuring the sub-formulas.")
 
-  (calc-use-selections t
-   "If non-nil, commands operate only on selected portions of formulas.
+(defcalcmodevar calc-use-selections t
+  "If non-nil, commands operate only on selected portions of formulas.
 If nil, selections displayed but ignored.")
 
-  (calc-assoc-selections t
-   "If non-nil, selection hides deep structure of associative formulas.")
-
-  (calc-display-working-message lots
-   "If non-nil, display \"Working...\" for potentially slow Calculator commands.")
-
-  (calc-auto-why maybe
-   "If non-nil, automatically execute a \"why\" command to explain odd results.")
-
-  (calc-timing nil
-   "If non-nil, display timing information on each slow command.")
-
-  (calc-mode-save-mode local)
-
-  (calc-standard-date-formats
-   ("N"
+(defcalcmodevar calc-assoc-selections t
+  "If non-nil, selection hides deep structure of associative formulas.")
+
+(defcalcmodevar calc-display-working-message 'lots
+  "If non-nil, display \"Working...\" for potentially slow Calculator commands.")
+
+(defcalcmodevar calc-auto-why 'maybe
+  "If non-nil, automatically execute a \"why\" command to explain odd results.")
+
+(defcalcmodevar calc-timing nil
+  "If non-nil, display timing information on each slow command.")
+
+(defcalcmodevar calc-mode-save-mode 'local)
+
+(defcalcmodevar calc-standard-date-formats
+  '("N"
     "<H:mm:SSpp >Www Mmm D, YYYY"
     "D Mmm YYYY<, h:mm:SS>"
     "Www Mmm BD< hh:mm:ss> YYYY"
@@ -533,40 +507,32 @@
     "j<, h:mm:SS>"
     "YYddd< hh:mm:ss>"))
 
-  (calc-autorange-units nil)
-  
-  (calc-was-keypad-mode nil)
+(defcalcmodevar calc-autorange-units nil)
   
-  (calc-full-mode nil)
-
-  (calc-user-parse-tables nil)
-
-  (calc-gnuplot-default-device "default")
-
-  (calc-gnuplot-default-output "STDOUT")
-
-  (calc-gnuplot-print-device "postscript")
+(defcalcmodevar calc-was-keypad-mode nil)
   
-  (calc-gnuplot-print-output "auto")
-
-  (calc-gnuplot-geometry nil)
-
-  (calc-graph-default-resolution 15)
-
-  (calc-graph-default-resolution-3d 5)
+(defcalcmodevar calc-full-mode nil)
+
+(defcalcmodevar calc-user-parse-tables nil)
+
+(defcalcmodevar calc-gnuplot-default-device "default")
+
+(defcalcmodevar calc-gnuplot-default-output "STDOUT")
+
+(defcalcmodevar calc-gnuplot-print-device "postscript")
   
-  (calc-invocation-macro nil)
-
-  (calc-show-banner t
-   "*If non-nil, show a friendly greeting above the stack."))
-  "List of variables (and default values) used in customizing GNU Calc.")
-
-(mapcar (function (lambda (v)
-                    (or (boundp (car v))
-                        (set (car v) (nth 1 v)))
-                    (if (nth 2 v)
-                        (put (car v) 'variable-documentation (nth 2 v)))))
-        calc-mode-var-list)
+(defcalcmodevar calc-gnuplot-print-output "auto")
+
+(defcalcmodevar calc-gnuplot-geometry nil)
+
+(defcalcmodevar calc-graph-default-resolution 15)
+
+(defcalcmodevar calc-graph-default-resolution-3d 5)
+  
+(defcalcmodevar calc-invocation-macro nil)
+
+(defcalcmodevar calc-show-banner t
+  "*If non-nil, show a friendly greeting above the stack.")
 
 (defconst calc-local-var-list '(calc-stack
 				calc-stack-top
@@ -1028,7 +994,7 @@
       (equal calc-settings-file user-init-file)
       (progn
 	(setq calc-loaded-settings-file t)
-	(load calc-settings-file t)))   ; t = missing-ok
+	(load (file-name-sans-extension calc-settings-file) t)))   ; t = missing-ok
   (let ((p command-line-args))
     (while p
       (and (equal (car p) "-f")
--- a/lisp/cus-edit.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/cus-edit.el	Sun Jan 16 03:40:12 2005 +0000
@@ -243,7 +243,6 @@
 
 (defgroup customize '((widgets custom-group))
   "Customization of the Customization support."
-  :link '(custom-manual "(elisp)Customization")
   :prefix "custom-"
   :group 'help)
 
@@ -3699,35 +3698,57 @@
 as specified by `user-init-file'.  If the value is not nil,
 it should be an absolute file name.
 
-To make this feature work, you'll need to put something in your
-init file to specify the value of `custom-file'.  Just
-customizing the variable won't suffice, because Emacs won't know
-which file to load unless the init file sets `custom-file'.
-
-When you change this variable, look in the previous custom file
-\(usually your init file) for the forms `(custom-set-variables ...)'
-and `(custom-set-faces ...)', and copy them (whichever ones you find)
-to the new custom file.  This will preserve your existing customizations."
-  :type '(choice (const :tag "Your Emacs init file" nil) file)
+You can set this option through Custom, if you carefully read the
+last paragraph below.  However, usually it is simpler to write
+something like the following in your init file:
+
+\(setq custom-file \"~/.emacs-custom.el\")
+\(load custom-file)
+
+Note that both lines are necessary: the first line tells Custom to
+save all customizations in this file, but does not load it.
+
+When you change this variable outside Custom, look in the
+previous custom file \(usually your init file) for the
+forms `(custom-set-variables ...)'  and `(custom-set-faces ...)',
+and copy them (whichever ones you find) to the new custom file.
+This will preserve your existing customizations.
+
+If you save this option using Custom, Custom will write all
+currently saved customizations, including the new one for this
+option itself, into the file you specify, overwriting any
+`custom-set-variables' and `custom-set-faces' forms already
+present in that file.  It will not delete any customizations from
+the old custom file.  You should do that manually if that is what you
+want.  You also have to put something like `\(load \"CUSTOM-FILE\")
+in your init file, where CUSTOM-FILE is the actual name of the
+file.  Otherwise, Emacs will not load the file when it starts up,
+and hence will not set `custom-file' to that file either."
+  :type '(choice (const :tag "Your Emacs init file" nil)
+		 (file :format "%t:%v%d"
+		       :doc
+		       "Please read entire docstring below before setting \
+this through Custom.
+Click om \"More\" \(or position point there and press RETURN)
+if only the first line of the docstring is shown."))
   :group 'customize)
 
 (defun custom-file ()
   "Return the file name for saving customizations."
-  (setq custom-file
-	(or custom-file
-	    (let ((user-init-file user-init-file)
-		  (default-init-file
-		    (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs")))
-	      (when (null user-init-file)
-		(if (or (file-exists-p default-init-file)
-			(and (eq system-type 'windows-nt)
-			     (file-exists-p "~/_emacs")))
-		    ;; Started with -q, i.e. the file containing
-		    ;; Custom settings hasn't been read.  Saving
-		    ;; settings there would overwrite other settings.
-		    (error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
-		(setq user-init-file default-init-file))
-	      user-init-file))))
+  (or custom-file
+      (let ((user-init-file user-init-file)
+	    (default-init-file
+	      (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs")))
+	(when (null user-init-file)
+	  (if (or (file-exists-p default-init-file)
+		  (and (eq system-type 'windows-nt)
+		       (file-exists-p "~/_emacs")))
+	      ;; Started with -q, i.e. the file containing
+	      ;; Custom settings hasn't been read.  Saving
+	      ;; settings there would overwrite other settings.
+	      (error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
+	  (setq user-init-file default-init-file))
+	user-init-file)))
 
 (defun custom-save-delete (symbol)
   "Visit `custom-file' and delete all calls to SYMBOL from it.
--- a/lisp/cus-face.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/cus-face.el	Sun Jan 16 03:40:12 2005 +0000
@@ -50,6 +50,7 @@
 	    (make-face-x-resource-internal face))))
     ;; Don't record SPEC until we see it causes no errors.
     (put face 'face-defface-spec spec)
+    (push (cons 'defface face) current-load-list)
     (when (and doc (null (face-documentation face)))
       (set-face-documentation face (purecopy doc)))
     (custom-handle-all-keywords face args 'custom-face)
--- a/lisp/custom.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/custom.el	Sun Jan 16 03:40:12 2005 +0000
@@ -168,7 +168,7 @@
     ;; Do the actual initialization.
     (unless custom-dont-initialize
       (funcall initialize symbol default)))
-  (push (cons 'defvar symbol) current-load-list)
+  (push symbol current-load-list)
   (run-hooks 'custom-define-hook)
   symbol)
 
@@ -710,44 +710,46 @@
 (put 'custom-local-buffer 'permanent-local t)
 
 (defun custom-set-variables (&rest args)
-  "Initialize variables according to user preferences.
-The settings are registered as theme `user'.
+  "Install user customizations of variable values specified in ARGS.
+These settings are registered as theme `user'.
 The arguments should each be a list of the form:
 
-  (SYMBOL VALUE [NOW [REQUEST [COMMENT]]])
+  (SYMBOL EXP [NOW [REQUEST [COMMENT]]])
 
-The unevaluated VALUE is stored as the saved value for SYMBOL.
-If NOW is present and non-nil, VALUE is also evaluated and bound as
-the default value for the SYMBOL.
+This stores EXP (without evaluating it) as the saved value for SYMBOL.
+If NOW is present and non-nil, then also evaluate EXP and set
+the default value for the SYMBOL to the value of EXP.
 
-REQUEST is a list of features we must 'require for SYMBOL.
+REQUEST is a list of features we must require in order to
+handle SYMBOL properly.
 COMMENT is a comment string about SYMBOL."
   (apply 'custom-theme-set-variables 'user args))
 
 (defun custom-theme-set-variables (theme &rest args)
-  "Initialize variables according to settings specified by args.
-Records the settings as belonging to THEME.
+  "Initialize variables for theme THEME according to settings in ARGS.
+Each of the arguments in ARGS should be a list of this form:
 
-The arguments should be a list where each entry has the form:
+  (SYMBOL EXP [NOW [REQUEST [COMMENT]]])
 
-  (SYMBOL VALUE [NOW [REQUEST [COMMENT]]])
+This stores EXP (without evaluating it) as the saved value for SYMBOL.
+If NOW is present and non-nil, then also evaluate EXP and set
+the default value for the SYMBOL to the value of EXP.
 
-The unevaluated VALUE is stored as the saved value for SYMBOL.
-If NOW is present and non-nil, VALUE is also evaluated and bound as
-the default value for the SYMBOL.
-REQUEST is a list of features we must 'require for SYMBOL.
+REQUEST is a list of features we must require in order to
+handle SYMBOL properly.
 COMMENT is a comment string about SYMBOL.
 
 Several properties of THEME and SYMBOL are used in the process:
 
-If THEME property `theme-immediate' is non-nil, this is equivalent of
-providing the NOW argument to all symbols in the argument list: SYMBOL
-is bound to the evaluated VALUE.  The only difference is SYMBOL property
+If THEME's property `theme-immediate' is non-nil, this is equivalent of
+providing the NOW argument to all symbols in the argument list:
+evaluate each EXP and set the corresponding SYMBOL.  However,
+there's a difference in the handling of SYMBOL's property
 `force-value': if NOW is non-nil, SYMBOL's property `force-value' is set to
 the symbol `rogue', else if THEME's property `theme-immediate' is non-nil,
-FACE's property `force-face' is set to the symbol `immediate'.
+SYMBOL's property `force-value' is set to the symbol `immediate'.
 
-VALUE itself is saved unevaluated as SYMBOL property `saved-value' and
+EXP itself is saved unevaluated as SYMBOL property `saved-value' and
 in SYMBOL's list property `theme-value' \(using `custom-push-theme')."
   (custom-check-theme theme)
   (let ((immediate (get theme 'theme-immediate)))
--- a/lisp/desktop.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/desktop.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,6 @@
 ;;; desktop.el --- save partial status of Emacs when killed
 
-;; Copyright (C) 1993, 1994, 1995, 1997, 2000, 2001
+;; Copyright (C) 1993, 1994, 1995, 1997, 2000, 2001, 2005
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Morten Welinder <terra@diku.dk>
@@ -198,7 +198,7 @@
     search-ring-yank-pointer
     regexp-search-ring
     regexp-search-ring-yank-pointer)
-  "List of global variables to clear by `desktop-clear'.
+  "List of global variables that `desktop-clear' will clear.
 An element may be variable name (a symbol) or a cons cell of the form
 \(VAR . FORM). Symbols are set to nil and for cons cells VAR is set
 to the value obtained by evaluateing FORM."
@@ -267,6 +267,27 @@
   :group 'desktop
   :version "21.4")
 
+(defcustom desktop-restore-eager t
+  "Number of buffers to restore immediately.
+Remaining buffers are restored lazily (when Emacs is idle).
+If value is t, all buffers are restored immediately."
+  :type '(choice (const t) integer)
+  :group 'desktop
+  :version "21.4")
+
+(defcustom desktop-lazy-verbose t
+  "Verbose reporting of lazily created buffers."
+  :type 'boolean
+  :group 'desktop
+  :version "21.4")
+
+(defcustom desktop-lazy-idle-delay 5
+  "Idle delay before starting to create buffers.
+See `desktop-restore-eager'."
+  :type 'integer
+  :group 'desktop
+  :version "21.4")
+
 ;;;###autoload
 (defvar desktop-save-buffer nil
   "When non-nil, save buffer status in desktop file.
@@ -365,6 +386,7 @@
 `desktop-clear-preserve-buffers'.  Furthermore, it clears the
 variables listed in `desktop-globals-to-clear'."
   (interactive)
+  (desktop-lazy-abort)
   (dolist (var desktop-globals-to-clear)
     (if (symbolp var)
       (eval `(setq-default ,var nil))
@@ -625,12 +647,13 @@
                         (setq locals (cdr locals)))
                       ll)))
               (buffer-list)))
+          (eager desktop-restore-eager)
           (buf (get-buffer-create "*desktop*")))
       (set-buffer buf)
       (erase-buffer)
 
       (insert
-        ";; -*- coding: utf-8-emacs; -*-\n"
+        ";; -*- mode: emacs-lisp; coding: utf-8-emacs; -*-\n"
         desktop-header
         ";; Created " (current-time-string) "\n"
         ";; Desktop file format version " desktop-file-version "\n"
@@ -645,14 +668,21 @@
 
       (insert "\n;; Buffer section -- buffers listed in same order as in buffer list:\n")
       (mapc #'(lambda (l)
-		(if (apply 'desktop-save-buffer-p l)
-		    (progn
-		      (insert "(desktop-create-buffer " desktop-file-version)
-		      (mapc #'(lambda (e)
-				(insert "\n  " (desktop-value-to-string e)))
-			    l)
-		      (insert ")\n\n"))))
-	    info)
+                (when (apply 'desktop-save-buffer-p l)
+                  (insert "("
+                          (if (or (not (integerp eager))
+                                  (unless (zerop eager)
+                                    (setq eager (1- eager))
+                                    t))
+                              "desktop-create-buffer"
+                            "desktop-append-buffer-args")
+                          " "
+                          desktop-file-version)
+                  (mapc #'(lambda (e)
+                            (insert "\n  " (desktop-value-to-string e)))
+                        l)
+                  (insert ")\n\n")))
+            info)
       (setq default-directory dirname)
       (when (file-exists-p filename) (delete-file filename))
       (let ((coding-system-for-write 'utf-8-emacs))
@@ -670,6 +700,11 @@
       (when (file-exists-p filename)
         (delete-file filename)))))
 
+(defvar desktop-buffer-args-list nil
+  "List of args for `desktop-create-buffer'.")
+
+(defvar desktop-lazy-timer nil)
+
 ;; ----------------------------------------------------------------------------
 ;;;###autoload
 (defun desktop-read (&optional dirname)
@@ -706,6 +741,7 @@
       (let ((desktop-first-buffer nil)
             (desktop-buffer-ok-count 0)
             (desktop-buffer-fail-count 0))
+        (setq desktop-lazy-timer nil)
         ;; Evaluate desktop buffer.
         (load (expand-file-name desktop-base-file-name desktop-dirname) t t t)
         ;; `desktop-create-buffer' puts buffers at end of the buffer list.
@@ -717,11 +753,15 @@
         (run-hooks 'desktop-delay-hook)
         (setq desktop-delay-hook nil)
         (run-hooks 'desktop-after-read-hook)
-        (message "Desktop: %d buffer%s restored%s."
+        (message "Desktop: %d buffer%s restored%s%s."
                  desktop-buffer-ok-count
                  (if (= 1 desktop-buffer-ok-count) "" "s")
                  (if (< 0 desktop-buffer-fail-count)
                      (format ", %d failed to restore" desktop-buffer-fail-count)
+                   "")
+                 (if desktop-buffer-args-list
+                     (format ", %d to restore lazily"
+                             (length desktop-buffer-args-list))
                    ""))
         t)
       ;; No desktop file found.
@@ -917,6 +957,69 @@
 			       (cons 'case-replace cr)
 			       (cons 'overwrite-mode (car mim)))))
 
+(defun desktop-append-buffer-args (&rest args)
+  "Append ARGS at end of `desktop-buffer-args-list'
+ARGS must be an argument list for `desktop-create-buffer'."
+  (setq desktop-buffer-args-list (nconc desktop-buffer-args-list (list args)))
+  (unless desktop-lazy-timer
+    (setq desktop-lazy-timer
+          (run-with-idle-timer desktop-lazy-idle-delay t 'desktop-idle-create-buffers))))
+
+(defun desktop-lazy-create-buffer ()
+  "Pop args from `desktop-buffer-args-list', create buffer and bury it."
+  (when desktop-buffer-args-list
+    (let* ((remaining (length desktop-buffer-args-list))
+           (args (pop desktop-buffer-args-list))
+           (buffer-name (nth 2 args))
+           (msg (format "Desktop lazily opening %s (%s remaining)..."
+                            buffer-name remaining)))
+      (when desktop-lazy-verbose
+        (message msg))
+      (let ((desktop-first-buffer nil)
+            (desktop-buffer-ok-count 0)
+            (desktop-buffer-fail-count 0))
+        (apply 'desktop-create-buffer args)
+        (run-hooks 'desktop-delay-hook)
+        (setq desktop-delay-hook nil)
+        (bury-buffer (get-buffer buffer-name))
+        (when desktop-lazy-verbose
+          (message "%s%s" msg (if (> desktop-buffer-ok-count 0) "done" "failed")))))))
+
+(defun desktop-idle-create-buffers ()
+  "Create buffers until the user does something, then stop.
+If there are no buffers left to create, kill the timer."
+  (let ((repeat 1))
+    (while (and repeat desktop-buffer-args-list)
+      (save-window-excursion
+        (desktop-lazy-create-buffer))
+      (setq repeat (sit-for 0.2))
+    (unless desktop-buffer-args-list
+      (cancel-timer desktop-lazy-timer)
+      (setq desktop-lazy-timer nil)
+      (message "Lazy desktop load complete")
+      (sit-for 3)
+      (message "")))))
+
+(defun desktop-lazy-complete ()
+  "Run the desktop load to completion."
+  (interactive)
+  (let ((desktop-lazy-verbose t))
+    (while desktop-buffer-args-list
+      (save-window-excursion
+        (desktop-lazy-create-buffer)))
+    (message "Lazy desktop load complete")))
+
+(defun desktop-lazy-abort ()
+  "Abort lazy loading of the desktop."
+  (interactive)
+  (when desktop-lazy-timer
+    (cancel-timer desktop-lazy-timer)
+    (setq desktop-lazy-timer nil))
+  (when desktop-buffer-args-list
+    (setq desktop-buffer-args-list nil)
+    (when (interactive-p)
+      (message "Lazy desktop load aborted"))))
+
 ;; ----------------------------------------------------------------------------
 ;; When `desktop-save-mode' is non-nil and "--no-desktop" is not specified on the
 ;; command line, we do the rest of what it takes to use desktop, but do it
--- a/lisp/ebuff-menu.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/ebuff-menu.el	Sun Jan 16 03:40:12 2005 +0000
@@ -149,7 +149,9 @@
 
 Entry to this mode via command `electric-buffer-list' calls the value of
 `electric-buffer-menu-mode-hook'."
-  (kill-all-local-variables)
+  (let ((saved header-line-format))
+    (kill-all-local-variables)
+    (setq header-line-format saved))
   (use-local-map electric-buffer-menu-mode-map)
   (setq mode-name "Electric Buffer Menu")
   (setq mode-line-buffer-identification "Electric Buffer List")
--- a/lisp/electric.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/electric.el	Sun Jan 16 03:40:12 2005 +0000
@@ -144,31 +144,17 @@
 	 (buf (get-buffer buffer))
 	 (one-window (one-window-p t))
 	 (pop-up-windows t)
-	 (pop-up-frames nil)
-	 (target-height)
-	 (lines))
+	 (pop-up-frames nil))
     (if (not buf)
 	(error "Buffer %s does not exist" buffer)
-      (with-current-buffer buf
-	(setq lines (count-lines (point-min) (point-max)))
-	(setq target-height
-	      (min (max (if max-height (min max-height (1+ lines)) (1+ lines))
-			window-min-height)
-		   (save-window-excursion
-		     (delete-other-windows)
-		     (1- (window-height (selected-window)))))))
       (cond ((and (eq (window-buffer win) buf))
 	     (select-window win))
 	    (one-window
 	     (pop-to-buffer buffer)
-	     (setq win (selected-window))
-	     (enlarge-window (- target-height (window-height win))))
+	     (setq win (selected-window)))
 	    (t
 	     (switch-to-buffer buf)))
-      (if (and (not max-height)
-	       (> target-height (window-height (selected-window))))
-	  (progn (goto-char (window-start win))
-		 (enlarge-window (- target-height (window-height win)))))
+      (fit-window-to-buffer win max-height)
       (goto-char (point-min))
       win)))
 
--- a/lisp/emacs-lisp/autoload.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/emacs-lisp/autoload.el	Sun Jan 16 03:40:12 2005 +0000
@@ -135,7 +135,7 @@
 
 
 (defun autoload-trim-file-name (file)
-  ;; Returns a relative pathname of FILE
+  ;; Returns a relative file path for FILE
   ;; starting from the directory that loaddefs.el is in.
   ;; That is normally a directory in load-path,
   ;; which means Emacs will be able to find FILE when it looks.
@@ -273,7 +273,7 @@
 	output-end)
 
     ;; If the autoload section we create here uses an absolute
-    ;; pathname for FILE in its header, and then Emacs is installed
+    ;; file name for FILE in its header, and then Emacs is installed
     ;; under a different path on another system,
     ;; `update-autoloads-here' won't be able to find the files to be
     ;; autoloaded.  So, if FILE is in the same directory or a
--- a/lisp/emacs-lisp/elint.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/emacs-lisp/elint.el	Sun Jan 16 03:40:12 2005 +0000
@@ -29,7 +29,7 @@
 ;; mispellings and undefined variables, although it can also catch
 ;; function calls with the wrong number of arguments.
 
-;; Before using, call `elint-initialize' to set up som argument
+;; Before using, call `elint-initialize' to set up some argument
 ;; data. This takes a while. Then call elint-current-buffer or
 ;; elint-defun to lint a buffer or a defun.
 
--- a/lisp/emacs-lisp/find-func.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/emacs-lisp/find-func.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,6 @@
 ;;; find-func.el --- find the definition of the Emacs Lisp function near point
 
-;; Copyright (C) 1997, 1999, 2001, 2004  Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001, 2004, 2005  Free Software Foundation, Inc.
 
 ;; Author: Jens Petersen <petersen@kurims.kyoto-u.ac.jp>
 ;; Maintainer: petersen@kurims.kyoto-u.ac.jp
@@ -76,16 +76,37 @@
   :version "21.1")
 
 (defcustom find-variable-regexp
-  (concat"^\\s-*(def[^umag]\\(\\w\\|\\s_\\)+\\*?" find-function-space-re "%s\\(\\s-\\|$\\)")
+  (concat"^\\s-*(def[^fumag]\\(\\w\\|\\s_\\)+\\*?" find-function-space-re "%s\\(\\s-\\|$\\)")
   "The regexp used by `find-variable' to search for a variable definition.
-It should match right up to the variable name.  The default value
-avoids `defun', `defmacro', `defalias', `defadvice', `defgroup'.
+Note it must contain a `%s' at the place where `format'
+should insert the variable name.  The default value
+avoids `defun', `defmacro', `defalias', `defadvice', `defgroup', `defface'.
 
 Please send improvements and fixes to the maintainer."
   :type 'regexp
   :group 'find-function
   :version "21.1")
 
+(defcustom find-face-regexp
+  (concat"^\\s-*(defface" find-function-space-re "%s\\(\\s-\\|$\\)")
+  "The regexp used by `find-face' to search for a face definition.
+Note it must contain a `%s' at the place where `format'
+should insert the face name.
+
+Please send improvements and fixes to the maintainer."
+  :type 'regexp
+  :group 'find-function
+  :version "21.4")
+
+(defvar find-function-regexp-alist
+  '((nil . find-function-regexp)
+    (defvar . find-variable-regexp)
+    (defface . find-face-regexp))
+  "Alist mapping definition types into regexp variables.
+Each regexp variable's value should actually be a format string
+to be used to substitute the desired symbol name into the regexp.")
+(put 'find-function-regexp-alist 'risky-local-variable t)
+
 (defcustom find-function-source-path nil
   "The default list of directories where `find-function' searches.
 
@@ -136,9 +157,9 @@
 If nil, do not try to find the source code of functions and variables
 defined in C.")
 
-(defun find-function-C-source (fun-or-var file variable-p)
+(defun find-function-C-source (fun-or-var file type)
   "Find the source location where SUBR-OR-VAR is defined in FILE.
-VARIABLE-P should be non-nil for a variable or nil for a subroutine."
+TYPE should be nil to find a function, or `defvar' to find a variable."
   (unless find-function-C-source-directory
     (setq find-function-C-source-directory
 	  (read-directory-name "Emacs C source dir: " nil nil t)))
@@ -146,12 +167,12 @@
   (unless (file-readable-p file)
     (error "The C source file %s is not available"
 	   (file-name-nondirectory file)))
-  (unless variable-p
+  (unless type
     (setq fun-or-var (indirect-function fun-or-var)))
   (with-current-buffer (find-file-noselect file)
     (goto-char (point-min))
     (unless (re-search-forward
-	     (if variable-p
+	     (if type
 		 (concat "DEFVAR[A-Z_]*[ \t\n]*([ \t\n]*\""
 			 (regexp-quote (symbol-name fun-or-var))
 			 "\"")
@@ -175,10 +196,12 @@
     (condition-case nil (switch-to-buffer buf) (error (pop-to-buffer buf)))))
 
 ;;;###autoload
-(defun find-function-search-for-symbol (symbol variable-p library)
-  "Search for SYMBOL.
-If VARIABLE-P is nil, `find-function-regexp' is used, otherwise
-`find-variable-regexp' is used.  The search is done in library LIBRARY."
+(defun find-function-search-for-symbol (symbol type library)
+  "Search for SYMBOL's definition of type TYPE in LIBRARY.
+If TYPE is nil, look for a function definition.
+Otherwise, TYPE specifies the kind of definition,
+and it is interpreted via `find-function-regexp-alist'.
+The search is done in the source for library LIBRARY."
   (if (null library)
       (error "Don't know where `%s' is defined" symbol))
   ;; Some functions are defined as part of the construct
@@ -186,14 +209,13 @@
   (while (and (symbolp symbol) (get symbol 'definition-name))
     (setq symbol (get symbol 'definition-name)))
   (if (string-match "\\`src/\\(.*\\.c\\)\\'" library)
-      (find-function-C-source symbol (match-string 1 library) variable-p)
+      (find-function-C-source symbol (match-string 1 library) type)
     (if (string-match "\\.el\\(c\\)\\'" library)
 	(setq library (substring library 0 (match-beginning 1))))
-    (let* ((filename (find-library-name library)))
+    (let* ((filename (find-library-name library))
+	   (regexp-symbol (cdr (assq type find-function-regexp-alist))))
       (with-current-buffer (find-file-noselect filename)
-	(let ((regexp (format (if variable-p
-				  find-variable-regexp
-				find-function-regexp)
+	(let ((regexp (format (symbol-value regexp-symbol)
 			      (regexp-quote (symbol-name symbol))))
 	      (case-fold-search))
 	  (with-syntax-table emacs-lisp-mode-syntax-table
@@ -245,55 +267,53 @@
 		 ((symbol-file function 'defun)))))
       (find-function-search-for-symbol function nil library))))
 
-(defalias 'function-at-point 'function-called-at-point)
-
-(defun find-function-read (&optional variable-p)
+(defun find-function-read (&optional type)
   "Read and return an interned symbol, defaulting to the one near point.
 
-If the optional VARIABLE-P is nil, then a function is gotten
-defaulting to the value of the function `function-at-point', otherwise
-a variable is asked for, with the default coming from
-`variable-at-point'."
-  (let ((symb (funcall (if variable-p
-			   'variable-at-point
-			 'function-at-point)))
+If TYPE is nil, insist on a symbol with a function definition.
+Otherwise TYPE should be `defvar' or `defface'.
+If TYPE is nil, defaults using `function-called-at-point',
+otherwise uses `variable-at-point'."
+  (let ((symb (if (null type)
+		  (function-called-at-point)
+		(if (eq type 'defvar)
+		    (variable-at-point)
+		  (variable-at-point t))))
+	(predicate (cdr (assq type '((nil . fboundp) (defvar . boundp)
+				     (defface . facep)))))
+	(prompt (cdr (assq type '((nil . "function") (defvar . "variable")
+				  (defface . "face")))))
 	(enable-recursive-minibuffers t)
 	val)
     (if (equal symb 0)
 	(setq symb nil))
-    (setq val (if variable-p
-		  (completing-read
-		   (concat "Find variable"
-			   (if symb
-			       (format " (default %s)" symb))
-			   ": ")
-		   obarray 'boundp t nil)
-		(completing-read
-		 (concat "Find function"
-			 (if symb
-			     (format " (default %s)" symb))
-			 ": ")
-		 obarray 'fboundp t nil)))
+    (setq val (completing-read
+	       (concat "Find "
+		       prompt
+		       (if symb
+			   (format " (default %s)" symb))
+		       ": ")
+	       obarray predicate t nil))
     (list (if (equal val "")
 	      symb
 	    (intern val)))))
 
-(defun find-function-do-it (symbol variable-p switch-fn)
+(defun find-function-do-it (symbol type switch-fn)
   "Find Emacs Lisp SYMBOL in a buffer and display it.
-If VARIABLE-P is nil, a function definition is searched for, otherwise
-a variable definition is searched for.  The start of a definition is
-centered according to the variable `find-function-recenter-line'.
-See also `find-function-after-hook'  It is displayed with function SWITCH-FN.
+TYPE is nil to search for a function definition,
+or else `defvar' or `defface'.
 
-Point is saved in the buffer if it is one of the current buffers."
+The variable `find-function-recenter-line' controls how
+to recenter the display.  SWITCH-FN is the function to call
+to display and select the buffer.
+See also `find-function-after-hook'.
+
+Set mark before moving, if the buffer already existed."
   (let* ((orig-point (point))
 	(orig-buf (window-buffer))
 	(orig-buffers (buffer-list))
 	(buffer-point (save-excursion
-			(funcall (if variable-p
-				      'find-variable-noselect
-				    'find-function-noselect)
-				  symbol)))
+			(find-definition-noselect symbol type)))
 	(new-buf (car buffer-point))
 	(new-point (cdr buffer-point)))
     (when buffer-point
@@ -309,9 +329,9 @@
   "Find the definition of the FUNCTION near point.
 
 Finds the Emacs Lisp library containing the definition of the function
-near point (selected by `function-at-point') in a buffer and
-places point before the definition.  Point is saved in the buffer if
-it is one of the current buffers.
+near point (selected by `function-called-at-point') in a buffer and
+places point before the definition.
+Set mark before moving, if the buffer already existed.
 
 The library where FUNCTION is defined is searched for in
 `find-function-source-path', if non nil, otherwise in `load-path'.
@@ -340,15 +360,15 @@
   "Return a pair `(BUFFER . POINT)' pointing to the definition of SYMBOL.
 
 Finds the Emacs Lisp library containing the definition of SYMBOL
-in a buffer and the point of the definition.  The buffer is
-not selected.
+in a buffer, and the point of the definition.  It does not switch
+to the buffer or display it.
 
 The library where VARIABLE is defined is searched for in FILE or
 `find-function-source-path', if non nil, otherwise in `load-path'."
   (if (not variable)
       (error "You didn't specify a variable"))
   (let ((library (or file (symbol-file variable 'defvar))))
-    (find-function-search-for-symbol variable 'variable library)))
+    (find-function-search-for-symbol variable 'defvar library)))
 
 ;;;###autoload
 (defun find-variable (variable)
@@ -356,35 +376,70 @@
 
 Finds the Emacs Lisp library containing the definition of the variable
 near point (selected by `variable-at-point') in a buffer and
-places point before the definition.  Point is saved in the buffer if
-it is one of the current buffers.
+places point before the definition.
+
+Set mark before moving, if the buffer already existed.
 
 The library where VARIABLE is defined is searched for in
 `find-function-source-path', if non nil, otherwise in `load-path'.
 See also `find-function-recenter-line' and `find-function-after-hook'."
-  (interactive (find-function-read 'variable))
-  (find-function-do-it variable t 'switch-to-buffer))
+  (interactive (find-function-read 'defvar))
+  (find-function-do-it variable 'defvar 'switch-to-buffer))
 
 ;;;###autoload
 (defun find-variable-other-window (variable)
   "Find, in another window, the definition of VARIABLE near point.
 
 See `find-variable' for more details."
-  (interactive (find-function-read 'variable))
-  (find-function-do-it variable t 'switch-to-buffer-other-window))
+  (interactive (find-function-read 'defvar))
+  (find-function-do-it variable 'defvar 'switch-to-buffer-other-window))
 
 ;;;###autoload
 (defun find-variable-other-frame (variable)
   "Find, in annother frame, the definition of VARIABLE near point.
 
 See `find-variable' for more details."
-  (interactive (find-function-read 'variable))
-  (find-function-do-it variable t 'switch-to-buffer-other-frame))
+  (interactive (find-function-read 'defvar))
+  (find-function-do-it variable 'defvar 'switch-to-buffer-other-frame))
+
+;;;###autoload
+(defun find-definition-noselect (symbol type &optional file)
+  "Return a pair `(BUFFER . POINT)' pointing to the definition of SYMBOL.
+TYPE says what type of definition: nil for a function,
+`defvar' or `defface' for a variable or face.  This functoin
+does not switch to the buffer or display it.
+
+The library where SYMBOL is defined is searched for in FILE or
+`find-function-source-path', if non nil, otherwise in `load-path'."
+  (if (not symbol)
+      (error "You didn't specify a symbol"))
+  (if (null type)
+      (find-function-noselect symbol)
+    (let ((library (or file (symbol-file symbol type))))
+      (find-function-search-for-symbol symbol type library))))
+
+;; For symmetry, this should be called find-face; but some programs
+;; assume that, if that name is defined, it means something else.
+;;;###autoload
+(defun find-face-definition (face)
+  "Find the definition of FACE.  FACE defaults to the name near point.
+
+Finds the Emacs Lisp library containing the definition of the face
+near point (selected by `variable-at-point') in a buffer and
+places point before the definition.
+
+Set mark before moving, if the buffer already existed.
+
+The library where FACE is defined is searched for in
+`find-function-source-path', if non nil, otherwise in `load-path'.
+See also `find-function-recenter-line' and `find-function-after-hook'."
+  (interactive (find-function-read 'defface))
+  (find-function-do-it face 'defface 'switch-to-buffer))
 
 ;;;###autoload
 (defun find-function-on-key (key)
   "Find the function that KEY invokes.  KEY is a string.
-Point is saved if FUNCTION is in the current buffer."
+Set mark before moving, if the buffer already existed."
   (interactive "kFind function on key: ")
   (let (defn)
     (save-excursion
@@ -412,7 +467,7 @@
 (defun find-function-at-point ()
   "Find directly the function at point in the other window."
   (interactive)
-  (let ((symb (function-at-point)))
+  (let ((symb (function-called-at-point)))
     (when symb
       (find-function-other-window symb))))
 
@@ -437,5 +492,5 @@
 
 (provide 'find-func)
 
-;;; arch-tag: 43ecd81c-74dc-4d9a-8f63-a61e55670d64
+;; arch-tag: 43ecd81c-74dc-4d9a-8f63-a61e55670d64
 ;;; find-func.el ends here
--- a/lisp/emacs-lisp/lisp-mnt.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/emacs-lisp/lisp-mnt.el	Sun Jan 16 03:40:12 2005 +0000
@@ -304,9 +304,14 @@
        (if ,filesym
 	   (with-temp-buffer
 	     (insert-file-contents ,filesym)
+	     (lisp-mode)
 	     ,@body)
 	 (save-excursion 
-	   ,@body)))))
+	   ;; Switching major modes is too drastic, so just switch
+	   ;; temporarily to the Lisp mode syntax table.
+	   (with-syntax-table lisp-mode-syntax-table
+	     ,@body))))))
+
 (put 'lm-with-file 'lisp-indent-function 1)
 (put 'lm-with-file 'edebug-form-spec t)
 
--- a/lisp/emacs-lisp/lisp-mode.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/emacs-lisp/lisp-mode.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1125,7 +1125,8 @@
       (set-marker endmark nil))))
 
 (defun indent-pp-sexp (&optional arg)
-  "Indent each line of the list or, with prefix ARG, pretty-printify the list."
+  "Indent each line of the list starting just after point, or prettyprint it.
+A prefix argument specifies pretty-printing."
   (interactive "P")
   (if arg
       (save-excursion
--- a/lisp/emacs-lisp/re-builder.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/emacs-lisp/re-builder.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,6 @@
 ;;; re-builder.el --- building Regexps with visual feedback
 
-;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
 
 ;; Author: Detlev Zundel <dzu@gnu.org>
 ;; Keywords: matching, lisp, tools
@@ -61,12 +61,12 @@
 ;; even the auto updates go all the way.  Forcing an update overrides
 ;; this limit allowing an easy way to see all matches.
 
-;; Currently `re-builder' understands four different forms of input,
-;; namely `read', `string', `sregex' and `lisp-re' syntax.  Read
+;; Currently `re-builder' understands five different forms of input,
+;; namely `read', `string', `rx', `sregex' and `lisp-re' syntax.  Read
 ;; syntax and string syntax are both delimited by `"'s and behave
 ;; according to their name.  With the `string' syntax there's no need
 ;; to escape the backslashes and double quotes simplifying the editing
-;; somewhat.  The other two allow editing of symbolic regular
+;; somewhat.  The other three allow editing of symbolic regular
 ;; expressions supported by the packages of the same name.  (`lisp-re'
 ;; is a package by me and its support may go away as it is nearly the
 ;; same as the `sregex' package in Emacs)
--- a/lisp/facemenu.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/facemenu.el	Sun Jan 16 03:40:12 2005 +0000
@@ -471,50 +471,81 @@
       col)))
 
 ;;;###autoload
-(defun list-colors-display (&optional list)
+(defun list-colors-display (&optional list buffer-name)
   "Display names of defined colors, and show what they look like.
 If the optional argument LIST is non-nil, it should be a list of
-colors to display.  Otherwise, this command computes a list
-of colors that the current display can handle."
+colors to display.  Otherwise, this command computes a list of
+colors that the current display can handle.  If the optional
+argument BUFFER-NAME is nil, it defaults to *Colors*."
   (interactive)
   (when (and (null list) (> (display-color-cells) 0))
-    (setq list (defined-colors))
-    ;; Delete duplicate colors.
-
-    ;; Identify duplicate colors by the name rather than the color
-    ;; value.  For example, on MS-Windows, logical colors are added to
-    ;; the list that might have the same value but have different
-    ;; names and meanings.  For example, `SystemMenuText' (the color
-    ;; w32 uses for the text in menu entries) and `SystemWindowText'
-    ;; (the default color w32 uses for the text in windows and
-    ;; dialogs) may be the same display color and be adjacent in the
-    ;; list.  Detecting duplicates by name insures that both of these
-    ;; colors remain despite identical color values.
-    (let ((l list))
-      (while (cdr l)
-	(if (facemenu-color-name-equal (car l) (car (cdr l)))
-	    (setcdr l (cdr (cdr l)))
-	  (setq l (cdr l)))))
+    (setq list (list-colors-duplicates (defined-colors)))
     (when (memq (display-visual-class) '(gray-scale pseudo-color direct-color))
       ;; Don't show more than what the display can handle.
       (let ((lc (nthcdr (1- (display-color-cells)) list)))
 	(if lc
 	    (setcdr lc nil)))))
-  (with-output-to-temp-buffer "*Colors*"
+  (with-output-to-temp-buffer (or buffer-name "*Colors*")
     (save-excursion
       (set-buffer standard-output)
-      (let (s)
-	(while list
-	  (setq s (point))
-	  (insert (car list))
-	  (indent-to 20)
-	  (put-text-property s (point) 'face
-			     (cons 'background-color (car list)))
-	  (setq s (point))
-	  (insert "  " (car list) "\n")
-	  (put-text-property s (point) 'face
-			     (cons 'foreground-color (car list)))
-	  (setq list (cdr list)))))))
+      (setq truncate-lines t)
+      (if temp-buffer-show-function
+	  (list-colors-print list)
+	;; Call list-colors-print from temp-buffer-show-hook
+	;; to get the right value of window-width in list-colors-print
+	;; after the buffer is displayed.
+	(add-hook 'temp-buffer-show-hook
+		  (lambda () (list-colors-print list)) nil t)))))
+
+(defun list-colors-print (list)
+  (dolist (color list)
+    (if (consp color)
+	(if (cdr color)
+	    (setq color (sort color (lambda (a b)
+				      (string< (downcase a)
+					       (downcase b))))))
+      (setq color (list color)))
+    (put-text-property
+     (prog1 (point)
+       (insert (car color))
+       (indent-to 22))
+     (point)
+     'face (cons 'background-color (car color)))
+    (put-text-property
+     (prog1 (point)
+       (insert "  " (if (cdr color)
+			(mapconcat 'identity (cdr color) ", ")
+		      (car color)))
+       (indent-to (max (- (window-width) 8) 44))
+       (insert (apply 'format " #%02x%02x%02x"
+		      (mapcar (lambda (c) (lsh c -8))
+			      (color-values (car color)))))
+
+       (insert "\n"))
+     (point)
+     'face (cons 'foreground-color (car color))))
+  (goto-char (point-min)))
+
+(defun list-colors-duplicates (&optional list)
+  "Return a list of colors with grouped duplicate colors.
+If a color has no duplicates, then the element of the returned list
+has the form '(COLOR-NAME).  The element of the returned list with
+duplicate colors has the form '(COLOR-NAME DUPLICATE-COLOR-NAME ...).
+This function uses the predicate `facemenu-color-equal' to compare
+color names.  If the optional argument LIST is non-nil, it should
+be a list of colors to display.  Otherwise, this function uses
+a list of colors that the current display can handle."
+  (let* ((list (mapcar 'list (or list (defined-colors))))
+	 (l list))
+    (while (cdr l)
+      (if (and (facemenu-color-equal (car (car l)) (car (car (cdr l))))
+	       (not (and (boundp 'w32-default-color-map)
+			 (not (assoc (car (car l)) w32-default-color-map)))))
+	  (progn
+	    (setcdr (car l) (cons (car (car (cdr l))) (cdr (car l))))
+	    (setcdr l (cdr (cdr l))))
+	(setq l (cdr l))))
+    list))
 
 (defun facemenu-color-equal (a b)
   "Return t if colors A and B are the same color.
@@ -525,22 +556,6 @@
   (cond ((equal a b) t)
 	((equal (color-values a) (color-values b)))))
 
-(defun facemenu-color-name-equal (a b)
-  "Return t if colors A and B are the same color.
-A and B should be strings naming colors.  These names are
-downcased, stripped of spaces and the string `grey' is turned
-into `gray'.  This accommodates alternative spellings of colors
-found commonly in the list.  It returns nil if the colors differ."
-  (progn
-    (setq a (replace-regexp-in-string "grey" "gray"
-            (replace-regexp-in-string " " ""
-             (downcase a)))
-         b (replace-regexp-in-string "grey" "gray"
-            (replace-regexp-in-string " " ""
-             (downcase b))))
-
-    (equal a b)))
-
 (defun facemenu-add-face (face &optional start end)
   "Add FACE to text between START and END.
 If START is nil or START to END is empty, add FACE to next typed character
--- a/lisp/files.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/files.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1856,8 +1856,14 @@
 
 If the element has the form (REGEXP FUNCTION NON-NIL), then after
 calling FUNCTION (if it's not nil), we delete the suffix that matched
-REGEXP and search the list again for another match.")
-
+REGEXP and search the list again for another match.
+
+If the file name matches `inhibit-first-line-modes-regexps',
+then `auto-mode-alist' is not processed.
+
+See also `interpreter-mode-alist', which detects executable script modes
+based on the interpreters they specify to run,
+and `magic-mode-alist', which determines modes based on file contents.")
 
 (defvar interpreter-mode-alist
   ;; Note: The entries for the modes defined in cc-mode.el (awk-mode
@@ -1902,11 +1908,13 @@
      ("guile" . scheme-mode)
      ("clisp" . lisp-mode)))
   "Alist mapping interpreter names to major modes.
-This alist applies to files whose first line starts with `#!'.
+This is used for files whose first lines match `auto-mode-interpreter-regexp'.
 Each element looks like (INTERPRETER . MODE).
 The car of each element is compared with
 the name of the interpreter specified in the first line.
-If it matches, mode MODE is selected.")
+If it matches, mode MODE is selected.
+
+See also `auto-mode-alist'.")
 
 (defvar inhibit-first-line-modes-regexps '("\\.tar\\'" "\\.tgz\\'")
   "List of regexps; if one matches a file name, don't look for `-*-'.")
@@ -1935,12 +1943,14 @@
 	(concat "\\(?:<\\?xml\\s +[^>]*>\\)?\\s *<"
 		comment-re "*"
 		"\\(?:!DOCTYPE\\s +[^>]*>\\s *<\\s *" comment-re "*\\)?"
-		"[Hh][Tt][Mm][Ll]")) . html-mode)
+		"[Hh][Tt][Mm][Ll]"))
+     . html-mode)
     ;; These two must come after html, because they are more general:
     ("<\\?xml " . xml-mode)
     (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
 	     (comment-re (concat "\\(?:!--" incomment-re "*-->\\s *<\\)")))
-	(concat "\\s *<" comment-re "*!DOCTYPE ")) . sgml-mode)
+	(concat "\\s *<" comment-re "*!DOCTYPE "))
+     . sgml-mode)
     ("%![^V]" . ps-mode)
     ("# xmcd " . conf-unix-mode))
   "Alist of buffer beginnings vs. corresponding major mode functions.
@@ -2202,86 +2212,86 @@
     (save-excursion
       (goto-char (point-max))
       (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move)
-      (if (let ((case-fold-search t))
-	    (and (search-forward "Local Variables:" nil t)
-		 (or (eq enable-local-variables t)
-		     mode-only
-		     (and enable-local-variables
-			  (save-window-excursion
-			    (switch-to-buffer (current-buffer))
-			    (save-excursion
-			      (beginning-of-line)
-			      (set-window-start (selected-window) (point)))
-			    (y-or-n-p (format "Set local variables as specified at end of %s? "
-					      (if buffer-file-name
-						  (file-name-nondirectory
-						   buffer-file-name)
-						(concat "buffer "
-							(buffer-name))))))))))
-	  (skip-chars-forward " \t")
-	  (let ((enable-local-eval enable-local-eval)
-		;; suffix is what comes after "local variables:" in its line.
-		(suffix
-		 (concat
-		  (regexp-quote (buffer-substring (point) (line-end-position)))
-		  "$"))
-		;; prefix is what comes before "local variables:" in its line.
-		(prefix
-		 (concat "^" (regexp-quote
-			      (buffer-substring (line-beginning-position)
-						(match-beginning 0)))))
-		beg)
-
-	    (forward-line 1)
-	    (let ((startpos (point))
-		  endpos
-		  (thisbuf (current-buffer)))
-	      (save-excursion
-		(if (not (re-search-forward
-			  (concat prefix "[ \t]*End:[ \t]*" suffix)
-			  nil t))
-		    (error "Local variables list is not properly terminated"))
-		(beginning-of-line)
-		(setq endpos (point)))
-
-	      (with-temp-buffer
-		(insert-buffer-substring thisbuf startpos endpos)
-		(goto-char (point-min))
-		(subst-char-in-region (point) (point-max) ?\^m ?\n)
-		(while (not (eobp))
-		  ;; Discard the prefix.
-		  (if (looking-at prefix)
-		      (delete-region (point) (match-end 0))
-		    (error "Local variables entry is missing the prefix"))
-		  (end-of-line)
-		  ;; Discard the suffix.
-		  (if (looking-back suffix)
-		      (delete-region (match-beginning 0) (point))
-		    (error "Local variables entry is missing the suffix"))
-		  (forward-line 1))
-		(goto-char (point-min))
-
-		(while (not (eobp))
-		  ;; Find the variable name; strip whitespace.
-		  (skip-chars-forward " \t")
-		  (setq beg (point))
-		  (skip-chars-forward "^:\n")
-		  (if (eolp) (error "Missing colon in local variables entry"))
-		  (skip-chars-backward " \t")
-		  (let* ((str (buffer-substring beg (point)))
-			 (var (read str))
-			 val)
-		    ;; Read the variable value.
-		    (skip-chars-forward "^:")
-		    (forward-char 1)
-		    (setq val (read (current-buffer)))
-		    (if mode-only
-			(if (eq var 'mode)
-			    (setq mode-specified t))
-		      ;; Set the variable.  "Variables" mode and eval are funny.
-		      (with-current-buffer thisbuf
-			(hack-one-local-variable var val))))
-		  (forward-line 1)))))))
+      (when (let ((case-fold-search t))
+	      (and (search-forward "Local Variables:" nil t)
+		   (or (eq enable-local-variables t)
+		       mode-only
+		       (and enable-local-variables
+			    (save-window-excursion
+			      (switch-to-buffer (current-buffer))
+			      (save-excursion
+				(beginning-of-line)
+				(set-window-start (selected-window) (point)))
+			      (y-or-n-p (format "Set local variables as specified at end of %s? "
+						(if buffer-file-name
+						    (file-name-nondirectory
+						     buffer-file-name)
+						  (concat "buffer "
+							  (buffer-name))))))))))
+	(skip-chars-forward " \t")
+	(let ((enable-local-eval enable-local-eval)
+	      ;; suffix is what comes after "local variables:" in its line.
+	      (suffix
+	       (concat
+		(regexp-quote (buffer-substring (point) (line-end-position)))
+		"$"))
+	      ;; prefix is what comes before "local variables:" in its line.
+	      (prefix
+	       (concat "^" (regexp-quote
+			    (buffer-substring (line-beginning-position)
+					      (match-beginning 0)))))
+	      beg)
+
+	  (forward-line 1)
+	  (let ((startpos (point))
+		endpos
+		(thisbuf (current-buffer)))
+	    (save-excursion
+	      (if (not (re-search-forward
+			(concat prefix "[ \t]*End:[ \t]*" suffix)
+			nil t))
+		  (error "Local variables list is not properly terminated"))
+	      (beginning-of-line)
+	      (setq endpos (point)))
+
+	    (with-temp-buffer
+	      (insert-buffer-substring thisbuf startpos endpos)
+	      (goto-char (point-min))
+	      (subst-char-in-region (point) (point-max) ?\^m ?\n)
+	      (while (not (eobp))
+		;; Discard the prefix.
+		(if (looking-at prefix)
+		    (delete-region (point) (match-end 0))
+		  (error "Local variables entry is missing the prefix"))
+		(end-of-line)
+		;; Discard the suffix.
+		(if (looking-back suffix)
+		    (delete-region (match-beginning 0) (point))
+		  (error "Local variables entry is missing the suffix"))
+		(forward-line 1))
+	      (goto-char (point-min))
+
+	      (while (not (eobp))
+		;; Find the variable name; strip whitespace.
+		(skip-chars-forward " \t")
+		(setq beg (point))
+		(skip-chars-forward "^:\n")
+		(if (eolp) (error "Missing colon in local variables entry"))
+		(skip-chars-backward " \t")
+		(let* ((str (buffer-substring beg (point)))
+		       (var (read str))
+		       val)
+		  ;; Read the variable value.
+		  (skip-chars-forward "^:")
+		  (forward-char 1)
+		  (setq val (read (current-buffer)))
+		  (if mode-only
+		      (if (eq var 'mode)
+			  (setq mode-specified t))
+		    ;; Set the variable.  "Variables" mode and eval are funny.
+		    (with-current-buffer thisbuf
+		      (hack-one-local-variable var val))))
+		(forward-line 1)))))))
     (unless mode-only
       (run-hooks 'hack-local-variables-hook))
     mode-specified))
@@ -3264,11 +3274,12 @@
 ;; but inhibited if one of write-file-functions returns non-nil.
 ;; It returns a value (MODES . BACKUPNAME), like backup-buffer.
 (defun basic-save-buffer-1 ()
-  (if save-buffer-coding-system
-      (let ((coding-system-for-write save-buffer-coding-system))
+  (prog1
+      (if save-buffer-coding-system
+	  (let ((coding-system-for-write save-buffer-coding-system))
+	    (basic-save-buffer-2))
 	(basic-save-buffer-2))
-    (basic-save-buffer-2))
-  (setq buffer-file-coding-system-explicit last-coding-system-used))
+    (setq buffer-file-coding-system-explicit last-coding-system-used)))
 
 ;; This returns a value (MODES . BACKUPNAME), like backup-buffer.
 (defun basic-save-buffer-2 ()
@@ -4549,7 +4560,7 @@
 		    error-lines)
 		;; Find all the lines that are error messages,
 		;; and record the bounds of each one.
-		(goto-char (point-min))
+		(goto-char beg)
 		(while (< (point) linebeg)
 		  (or (eql (following-char) ?\s)
 		      (push (list (point) (line-end-position)) error-lines))
@@ -4575,11 +4586,9 @@
 		      (end-of-line))))
 		(goto-char end)
 		(beginning-of-line)
-		(delete-region (point) (progn (forward-line 2) (point))))
-	      (forward-line 1)
+		(delete-region (point) (progn (forward-line 1) (point))))
 	      (if (looking-at "//DIRED-OPTIONS//")
-		  (delete-region (point) (progn (forward-line 1) (point)))
-		(forward-line 1))))
+		  (delete-region (point) (progn (forward-line 1) (point))))))
 
 	  ;; Now decode what read if necessary.
 	  (let ((coding (or coding-system-for-read
--- a/lisp/gnus/ChangeLog	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/gnus/ChangeLog	Sun Jan 16 03:40:12 2005 +0000
@@ -1,3 +1,8 @@
+2005-01-05  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* spam.el (spam-face): New face.  Don't use `gnus-splash-face'
+	which is unreadable in some setups.
+
 2004-12-27  Simon Josefsson  <jas@extundo.com>
 
 	* mm-bodies.el (mm-body-encoding): Don't permit 7-bit to be used
--- a/lisp/gnus/spam.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/gnus/spam.el	Sun Jan 16 03:40:12 2005 +0000
@@ -298,7 +298,19 @@
   :type '(radio (const nil) regexp)
   :group 'spam)
 
-(defcustom spam-face 'gnus-splash-face
+(defface spam-face
+  '((((class color) (type tty) (background dark))
+     (:foreground "gray80" :background "gray50"))
+    (((class color) (type tty) (background light))
+     (:foreground "gray50" :background "gray80"))
+    (((class color) (background dark))
+     (:foreground "ivory2"))
+    (((class color) (background light))
+     (:foreground "ivory4"))
+    (t :inverse-video t))
+  "Face for spam-marked articles.")
+
+(defcustom spam-face 'spam-face
   "Face for spam-marked articles."
   :type 'face
   :group 'spam)
--- a/lisp/help-fns.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/help-fns.el	Sun Jan 16 03:40:12 2005 +0000
@@ -216,6 +216,14 @@
 			(intern (upcase name))))))
 		arglist)))
 
+;;; Could be this, if we make symbol-file do the work below.
+;;; (defun help-C-file-name (subr-or-var kind)
+;;;   "Return the name of the C file where SUBR-OR-VAR is defined.
+;;; KIND should be `var' for a variable or `subr' for a subroutine."
+;;;   (symbol-file (if (symbolp subr-or-var) subr-or-var
+;;; 		 (subr-name subr-or-var))
+;;; 	       (if (eq kind 'var) 'defvar 'defun)))
+
 (defun help-C-file-name (subr-or-var kind)
   "Return the name of the C file where SUBR-OR-VAR is defined.
 KIND should be `var' for a variable or `subr' for a subroutine."
@@ -231,8 +239,8 @@
       (let ((file (catch 'loop
 		    (while t
 		      (let ((pnt (search-forward (concat "" name "\n"))))
-      (re-search-backward "S\\(.*\\)")
-      (let ((file (match-string 1)))
+			(re-search-backward "S\\(.*\\)")
+			(let ((file (match-string 1)))
 			  (if (member file build-files)
 			      (throw 'loop file)
 			    (goto-char pnt))))))))
@@ -463,9 +471,10 @@
 ;; Variables
 
 ;;;###autoload
-(defun variable-at-point ()
+(defun variable-at-point (&optional any-symbol)
   "Return the bound variable symbol found around point.
-Return 0 if there is no such symbol."
+Return 0 if there is no such symbol.
+If ANY-SYMBOL is non-nil, don't insist the symbol be bound."
   (or (condition-case ()
 	  (with-syntax-table emacs-lisp-mode-syntax-table
 	    (save-excursion
@@ -479,12 +488,12 @@
 	(error nil))
       (let* ((str (find-tag-default))
 	     (sym (if str (intern-soft str))))
-	(if (and sym (boundp sym))
+	(if (and sym (or any-symbol (boundp sym)))
 	    sym
 	  (save-match-data
 	    (when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str))
 	      (setq sym (intern-soft (match-string 1 str)))
-	      (and (boundp sym) sym)))))
+	      (and (or any-symbol (boundp sym)) sym)))))
       0))
 
 ;;;###autoload
--- a/lisp/help-macro.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/help-macro.el	Sun Jan 16 03:40:12 2005 +0000
@@ -121,7 +121,7 @@
 		     (if three-step-help
 			 (progn
 			   (setq key (let ((overriding-local-map local-map))
-				     (read-key-sequence nil)))
+				       (read-key-sequence nil)))
 			   ;; Make the HELP key translate to C-h.
 			   (if (lookup-key function-key-map key)
 			       (setq key (lookup-key function-key-map key)))
--- a/lisp/imenu.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/imenu.el	Sun Jan 16 03:40:12 2005 +0000
@@ -532,7 +532,7 @@
 	(push item keep-at-top)
 	(setq menulist (delq item menulist))))
     (if imenu-sort-function
-	(setq menulist (sort menulist imenu-sort-function)))
+	(setq menulist (sort (copy-sequence menulist) imenu-sort-function)))
     (if (> (length menulist) imenu-max-items)
 	(setq menulist
 	      (mapcar
@@ -817,32 +817,30 @@
 		(setq start (point))
 		(goto-char (match-end index))
 		(setq beg (match-beginning index))
-		(goto-char beg)
+		;; Go to the start of the match.
+		;; That's the official position of this definition.
+		(goto-char start)
 		(imenu-progress-message prev-pos nil t)
 		;; Add this sort of submenu only when we've found an
 		;; item for it, avoiding empty, duff menus.
 		(unless (assoc menu-title index-alist)
 		  (push (list menu-title) index-alist))
 		(if imenu-use-markers
-		    (setq beg (copy-marker beg)))
+		    (setq start (copy-marker start)))
 		(let ((item
 		       (if function
 			   (nconc (list (match-string-no-properties index)
-					beg function)
+					start function)
 				  rest)
 			 (cons (match-string-no-properties index)
-			       beg)))
+			       start)))
 		      ;; This is the desired submenu,
 		      ;; starting with its title (or nil).
 		      (menu (assoc menu-title index-alist)))
 		  ;; Insert the item unless it is already present.
 		  (unless (member item (cdr menu))
 		    (setcdr menu
-			    (cons item (cdr menu)))))
-		;; Move to the start of the entire match,
-		;; to ensure we keep moving backwards
-		;; as long as the match is nonempty.
-		(goto-char start))))
+			    (cons item (cdr menu))))))))
 	  (set-syntax-table old-table)))
     (imenu-progress-message prev-pos 100 t)
     ;; Sort each submenu by position.
--- a/lisp/info-look.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/info-look.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,7 +1,7 @@
 ;;; info-look.el --- major-mode-sensitive Info index lookup facility
 ;; An older version of this was known as libc.el.
 
-;; Copyright (C) 1995,96,97,98,99,2001,03,04  Free Software Foundation, Inc.
+;; Copyright (C) 1995,96,97,98,99,2001,03,04,05  Free Software Foundation, Inc.
 
 ;; Author: Ralph Schleicher <rs@nunatak.allgaeu.org>
 ;;         (did not show signs of life (Nov 2001)  -stef)
@@ -634,8 +634,15 @@
  :regexp "\\(struct \\|union \\|enum \\)?[_a-zA-Z][_a-zA-Z0-9]*"
  :doc-spec '(("(libc)Function Index" nil
 	      "^[ \t]+-+ \\(Function\\|Macro\\): .*\\<" "\\>")
+             ;; prefix/suffix has to match things like
+             ;;   " -- Macro: int F_DUPFD"
+             ;;   " -- Variable: char * tzname [2]"
+             ;;   "`DBL_MAX'"    (texinfo @table)
+             ;; suffix "\\>" is not used because that sends DBL_MAX to
+             ;; DBL_MAX_EXP ("_" is a non-word char)
 	     ("(libc)Variable Index" nil
-	      "^[ \t]+-+ \\(Variable\\|Macro\\): .*\\<" "\\>")
+              "^\\([ \t]+-+ \\(Variable\\|Macro\\): .*\\<\\|`\\)"
+              "\\( \\|'?$\\)")
 	     ("(libc)Type Index" nil
 	      "^[ \t]+-+ Data Type: \\<" "\\>")
 	     ("(termcap)Var Index" nil
--- a/lisp/info.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/info.el	Sun Jan 16 03:40:12 2005 +0000
@@ -47,6 +47,10 @@
   "Stack of info nodes user has visited.
 Each element of list is a list (FILENAME NODENAME BUFFERPOS).")
 
+(defvar Info-history-forward nil
+  "Stack of info nodes user has visited with `Info-history-back' command.
+Each element of list is a list (FILENAME NODENAME BUFFERPOS).")
+
 (defvar Info-history-list nil
   "List of all info nodes user has visited.
 Each element of list is a list (FILENAME NODENAME).")
@@ -1295,7 +1299,8 @@
 	;; Add a new unique history item to full history list
 	(let ((new-history (list Info-current-file Info-current-node)))
 	  (setq Info-history-list
-		(cons new-history (delete new-history Info-history-list))))
+		(cons new-history (delete new-history Info-history-list)))
+	  (setq Info-history-forward nil))
 	(if (not (eq Info-fontify-maximum-menu-size nil))
             (Info-fontify-node))
 	(Info-display-images-node)
@@ -1731,18 +1736,38 @@
       (goto-char p)
       (Info-restore-point Info-history))))
 
-(defun Info-last ()
-  "Go back to the last node visited."
+(defun Info-history-back ()
+  "Go back in the history to the last node visited."
   (interactive)
   (or Info-history
       (error "This is the first Info node you looked at"))
-  (let (filename nodename opoint)
+  (let ((history-forward
+	 (cons (list Info-current-file Info-current-node (point))
+	       Info-history-forward))
+	filename nodename opoint)
     (setq filename (car (car Info-history)))
     (setq nodename (car (cdr (car Info-history))))
     (setq opoint (car (cdr (cdr (car Info-history)))))
     (setq Info-history (cdr Info-history))
     (Info-find-node filename nodename)
     (setq Info-history (cdr Info-history))
+    (setq Info-history-forward history-forward)
+    (goto-char opoint)))
+
+(defalias 'Info-last 'Info-history-back)
+
+(defun Info-history-forward ()
+  "Go forward in the history of visited nodes."
+  (interactive)
+  (or Info-history-forward
+      (error "This is the last Info node you looked at"))
+  (let ((history-forward (cdr Info-history-forward))
+	filename nodename opoint)
+    (setq filename (car (car Info-history-forward)))
+    (setq nodename (car (cdr (car Info-history-forward))))
+    (setq opoint (car (cdr (cdr (car Info-history-forward)))))
+    (Info-find-node filename nodename)
+    (setq Info-history-forward history-forward)
     (goto-char opoint)))
 
 ;;;###autoload
@@ -2894,12 +2919,13 @@
   (define-key Info-mode-map "g" 'Info-goto-node)
   (define-key Info-mode-map "h" 'Info-help)
   (define-key Info-mode-map "i" 'Info-index)
-  (define-key Info-mode-map "l" 'Info-last)
+  (define-key Info-mode-map "l" 'Info-history-back)
   (define-key Info-mode-map "L" 'Info-history)
   (define-key Info-mode-map "m" 'Info-menu)
   (define-key Info-mode-map "n" 'Info-next)
   (define-key Info-mode-map "p" 'Info-prev)
   (define-key Info-mode-map "q" 'Info-exit)
+  (define-key Info-mode-map "r" 'Info-history-forward)
   (define-key Info-mode-map "s" 'Info-search)
   (define-key Info-mode-map "S" 'Info-search-case-sensitively)
   ;; For consistency with Rmail.
@@ -2913,6 +2939,7 @@
   (define-key Info-mode-map "," 'Info-index-next)
   (define-key Info-mode-map "\177" 'Info-scroll-down)
   (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node)
+  (define-key Info-mode-map [follow-link] 'mouse-face)
   )
 
 (defun Info-check-pointer (item)
@@ -2951,8 +2978,10 @@
     :help "Search for another occurrence of regular expression"]
    ["Go to Node..." Info-goto-node
     :help "Go to a named node"]
-   ["Last" Info-last :active Info-history
-    :help "Go to the last node you were at"]
+   ["Back in history" Info-history-back :active Info-history
+    :help "Go back in history to the last node you were at"]
+   ["Forward in history" Info-history-forward :active Info-history-forward
+    :help "Go forward in history"]
    ["History" Info-history :active Info-history-list
     :help "Go to menu of visited nodes"]
    ["Table of Contents" Info-toc
@@ -2980,7 +3009,8 @@
 	(tool-bar-local-item-from-menu 'Info-prev "left_arrow" map Info-mode-map)
 	(tool-bar-local-item-from-menu 'Info-next "right_arrow" map Info-mode-map)
 	(tool-bar-local-item-from-menu 'Info-up "up_arrow" map Info-mode-map)
-	(tool-bar-local-item-from-menu 'Info-last "undo" map Info-mode-map)
+	(tool-bar-local-item-from-menu 'Info-history-back "back_arrow" map Info-mode-map)
+	(tool-bar-local-item-from-menu 'Info-history-forward "fwd_arrow" map Info-mode-map)
 	(tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map)
 	(tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map)
 	(tool-bar-local-item-from-menu 'Info-goto-node "jump_to" map Info-mode-map)
@@ -3100,7 +3130,8 @@
 	  Picking a menu item causes another node to be selected.
 \\[Info-directory]	Go to the Info directory node.
 \\[Info-follow-reference]	Follow a cross reference.  Reads name of reference.
-\\[Info-last]	Move to the last node you were at.
+\\[Info-history-back]	Move back in history to the last node you were at.
+\\[Info-history-forward]	Move forward in history to the node you returned from after using \\[Info-history-back].
 \\[Info-history]	Go to menu of visited nodes.
 \\[Info-toc]	Go to table of contents of the current Info file.
 \\[Info-top-node]	Go to the Top node of this file.
@@ -3157,6 +3188,7 @@
   (make-local-variable 'Info-tag-table-buffer)
   (setq Info-tag-table-buffer nil)
   (make-local-variable 'Info-history)
+  (make-local-variable 'Info-history-forward)
   (make-local-variable 'Info-index-alternatives)
   (setq header-line-format
 	(if Info-use-header-line
@@ -3368,7 +3400,7 @@
 		(message "Found %d other entr%s.  Use %s to see %s."
 			 (1- num-matches)
 			 (if (> num-matches 2) "ies" "y")
-			 (substitute-command-keys "\\[Info-last]")
+			 (substitute-command-keys "\\[Info-history-back]")
 			 (if (> num-matches 2) "them" "it")))))
       (error "Couldn't find documentation for %s" command))))
 
@@ -3453,6 +3485,7 @@
     (define-key keymap [header-line mouse-2] 'Info-next)
     (define-key keymap [header-line down-mouse-1] 'ignore)
     (define-key keymap [mouse-2] 'Info-next)
+    (define-key keymap [follow-link] 'mouse-face)
     keymap)
   "Keymap to put on the Next link in the text or the header line.")
 
@@ -3462,6 +3495,7 @@
     (define-key keymap [header-line mouse-2] 'Info-prev)
     (define-key keymap [header-line down-mouse-1] 'ignore)
     (define-key keymap [mouse-2] 'Info-prev)
+    (define-key keymap [follow-link] 'mouse-face)
     keymap)
   "Keymap to put on the Prev link in the text or the header line.")
 
@@ -3472,6 +3506,7 @@
     (define-key keymap [header-line mouse-2] 'Info-up)
     (define-key keymap [header-line down-mouse-1] 'ignore)
     (define-key keymap [mouse-2] 'Info-up)
+    (define-key keymap [follow-link] 'mouse-face)
     keymap)
   "Keymap to put on the Up link in the text or the header line.")
 
@@ -3506,7 +3541,7 @@
               (put-text-property tbeg nend 'mouse-face 'highlight)
               (put-text-property tbeg nend
                                  'help-echo
-                                 (concat "Go to node "
+                                 (concat "mouse-2: Go to node "
                                          (buffer-substring nbeg nend)))
               ;; Always set up the text property keymap.
               ;; It will either be used in the buffer
--- a/lisp/isearch.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/isearch.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,7 +1,7 @@
 ;;; isearch.el --- incremental search minor mode
 
 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1999,
-;;   2000, 2001, 2003, 2004  Free Software Foundation, Inc.
+;;   2000, 2001, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 ;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
 ;; Maintainer: FSF
@@ -120,11 +120,6 @@
   :type 'regexp
   :group 'isearch)
 
-(defcustom search-highlight t
-  "*Non-nil means incremental search highlights the current match."
-  :type 'boolean
-  :group 'isearch)
-
 (defcustom search-invisible 'open
   "If t incremental search can match hidden text.
 nil means don't match invisible text.
@@ -199,6 +194,98 @@
   :type 'boolean
   :group 'isearch)
 
+;;; isearch highlight customization.
+
+(defcustom search-highlight t
+  "*Non-nil means incremental search highlights the current match."
+  :type 'boolean
+  :group 'isearch)
+
+(defface isearch
+  '((((class color) (min-colors 88) (background light))
+     ;; The background must not be too dark, for that means
+     ;; the character is hard to see when the cursor is there.
+     (:background "magenta2" :foreground "lightskyblue1"))
+    (((class color) (min-colors 88) (background dark))
+     (:background "palevioletred2" :foreground "brown4"))
+    (((class color) (min-colors 16))
+     (:background "magenta4" :foreground "cyan1"))
+    (((class color) (min-colors 8))
+     (:background "magenta4" :foreground "cyan1"))
+    (t (:inverse-video t)))
+  "Face for highlighting Isearch matches."
+  :group 'isearch)
+(defvar isearch 'isearch)
+
+(defcustom isearch-lazy-highlight t
+  "*Controls the lazy-highlighting during incremental search.
+When non-nil, all text in the buffer matching the current search
+string is highlighted lazily (see `lazy-highlight-initial-delay'
+and `lazy-highlight-interval')."
+  :type 'boolean
+  :group 'lazy-highlight
+  :group 'isearch)
+
+;;; Lazy highlight customization.
+
+(defgroup lazy-highlight nil
+  "Lazy highlighting feature for matching strings."
+  :prefix "lazy-highlight-"
+  :version "21.1"
+  :group 'isearch
+  :group 'matching)
+
+(defcustom lazy-highlight-cleanup t
+  "*Controls whether to remove extra highlighting after a search.
+If this is nil, extra highlighting can be \"manually\" removed with
+\\[isearch-lazy-highlight-cleanup]."
+  :type 'boolean
+  :group 'lazy-highlight)
+(defvaralias 'isearch-lazy-highlight-cleanup 'lazy-highlight-cleanup)
+(make-obsolete-variable 'isearch-lazy-highlight-cleanup 'lazy-highlight-cleanup)
+
+(defcustom lazy-highlight-initial-delay 0.25
+  "*Seconds to wait before beginning to lazily highlight all matches."
+  :type 'number
+  :group 'lazy-highlight)
+(defvaralias 'isearch-lazy-highlight-initial-delay 'lazy-highlight-initial-delay)
+(make-obsolete-variable 'isearch-lazy-highlight-initial-delay 'lazy-highlight-initial-delay)
+
+(defcustom lazy-highlight-interval 0 ; 0.0625
+  "*Seconds between lazily highlighting successive matches."
+  :type 'number
+  :group 'lazy-highlight)
+(defvaralias 'isearch-lazy-highlight-interval 'lazy-highlight-interval)
+(make-obsolete-variable 'isearch-lazy-highlight-interval 'lazy-highlight-interval)
+
+(defcustom lazy-highlight-max-at-a-time 20
+  "*Maximum matches to highlight at a time (for `lazy-highlight').
+Larger values may reduce isearch's responsiveness to user input;
+smaller values make matches highlight slowly.
+A value of nil means highlight all matches."
+  :type '(choice (const :tag "All" nil)
+		 (integer :tag "Some"))
+  :group 'lazy-highlight)
+(defvaralias 'isearch-lazy-highlight-max-at-a-time 'lazy-highlight-max-at-a-time)
+(make-obsolete-variable 'isearch-lazy-highlight-max-at-a-time 'lazy-highlight-max-at-a-time)
+
+(defface lazy-highlight
+  '((((class color) (min-colors 88) (background light))
+     (:background "paleturquoise"))
+    (((class color) (min-colors 88) (background dark))
+     (:background "paleturquoise4"))
+    (((class color) (min-colors 16))
+     (:background "turquoise3"))
+    (((class color) (min-colors 8))
+     (:background "turquoise3"))
+    (t (:underline t)))
+  "Face for lazy highlighting of matches other than the current one."
+  :group 'lazy-highlight)
+(put 'isearch-lazy-highlight-face 'face-alias 'lazy-highlight)
+(defvar lazy-highlight-face 'lazy-highlight)
+(defvaralias 'isearch-lazy-highlight-face 'lazy-highlight-face)
+(make-obsolete-variable 'isearch-lazy-highlight-face 'lazy-highlight-face)
+
 ;; Define isearch-mode keymap.
 
 (defvar isearch-mode-map
@@ -644,7 +731,7 @@
             (if (< isearch-other-end (point)) ; isearch-forward?
                 (isearch-highlight isearch-other-end (point))
               (isearch-highlight (point) isearch-other-end))
-          (isearch-dehighlight nil))
+          (isearch-dehighlight))
         ))
   (setq ;; quit-flag nil  not for isearch-mode
    isearch-adjusted nil
@@ -672,8 +759,8 @@
   (setq overriding-terminal-local-map nil)
   ;; (setq pre-command-hook isearch-old-pre-command-hook) ; for lemacs
   (setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout)
-  (isearch-dehighlight t)
-  (isearch-lazy-highlight-cleanup isearch-lazy-highlight-cleanup)
+  (isearch-dehighlight)
+  (isearch-lazy-highlight-cleanup lazy-highlight-cleanup)
   (let ((found-start (window-start (selected-window)))
 	(found-point (point)))
     (if isearch-window-configuration
@@ -2142,31 +2229,8 @@
 	      (setq isearch-hidden t)))))))
 
 
-;; Highlighting
-
-(defvar isearch-overlay nil)
-
-(defun isearch-highlight (beg end)
-  (unless (null search-highlight)
-    (cond (isearch-overlay
-	   ;; Overlay already exists, just move it.
-	   (move-overlay isearch-overlay beg end (current-buffer)))
-
-	  (t
-	   ;; Overlay doesn't exist, create it.
-	   (setq isearch-overlay (make-overlay beg end))
-	   (overlay-put isearch-overlay 'face isearch)
-           (overlay-put isearch-overlay 'priority 1) ;higher than lazy overlays
-           ))))
-
-(defun isearch-dehighlight (totally)
-  (when isearch-overlay
-    (delete-overlay isearch-overlay)))
-
-
 ;; General utilities
 
-
 (defun isearch-no-upper-case-p (string regexp-flag)
   "Return t if there are no upper case chars in STRING.
 If REGEXP-FLAG is non-nil, disregard letters preceded by `\\' (but not `\\\\')
@@ -2198,12 +2262,33 @@
 	(append char-or-events unread-command-events)))
 
 
+;; Highlighting
+
+(defvar isearch-overlay nil)
+
+(defun isearch-highlight (beg end)
+  (unless (null search-highlight)
+    (cond (isearch-overlay
+	   ;; Overlay already exists, just move it.
+	   (move-overlay isearch-overlay beg end (current-buffer)))
+
+	  (t
+	   ;; Overlay doesn't exist, create it.
+	   (setq isearch-overlay (make-overlay beg end))
+	   (overlay-put isearch-overlay 'face isearch)
+           (overlay-put isearch-overlay 'priority 1) ;higher than lazy overlays
+           ))))
+
+(defun isearch-dehighlight ()
+  (when isearch-overlay
+    (delete-overlay isearch-overlay)))
+
 ;; isearch-lazy-highlight feature
 ;; by Bob Glickstein <http://www.zanshin.com/~bobg/>
 
 ;; When active, *every* match for the current search string is
 ;; highlighted: the current one using the normal isearch match color
-;; and all the others using `isearch-lazy-highlight-face'.  The extra
+;; and all the others using `isearch-lazy-highlight'.  The extra
 ;; highlighting makes it easier to anticipate where the cursor will
 ;; land each time you press C-s or C-r to repeat a pending search.
 ;; Highlighting of these additional matches happens in a deferred
@@ -2223,81 +2308,6 @@
 ;;  - the variable `isearch-invalid-regexp' is expected to be true
 ;;    iff `isearch-string' is an invalid regexp.
 
-(defgroup isearch-lazy-highlight nil
-  "Lazy highlighting feature for incremental search."
-  :prefix "isearch-lazy-highlight-"
-  :version "21.1"
-  :group 'isearch)
-
-(defcustom isearch-lazy-highlight t
-  "*Controls the lazy-highlighting during incremental searches.
-When non-nil, all text in the buffer matching the current search
-string is highlighted lazily (see `isearch-lazy-highlight-initial-delay'
-and `isearch-lazy-highlight-interval')."
-  :type 'boolean
-  :group 'isearch-lazy-highlight)
-
-(defcustom isearch-lazy-highlight-cleanup t
-  "*Controls whether to remove extra highlighting after a search.
-If this is nil, extra highlighting can be \"manually\" removed with
-\\[isearch-lazy-highlight-cleanup]."
-  :type 'boolean
-  :group 'isearch-lazy-highlight)
-
-(defcustom isearch-lazy-highlight-initial-delay 0.25
-  "*Seconds to wait before beginning to lazily highlight all matches."
-  :type 'number
-  :group 'isearch-lazy-highlight)
-
-(defcustom isearch-lazy-highlight-interval 0 ; 0.0625
-  "*Seconds between lazily highlighting successive matches."
-  :type 'number
-  :group 'isearch-lazy-highlight)
-
-(defcustom isearch-lazy-highlight-max-at-a-time 20
-  "*Maximum matches to highlight at a time (for `isearch-lazy-highlight').
-Larger values may reduce isearch's responsiveness to user input;
-smaller values make matches highlight slowly.
-A value of nil means highlight all matches."
-  :type '(choice (const :tag "All" nil)
-		 (integer :tag "Some"))
-  :group 'isearch-lazy-highlight)
-
-(defgroup isearch-faces nil
-  "Lazy highlighting feature for incremental search."
-  :version "21.1"
-  :group 'isearch)
-
-(defface isearch
-  '((((class color) (min-colors 88) (background light))
-     ;; The background must not be too dark, for that means
-     ;; the character is hard to see when the cursor is there.
-     (:background "magenta2" :foreground "lightskyblue1"))
-    (((class color) (min-colors 88) (background dark))
-     (:background "palevioletred2" :foreground "brown4"))
-    (((class color) (min-colors 16))
-     (:background "magenta4" :foreground "cyan1"))
-    (((class color) (min-colors 8))
-     (:background "magenta4" :foreground "cyan1"))
-    (t (:inverse-video t)))
-  "Face for highlighting Isearch matches."
-  :group 'isearch-faces)
-(defvar isearch 'isearch)
-
-(defface isearch-lazy-highlight-face
-  '((((class color) (min-colors 88) (background light))
-     (:background "paleturquoise"))
-    (((class color) (min-colors 88) (background dark))
-     (:background "paleturquoise4"))
-    (((class color) (min-colors 16))
-     (:background "turquoise3"))
-    (((class color) (min-colors 8))
-     (:background "turquoise3"))
-    (t (:underline t)))
-  "Face for lazy highlighting of Isearch matches other than the current one."
-  :group 'isearch-faces)
-(defvar isearch-lazy-highlight-face 'isearch-lazy-highlight-face)
-
 (defvar isearch-lazy-highlight-overlays nil)
 (defvar isearch-lazy-highlight-wrapped nil)
 (defvar isearch-lazy-highlight-start nil)
@@ -2312,11 +2322,11 @@
 
 (defun isearch-lazy-highlight-cleanup (&optional force)
   "Stop lazy highlighting and remove extra highlighting from current buffer.
-FORCE non-nil means do it whether or not `isearch-lazy-highlight-cleanup'
+FORCE non-nil means do it whether or not `lazy-highlight-cleanup'
 is nil.  This function is called when exiting an incremental search if
-`isearch-lazy-highlight-cleanup' is non-nil."
+`lazy-highlight-cleanup' is non-nil."
   (interactive '(t))
-  (if (or force isearch-lazy-highlight-cleanup)
+  (if (or force lazy-highlight-cleanup)
       (while isearch-lazy-highlight-overlays
         (delete-overlay (car isearch-lazy-highlight-overlays))
         (setq isearch-lazy-highlight-overlays
@@ -2326,7 +2336,7 @@
     (setq isearch-lazy-highlight-timer nil)))
 
 (defun isearch-lazy-highlight-new-loop ()
-  "Cleanup any previous `isearch-lazy-highlight' loop and begin a new one.
+  "Cleanup any previous `lazy-highlight' loop and begin a new one.
 This happens when `isearch-update' is invoked (which can cause the
 search string to change or the window to scroll)."
   (when (and (null executing-kbd-macro)
@@ -2357,7 +2367,7 @@
             isearch-lazy-highlight-wrapped      nil)
       (unless (equal isearch-string "")
 	(setq isearch-lazy-highlight-timer
-	      (run-with-idle-timer isearch-lazy-highlight-initial-delay nil
+	      (run-with-idle-timer lazy-highlight-initial-delay nil
 				   'isearch-lazy-highlight-update))))))
 
 (defun isearch-lazy-highlight-search ()
@@ -2378,7 +2388,7 @@
 
 (defun isearch-lazy-highlight-update ()
   "Update highlighting of other matches for current search."
-  (let ((max isearch-lazy-highlight-max-at-a-time)
+  (let ((max lazy-highlight-max-at-a-time)
         (looping t)
         nomore)
     (with-local-quit
@@ -2437,7 +2447,7 @@
 			(goto-char (window-end)))))))
 	    (unless nomore
 	      (setq isearch-lazy-highlight-timer
-		    (run-at-time isearch-lazy-highlight-interval nil
+		    (run-at-time lazy-highlight-interval nil
 				 'isearch-lazy-highlight-update)))))))))
 
 (defun isearch-resume (search regexp word forward message case-fold)
--- a/lisp/loadhist.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/loadhist.el	Sun Jan 16 03:40:12 2005 +0000
@@ -51,9 +51,26 @@
       (error "%S is not a currently loaded feature" feature)
     (car (feature-symbols feature))))
 
+(defun file-loadhist-lookup (file)
+  "Return the `load-history' element for FILE."
+  ;; First look for FILE as given.
+  (let ((symbols (assoc file load-history)))
+    ;; Try converting a library name to an absolute file name.
+    (and (null symbols)
+	 (let ((absname (find-library-name file)))
+	   (if (not (equal absname file))
+	       (setq symbols (cdr (assoc absname load-history))))))
+    ;; Try converting an absolute file name to a library name.
+    (and (null symbols) (string-match "[.]el\\'" file)
+	 (let ((libname (file-name-nondirectory file)))
+	   (string-match "[.]el\\'" libname)
+	   (setq libname (substring libname 0 (match-beginning 0)))
+	   (setq symbols (cdr (assoc libname load-history)))))
+    symbols))
+
 (defun file-provides (file)
   "Return the list of features provided by FILE."
-  (let ((symbols (cdr (assoc file load-history)))
+  (let ((symbols (file-loadhist-lookup file))
 	provides)
     (mapc (lambda (x)
 	    (if (and (consp x) (eq (car x) 'provide))
@@ -63,7 +80,7 @@
 
 (defun file-requires (file)
   "Return the list of features required by FILE."
-  (let ((symbols (cdr (assoc file load-history)))
+  (let ((symbols (file-loadhist-lookup file))
 	requires)
     (mapc (lambda (x)
 	    (if (and (consp x) (eq (car x) 'require))
--- a/lisp/mail/mailabbrev.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/mail/mailabbrev.el	Sun Jan 16 03:40:12 2005 +0000
@@ -305,10 +305,19 @@
 		    end (string-match "\"[ \t,]*" definition start))
 	    (setq end (string-match "[ \t,]+" definition start)))
 	(setq end (string-match "[ \t\n,]*,[ \t\n,]*" definition start)))
-      (setq result (cons (substring definition start end) result))
-      (setq start (and end
-		       (/= (match-end 0) L)
-		       (match-end 0))))
+      (let ((tem (substring definition start end)))
+	;; Advance the loop past this address.
+	(setq start (and end
+			 (/= (match-end 0) L)
+			 (match-end 0)))
+	;; If the full name contains a problem character, quote it.
+	(when (string-match "\\(.+?\\)[ \t]*\\(<.*>\\)" tem)
+	  (if (string-match "[^- !#$%&'*+/0-9=?A-Za-z^_`{|}~]"
+			    (match-string 1 tem))
+	      (setq tem (replace-regexp-in-string
+			 "\\(.+?\\)[ \t]*\\(<.*>\\)" "\"\\1\" \\2"
+			 tem))))
+	(push tem result)))
     (setq definition (mapconcat (function identity)
 				(nreverse result)
 				mail-alias-separator-string)))
@@ -485,7 +494,9 @@
 	     ;; the usual syntax table.
 
 	     (or (and (integerp last-command-char)
-		      (eq (char-syntax last-command-char) ?_))
+		      (or (eq (char-syntax last-command-char) ?_)
+			  ;; Don't expand on @.
+			  (memq last-command-char '(?@ ?. ?% ?! ?_ ?-))))
 		 (let ((pre-abbrev-expand-hook nil)) ; That's us; don't loop.
 		   ;; Use this table so that abbrevs can have hyphens in them.
 		   (set-syntax-table mail-abbrev-syntax-table)
@@ -610,7 +621,8 @@
   (interactive "P")
   (if (looking-at "[ \t]*\n") (expand-abbrev))
   (setq this-command 'end-of-buffer)
-  (end-of-buffer arg))
+  (with-no-warnings
+   (end-of-buffer arg)))
 
 (eval-after-load "sendmail"
   '(progn
--- a/lisp/mail/rmail.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/mail/rmail.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,6 @@
 ;;; rmail.el --- main code of "RMAIL" mail reader for Emacs
 
-;; Copyright (C) 1985,86,87,88,93,94,95,96,97,98,2000, 01, 2004
+;; Copyright (C) 1985,86,87,88,93,94,95,96,97,98,2000,01,2004,2005
 ;;		Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -91,6 +91,9 @@
   :prefix "rmail-edit-"
   :group 'rmail)
 
+(defgroup rmail-obsolete nil
+  "Rmail obsolete customization variables."
+  :group 'rmail)
 
 (defcustom rmail-movemail-program nil
   "If non-nil, name of program for fetching new mail."
@@ -98,15 +101,46 @@
   :type '(choice (const nil) string))
 
 (defcustom rmail-pop-password nil
-  "*Password to use when reading mail from a POP server, if required."
+  "*Password to use when reading mail from POP server. Please, use rmail-remote-password instead."
+  :type '(choice (string :tag "Password")
+		 (const :tag "Not Required" nil))
+  :group 'rmail-obsolete)
+
+(defcustom rmail-pop-password-required nil
+  "*Non-nil if a password is required when reading mail from a POP server. Please, use rmail-remote-password-required instead."
+  :type 'boolean
+  :group 'rmail-obsolete)
+
+(defcustom rmail-remote-password nil
+  "*Password to use when reading mail from a remote server. This setting is ignored for mailboxes whose URL already contains a password."
   :type '(choice (string :tag "Password")
 		 (const :tag "Not Required" nil))
-  :group 'rmail-retrieve)
-
-(defcustom rmail-pop-password-required nil
-  "*Non-nil if a password is required when reading mail using POP."
+  :set-after '(rmail-pop-password)
+  :set #'(lambda (symbol value)
+	   (set-default symbol 
+			(if (and (not value)
+                                 (boundp 'rmail-pop-password)
+				 rmail-pop-password)
+			    rmail-pop-password
+			  value))
+	   (setq rmail-pop-password nil))
+  :group 'rmail-retrieve
+  :version "21.3.50.1")
+
+(defcustom rmail-remote-password-required nil
+  "*Non-nil if a password is required when reading mail from a remote server."
   :type 'boolean
-  :group 'rmail-retrieve)
+  :set-after '(rmail-pop-password-required)
+  :set #'(lambda (symbol value)
+	   (set-default symbol 
+			(if (and (not value)
+                                 (boundp 'rmail-pop-password-required)
+				 rmail-pop-password-required)
+			    rmail-pop-password-required
+			  value))
+	   (setq rmail-pop-password-required nil))
+  :group 'rmail-retrieve
+  :version "21.3.50.1")
 
 (defcustom rmail-movemail-flags nil
   "*List of flags to pass to movemail.
@@ -116,13 +150,14 @@
   :group 'rmail-retrieve
   :version "20.3")
 
-(defvar rmail-pop-password-error "invalid usercode or password\\|
-unknown user name or bad password"
-  "Regular expression matching incorrect-password POP server error messages.
+(defvar rmail-remote-password-error "invalid usercode or password\\|
+unknown user name or bad password\\|Authentication failed\\|MU_ERR_AUTH_FAILURE"
+  "Regular expression matching incorrect-password POP or IMAP server error
+messages.
 If you get an incorrect-password error that this expression does not match,
 please report it with \\[report-emacs-bug].")
 
-(defvar rmail-encoded-pop-password nil)
+(defvar rmail-encoded-remote-password nil)
 
 (defcustom rmail-preserve-inbox nil
   "*Non-nil if incoming mail should be left in the user's inbox,
@@ -130,6 +165,67 @@
   :type 'boolean
   :group 'rmail-retrieve)
 
+(defcustom rmail-movemail-search-path nil
+    "*List of directories to search for movemail (in addition to `exec-path')."
+    :group 'rmail-retrieve
+    :type '(repeat (directory)))
+
+(defun rmail-probe (prog)
+  "Determine what flavor of movemail PROG is by executing it with --version
+command line option and analyzing its output."
+  (with-temp-buffer
+    (let ((tbuf (current-buffer)))
+      (buffer-disable-undo tbuf)
+      (call-process prog nil tbuf nil "--version")
+      (if (not (buffer-modified-p tbuf))
+	  ;; Should not happen...
+	  nil
+	(goto-char (point-min))
+	(cond
+	 ((looking-at ".*movemail: invalid option")
+	  'emacs)    ;; Possibly...
+	 ((looking-at "movemail (GNU Mailutils .*)")
+	  'mailutils)
+	 (t
+	  ;; FIXME:
+	  'emacs))))))
+
+(defun rmail-autodetect ()
+  "Determine and return the flavor of `movemail' program in use. If
+rmail-movemail-program is set, use it. Otherwise, look for `movemail'
+in the path constructed by appending rmail-movemail-search-path,
+exec-path and exec-directory."
+  (if rmail-movemail-program
+      (rmail-probe rmail-movemail-program)
+    (catch 'scan
+      (dolist (dir (append rmail-movemail-search-path exec-path
+			   (list exec-directory)))
+	(when (and dir (file-accessible-directory-p dir))
+	  (let ((progname (expand-file-name "movemail" dir)))
+	    (when (and (not (file-directory-p progname))
+		       (file-executable-p progname))
+	      (let ((x (rmail-probe progname)))
+		(when x
+		  (setq rmail-movemail-program progname)
+		  (throw 'scan x))))))))))
+
+(defvar rmail-movemail-variant-in-use nil
+  "The movemail variant currently in use. Known variants are:
+
+  `emacs'     Means any implementation, compatible with the native Emacs one.
+              This is the default;
+  `mailutils' Means GNU mailutils implementation, capable of handling full
+mail URLs as the source mailbox;")
+
+;;;###autoload
+(defun rmail-movemail-variant-p (&rest variants)
+  "Return t if the current movemail variant is any of VARIANTS.
+Currently known variants are 'emacs and 'mailutils."
+  (when (not rmail-movemail-variant-in-use)
+    ;; Autodetect
+    (setq rmail-movemail-variant-in-use (rmail-autodetect)))
+  (not (null (member rmail-movemail-variant-in-use variants))))
+
 ;;;###autoload
 (defcustom rmail-dont-reply-to-names nil "\
 *A regexp specifying addresses to prune from a reply message.
@@ -1516,6 +1612,40 @@
       ;; Don't leave the buffer screwed up if we get a disk-full error.
       (or found (rmail-show-message)))))
 
+(defun rmail-parse-url (file)
+  "Parse the supplied URL. Return (list MAILBOX-NAME REMOTE PASSWORD GOT-PASSWORD)
+WHERE MAILBOX-NAME is the name of the mailbox suitable as argument to the
+actual version of `movemail', REMOTE is non-nil if MAILBOX-NAME refers to
+a remote mailbox, PASSWORD is the password if it should be
+supplied as a separate argument to `movemail' or nil otherwise, GOT-PASSWORD
+is non-nil if the user has supplied the password interactively.
+"
+  (if (string-match "^\\([^:]+\\)://\\(\\([^:@]+\\)\\(:\\([^@]+\\)\\)?@\\)?.*" file)
+      (let (got-password supplied-password 
+	    (proto (match-string 1 file))
+	    (user  (match-string 3 file))
+	    (pass  (match-string 5 file))
+	    (host  (substring file (or (match-end 2)
+				       (+ 3 (match-end 1))))))
+	(if (not pass)
+	    (when rmail-remote-password-required
+	      (setq got-password (not (rmail-have-password)))
+	      (setq supplied-password (rmail-get-remote-password
+				       (string-equal proto "imap")))))
+			      
+	(if (rmail-movemail-variant-p 'emacs)
+	    (if (string-equal proto "pop")
+		(list (concat "po:" user ":" host)
+		      t
+		      (or pass supplied-password)
+		      got-password)
+	      (error "Emacs movemail does not support %s protocol" proto))
+	  (list file
+		(or (string-equal proto "pop") (string-equal proto "imap"))
+		supplied-password
+		got-password)))
+    (list file nil nil nil)))
+
 (defun rmail-insert-inbox-text (files renamep)
   ;; Detect a locked file now, so that we avoid moving mail
   ;; out of the real inbox file.  (That could scare people.)
@@ -1524,10 +1654,15 @@
 	     (file-name-nondirectory buffer-file-name)))
   (let (file tofile delete-files movemail popmail got-password password)
     (while files
-      ;; Handle POP mailbox names specially; don't expand as filenames
+      ;; Handle remote mailbox names specially; don't expand as filenames
       ;; in case the userid contains a directory separator.
       (setq file (car files))
-      (setq popmail (string-match "^po:" file))
+      (let ((url-data (rmail-parse-url file)))
+	(setq file (nth 0 url-data))
+	(setq popmail (nth 1 url-data))
+	(setq password (nth 2 url-data))
+	(setq got-password (nth 3 url-data)))
+
       (if popmail
 	  (setq renamep t)
 	(setq file (file-truename
@@ -1535,7 +1670,12 @@
       (setq tofile (expand-file-name
 		    ;; Generate name to move to from inbox name,
 		    ;; in case of multiple inboxes that need moving.
-		    (concat ".newmail-" (file-name-nondirectory file))
+		    (concat ".newmail-"
+			    (file-name-nondirectory 
+			     (if (memq system-type '(windows-nt cygwin))
+				 ;; cannot have "po:" in file name
+				 (substring file 3)
+			       file)))
 		    ;; Use the directory of this rmail file
 		    ;; because it's a nuisance to use the homedir
 		    ;; if that is on a full disk and this rmail
@@ -1560,18 +1700,7 @@
 		(setq file (expand-file-name (user-login-name)
 					     file)))))
       (cond (popmail
-	     (if rmail-pop-password-required
-		 (progn (setq got-password (not (rmail-have-password)))
-			(setq password (rmail-get-pop-password))))
-	     (if (memq system-type '(windows-nt cygwin))
-		 ;; cannot have "po:" in file name
-		 (setq tofile
-		       (expand-file-name
-			(concat ".newmail-pop-"
-				(file-name-nondirectory (substring file 3)))
-			(file-name-directory
-			 (expand-file-name buffer-file-name)))))
-	     (message "Getting mail from post office ..."))
+	     (message "Getting mail from the remote server ..."))
 	    ((and (file-exists-p tofile)
 		  (/= 0 (nth 7 (file-attributes tofile))))
 	     (message "Getting mail from %s..." tofile))
@@ -1603,50 +1732,59 @@
 		     (write-region (point) (point) file)
 		   (file-error nil))))
 	    (t
-	     (let ((errors nil))
-	       (unwind-protect
-		   (save-excursion
-		     (setq errors (generate-new-buffer " *rmail loss*"))
-		     (buffer-disable-undo errors)
-		     (let ((args
-			    (append
-			     (list (or rmail-movemail-program
-				       (expand-file-name "movemail"
-							 exec-directory))
-				   nil errors nil)
-			     (if rmail-preserve-inbox
-				 (list "-p")
-			       nil)
-			     rmail-movemail-flags
-			     (list file tofile)
-			     (if password (list password) nil))))
-		       (apply 'call-process args))
-		     (if (not (buffer-modified-p errors))
-			 ;; No output => movemail won
-			 nil
-		       (set-buffer errors)
-		       (subst-char-in-region (point-min) (point-max)
-					     ?\n ?\  )
-		       (goto-char (point-max))
-		       (skip-chars-backward " \t")
-		       (delete-region (point) (point-max))
-		       (goto-char (point-min))
-		       (if (looking-at "movemail: ")
-			   (delete-region (point-min) (match-end 0)))
-		       (beep t)
-		       (message "movemail: %s"
-				(buffer-substring (point-min)
-						  (point-max)))
-		       ;; If we just read the password, most likely it is
-		       ;; wrong.  Otherwise, see if there is a specific
-		       ;; reason to think that the problem is a wrong passwd.
-		       (if (or got-password
-			       (re-search-forward rmail-pop-password-error
-						  nil t))
-			   (rmail-set-pop-password nil))
-		       (sit-for 3)
-		       nil))
-		 (if errors (kill-buffer errors))))))
+	     (with-temp-buffer
+	       (let ((errors (current-buffer)))
+		 (buffer-disable-undo errors)
+		 (let ((args
+			(append
+			 (list (or rmail-movemail-program
+				   (expand-file-name "movemail"
+						     exec-directory))
+			       nil errors nil)
+			 (if rmail-preserve-inbox
+			     (list "-p")
+			   nil)
+			 (if (rmail-movemail-variant-p 'mailutils)
+			     (append (list "--emacs") rmail-movemail-flags)
+			   rmail-movemail-flags)
+			 (list file tofile)
+			 (if password (list password) nil))))
+		   (apply 'call-process args))
+		 (if (not (buffer-modified-p errors))
+		     ;; No output => movemail won
+		     nil
+		   (set-buffer errors)
+		   (subst-char-in-region (point-min) (point-max)
+					 ?\n ?\  )
+		   (goto-char (point-max))
+		   (skip-chars-backward " \t")
+		   (delete-region (point) (point-max))
+		   (goto-char (point-min))
+		   (if (looking-at "movemail: ")
+		       (delete-region (point-min) (match-end 0)))
+		   (beep t)
+		   ;; If we just read the password, most likely it is
+		   ;; wrong.  Otherwise, see if there is a specific
+		   ;; reason to think that the problem is a wrong passwd.
+		   (if (or got-password
+			   (re-search-forward rmail-remote-password-error
+					      nil t))
+		       (rmail-set-remote-password nil))
+
+		   ;; If using Mailutils, remove initial error code
+		   ;; abbreviation
+		   (when (rmail-movemail-variant-p 'mailutils)
+		     (goto-char (point-min))
+		     (when (looking-at "[A-Z][A-Z0-9_]*:")
+		       (delete-region (point-min) (match-end 0))))
+		   
+		   (message "movemail: %s"
+			    (buffer-substring (point-min)
+					      (point-max)))
+		       
+		   (sit-for 3)
+		   nil)))))
+	       
       ;; At this point, TOFILE contains the name to read:
       ;; Either the alternate name (if we renamed)
       ;; or the actual inbox (if not renaming).
@@ -3834,27 +3972,30 @@
 ; nor is it meant to be.
 
 ;;;###autoload
-(defun rmail-set-pop-password (password)
-  "Set PASSWORD to be used for retrieving mail from a POP server."
+(defun rmail-set-remote-password (password)
+  "Set PASSWORD to be used for retrieving mail from a POP or IMAP server."
   (interactive "sPassword: ")
   (if password
-      (setq rmail-encoded-pop-password
+      (setq rmail-encoded-remote-password
 	    (rmail-encode-string password (emacs-pid)))
-    (setq rmail-pop-password nil)
-    (setq rmail-encoded-pop-password nil)))
-
-(defun rmail-get-pop-password ()
-  "Get the password for retrieving mail from a POP server.  If none
+    (setq rmail-remote-password nil)
+    (setq rmail-encoded-remote-password nil)))
+
+(defun rmail-get-remote-password (imap)
+  "Get the password for retrieving mail from a POP or IMAP server.  If none
 has been set, then prompt the user for one."
-  (if (not rmail-encoded-pop-password)
-      (progn (if (not rmail-pop-password)
-		 (setq rmail-pop-password (read-passwd "POP password: ")))
-	     (rmail-set-pop-password rmail-pop-password)
-	     (setq rmail-pop-password nil)))
-  (rmail-encode-string rmail-encoded-pop-password (emacs-pid)))
+  (when (not rmail-encoded-remote-password)
+    (if (not rmail-remote-password)
+	(setq rmail-remote-password
+	      (read-passwd (if imap
+			       "IMAP password: "
+			     "POP password: "))))
+    (rmail-set-remote-password rmail-remote-password)
+    (setq rmail-remote-password nil))
+  (rmail-encode-string rmail-encoded-remote-password (emacs-pid)))
 
 (defun rmail-have-password ()
-  (or rmail-pop-password rmail-encoded-pop-password))
+  (or rmail-remote-password rmail-encoded-remote-password))
 
 (defun rmail-encode-string (string mask)
  "Encode STRING with integer MASK, by taking the exclusive OR of the
--- a/lisp/man.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/man.el	Sun Jan 16 03:40:12 2005 +0000
@@ -415,13 +415,15 @@
 ;; buttons
 (define-button-type 'Man-xref-man-page
   'action (lambda (button) (man-follow (button-label button)))
-  'help-echo "RET, mouse-2: display this man page")
+  'follow-link t
+  'help-echo "mouse-2, RET: display this man page")
 
 (define-button-type 'Man-xref-header-file
     'action (lambda (button)
               (let ((w (button-get button 'Man-target-string)))
                 (unless (Man-view-header-file w)
                   (error "Cannot find header file: %s" w))))
+    'follow-link t
     'help-echo "mouse-2: display this header file")
 
 (define-button-type 'Man-xref-normal-file
@@ -433,6 +435,7 @@
 		      (view-file f)
 		    (error "Cannot read a file: %s" f))
 		(error "Cannot find a file: %s" f))))
+  'follow-link t
   'help-echo "mouse-2: display this file")
 
 
@@ -822,6 +825,7 @@
   (goto-char (point-min))
   ;; Fontify ANSI escapes.
   (let ((faces nil)
+	(buffer-undo-list t)
 	(start (point)))
     ;; http://www.isthe.com/chongo/tech/comp/ansi_escapes.html
     ;; suggests many codes, but we only handle:
@@ -853,46 +857,47 @@
       (delete-region (match-beginning 0) (match-end 0))
       (setq start (point))))
   ;; Other highlighting.
-  (if (< (buffer-size) (position-bytes (point-max)))
-      ;; Multibyte characters exist.
-      (progn
-	(goto-char (point-min))
-	(while (search-forward "__\b\b" nil t)
-	  (backward-delete-char 4)
-	  (put-text-property (point) (1+ (point)) 'face Man-underline-face))
-	(goto-char (point-min))
-	(while (search-forward "\b\b__" nil t)
-	  (backward-delete-char 4)
-	  (put-text-property (1- (point)) (point) 'face Man-underline-face))))
-  (goto-char (point-min))
-  (while (search-forward "_\b" nil t)
-    (backward-delete-char 2)
-    (put-text-property (point) (1+ (point)) 'face Man-underline-face))
-  (goto-char (point-min))
-  (while (search-forward "\b_" nil t)
-    (backward-delete-char 2)
-    (put-text-property (1- (point)) (point) 'face Man-underline-face))
-  (goto-char (point-min))
-  (while (re-search-forward "\\(.\\)\\(\b+\\1\\)+" nil t)
-    (replace-match "\\1")
-    (put-text-property (1- (point)) (point) 'face Man-overstrike-face))
-  (goto-char (point-min))
-  (while (re-search-forward "o\b\\+\\|\\+\bo" nil t)
-    (replace-match "o")
-    (put-text-property (1- (point)) (point) 'face 'bold))
-  (goto-char (point-min))
-  (while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t)
-    (replace-match "+")
-    (put-text-property (1- (point)) (point) 'face 'bold))
-  (goto-char (point-min))
-  ;; Try to recognize common forms of cross references.
-  (Man-highlight-references)
-  (Man-softhyphen-to-minus)
-  (goto-char (point-min))
-  (while (re-search-forward Man-heading-regexp nil t)
-    (put-text-property (match-beginning 0)
-		       (match-end 0)
-		       'face Man-overstrike-face))
+  (let ((buffer-undo-list t))
+    (if (< (buffer-size) (position-bytes (point-max)))
+	;; Multibyte characters exist.
+	(progn
+	  (goto-char (point-min))
+	  (while (search-forward "__\b\b" nil t)
+	    (backward-delete-char 4)
+	    (put-text-property (point) (1+ (point)) 'face Man-underline-face))
+	  (goto-char (point-min))
+	  (while (search-forward "\b\b__" nil t)
+	    (backward-delete-char 4)
+	    (put-text-property (1- (point)) (point) 'face Man-underline-face))))
+    (goto-char (point-min))
+    (while (search-forward "_\b" nil t)
+      (backward-delete-char 2)
+      (put-text-property (point) (1+ (point)) 'face Man-underline-face))
+    (goto-char (point-min))
+    (while (search-forward "\b_" nil t)
+      (backward-delete-char 2)
+      (put-text-property (1- (point)) (point) 'face Man-underline-face))
+    (goto-char (point-min))
+    (while (re-search-forward "\\(.\\)\\(\b+\\1\\)+" nil t)
+      (replace-match "\\1")
+      (put-text-property (1- (point)) (point) 'face Man-overstrike-face))
+    (goto-char (point-min))
+    (while (re-search-forward "o\b\\+\\|\\+\bo" nil t)
+      (replace-match "o")
+      (put-text-property (1- (point)) (point) 'face 'bold))
+    (goto-char (point-min))
+    (while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t)
+      (replace-match "+")
+      (put-text-property (1- (point)) (point) 'face 'bold))
+    (goto-char (point-min))
+    ;; Try to recognize common forms of cross references.
+    (Man-highlight-references)
+    (Man-softhyphen-to-minus)
+    (goto-char (point-min))
+    (while (re-search-forward Man-heading-regexp nil t)
+      (put-text-property (match-beginning 0)
+			 (match-end 0)
+			 'face Man-overstrike-face)))
   (message "%s man page formatted" Man-arguments))
 
 (defun Man-highlight-references ()
--- a/lisp/mouse.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/mouse.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,6 @@
 ;;; mouse.el --- window system-independent mouse support
 
-;; Copyright (C) 1993, 94, 95, 1999, 2000, 2001, 2002, 2003, 2004
+;; Copyright (C) 1993, 94, 95, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -397,7 +397,6 @@
 	 (start-nwindows (count-windows t))
 	 (old-selected-window (selected-window))
 	 (minibuffer (frame-parameter nil 'minibuffer))
-	 (mouse-autoselect-window nil)
 	 should-enlarge-minibuffer event mouse y top bot edges wconfig growth)
     (track-mouse
       (progn
@@ -435,7 +434,7 @@
 	  (cond ((integerp event)
 		 (setq done t))
 
-		((eq (car event) 'switch-frame)
+		((memq (car event) '(switch-frame select-window))
 		 nil)
 
 		((not (memq (car event) '(mouse-movement scroll-bar-movement)))
@@ -582,7 +581,7 @@
 	  ;;     unknown event.
 	  (cond ((integerp event)
 		 (setq done t))
-		((eq (car event) 'switch-frame)
+		((memq (car event) '(switch-frame select-window))
 		 nil)
 		((not (memq (car event)
 			    '(mouse-movement scroll-bar-movement)))
@@ -754,11 +753,11 @@
 
 If the click is in the echo area, display the `*Messages*' buffer."
   (interactive "e")
-  (let ((w (posn-window (event-start start-event)))
-	(mouse-autoselect-window nil))
-    (if (not (or (not (window-minibuffer-p w))
-		 (minibuffer-window-active-p w)))
+  (let ((w (posn-window (event-start start-event))))
+    (if (and (window-minibuffer-p w)
+	     (not (minibuffer-window-active-p w)))
 	(save-excursion
+	  ;; Swallow the up-event.
 	  (read-event)
 	  (set-buffer "*Messages*")
 	  (goto-char (point-max))
@@ -773,21 +772,24 @@
 
 A clickable link is identified by one of the following methods:
 
-1) If the character at POS has a non-nil `follow-link' text or
-overlay property, the value of that property is returned.
+- If the character at POS has a non-nil `follow-link' text or
+overlay property, use the value of that property determines what
+to do.
 
-2) If there is a local key-binding or a keybinding at position
-POS for the `follow-link' event, the binding of that event
-determines whether POS is inside a link:
+- If there is a local key-binding or a keybinding at position POS
+for the `follow-link' event, the binding of that event determines
+what to do.
 
-- If the binding is `mouse-face', POS is inside a link if there
+The resulting value determine whether POS is inside a link:
+
+- If the value is `mouse-face', POS is inside a link if there
 is a non-nil `mouse-face' property at POS.  Return t in this case.
 
-- If the binding is a function, FUNC, POS is inside a link if
+- If the value is a function, FUNC, POS is inside a link if
 the call \(FUNC POS) returns non-nil.  Return the return value
 from that call.
 
-- Otherwise, return the binding of the `follow-link' binding.
+- Otherwise, return the value itself.
 
 The return value is interpreted as follows:
 
@@ -801,16 +803,17 @@
 
 - Otherwise, the mouse-1 event is translated into a mouse-2 event
 at the same position."
-  (or (get-char-property pos 'follow-link)
-      (save-excursion
-	(goto-char pos)
-	(let ((b (key-binding [follow-link] nil t)))
-	  (cond
-	   ((eq b 'mouse-face)
-	    (and (get-char-property pos 'mouse-face) t))
-	   ((functionp b)
-	    (funcall b pos))
-	   (t b))))))
+  (let ((action
+	 (or (get-char-property pos 'follow-link)
+	     (save-excursion
+	       (goto-char pos)
+	       (key-binding [follow-link] nil t)))))
+    (cond
+     ((eq action 'mouse-face)
+      (and (get-char-property pos 'mouse-face) t))
+     ((functionp action)
+      (funcall action pos))
+     (t action))))
 
 (defun mouse-drag-region-1 (start-event)
   (mouse-minibuffer-check start-event)
@@ -858,8 +861,8 @@
 	(while (progn
 		 (setq event (read-event))
 		 (or (mouse-movement-p event)
-		     (eq (car-safe event) 'switch-frame)))
-	  (if (eq (car-safe event) 'switch-frame)
+		     (memq (car-safe event) '(switch-frame select-window))))
+	  (if (memq (car-safe event) '(switch-frame select-window))
 	      nil
 	    (setq end (event-end event)
 		  end-point (posn-point end))
@@ -1153,6 +1156,7 @@
       (move-overlay mouse-drag-overlay (point) (mark t)))
     (catch 'mouse-show-mark
       ;; In this loop, execute scroll bar and switch-frame events.
+      ;; Should we similarly handle `select-window' events?  --Stef
       ;; Also ignore down-events that are undefined.
       (while (progn (setq event (read-event))
 		    (setq events (append events (list event)))
@@ -1476,9 +1480,9 @@
 	  (while (progn
 		   (setq event (read-event))
 		   (or (mouse-movement-p event)
-		       (eq (car-safe event) 'switch-frame)))
+		       (memq (car-safe event) '(switch-frame select-window))))
 
-	    (if (eq (car-safe event) 'switch-frame)
+	    (if (memq (car-safe event) '(switch-frame select-window))
 		nil
 	      (setq end (event-end event)
 		    end-point (posn-point end))
--- a/lisp/progmodes/ebrowse.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/progmodes/ebrowse.el	Sun Jan 16 03:40:12 2005 +0000
@@ -780,16 +780,16 @@
 
 (defun ebrowse-class-in-tree (class tree)
   "Search for a class with name CLASS in TREE.
-Return the class found, if any.  This function is used during the load
-phase where classes appended to a file replace older class
-information."
+If CLASS is found, return the tail of TREE starting at CLASS.  This function
+is used during the load phase where classes appended to a file replace older
+class information."
   (let ((tclass (ebrowse-ts-class class))
 	found)
     (while (and tree (not found))
-      (let ((root (car tree)))
-	(when (string= (ebrowse-qualified-class-name (ebrowse-ts-class root))
+      (let ((root-ptr tree))
+	(when (string= (ebrowse-qualified-class-name (ebrowse-ts-class (car root-ptr)))
 		       (ebrowse-qualified-class-name tclass))
-	  (setq found root))
+	  (setq found root-ptr))
 	(setq tree (cdr tree))))
     found))
 
@@ -903,10 +903,10 @@
     (let ((gc-cons-threshold 2000000))
       (while (not (progn (skip-chars-forward " \t\n\r") (eobp)))
 	(let* ((root (read (current-buffer)))
-	       (old-root (ebrowse-class-in-tree root tree)))
+	       (old-root-ptr (ebrowse-class-in-tree root tree)))
 	  (ebrowse-show-progress "Reading data" (null tree))
-	  (if old-root
-	      (setf (car old-root) root)
+	  (if old-root-ptr
+	      (setcar old-root-ptr root)
 	    (push root tree)))))
     (garbage-collect)
     (list header tree)))
--- a/lisp/progmodes/hideshow.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/progmodes/hideshow.el	Sun Jan 16 03:40:12 2005 +0000
@@ -5,7 +5,7 @@
 ;; Author: Thien-Thi Nguyen <ttn@gnu.org>
 ;;      Dan Nicolaescu <dann@ics.uci.edu>
 ;; Keywords: C C++ java lisp tools editing comments blocks hiding outlines
-;; Maintainer-Version: 5.58.2.3
+;; Maintainer-Version: 5.58.2.4
 ;; Time-of-Day-Author-Most-Likely-to-be-Recalcitrant: early morning
 
 ;; This file is part of GNU Emacs.
@@ -233,7 +233,6 @@
 ;;; Code:
 
 (require 'easymenu)
-(eval-when-compile (require 'cl))
 
 ;;---------------------------------------------------------------------------
 ;; user-configurable variables
--- a/lisp/progmodes/perl-mode.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/progmodes/perl-mode.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,6 @@
 ;;; perl-mode.el --- Perl code editing commands for GNU Emacs
 
-;; Copyright (C) 1990, 1994, 2003  Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1994, 2003, 2005  Free Software Foundation, Inc.
 
 ;; Author: William F. Mann
 ;; Maintainer: FSF
@@ -408,7 +408,7 @@
 create a new comment."
   :type 'boolean)
 
-(defcustom perl-nochange ";?#\\|\f\\|\\s(\\|\\(\\w\\|\\s_\\)+:"
+(defcustom perl-nochange ";?#\\|\f\\|\\s(\\|\\(\\w\\|\\s_\\)+:[^:]"
   "*Lines starting with this regular expression are not auto-indented."
   :type 'regexp)
 
@@ -769,7 +769,7 @@
 			   (skip-chars-forward " \t\f\n")
 			   (cond ((looking-at ";?#")
 				  (forward-line 1) t)
-				 ((looking-at "\\(\\w\\|\\s_\\)+:")
+				 ((looking-at "\\(\\w\\|\\s_\\)+:[^:]")
 				  (save-excursion
 				    (end-of-line)
 				    (setq colon-line-end (point)))
@@ -929,5 +929,5 @@
 
 (provide 'perl-mode)
 
-;;; arch-tag: 8c7ff68d-15f3-46a2-ade2-b7c41f176826
+;; arch-tag: 8c7ff68d-15f3-46a2-ade2-b7c41f176826
 ;;; perl-mode.el ends here
--- a/lisp/progmodes/sh-script.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/progmodes/sh-script.el	Sun Jan 16 03:40:12 2005 +0000
@@ -448,6 +448,7 @@
     (define-key map "\C-c=" 'sh-set-indent)
     (define-key map "\C-c<" 'sh-learn-line-indent)
     (define-key map "\C-c>" 'sh-learn-buffer-indent)
+    (define-key map "\C-c\C-\\" 'sh-backslash-region)
 
     (define-key map "=" 'sh-assignment)
     (define-key map "\C-c+" 'sh-add)
@@ -1183,6 +1184,16 @@
   :type `(choice ,@ sh-number-or-symbol-list)
   :group 'sh-indentation)
 
+(defcustom sh-backslash-column 48
+  "*Column in which `sh-backslash-region' inserts backslashes."
+  :type 'integer
+  :group 'sh)
+
+(defcustom sh-backslash-align t
+  "*If non-nil, `sh-backslash-region' will align backslashes."
+  :type 'boolean
+  :group 'sh)
+
 ;; Internal use - not designed to be changed by the user:
 
 (defun sh-mkword-regexpr (word)
@@ -3547,6 +3558,77 @@
   (if (re-search-forward sh-end-of-command nil t)
       (goto-char (match-end 1))))
 
+;; Backslashification.  Stolen from make-mode.el.
+
+(defun sh-backslash-region (from to delete-flag)
+  "Insert, align, or delete end-of-line backslashes on the lines in the region.
+With no argument, inserts backslashes and aligns existing backslashes.
+With an argument, deletes the backslashes.
+
+This function does not modify the last line of the region if the region ends
+right at the start of the following line; it does not modify blank lines
+at the start of the region.  So you can put the region around an entire 
+shell command and conveniently use this command."
+  (interactive "r\nP")
+  (save-excursion
+    (goto-char from)
+    (let ((column sh-backslash-column)
+          (endmark (make-marker)))
+      (move-marker endmark to)
+      ;; Compute the smallest column number past the ends of all the lines.
+      (if sh-backslash-align
+	  (progn
+	    (if (not delete-flag)
+		(while (< (point) to)
+		  (end-of-line)
+		  (if (= (preceding-char) ?\\)
+		      (progn (forward-char -1)
+			     (skip-chars-backward " \t")))
+		  (setq column (max column (1+ (current-column))))
+		  (forward-line 1)))
+	    ;; Adjust upward to a tab column, if that doesn't push
+	    ;; past the margin.
+	    (if (> (% column tab-width) 0)
+		(let ((adjusted (* (/ (+ column tab-width -1) tab-width)
+				   tab-width)))
+		  (if (< adjusted (window-width))
+		      (setq column adjusted))))))
+      ;; Don't modify blank lines at start of region.
+      (goto-char from)
+      (while (and (< (point) endmark) (eolp))
+        (forward-line 1))
+      ;; Add or remove backslashes on all the lines.
+      (while (and (< (point) endmark)
+                  ;; Don't backslashify the last line
+                  ;; if the region ends right at the start of the next line.
+                  (save-excursion
+                    (forward-line 1)
+                    (< (point) endmark)))
+        (if (not delete-flag)
+            (sh-append-backslash column)
+          (sh-delete-backslash))
+        (forward-line 1))
+      (move-marker endmark nil))))
+
+(defun sh-append-backslash (column)
+  (end-of-line)
+  ;; Note that "\\\\" is needed to get one backslash.
+  (if (= (preceding-char) ?\\)
+      (progn (forward-char -1)
+             (delete-horizontal-space)
+             (indent-to column (if sh-backslash-align nil 1)))
+    (indent-to column (if sh-backslash-align nil 1))
+    (insert "\\")))
+
+(defun sh-delete-backslash ()
+  (end-of-line)
+  (or (bolp)
+      (progn
+ 	(forward-char -1)
+ 	(if (looking-at "\\\\")
+ 	    (delete-region (1+ (point))
+ 			   (progn (skip-chars-backward " \t") (point)))))))
+
 (provide 'sh-script)
 
 ;;; arch-tag: eccd8b72-f337-4fc2-ae86-18155a69d937
--- a/lisp/replace.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/replace.el	Sun Jan 16 03:40:12 2005 +0000
@@ -64,6 +64,27 @@
   :group 'matching
   :version "21.4")
 
+(defcustom query-replace-highlight t
+  "*Non-nil means to highlight matches during query replacement."
+  :type 'boolean
+  :group 'matching)
+
+(defcustom query-replace-lazy-highlight t
+  "*Controls the lazy-highlighting during query replacements.
+When non-nil, all text in the buffer matching the current match
+is highlighted lazily using isearch lazy highlighting (see
+`lazy-highlight-initial-delay' and `lazy-highlight-interval')."
+  :type 'boolean
+  :group 'lazy-highlight
+  :group 'matching
+  :version "21.4")
+
+(defface query-replace
+  '((t (:inherit isearch)))
+  "Face for highlighting query replacement matches."
+  :group 'matching
+  :version "21.4")
+
 (defun query-replace-descr (string)
   (mapconcat 'isearch-text-char-description string ""))
 
@@ -802,9 +823,10 @@
 	(setq count (+ count (if forwardp -1 1)))
 	(setq beg (line-beginning-position)
 	      end (line-end-position))
-	(if (and keep-props (boundp 'jit-lock-mode) jit-lock-mode
+	(if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode)
 		 (text-property-not-all beg end 'fontified t))
-	    (jit-lock-fontify-now beg end))
+	    (if (fboundp 'jit-lock-fontify-now)
+		(jit-lock-fontify-now beg end)))
 	(push
 	 (funcall (if keep-props
 		      #'buffer-substring
@@ -1008,9 +1030,11 @@
 			    endpt (line-end-position)))
 		    (setq marker (make-marker))
 		    (set-marker marker matchbeg)
-		    (if (and keep-props (boundp 'jit-lock-mode) jit-lock-mode
+		    (if (and keep-props
+			     (if (boundp 'jit-lock-mode) jit-lock-mode)
 			     (text-property-not-all begpt endpt 'fontified t))
-			(jit-lock-fontify-now begpt endpt))
+			(if (fboundp 'jit-lock-fontify-now)
+			    (jit-lock-fontify-now begpt endpt)))
 		    (setq curstring (buffer-substring begpt endpt))
 		    ;; Depropertize the string, and maybe
 		    ;; highlight the matches
@@ -1258,27 +1282,6 @@
   (replace-match newtext fixedcase literal)
   noedit)
 
-(defcustom query-replace-highlight t
-  "*Non-nil means to highlight matches during query replacement."
-  :type 'boolean
-  :group 'matching)
-
-(defcustom query-replace-lazy-highlight t
-  "*Controls the lazy-highlighting during query replacements.
-When non-nil, all text in the buffer matching the current match
-is highlighted lazily using isearch lazy highlighting (see
-`isearch-lazy-highlight-initial-delay' and
-`isearch-lazy-highlight-interval')."
-  :type 'boolean
-  :group 'matching
-  :version "21.4")
-
-(defface query-replace
-  '((t (:inherit isearch)))
-  "Face for highlighting query replacement matches."
-  :group 'matching
-  :version "21.4")
-
 (defun perform-replace (from-string replacements
 		        query-flag regexp-flag delimited-flag
 			&optional repeat-count map start end)
--- a/lisp/simple.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/simple.el	Sun Jan 16 03:40:12 2005 +0000
@@ -647,15 +647,16 @@
        (skip-chars-backward " \t")
        (constrain-to-field nil orig-pos)))))
 
-(defun just-one-space ()
-  "Delete all spaces and tabs around point, leaving one space."
-  (interactive "*")
+(defun just-one-space (n)
+  "Delete all spaces and tabs around point, leaving one space (or N spaces)."
+  (interactive "*p")
   (let ((orig-pos (point)))
     (skip-chars-backward " \t")
     (constrain-to-field nil orig-pos)
-    (if (= (following-char) ? )
-	(forward-char 1)
-      (insert ? ))
+    (dotimes (i n)
+      (if (= (following-char) ?\ )
+	  (forward-char 1)
+	(insert ?\ )))
     (delete-region
      (point)
      (progn
@@ -899,7 +900,7 @@
   (if (and (integerp value)
            (or (not (memq this-command '(eval-last-sexp eval-print-last-sexp)))
                (eq this-command last-command)
-               (and (boundp 'edebug-active) edebug-active)))
+               (if (boundp 'edebug-active) edebug-active)))
       (let ((char-string
              (if (or (and (boundp 'edebug-active) edebug-active)
                      (memq this-command '(eval-last-sexp eval-print-last-sexp)))
@@ -3008,10 +3009,10 @@
   (when mark-ring
     (setq mark-ring (nconc mark-ring (list (copy-marker (mark-marker)))))
     (set-marker (mark-marker) (+ 0 (car mark-ring)) (current-buffer))
-    (deactivate-mark)
     (move-marker (car mark-ring) nil)
     (if (null (mark t)) (ding))
-    (setq mark-ring (cdr mark-ring))))
+    (setq mark-ring (cdr mark-ring)))
+  (deactivate-mark))
 
 (defalias 'exchange-dot-and-mark 'exchange-point-and-mark)
 (defun exchange-point-and-mark (&optional arg)
@@ -3590,7 +3591,7 @@
 The place mark goes is the same place \\[forward-word] would
 move to with the same argument.
 Interactively, if this command is repeated
-or (in Transient Mark mode) if the mark is active, 
+or (in Transient Mark mode) if the mark is active,
 it marks the next ARG words after the ones already marked."
   (interactive "P\np")
   (cond ((and allow-extend
@@ -4115,7 +4116,7 @@
     (play-sound sound)))
 
 (define-key global-map "\e\e\e" 'keyboard-escape-quit)
-
+
 (defcustom read-mail-command 'rmail
   "*Your preference for a mail reading package.
 This is used by some keybindings which support reading mail.
@@ -4257,7 +4258,7 @@
    (list nil nil nil current-prefix-arg))
   (compose-mail to subject other-headers continue
 		'switch-to-buffer-other-frame yank-action send-actions))
-
+
 (defvar set-variable-value-history nil
   "History of values entered with `set-variable'.")
 
@@ -4320,7 +4321,7 @@
   ;; Force a thorough redisplay for the case that the variable
   ;; has an effect on the display, like `tab-width' has.
   (force-mode-line-update))
-
+
 ;; Define the major mode for lists of completions.
 
 (defvar completion-list-mode-map nil
@@ -4328,6 +4329,7 @@
 (or completion-list-mode-map
     (let ((map (make-sparse-keymap)))
       (define-key map [mouse-2] 'mouse-choose-completion)
+      (define-key map [follow-link] 'mouse-face)
       (define-key map [down-mouse-2] nil)
       (define-key map "\C-m" 'choose-completion)
       (define-key map "\e\e\e" 'delete-completion-window)
--- a/lisp/startup.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/startup.el	Sun Jan 16 03:40:12 2005 +0000
@@ -871,12 +871,6 @@
 			      (sit-for 1))
 			    (setq user-init-file source))))
 
-		      (when (stringp custom-file)
-                        (unless (assoc custom-file load-history)
-                          ;; If the .emacs file has set `custom-file' but hasn't
-                          ;; loaded the file yet, let's load it.
-                          (load custom-file t t)))
-
 		      (unless inhibit-default-init
                         (let ((inhibit-startup-message nil))
                           ;; Users are supposed to be told their rights.
--- a/lisp/textmodes/ispell.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/ispell.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1074,15 +1074,54 @@
       (decode-coding-string str (ispell-get-coding-system))
     str))
 
+(put 'ispell-unified-chars-table 'char-table-extra-slots 0)
+
+;; Char-table that maps an Unicode character (charset:
+;; latin-iso8859-1, mule-unicode-0100-24ff, mule-unicode-2500-34ff) to
+;; a string in which all equivalent characters are listed.
+
+(defconst ispell-unified-chars-table
+  (let ((table (make-char-table 'ispell-unified-chars-table)))
+    (map-char-table
+     #'(lambda (c v)
+	 (if (and v (/= c v))
+	     (let ((unified (or (aref table v) (string v))))
+	       (aset table v (concat unified (string c))))))
+     ucs-mule-8859-to-mule-unicode)
+    table))
+
+;; Return a string decoded from Nth element of the current dictionary
+;; while splice equivalent characters into the string.  This splicing
+;; is done only if the string is a regular expression of the form
+;; "[...]" because, otherwise, splicing will result in incorrect
+;; regular expression matching.
+
+(defun ispell-get-decoded-string (n)
+  (let* ((slot (assoc ispell-dictionary ispell-dictionary-alist))
+	 (str (nth n slot)))
+    (when (and (> (length str) 0)
+	       (not (multibyte-string-p str)))
+      (setq str (ispell-decode-string str))
+      (if (and (= (aref str 0) ?\[)
+	       (eq (string-match "\\]" str) (1- (length str))))
+	  (setq str
+		(string-as-multibyte
+		 (mapconcat
+		  #'(lambda (c)
+		      (let ((unichar (aref ucs-mule-8859-to-mule-unicode c)))
+			(if unichar
+			    (aref ispell-unified-chars-table unichar)
+			  (string c))))
+		  str ""))))
+      (setcar (nthcdr n slot) str))
+    str))
+
 (defun ispell-get-casechars ()
-  (ispell-decode-string
-   (nth 1 (assoc ispell-dictionary ispell-dictionary-alist))))
+  (ispell-get-decoded-string 1))
 (defun ispell-get-not-casechars ()
-  (ispell-decode-string
-   (nth 2 (assoc ispell-dictionary ispell-dictionary-alist))))
+  (ispell-get-decoded-string 2))
 (defun ispell-get-otherchars ()
-  (ispell-decode-string
-   (nth 3 (assoc ispell-dictionary ispell-dictionary-alist))))
+  (ispell-get-decoded-string 3))
 (defun ispell-get-many-otherchars-p ()
   (nth 4 (assoc ispell-dictionary ispell-dictionary-alist)))
 (defun ispell-get-ispell-args ()
--- a/lisp/textmodes/org.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/org.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,11 +1,11 @@
 ;; org.el --- Outline-based notes management and organizer 
-
+;; Carstens outline-mode for keeping track of everything.
 ;; Copyright (c) 2003, 2004 Free Software Foundation
 
 ;; Author: Carsten Dominik <dominik at science dot uva dot nl>
 ;; Keywords: outlines, hypermedia, calendar
 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
-;; Version: 3.03
+;; Version: 3.04
 
 ;; This file is part of GNU Emacs.
 
@@ -23,9 +23,7 @@
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Carsten's outline-mode for keeping track of everything.
 ;;
 ;;; Commentary:
 ;;
@@ -59,6 +57,8 @@
 ;;    (autoload 'org-diary "org" "Diary entries from Org mode")
 ;;    (autoload 'org-agenda "org" "Multi-file agenda from Org mode" t)
 ;;    (autoload 'org-store-link "org" "Store a link to the current location" t)
+;;    (autoload 'orgtbl-mode "org" "Org tables as a minor mode" t)
+;;    (autoload 'turn-on-orgtbl "org" "Org tables as a minor mode")
 ;;    (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
 ;;    (define-key global-map "\C-cl" 'org-store-link)
 ;;    (define-key global-map "\C-ca" 'org-agenda)
@@ -79,9 +79,18 @@
 ;;
 ;; Changes:
 ;; -------
+;; Version 3.04
+;;    - Table editor optimized to need fewer realignments, and to keep
+;;      table shape when typing in fields.
+;;    - A new minor mode, orgtbl-mode, introduces the Org-mode table editor
+;;      into arbitrary major modes.
+;;    - Fixed bug with realignment in XEmacs.
+;;    - Startup options can be set with special #+STARTUP line.
+;;    - Heading following a match in org-occur can be suppressed.
+;;
 ;; Version 3.03
 ;;    - Copyright transfer to the FSF.
-;;    - Effect of C-u and C-u C-u in org-timeline interchanged.
+;;    - Effect of C-u and C-u C-u in org-timeline swapped.
 ;;    - Timeline now always contains today, and `.' jumps to it.
 ;;    - Table editor:
 ;;      - cut and paste of regtangular regions in tables
@@ -204,7 +213,7 @@
 
 ;;; Customization variables
 
-(defvar org-version "3.03"
+(defvar org-version "3.04"
   "The version number of the file org.el.")
 (defun org-version (arg)
   (interactive "P")
@@ -402,11 +411,11 @@
   "Matches the SCHEDULED keyword together with a time stamp.")
 (make-variable-buffer-local 'org-scheduled-time-regexp)
 
-(defun org-set-regexps ()
+(defun org-set-regexps-and-options ()
   "Precompute regular expressions for current buffer."
   (when (eq major-mode 'org-mode)
     (let ((re (org-make-options-regexp
-               '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO")))
+               '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" "STARTUP")))
           (splitre "[ \t]+")
           kwds int key value cat)
       (save-restriction
@@ -426,7 +435,17 @@
                     kwds (append kwds (org-split-string value splitre))))
              ((equal key "TYP_TODO")
               (setq int 'type
-                    kwds (append kwds (org-split-string value splitre)))))
+                    kwds (append kwds (org-split-string value splitre))))
+             ((equal key "STARTUP")
+              (let ((opts (org-split-string value splitre))
+                    (set '(("fold" org-startup-folded t)
+                           ("nofold" org-startup-folded nil)
+                           ("dlcheck" org-startup-with-deadline-check t)
+                           ("nodlcheck" org-startup-with-deadline-check nil)))
+                    l var val)
+                (while (setq l (assoc (pop opts) set))
+                  (setq var (nth 1 l) val (nth 2 l))
+                  (set (make-local-variable var) val)))))             
             )))
       (and cat (set (make-local-variable 'org-category) cat))
       (and kwds (set (make-local-variable 'org-todo-keywords) kwds))
@@ -465,8 +484,6 @@
           (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>"))
     (org-set-font-lock-defaults)))
 
-;(add-hook 'hack-local-variables-hook 'org-set-regexps)
-
 (defgroup org-time nil
   "Options concerning time stamps and deadlines in Org-mode."
   :tag "Org Time"
@@ -540,7 +557,7 @@
   :type 'number)
 
 (defcustom org-agenda-include-all-todo t
-  "Non-nil means, the multifile agenda will always contain alm TODO entries.
+  "Non-nil means, the multifile 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
@@ -639,6 +656,18 @@
   "Formats for `format-time-string' which are used for time stamps.
 It is not recommended to change this constant.")
 
+(defcustom org-show-following-heading t
+  "Non-nil means, show heading following match in `org-occur'.
+When doing an `org-occur' it is useful to show the headline which
+follows the match, even if they do not match the regexp. This makes it
+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
+  :type 'boolean)
+
+
+
 (defgroup org-link nil
   "Options concerning links in Org-mode."
   :tag "Org Link"
@@ -845,11 +874,34 @@
   :tag "Org Table"
   :group 'org)
 
-(defcustom org-enable-table-editor t
+(defcustom org-enable-table-editor 'optimized
   "Non-nil means, lines starting with \"|\" are handled by the table editor.
-When nil, such lines will be treated like ordinary lines."
+When nil, such lines will be treated like ordinary lines.
+
+When equal to the symbol `optimized', the table editor will be optimized to
+do the following
+- Use automatic overwrite mode in front of whitespace in table fields.
+  This make the structure of the table stay in tact as long as the edited
+  field does not exceed the column width.
+- Minimize the number of realigns.  Normally, the table is aligned each time
+  TAB or RET are pressed to move to another field.  With optimization this
+  happens only if changes to a field might have  changed the column width.
+Optimization requires replacing the functions `self-insert-command',
+`delete-char', and `backward-delete-char' in Org-mode buffers, with a
+slight (in fact: unnoticable) speed impact for normal typing.  Org-mode is
+very good at guessing when a re-align will be necessary, but you can always
+force one with `C-c C-c'.
+
+I you would like to use the optimized version in Org-mode, but the un-optimized
+version in OrgTbl-mode, see the variable `orgtbl-optimized'.
+
+This variable can be used to turn on and off the table editor during a session,
+but in order to toggle optimization, a restart is required."
   :group 'org-table
-  :type 'boolean)
+  :type '(choice
+          (const :tag "off" nil)
+          (const :tag "on" t)
+          (const :tag "on, optimized" optimized)))
 
 (defcustom org-table-default-size "5x2"
   "The default size for newly created tables, Columns x Rows."
@@ -1295,6 +1347,8 @@
 (eval-when-compile
   (defvar zmacs-regions)
   (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)
@@ -1351,7 +1405,7 @@
 For printing and sharing of notes, an Org-mode file (or a part of it)
 can be exported as a well-structured ASCII or HTML file.
 
-+  The following commands are available:
+The following commands are available:
 
 \\{org-mode-map}"
   (interactive "P")
@@ -1363,10 +1417,12 @@
   (org-install-agenda-files-menu)
   (setq outline-regexp "\\*+")
   (if org-startup-truncated (setq truncate-lines t))
-  (org-set-regexps)
+  (org-set-regexps-and-options)
   (set (make-local-variable 'font-lock-unfontify-region-function)
        'org-unfontify-region)
   ;; Activate before-change-function
+  (set (make-local-variable 'org-table-may-need-update) t)
+  (make-local-hook 'before-change-functions)  ;; needed for XEmacs
   (add-hook 'before-change-functions 'org-before-change-function nil
             'local)
   ;; Inhibit auto-fill for headers, tables and fixed-width lines.
@@ -1507,7 +1563,7 @@
 (defvar org-cycle-global-status nil)
 (defvar org-cycle-subtree-status nil)
 (defun org-cycle (&optional arg)
-  "Visibility cycling for outline(-minor)-mode.
+  "Visibility cycling for org-mode.
 
 - When this function is called with a prefix argument, rotate the entire
   buffer through 3 states (global cycling)
@@ -1540,7 +1596,9 @@
    ((org-at-table-p 'any)
     ;; Enter the table or move to the next field in the table
     (or (org-table-recognize-table.el)
-        (org-table-next-field)))
+        (progn
+          (org-table-justify-field-maybe)
+          (org-table-next-field))))
 
    (arg ;; Global cycling
 
@@ -1765,9 +1823,9 @@
 (defvar org-ignore-region nil
   "To temporary disable the active region.")
 
-(defun org-insert-heading ()
+(defun org-insert-heading (arg)
   "Insert a new heading with same depth at point."
-  (interactive)
+  (interactive "P")
   (let* ((head (save-excursion
 		 (condition-case nil
 		     (org-back-to-heading)
@@ -2271,14 +2329,14 @@
         (message "%d match(es) for regexp %s" cnt regexp))
     cnt))
 
-
 (defun org-show-hierarchy-above ()
   "Make sure point and the headings hierarchy above is visible."
   (if (org-on-heading-p t)
       (org-flag-heading nil)    ; only show the heading
     (org-show-hidden-entry))    ; show entire entry
   (save-excursion
-    (and (outline-next-heading)
+    (and org-show-following-heading
+         (outline-next-heading)
          (org-flag-heading nil)))  ; show the next heading
   (save-excursion                  ; show all higher headings
     (while (condition-case nil
@@ -2361,7 +2419,7 @@
 specified by the user will be filled in from the current date/time.
 So if you press just return without typing anything, the time stamp
 will represent the current date/time.  If there is already a timestamp
-at the cursoe, it will be modified."
+at the cursor, it will be modified."
   (interactive "P")
   (let ((fmt (if arg (cdr org-time-stamp-formats)
                (car org-time-stamp-formats)))
@@ -2798,7 +2856,11 @@
 
 ;;;###autoload
 (defun org-agenda-mode ()
-  "Mode for time-sorted view on action items in Org-mode files."
+  "Mode for time-sorted view on action items in Org-mode files.
+
+The following commands are available:
+
+\\{org-agenda-mode-map}"
   (interactive)
   (kill-all-local-variables)
   (setq major-mode 'org-agenda-mode)
@@ -3118,7 +3180,7 @@
 (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 be fixed by explicitly going to the buffer, maybe.
+  ;; Could probably be fixed by explicitly going to the buffer.
   (when (not (file-exists-p file))
     (message "non-existent file %s.  [R]emove from agenda-files or [A]bort?"
              file)
@@ -4507,7 +4569,6 @@
 RET on headline   -> Store as sublevel entry to current headline
 <left>/<right>    -> before/after current headline, same headings level")
 
-;; FIXME: Document C-u C-c C-c
 ;;;###autoload
 (defun org-remember-handler ()
   "Store stuff from remember.el into an org file.
@@ -4796,6 +4857,21 @@
       (save-buffer))
     (kill-buffer buf)))
 
+(defvar org-table-aligned-begin-marker (make-marker)
+  "Marker at the beginning of the table last aligned.
+Used to check if cursor still is in that table, to minimize realignment.")
+(defvar org-table-aligned-end-marker (make-marker)
+  "Marker at the end of the table last aligned.
+Used to check if cursor still is in that table, to minimize realignment.")
+(defvar org-table-last-alignment nil
+  "List of flags for flushright alignment, from the last re-algnment.
+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 ffields in each column.
+This is being used to correctly align a single field after TAB or RET.")
+
+
 (defun org-table-align (&optional arg)
   "Align the table at point by aligning all vertical bars."
   (interactive "P")
@@ -4866,6 +4942,8 @@
       (push (>= frac org-table-number-fraction) typenums))
     (setq lengths (nreverse lengths)
           typenums (nreverse typenums))
+    (setq org-table-last-alignment typenums
+          org-table-last-column-widths lengths)
     ;; Compute the formats needed for output of the table
     (setq rfmt (concat indent "|") hfmt (concat indent "|"))
     (while (setq l (pop lengths))
@@ -4884,13 +4962,14 @@
     ;; Replace the old one
     (delete-region beg end)
     (move-marker end nil)
+    (move-marker org-table-aligned-begin-marker (point))
     (insert new)
+    (move-marker org-table-aligned-end-marker (point))
     ;; 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)
-    ;; (message "Aligning table...done")
     (if (org-in-invisibility-spec-p '(org-table))
         (org-table-add-invisible-to-vertical-lines))
     ))
@@ -4920,6 +4999,35 @@
       (goto-char (match-beginning 0)))
     (point-marker)))
 
+(defun org-table-justify-field-maybe ()
+  "Justify the current field, text to left, number to right."
+  (cond
+   (org-table-may-need-update) ; Realignment will happen anyway, don't bother
+   ((org-at-table-hline-p)
+    ;; This is pretty stupid, but I don't know how to deal with hlines
+    (setq org-table-may-need-update t))
+   ((or (not (equal (marker-buffer org-table-aligned-begin-marker)
+                    (current-buffer)))
+        (< (point) org-table-aligned-begin-marker)
+        (>= (point) org-table-aligned-end-marker))
+    ;; This is not the same table, force a full re-align
+    (setq org-table-may-need-update t))
+   (t ;; realign the current field, based on previous full realign
+    (let* ((pos (point)) s org-table-may-need-update
+           (col (org-table-current-column))
+           (num (nth (1- col) org-table-last-alignment))
+           l f)
+      (when (> col 0)
+        (skip-chars-backward "^|\n")
+        (if (looking-at " *\\([^|\n]*?\\) *|")
+            (progn
+              (setq s (match-string 1)
+                    l (max 1 (- (match-end 0) (match-beginning 0) 3)))
+              (setq f (format (if num " %%%ds |" " %%-%ds |") l))
+              (replace-match (format f s t t)))
+          (setq org-table-may-need-update t))
+        (goto-char pos))))))
+
 (defun org-table-next-field (&optional arg)
   "Go to the next field in the current table.
 Before doing so, re-align the table if necessary."
@@ -5013,18 +5121,21 @@
       (error "Not in table data field")))
 
 (defun org-table-blank-field ()
-  "Blank the current table field."
+  "Blank the current table field or active region."
   (interactive)
   (org-table-check-inside-data-field)
-  (skip-chars-backward "^|")
-  (backward-char 1)
-  (if (looking-at "|[^|]+")
-      (let* ((pos (match-beginning 0))
-             (match (match-string 0))
-             (len (length match)))
-        (replace-match (concat "|" (make-string (1- len) ?\ )))
-        (goto-char (+ 2 pos))
-        (substring match 1))))
+  (if (and (interactive-p) (org-region-active-p))
+      (let (org-table-clip)
+        (org-table-cut-region))
+    (skip-chars-backward "^|")
+    (backward-char 1)
+    (if (looking-at "|[^|]+")
+        (let* ((pos (match-beginning 0))
+               (match (match-string 0))
+               (len (length match)))
+          (replace-match (concat "|" (make-string (1- len) ?\ )))
+          (goto-char (+ 2 pos))
+          (substring match 1)))))
 
 (defun org-table-get-field (&optional n replace)
   "Return the value of the field in column N of current row.
@@ -5199,6 +5310,15 @@
     (org-table-goto-column colpos))
   (org-table-align))
 
+(defun org-table-move-column-right ()
+  "Move column to the right."
+  (interactive)
+  (org-table-move-column nil))
+(defun org-table-move-column-left ()
+  "Move column to the left."
+  (interactive)
+  (org-table-move-column 'left))
+
 (defun org-table-move-column (&optional left)
   "Move the current column to the right.  With arg LEFT, move to the left."
   (interactive "P")
@@ -5230,6 +5350,15 @@
     (org-table-goto-column colpos))
   (org-table-align))
 
+(defun org-table-move-row-down ()
+  "Move table row down."
+  (interactive)
+  (org-table-move-row nil))
+(defun org-table-move-row-up ()
+  "Move table row down."
+  (interactive)
+  (org-table-move-row 'up))
+
 (defun org-table-move-row (&optional up)
   "Move the current table line down. With arg UP, move it up."
   (interactive "P")
@@ -5263,11 +5392,12 @@
         (setq line (mapcar (lambda (x) (if (member x '(?| ?+)) ?| ?\ )) line))
       (setq line (mapcar (lambda (x) (if (equal x ?|) ?| ?\ )) line)))
     (beginning-of-line (if arg 2 1))
-    (apply 'insert line)
-    (insert "\n")
+    (let (org-table-may-need-update)
+      (apply 'insert-before-markers line)
+      (insert-before-markers "\n"))
     (beginning-of-line 0)
     (re-search-forward "| ?" (point-at-eol) t)
-    (org-table-align)))
+    (and org-table-may-need-update (org-table-align))))
 
 (defun org-table-insert-hline (&optional arg)
   "Insert a horizontal-line below the current line into the table.
@@ -5788,6 +5918,271 @@
         (setq ndown 0)))
     (org-table-align)))
 
+;;; The orgtbl minor mode
+
+;; Define a minor mode which can be used in other modes in order to
+;; integrate the org-mode table editor.
+
+;; This is really a hack, because the org-mode table editor uses several
+;; keys which normally belong to the major mode, for example the TAB and
+;; RET keys.  Here is how it works: The minor mode defines all the keys
+;; necessary to operate the table editor, but wraps the commands into a
+;; function which tests if the cursor is currently inside a table.  If that
+;; is the case, the table editor command is executed.  However, when any of
+;; those keys is used outside a table, the function uses `key-binding' to
+;; look up if the key has an associated command in another currently active
+;; keymap (minor modes, major mode, global), and executes that command.
+;; There might be problems if any of the keys used by the table editor is
+;; otherwise used as a prefix key.
+
+;; Another challenge is that the key binding for TAB can be tab or \C-i,
+;; likewise the binding for RET can be return or \C-m.  Orgtbl-mode
+;; addresses this by checking explicitly for both bindings.
+
+;; The optimized version (see variable `orgtbl-optimized') takes over
+;; all keys which are bound to `self-insert-command' in the *global map*.
+;; Some modes bind other commands to simple characters, for example
+;; AUCTeX binds the double quote to `Tex-insert-quote'.  With orgtbl-mode
+;; 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 iin arbitrary modes.")
+(make-variable-buffer-local 'orgtbl-mode)
+
+(defvar orgtbl-mode-map (make-sparse-keymap)
+  "Keymap for orgtbl-mode.")
+
+;;;###autoload
+(defun turn-on-orgtbl ()
+  "Unconditionally turn on orgtbl-mode."
+  (orgtbl-mode 1))
+
+;;;###autoload
+(defun orgtbl-mode (&optional arg)
+  "The org-mode table editor as a minor mode for use in other modes." 
+  (interactive) 
+  (setq orgtbl-mode
+        (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode)))
+  (if orgtbl-mode
+      (progn 
+        (set (make-local-variable (quote org-table-may-need-update)) t)
+        (make-local-hook (quote before-change-functions))
+        (add-hook 'before-change-functions 'org-before-change-function
+                  nil 'local)
+        (set (make-local-variable 'org-old-auto-fill-inhibit-regexp)
+             auto-fill-inhibit-regexp)
+        (set (make-local-variable 'auto-fill-inhibit-regexp)
+             (if auto-fill-inhibit-regexp 
+                 (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp)
+               "[ \t]*|"))
+        (easy-menu-add orgtbl-mode-menu)
+        (run-hooks (quote orgtbl-mode-hook)))
+    (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
+    (remove-hook 'before-change-functions 'org-before-change-function t)
+    (easy-menu-remove orgtbl-mode-menu)
+    (force-mode-line-update 'all)))
+
+;; Install it as a minor mode.
+(put 'orgtbl-mode :included t)
+(put 'orgtbl-mode :menu-tag "Org Table Mode")
+(add-minor-mode 'orgtbl-mode " OrgTbl" orgtbl-mode-map)
+
+(defun orgtbl-make-binding (fun &rest keys)
+  "Create a function for binding in the table minor mode."
+  (list 'lambda '(arg) '(interactive "p")
+        (list 'if
+              '(org-at-table-p)
+              (list 'call-interactively (list 'quote fun))
+              (list 'let '(orgtbl-mode)
+                    (list 'call-interactively
+                          (append '(or)
+                                  (mapcar (lambda (k)
+                                            (list 'key-binding k))
+                                          keys)
+                                  '('orgtbl-error)))))))
+
+(defun orgtbl-error ()
+  "Error when there is no default binding for a table key."
+  (interactive)
+  (error "This key is has no function outside tables"))
+
+;; Keybindings for the minor mode
+(let ((bindings
+       '(([(meta shift left)]  org-table-delete-column)
+         ([(meta left)]        org-table-move-column-left)
+         ([(meta right)]       org-table-move-column-right)
+         ([(meta shift right)] org-table-insert-column)
+         ([(meta shift up)]    org-table-kill-row)
+         ([(meta shift down)]  org-table-insert-row)
+         ([(meta up)]          org-table-move-row-up)
+         ([(meta down)]        org-table-move-row-down)
+         ("\C-c\C-w"           org-table-cut-region)
+         ("\C-c\M-w"           org-table-copy-region)
+         ("\C-c\C-y"           org-table-paste-rectangle)
+         ("\C-c-"              org-table-insert-hline)
+         ([(shift tab)]        org-table-previous-field)
+         ("\C-c\C-c"           org-table-align)
+         ([(return)]           org-table-next-row)
+         ([(shift return)]     org-table-copy-from-above)
+         ([(meta return)]      org-table-wrap-region)
+         ("\C-c\C-q"           org-table-wrap-region)
+         ("\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)))
+      elt key fun cmd)
+  (while (setq elt (pop bindings))
+    (setq key (car elt)
+          fun (nth 1 elt)
+          cmd (orgtbl-make-binding fun key))
+    (define-key orgtbl-mode-map key cmd)))
+
+;; Special treatment needed for TAB and RET
+;(define-key orgtbl-mode-map [(return)] 
+;  (orgtbl-make-binding 'org-table-next-row [(return)] "\C-m"))
+;(define-key orgtbl-mode-map "\C-m" 
+;  (orgtbl-make-binding 'org-table-next-row "\C-m" [(return)]))
+;(define-key orgtbl-mode-map [(tab)] 
+;  (orgtbl-make-binding 'org-table-next-field [(tab)] "\C-i"))
+;(define-key orgtbl-mode-map "\C-i"
+;  (orgtbl-make-binding 'org-table-next-field "\C-i" [(tab)]))
+
+(define-key orgtbl-mode-map [(return)] 
+  (orgtbl-make-binding 'orgtbl-ret [(return)] "\C-m"))
+(define-key orgtbl-mode-map "\C-m" 
+  (orgtbl-make-binding 'orgtbl-ret "\C-m" [(return)]))
+(define-key orgtbl-mode-map [(tab)] 
+  (orgtbl-make-binding 'orgtbl-tab [(tab)] "\C-i"))
+(define-key orgtbl-mode-map "\C-i"
+  (orgtbl-make-binding 'orgtbl-tab "\C-i" [(tab)]))
+
+(when orgtbl-optimized
+  ;; If the user wants maximum table support, we need to hijack
+  ;; some standard editing functions
+  (substitute-key-definition 'self-insert-command 'orgtbl-self-insert-command
+                             orgtbl-mode-map global-map)
+  (substitute-key-definition 'delete-char 'orgtbl-delete-char
+                             orgtbl-mode-map global-map)
+  (substitute-key-definition 'delete-backward-char 'orgtbl-delete-backward-char
+                             orgtbl-mode-map global-map)
+  (define-key org-mode-map "|" 'self-insert-command))
+
+(defun orgtbl-tab ()
+  "Justification and field motion for orgtbl-mode."
+  (interactive)
+  (org-table-justify-field-maybe)
+  (org-table-next-field))
+
+(defun orgtbl-ret ()
+  "Justification and field motion for orgtbl-mode."
+  (interactive)
+  (org-table-justify-field-maybe)
+  (org-table-next-row))
+
+(defun orgtbl-self-insert-command (N)
+  "Like `self-insert-command', use overwrite-mode for whitespace in tables.
+If the cursor is in a table looking at whitespace, the whitespace is
+overwritten, and the table is not marked as requiring realignment."
+  (interactive "p")
+  (if (and (org-at-table-p)
+           (eq N 1)
+           (looking-at "[^|\n]*  +|"))
+      (let (org-table-may-need-update (pos (point)))
+        (goto-char (1- (match-end 0)))
+        (delete-backward-char 1)
+        (goto-char (match-beginning 0))
+        (self-insert-command N))
+    (setq org-table-may-need-update t)
+    (let (orgtbl-mode)
+      (call-interactively (key-binding (vector last-input-event))))))
+
+(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)
+           (looking-at ".*?|"))
+      (let ((pos (point)))
+        (backward-delete-char N)
+        (skip-chars-forward "^|")
+        (insert " ")
+        (goto-char (1- pos)))
+    (message "%s" last-input-event) (sit-for 1)
+    (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)
+           (eq N 1))
+      (if (looking-at ".*?|")
+          (let ((pos (point)))
+            (replace-match (concat
+                            (substring (match-string 0) 1 -1)
+                            " |"))
+            (goto-char pos)))
+    (delete-char N)))
+
+(easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu"
+  '("Tbl"
+    ["Align" org-ctrl-c-ctrl-c :active (org-at-table-p) :keys "C-c C-c"]
+    ["Next field" org-cycle :active (org-at-table-p) :keys "TAB"]
+    ["Previous Field" org-shifttab :active (org-at-table-p) :keys "S-TAB"]
+    ["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"]
+    ["Copy field from above"
+     org-table-copy-from-above :active (org-at-table-p) :keys "S-RET"]
+    "--"
+    ("Column"
+     ["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>"])
+    ("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>"]
+     ["Delete row" org-shiftmetaup :active (org-at-table-p) :keys "M-S-<up>"]
+     ["Insert row" org-shiftmetadown :active (org-at-table-p) :keys "M-S-<down>"]
+     "--"
+     ["Insert hline" org-table-insert-hline :active (org-at-table-p) :keys "C-c -"])
+    ("Rectangle"
+     ["Copy rectangle" org-copy-special :active (org-at-table-p) :keys "C-c M-w"]
+     ["Cut rectangle" org-cut-special :active (org-at-table-p) :keys "C-c C-w"]
+     ["Paste rectangle" org-paste-special :active (org-at-table-p) :keys "C-c C-y"]
+     ["Fill rectangle" org-table-wrap-region :active (org-at-table-p) :keys "C-c C-q"])
+    "--"
+    ["Which column?" org-table-current-column :active (org-at-table-p) :keys "C-c ?"]
+    ["Sum column/rectangle" org-table-sum 
+     :active (or (org-at-table-p) (org-region-active-p)) :keys "C-c +"]
+    ["Eval formula" org-table-eval-formula :active (org-at-table-p) :keys "C-c ="]
+    ))
+
 ;;; Exporting
 
 (defconst org-level-max 20)
@@ -6300,6 +6695,7 @@
 #+CATEGORY:  %s
 #+SEQ_TODO:  %s
 #+TYP_TODO:  %s
+#+STARTUP:   %s %s
 "
    (buffer-name) (user-full-name) user-mail-address org-export-default-language
    org-export-headline-levels
@@ -6318,7 +6714,10 @@
      "TODO FEEDBACK VERIFY DONE")
    (if (equal org-todo-interpretation 'type)
        (mapconcat 'identity org-todo-keywords " ")
-     "Me Jason Marie DONE")))
+     "Me Jason Marie DONE")
+   (if org-startup-folded "fold" "nofold")
+   (if org-startup-with-deadline-check "dlcheck" "nodlcheck")
+   ))
 
 (defun org-insert-export-options-template ()
   "Insert into the buffer a template with information for exporting."
@@ -7025,6 +7424,7 @@
 (define-key org-mode-map "\C-c\C-c"       'org-ctrl-c-ctrl-c)
 (define-key org-mode-map [(return)]       'org-return)
 (define-key org-mode-map [(shift return)] 'org-table-copy-from-above)
+(define-key org-mode-map [(meta return)]  'org-meta-return)
 (define-key org-mode-map [(control up)]   'org-move-line-up)
 (define-key org-mode-map [(control down)] 'org-move-line-down)
 (define-key org-mode-map "\C-c?"          'org-table-current-column)
@@ -7041,6 +7441,105 @@
 (define-key org-mode-map "\C-c\C-xh"      'org-export-as-html)
 (define-key org-mode-map "\C-c\C-x\C-h"   'org-export-as-html-and-open)
 
+
+;; FIXME:  Do we really need to save match data in these commands?
+;; I would like to remove it in order to minimize impact.
+;; Self-insert already does not preserve it.  How much resources does this take???
+
+(defsubst org-table-p ()
+  (if (and (eq major-mode 'org-mode) font-lock-mode)
+      (eq (get-text-property (point) 'face) 'org-table-face)
+    (save-match-data (org-at-table-p))))
+
+(defun org-self-insert-command (N)
+  "Like `self-insert-command', use overwrite-mode for whitespace in tables.
+If the cursor is in a table looking at whitespace, the whitespace is
+overwritten, and the table is not marked as requiring realignment."
+  (interactive "p")
+  (if (and (org-table-p)
+           (eq N 1)
+           (looking-at "[^|\n]*  +|"))
+      (let (org-table-may-need-update (pos (point)))
+        (goto-char (1- (match-end 0)))
+        (delete-backward-char 1)
+        (goto-char (match-beginning 0))
+        (self-insert-command N))
+    (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.  Right now they raise the flag each time
+;; (through before-change-functions).  Here is how this could be minimized:
+;; Basically, check if the non-white field width before deletion is
+;; equal to the column width.  If yes, the delete should trigger a
+;; re-align.  I have not implemented this so far because it is not so
+;; easy, requires grabbing the field etc.  So it may finally have some
+;; impact on typing performance which we don't want.
+
+;; The defsubst is only a draft, untested...
+
+;; Maybe it is not so important to get rid of realigns - maybe the most
+;; important aspect is to keep the table look noce as long as possible,
+;; which is already achieved...
+
+;(defsubst org-check-delete-triggers-realign ()
+;  (let ((pos (point)))
+;    (skip-chars-backward "^|\n")
+;    (and (looking-at " *\\(.*?\\) *|")
+;         (= (nth (1- (org-table-current-column))
+;                 org-table-last-column-widths)
+;            (- (match-end 1) (match-beginning 1)))
+;         (setq org-table-may-need-update t))))
+
+(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."
+  (interactive "p")
+  (if (and (org-table-p)
+           (eq N 1)
+           (looking-at ".*?|"))
+      (let ((pos (point)))
+        (backward-delete-char N)
+        (skip-chars-forward "^|")
+        (insert " ")
+        (goto-char (1- pos)))
+    (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."
+  (interactive "p")
+  (if (and (org-table-p)
+           (eq N 1))
+      (if (looking-at ".*?|")
+          (let ((pos (point)))
+            (replace-match (concat
+                            (substring (match-string 0) 1 -1)
+                            " |"))
+            (goto-char pos)))
+    (delete-char N)))
+
+;; How to do this: Measure non-white length of current string
+;; If equal to column width, we should realign.
+
+(when (eq org-enable-table-editor 'optimized)
+  ;; If the user wants maximum table support, we need to hijack
+  ;; some standard editing functions
+  (substitute-key-definition 'self-insert-command 'org-self-insert-command
+                             org-mode-map global-map)
+  (substitute-key-definition 'delete-char 'org-delete-char
+                             org-mode-map global-map)
+  (substitute-key-definition 'delete-backward-char 'org-delete-backward-char
+                             org-mode-map global-map)
+  (define-key org-mode-map "|" 'self-insert-command))
+
 (defun org-shiftcursor-error ()
   "Throw an error because Shift-Cursor command was applied in wrong context."
   (error "This command is only active in tables and on headlines."))
@@ -7173,9 +7672,18 @@
   "Call `org-table-next-row' or `newline'."
   (interactive "P")
   (cond
-   ((org-at-table-p) (org-table-next-row))
+   ((org-at-table-p)
+    (org-table-justify-field-maybe)
+    (org-table-next-row))
    (t (newline))))
 
+(defun org-meta-return (&optional arg)
+  "Call `org-insert-heading' or `org-table-wrap-region'."
+  (interactive "P")
+  (cond
+   ((org-at-table-p)
+    (org-table-wrap-region arg))
+   (t (org-insert-heading arg))))
 
 ;;; Menu entries
 
@@ -7245,7 +7753,7 @@
      ["Check Deadlines this file" org-check-deadlines t]
      ["Timeline current file" org-timeline t]
      "--"
-     ["Adenda (multifile)" org-agenda-overview t])
+     ["Adenda (multifile)" org-agenda t])
     ("File List for Agenda")
     "--"
     ("Hyperlinks"
@@ -7586,6 +8094,7 @@
 
 (run-hooks 'org-load-hook)
 
+;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
+
 ;;; org.el ends here
 
-;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
--- a/lisp/textmodes/reftex-auc.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/reftex-auc.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,8 +1,8 @@
 ;;; reftex-auc.el --- RefTeX's interface to AUCTeX
-;; Copyright (c) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.21
+;; Version: 4.26
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/textmodes/reftex-cite.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/reftex-cite.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,8 +1,8 @@
 ;;; reftex-cite.el --- creating citations with RefTeX
-;; Copyright (c) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.21
+;; Version: 4.26
 
 ;; This file is part of GNU Emacs.
 
@@ -49,11 +49,11 @@
  TAB        Enter citation key with completion.
  RET        Accept current entry (also on mouse-2) and create \\cite macro.
  m / u      Mark/Unmark the entry.
+ e / E      Create BibTeX file with all (marked/unmarked) entries
  a / A      Put all (marked) entries into one/many \\cite commands.")
 
 ;; Find bibtex files
 
-
 (defmacro reftex-with-special-syntax-for-bib (&rest body)
   `(let ((saved-syntax (syntax-table)))
      (unwind-protect
@@ -311,8 +311,8 @@
       (not (stringp (car al1))))))
 
 (defun reftex-bib-sort-year (e1 e2)
-  (< (string-to-int (cdr (assoc "year" e1)))
-     (string-to-int (cdr (assoc "year" e2)))))
+  (< (string-to-int (or (cdr (assoc "year" e1)) "0"))
+     (string-to-int (or (cdr (assoc "year" e2)) "0"))))
 
 (defun reftex-bib-sort-year-reverse (e1 e2)
   (> (string-to-int (or (cdr (assoc "year" e1)) "0"))
@@ -597,12 +597,13 @@
 
 If NO-INSERT is non-nil, nothing is inserted, only the selected key returned.
 
-FORAT-KEY can be used to pre-select a citation format.
+FORMAT-KEY can be used to pre-select a citation format.
 
-When called with one or two `C-u' prefixes, first rescans the document.
-When called with a numeric prefix, make that many citations.  When
-called with point inside the braces of a `\\cite' command, it will
-add another key, ignoring the value of `reftex-cite-format'.
+When called with a `C-u' prefix, prompt for optional arguments in
+cite macros.  When called with a numeric prefix, make that many
+citations.  When called with point inside the braces of a `\\cite'
+command, it will add another key, ignoring the value of
+`reftex-cite-format'.
 
 The regular expression uses an expanded syntax: && is interpreted as `and'.
 Thus, `aaaa&&bbb' matches entries which contain both `aaaa' and `bbb'.
@@ -618,7 +619,7 @@
   ;; Thus look for the scanning info only if in reftex-mode.
 
   (when reftex-mode
-    (reftex-access-scan-info current-prefix-arg))
+    (reftex-access-scan-info nil))
 
   ;; Call reftex-do-citation, but protected
   (unwind-protect
@@ -629,11 +630,14 @@
   ;; This really does the work of reftex-citation.
 
   (let* ((format (reftex-figure-out-cite-format arg no-insert format-key))
+         (start 0)
          (docstruct-symbol reftex-docstruct-symbol)
          (selected-entries (reftex-offer-bib-menu))
          (insert-entries selected-entries)
          entry string cite-view)
 
+    (when (stringp selected-entries)
+      (error selected-entries))
     (unless selected-entries (error "Quit"))
 
     (if (stringp selected-entries)
@@ -646,6 +650,7 @@
 
     (when (eq (car selected-entries) 'concat)
       ;; All keys go into a single command - we need to trick a little
+      ;; FIXME: Unfortunately, this meens that commenting does not work right.
       (pop selected-entries)
       (let ((concat-keys (mapconcat 'car selected-entries ",")))
         (setq insert-entries 
@@ -663,6 +668,24 @@
                                   (reftex-get-bib-field "&key" entry)
                                   format)
                        (reftex-format-citation entry format)))
+        (when (or (eq reftex-cite-prompt-optional-args t)
+                  (and reftex-cite-prompt-optional-args
+                       (equal arg '(4))))
+          (let ((start 0) (nth 0) value)
+            (while (setq start (string-match "\\[\\]" string start))
+              (setq value (read-string (format "Optional argument %d: "
+                                               (setq nth (1+ nth)))))
+              (setq string (replace-match (concat "[" value "]") t t string))
+              (setq start (1+ start)))))
+        ;; Should we cleanup empty optional arguments?
+        ;; if the first is empty, it can be removed.  If the second is empty,
+        ;; it has to go.
+        (when reftex-cite-cleanup-optional-args
+          (cond 
+           ((string-match "\\[\\]\\(\\[[a-zA-Z0-9., ]+\\]\\)" string)
+            (setq string (replace-match "\\1" nil nil string)))
+           ((string-match "\\[\\]\\[\\]" string)
+            (setq string (replace-match "" t t string)))))
         (insert string))
 
       ;; Reposition cursor?
@@ -842,6 +865,17 @@
                                 (mapcar 'car (nreverse reftex-select-marked))
                               found-list)))
                 (throw 'done t))
+               ((eq key ?e)
+                ;; Take all (marked), and push the symbol 'concat
+                (reftex-extract-bib-file found-list reftex-select-marked)
+                (setq selected-entries "BibTeX database file created")
+                (throw 'done t))
+               ((eq key ?E)
+                ;; Take all (marked), and push the symbol 'concat
+                (reftex-extract-bib-file found-list reftex-select-marked
+                                         'complement)
+                (setq selected-entries "BibTeX database file created")
+                (throw 'done t))
                ((or (eq key ?\C-m)
                     (eq key 'return))
                 ;; Take selected
@@ -882,6 +916,29 @@
       (ding)
       found-list)))
 
+(defun reftex-extract-bib-file (all &optional marked complement)
+  ;; Limit FOUND-LIST with more regular expressions
+  (let ((file (read-file-name "File to create: ")))
+    (find-file-other-window file)
+    (if (> (buffer-size) 0)
+        (unless (yes-or-no-p 
+                 (format "Overwrite non-empty file %s? " file))
+          (error "Abort")))
+    (erase-buffer)
+    (setq all (delq nil
+                    (mapcar
+                     (lambda (x)
+                       (if marked
+                           (if (or (and (assoc x marked) (not complement))
+                                   (and (not (assoc x marked)) complement))
+                               (cdr (assoc "&entry" x))
+                             nil)
+                         (cdr (assoc "&entry" x))))
+                     all)))
+    (insert (mapconcat 'identity all "\n\n"))
+    (save-buffer)
+    (goto-char (point-min))))
+
 (defun reftex-insert-bib-matches (list)
   ;; Insert the bib matches and number them correctly
   (let ((mouse-face
@@ -1043,5 +1100,73 @@
       
     (select-window win)))
 
+;;; Global BibTeX file
+(defun reftex-all-used-citation-keys ()
+  (reftex-access-scan-info)
+  (let ((files (reftex-all-document-files)) file keys kkk kk k)
+    (save-excursion
+      (while (setq file (pop files))
+        (set-buffer (reftex-get-file-buffer-force file 'mark))
+        (save-excursion
+          (save-restriction
+            (widen)
+            (goto-char (point-min))
+            (while (re-search-forward "^[^%\n\r]*\\\\\\(bibentry\\|[a-zA-Z]*cite[a-zA-Z]*\\)\\(\\[[^\\]]*\\]\\)?{\\([^}]+\\)}" nil t)
+              (setq kk (match-string-no-properties 3))
+              (while (string-match "%.*\n?" kk)
+                (setq kk (replace-match "" t t kk)))
+              (setq kk (split-string kk "[, \t\r\n]+"))
+              (while (setq k (pop kk))
+                (or (member k keys)
+                    (setq keys (cons k keys)))))))))
+    (reftex-kill-temporary-buffers)
+    keys))
+
+(defun reftex-create-bibtex-file (bibfile)
+  "Create a new BibTeX database file with all entries referenced in document.
+The command prompts for a filename and writes the collected entries to
+that file.  Only entries referenced in the current document with
+any \\cite-like macros are used. 
+The sequence in the new file is the same as it was in the old database."
+  (interactive "FNew BibTeX file: ")
+  (let ((keys (reftex-all-used-citation-keys))
+        (files (reftex-get-bibfile-list))
+        file key entries beg end entry)
+    (save-excursion
+      (while (setq file (pop files))
+        (set-buffer (reftex-get-file-buffer-force file 'mark))
+        (reftex-with-special-syntax-for-bib
+         (save-excursion
+           (save-restriction
+             (widen)
+             (goto-char (point-min))
+             (while (re-search-forward 
+                     "^[ \t]*@[a-zA-Z]+[ \t]*{\\([^ \t\r\n]+\\),"
+                     nil t)
+               (setq key (match-string 1)
+                     beg (match-beginning 0)
+                     end (progn
+                           (goto-char (match-beginning 1))
+                           (condition-case nil
+                               (up-list 1)
+                             (error (goto-char (match-end 0))))
+                           (point)))
+               (when (member key keys)
+                 (setq entry (buffer-substring beg end)
+                       entries (cons entry entries)
+                       keys (delete key keys)))))))))
+    (find-file-other-window bibfile)
+    (if (> (buffer-size) 0)
+        (unless (yes-or-no-p 
+                 (format "Overwrite non-empty file %s? " bibfile))
+          (error "Abort")))
+    (erase-buffer)
+    (insert (mapconcat 'identity (reverse entries) "\n\n"))
+    (goto-char (point-min))
+    (save-buffer)
+    (message "%d entries extracted and copied to new database"
+             (length entries))))
+
+
 ;;; arch-tag: d53d0a5a-ab32-4b52-a846-2a7c3527cd89
 ;;; reftex-cite.el ends here
--- a/lisp/textmodes/reftex-dcr.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/reftex-dcr.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,8 +1,8 @@
 ;;; reftex-dcr.el --- viewing cross references and citations with RefTeX
-;; Copyright (c) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.21
+;; Version: 4.26
 ;;
 
 ;; This file is part of GNU Emacs.
--- a/lisp/textmodes/reftex-global.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/reftex-global.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,8 +1,8 @@
 ;;; reftex-global.el --- operations on entire documents with RefTeX
-;; Copyright (c) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.21
+;; Version: 4.26
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/textmodes/reftex-index.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/reftex-index.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,8 +1,8 @@
 ;;; reftex-index.el --- index support with RefTeX
-;; Copyright (c) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.21
+;; Version: 4.26
 
 ;; This file is part of GNU Emacs.
 
@@ -360,7 +360,7 @@
       (reftex-highlight 0 (match-beginning 0) (match-end 0) (current-buffer)))
     match))
 
-(defun reftex-display-index (&optional tag overriding-restriction
+(defun reftex-display-index (&optional tag overriding-restriction redo
                                        &rest locations)
   "Display a buffer with an index compiled from the current document.
 When the document has multiple indices, first prompts for the correct one.
@@ -387,7 +387,7 @@
          (calling-file (buffer-file-name))
          (restriction
           (or overriding-restriction
-              (and (interactive-p) 
+              (and (not redo) 
                    (reftex-get-restriction current-prefix-arg docstruct))))
          (locations
           ;; See if we are on an index macro as initial position
@@ -427,7 +427,7 @@
     (if restriction
         (setq reftex-index-restriction-indicator (car restriction)
               reftex-index-restriction-data (cdr restriction))
-      (if (interactive-p)
+      (if (not redo)
           (setq reftex-index-restriction-indicator nil
                 reftex-index-restriction-data nil)))
     (when (= (buffer-size) 0)
@@ -703,7 +703,7 @@
               (error "Don't know which file to rescan.  Try `C-u r'")
             (switch-to-buffer (reftex-get-file-buffer-force file))
             (setq current-prefix-arg '(4))
-            (reftex-display-index index-tag nil line)))
+            (reftex-display-index index-tag nil 'redo line)))
       (reftex-index-Rescan))
     (reftex-kill-temporary-buffers)))
 (defun reftex-index-Rescan (&rest ignore)
@@ -714,7 +714,7 @@
     (switch-to-buffer
      (reftex-get-file-buffer-force reftex-last-index-file))
     (setq current-prefix-arg '(16))
-    (reftex-display-index index-tag nil line)))
+    (reftex-display-index index-tag nil 'redo line)))
 (defun reftex-index-revert (&rest ignore)
   "Regenerate the *Index* from the internal lists.  No reparsing os done."
   (interactive)
@@ -727,14 +727,14 @@
     (reftex-erase-buffer buf)
     (setq current-prefix-arg nil
           reftex-last-follow-point 1)
-    (reftex-display-index index-tag nil data line)))
+    (reftex-display-index index-tag nil 'redo data line)))
 (defun reftex-index-switch-index-tag (&rest ignore)
   "Switch to a different index of the same document."
   (interactive)
   (switch-to-buffer
    (reftex-get-file-buffer-force reftex-last-index-file))
   (setq current-prefix-arg nil)
-  (reftex-display-index))
+  (reftex-display-index nil nil 'redo))
 
 (defun reftex-index-restrict-to-section (&optional force)
   "Restrict index to entries defined in same document sect. as entry at point."
@@ -1352,23 +1352,23 @@
     (if (re-search-forward reftex-index-phrases-phrase-regexp12 nil t)
         (progn
           (goto-char (match-beginning 0))
-          (reftex-index-this-phrase))
+          (reftex-index-this-phrase 'slave))
       (error "No more phrase lines after point"))))
 
-(defun reftex-index-this-phrase ()
+(defun reftex-index-this-phrase (&optional slave)
   "Index the phrase in the current line.
 Does a global search and replace in the entire document.  At each
 match, the user will be asked to confirm the replacement."
   (interactive)
-  (if (interactive-p) (reftex-index-phrases-parse-header t))
+  (if (not slave) (reftex-index-phrases-parse-header t))
   (save-excursion
     (beginning-of-line)
     (cond ((looking-at reftex-index-phrases-comment-regexp)
-           (if (interactive-p) (error "Comment line")))
+           (if (not slave) (error "Comment line")))
           ((looking-at "^[ \t]*$")
-           (if (interactive-p) (error "Empty line")))
+           (if (not slave) (error "Empty line")))
           ((looking-at reftex-index-phrases-macrodef-regexp)
-           (if (interactive-p) (error "Macro definition line")))
+           (if (not slave) (error "Macro definition line")))
           ((looking-at reftex-index-phrases-phrase-regexp12)
            ;; This is a phrase
            (let* ((char (if (not (equal (match-string 1) ""))
@@ -1429,7 +1429,7 @@
   (goto-char beg)
   (while (not (or (eobp)
                   (>= (point) end)))
-    (save-excursion (reftex-index-this-phrase))
+    (save-excursion (reftex-index-this-phrase 'slave))
     (beginning-of-line 2)))
 
 (defun reftex-index-phrases-parse-header (&optional get-files)
@@ -1736,12 +1736,15 @@
                        "\\([ \t]*\\(\n[ \t]*\\)?\\|[ \t]\\)"
                      "\\([ \t]+\\)")))
     (concat (if (and as-words (string-match "\\`\\w" (car words)))
-                "\\<" "")
-            (mapconcat (lambda (w) (regexp-quote (downcase w)))
+                "\\(\\<\\|[`']\\)" "")
+            (mapconcat (lambda (w) (regexp-quote 
+                                    (if reftex-index-phrases-case-fold-search
+                                        (downcase w)
+                                      w)))
                        words space-re)
             (if (and as-words 
                      (string-match "\\w\\'" (nth (1- (length words)) words)))
-                "\\>" ""))))
+                "\\(\\>\\|'\\)" ""))))
 
 (defun reftex-index-simplify-phrase (phrase)
   "Make phrase single spaces and single line."
@@ -1825,6 +1828,8 @@
     (unwind-protect
         (while (re-search-forward re nil t)
           (catch 'next-match
+            (if (reftex-in-comment)
+                (throw 'next-match nil))
             (if (and (fboundp reftex-index-verify-function)
                      (not (funcall reftex-index-verify-function)))
                 (throw 'next-match nil))
@@ -1925,7 +1930,7 @@
       (reftex-unhighlight 0))))
 
 (defun reftex-index-phrase-match-is-indexed (beg end)
-  ;; CHeck if match is in an argument of an index macro, or if an
+  ;; Check if match is in an argument of an index macro, or if an
   ;; index macro is directly attached to the match.
   (save-excursion
     (goto-char end)
--- a/lisp/textmodes/reftex-parse.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/reftex-parse.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,8 +1,8 @@
 ;;; reftex-parse.el --- parser functions for RefTeX
-;; Copyright (c) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.21
+;; Version: 4.26
 ;;
 
 ;; This file is part of GNU Emacs.
--- a/lisp/textmodes/reftex-ref.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/reftex-ref.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,8 +1,8 @@
 ;;; reftex-ref.el --- code to create labels and references with RefTeX
-;; Copyright (c) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.21
+;; Version: 4.26
 
 ;; This file is part of GNU Emacs.
 
@@ -96,14 +96,27 @@
 
 (defun reftex-label-info (label &optional file bound derive env-or-mac)
   ;; Return info list on LABEL at point.
-  (let* ((env-or-mac (or env-or-mac (reftex-label-location bound)))
-         (typekey (nth 1 (assoc env-or-mac reftex-env-or-mac-alist)))
+  (let* ((prefix (if (string-match "^[a-zA-Z0-9]+:" label)
+                     (match-string 0 label)))
+         (typekey (cdr (assoc prefix reftex-prefix-to-typekey-alist)))
          (file (or file (buffer-file-name)))
-         (parse (nth 2 (assoc env-or-mac reftex-env-or-mac-alist)))
-         (text (reftex-short-context env-or-mac parse reftex-location-start
-                                     derive))
+         (trust reftex-trust-label-prefix)
          (in-comment (reftex-in-comment)))
-    (list label typekey text file in-comment)))
+    (if (and typekey
+             (cond ((eq trust t) t)
+                   ((null trust) nil)
+                   ((stringp trust) (string-match trust typekey))
+                   ((listp trust) (member typekey trust))
+                   (t nil)))
+        (list label typekey
+              (reftex-nicify-text (reftex-context-substring))
+              file in-comment)
+      (let* ((env-or-mac (or env-or-mac (reftex-label-location bound)))
+             (typekey (nth 1 (assoc env-or-mac reftex-env-or-mac-alist)))
+             (parse (nth 2 (assoc env-or-mac reftex-env-or-mac-alist)))
+             (text (reftex-short-context env-or-mac parse reftex-location-start
+                                         derive)))
+        (list label typekey text file in-comment)))))
 
 ;;; Creating labels ---------------------------------------------------------
 
@@ -296,35 +309,43 @@
       (while (string-match "\\%\\([a-zA-Z]\\)" prefix num)
         (setq letter (match-string 1 prefix))
         (setq replace
-              (cond
-               ((equal letter "f")
-                (file-name-sans-extension
-                 (file-name-nondirectory (buffer-file-name))))
-               ((equal letter "F")
-                (let ((masterdir (file-name-directory (reftex-TeX-master-file)))
-                      (file (file-name-sans-extension (buffer-file-name))))
-                  (if (string-match (concat "\\`" (regexp-quote masterdir))
-                                    file)
-                      (substring file (length masterdir))
-                    file)))
-               ((equal letter "u")
-                (or (user-login-name) ""))
-               ((equal letter "S")
-                (let* (macro level-exp level)
-                  (save-excursion
-                    (save-match-data
-                      (when (re-search-backward reftex-section-regexp nil t)
-                        (setq macro (reftex-match-string 2)
-                              level-exp (cdr (assoc macro reftex-section-levels-all))
-                              level (if (symbolp level-exp)
-                                        (abs (save-match-data
-                                               (funcall level-exp)))
-                                      (abs level-exp))))
-                      (cdr (or (assoc macro reftex-section-prefixes)
-                               (assoc level reftex-section-prefixes)
-                               (assq t reftex-section-prefixes)
-                               (list t "sec:")))))))
-               (t "")))
+              (save-match-data
+                (cond
+                 ((equal letter "f")
+                  (file-name-sans-extension
+                   (file-name-nondirectory (buffer-file-name))))
+                 ((equal letter "F")
+                  (let ((masterdir (file-name-directory (reftex-TeX-master-file)))
+                        (file (file-name-sans-extension (buffer-file-name))))
+                    (if (string-match (concat "\\`" (regexp-quote masterdir))
+                                      file)
+                        (substring file (length masterdir))
+                      file)))
+                 ((equal letter "m")
+                  (file-name-sans-extension
+                   (file-name-nondirectory (reftex-TeX-master-file))))
+                 ((equal letter "M")
+                  (file-name-nondirectory
+                   (substring (file-name-directory (reftex-TeX-master-file))
+                              0 -1)))
+                 ((equal letter "u")
+                  (or (user-login-name) ""))
+                 ((equal letter "S")
+                  (let* (macro level-exp level)
+                    (save-excursion
+                      (save-match-data
+                        (when (re-search-backward reftex-section-regexp nil t)
+                          (setq macro (reftex-match-string 2)
+                                level-exp (cdr (assoc macro reftex-section-levels-all))
+                                level (if (symbolp level-exp)
+                                          (abs (save-match-data
+                                                 (funcall level-exp)))
+                                        (abs level-exp))))
+                        (cdr (or (assoc macro reftex-section-prefixes)
+                                 (assoc level reftex-section-prefixes)
+                                 (assq t reftex-section-prefixes)
+                                 (list t "sec:")))))))
+                 (t ""))))
         (setq num (1- (+ (match-beginning 1) (length replace)))
               prefix (replace-match replace nil nil prefix)))
       prefix)))
@@ -449,7 +470,7 @@
 
         ;; remove ~ if we do already have a space
         (when (and (= ?~ (string-to-char form))
-                   (member (preceding-char) '(?\ ?\t ?\n ?. ?~)))
+                   (member (preceding-char) '(?\ ?\t ?\n ?~)))
           (setq form (substring form 1)))
         ;; do we have a special format?
         (setq reftex-format-ref-function
--- a/lisp/textmodes/reftex-sel.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/reftex-sel.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,8 +1,8 @@
 ;;; reftex-sel.el --- the selection modes for RefTeX
-;; Copyright (c) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.21
+;; Version: 4.26
 
 ;; This file is part of GNU Emacs.
 
@@ -607,13 +607,11 @@
     (setq ovl (make-overlay boe eoe))
     (push (list data ovl separator) reftex-select-marked)
     (overlay-put ovl 'face reftex-select-mark-face)
-    (if (featurep 'xemacs)
-        ;; before-string property is broken in Emacs
-        (overlay-put ovl 'before-string
-                     (if separator
-                         (format "*%c%d* " separator
-                                 (length reftex-select-marked))
-                       (format "*%d*  " (length reftex-select-marked)))))
+    (overlay-put ovl 'before-string
+                 (if separator
+                     (format "*%c%d* " separator
+                             (length reftex-select-marked))
+                   (format "*%d*  " (length reftex-select-marked))))
     (message "Entry has mark no. %d" (length reftex-select-marked))))
 
 (defun reftex-select-mark-comma ()
@@ -725,7 +723,7 @@
       (define-key reftex-select-label-map (car x) (cdr x)))
 
 ;; Specific bindings in reftex-select-bib-map
-(loop for key across "grRaA" do
+(loop for key across "grRaAeE" do
       (define-key reftex-select-bib-map (vector (list key))
         (list 'lambda '() 
               "Press `?' during selection to find out about this key."
--- a/lisp/textmodes/reftex-toc.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/reftex-toc.el	Sun Jan 16 03:40:12 2005 +0000
@@ -2,7 +2,7 @@
 ;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.21
+;; Version: 4.26
 
 ;; This file is part of GNU Emacs.
 
@@ -868,6 +868,7 @@
            ((and (markerp marker) (marker-buffer marker))
             ;; Buffer is still live and we have the marker.  Should be easy.
             (switch-to-buffer-other-window (marker-buffer marker))
+            (push-mark nil)
             (goto-char (marker-position marker))
             (or (looking-at (regexp-quote literal))
                 (looking-at (reftex-make-regexp-allow-for-ctrl-m literal))
@@ -1088,4 +1089,4 @@
 
 
 ;;; arch-tag: 92400ce2-0b86-4c89-a606-4ed71acea17e
-;;; reftex-toc.el ends here
\ No newline at end of file
+;;; reftex-toc.el ends here
--- a/lisp/textmodes/reftex-vars.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/reftex-vars.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,8 +1,8 @@
 ;;; reftex-vars.el --- configuration variables for RefTeX
-;; Copyright (c) 1997, 1998, 1999, 2003 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.21
+;; Version: 4.26
 
 ;; This file is part of GNU Emacs.
 
@@ -128,13 +128,13 @@
 
 (defconst reftex-cite-format-builtin
   '((default "Default macro \\cite{%l}"
-      "\\cite{%l}")
+      "\\cite[]{%l}")
     (natbib "The Natbib package"
-     ((?\C-m . "\\cite{%l}")
-      (?t    . "\\citet{%l}")
-      (?T    . "\\citet*{%l}")
-      (?p    . "\\citep{%l}")
-      (?P    . "\\citep*{%l}")
+     ((?\C-m . "\\cite[][]{%l}")
+      (?t    . "\\citet[][]{%l}")
+      (?T    . "\\citet*[][]{%l}")
+      (?p    . "\\citep[][]{%l}")
+      (?P    . "\\citep*[][]{%l}")
       (?e    . "\\citep[e.g.][]{%l}")
       (?s    . "\\citep[see][]{%l}")
       (?a    . "\\citeauthor{%l}")
@@ -157,8 +157,8 @@
     (bibentry "The Bibentry package"
       "\\bibentry{%l}")
     (harvard "The Harvard package"
-     ((?\C-m . "\\cite{%l}")
-      (?p    . "\\cite{%l}")
+     ((?\C-m . "\\cite[]{%l}")
+      (?p    . "\\cite[]{%l}")
       (?t    . "\\citeasnoun{%l}")
       (?n    . "\\citeasnoun{%l}")
       (?s    . "\\possessivecite{%l}")
@@ -166,17 +166,17 @@
       (?y    . "\\citeyear{%l}")
       (?a    . "\\citename{%l}")))
     (chicago "The Chicago package"
-     ((?\C-m . "\\cite{%l}")
-      (?t    . "\\citeN{%l}")
+     ((?\C-m . "\\cite[]{%l}")
+      (?t    . "\\citeN[]{%l}")
       (?T    . "\\shortciteN{%l}")
-      (?p    . "\\cite{%l}")
+      (?p    . "\\cite[]{%l}")
       (?P    . "\\shortcite{%l}")
       (?a    . "\\citeA{%l}")
       (?A    . "\\shortciteA{%l}")
       (?y    . "\\citeyear{%l}")))
     (astron "The Astron package"
-     ((?\C-m . "\\cite{%l}")
-      (?p    . "\\cite{%l}" )
+     ((?\C-m . "\\cite[]{%l}")
+      (?p    . "\\cite[]{%l}" )
       (?t    . "%2a (\\cite{%l})")))
     (author-year "Do-it-yourself Author-year"
      ((?\C-m . "\\cite{%l}")
@@ -484,6 +484,8 @@
     empty string.  The prefix may contain the following `%' escapes:
        %f   Current file name with directory and extension stripped.
        %F   Current file name relative to directory of master file.
+       %m   Master file name, directory and extension stripped.
+       %M   Directory name (without path) where master file is located.
        %u   User login name, on systems which support this.
        %S   A section prefix derived with variable `reftex-section-prefixes'.
 
@@ -631,6 +633,43 @@
 or macro."
   :group 'reftex-defining-label-environments
   :type '(repeat (cons (symbol) (regexp))))
+
+(defcustom reftex-trust-label-prefix nil
+  "Non-nil means, trust the label prefix when determining label type.
+It is customary to use special label prefixes to distinguish different label
+types.  The label prefixes have no syntactic meaning in LaTeX (unless
+special packages like fancyref) are being used.  RefTeX can and by
+default does parse around each label to detect the correct label type,
+but this process can be slow when a document contains thousands of
+labels.  If you use label prefixes consistently, you may speed up
+document parsing by setting this variable to a non-nil value.  RefTeX
+will then compare the label prefix with the prefixes found in
+`reftex-label-alist' and derive the correct label type in this way.
+Possible values for this option are:
+
+t          This means to trust any label prefixes found.
+regexp     If a regexp, only prefixes matched by the regexp are trusted.
+list       List of accepted prefixes, as strings.  The colon is part of
+           the prefix, e.g. (\"fn:\" \"eqn:\" \"item:\").
+nil        Never trust a label prefix.
+
+The only disadvantage of using this feature is that the label context
+displayed in the label selection buffer along with each label is
+simply some text after the label definition.  This is no problem if you
+place labels keeping this in mind (e.g. *before* the equation, *at
+the beginning* of a fig/tab caption ...).  Anyway, it is probably best
+to use the regexp or the list value types to fine-tune this feature.
+For example, if your document contains thousands of footnotes with
+labels fn:xxx, you may want to set this variable to the value \"^fn:$\" or
+\(\"fn:\").  Then RefTeX will still do extensive parsing for any
+non-footnote labels."
+  :group 'reftex-defining-label-environments
+  :type '(choice
+          (const :tag "Always" t)
+          (const :tag "Never" nil)
+          (regexp)
+          (repeat :tag "List"
+                  (string :tag "prefix (with colon)"))))
   
 (defcustom reftex-special-environment-functions nil
   "List of functions to be called when trying to figure out current environment.
@@ -1010,6 +1049,9 @@
 %< as a special operator kills punctuation and space around it after the 
 string has been formatted.
 
+A pair of square brackets indicates an optional argument, and RefTeX
+will prompt for the values of these arguments.
+
 Beware that all this only works with BibTeX database files.  When
 citations are made from the \\bibitems in an explicit thebibliography
 environment, only %l is available.
@@ -1042,6 +1084,42 @@
             (cons (character :tag "Key character" ?\r)
                   (string    :tag "Format string" "")))))
 
+(defcustom reftex-cite-prompt-optional-args 'maybe
+  "*Non-nil means, prompt for empty optional arguments in cite macros.
+When an entry in `reftex-cite-format' ist given with square brackets to
+indicate optional arguments (for example \\cite[][]{%l}), RefTeX can
+prompt for values.  Possible values are:
+
+nil     Never prompt for optional arguments
+t       Always prompt
+maybe   Prompt only if `reftex-citation' was called with C-u prefix arg
+
+Unnecessary empty optional arguments are removed before insertion into
+the buffer.  See `reftex-cite-cleanup-optional-args'."
+  :group 'reftex-citation-support
+  :type '(choice
+          (const :tag "Always" t)
+          (const :tag "When called with prefix arg" maybe)
+          (const :tag "Never" nil)))
+
+(defcustom reftex-cite-cleanup-optional-args t
+  "*Non-nil means, remove unnecessary empty optional arguments in cite macros.
+The cite macros provided by some packages (for example
+natbib) allow specifying two optional arguments, one for a prefix to
+the citation, and a second for a postfix.  When only one optional
+argument is given, it is interpreted as postfix.  When this option is
+t, RefTeX removes unnecessary empty optional arguments from the cite
+macro before insertion.  For example, it will change
+    \\cite[][]{Jones}              -> \\cite{Jones}
+    \\cite[][Chapter 1]{Jones}     -> \\cite[Chapter 1]{Jones}
+    \\cite[see][]{Jones}           -> \\cite[see][]{Jones}
+    \\cite[see][Chapter 1]{Jones}  -> \\cite{Jones}
+Is is possible that other packages have other conventions about which
+optional argument is interpreted how - that is why this cleaning up
+can be turned off."
+  :group 'reftex-citation-support
+  :type 'boolean)
+
 (defcustom reftex-comment-citations nil
   "*Non-nil means add a comment for each citation describing the full entry.
 The comment is formatted according to `reftex-cite-comment-format'."
--- a/lisp/textmodes/reftex.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/reftex.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,8 +1,8 @@
 ;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX
-;; Copyright (c) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+;; Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: 4.21
+;; Version: 4.26
 ;; Keywords: tex
 
 ;; This file is part of GNU Emacs.
@@ -300,7 +300,7 @@
 ;;; Define the formal stuff for a minor mode named RefTeX.
 ;;;
 
-(defconst reftex-version "RefTeX version 4.21"
+(defconst reftex-version "RefTeX version 4.26"
   "Version string for RefTeX.")
 
 (defvar reftex-mode nil
@@ -669,6 +669,8 @@
 
 ;; Alist relating magic words to a label type.
 (defvar reftex-words-to-typekey-alist nil)
+;; Alist relating label prefixes to a label type.
+(defvar reftex-prefix-to-typekey-alist nil)
 
 ;; The last list-of-labels entry used in a reference.
 (defvar reftex-last-used-reference (list nil nil nil nil))
@@ -750,6 +752,7 @@
     reftex-typekey-to-format-alist
     reftex-typekey-to-prefix-alist
     reftex-words-to-typekey-alist
+    reftex-prefix-to-typekey-alist
     reftex-type-query-prompt
     reftex-type-query-help
 
@@ -904,6 +907,8 @@
         macro verify repeat nindex tag key toc-level toc-levels)
 
     (setq reftex-words-to-typekey-alist nil
+          reftex-prefix-to-typekey-alist 
+          '(("sec:" . "s") ("cha:" . "s") ("chap:" . "s"))
           reftex-typekey-list nil
           reftex-typekey-to-format-alist nil
           reftex-typekey-to-prefix-alist nil
@@ -946,6 +951,10 @@
         (if typekey
             (add-to-list 'reftex-typekey-list typekey))
         (if (and typekey prefix
+                 (not (assoc prefix reftex-prefix-to-typekey-alist)))
+            (add-to-list 'reftex-prefix-to-typekey-alist
+                         (cons prefix typekey)))
+        (if (and typekey prefix
                  (not (assoc typekey reftex-typekey-to-prefix-alist)))
             (add-to-list 'reftex-typekey-to-prefix-alist
                          (cons typekey prefix)))
@@ -1676,6 +1685,7 @@
  "Make a citation using BibTeX database files." t)
 (autoload 'reftex-default-bibliography "reftex-cite")
 (autoload 'reftex-bib-or-thebib "reftex-cite")
+(autoload 'reftex-create-bibtex-file "reftex-cite")
 
 ;;; =========================================================================
 ;;;
@@ -2439,6 +2449,7 @@
     ["Restore from File"      (reftex-access-parse-file 'restore) t])
    ("Global Actions"
     ["Search Whole Document"  reftex-search-document t]
+    ["Search Again"           tags-loop-continue t]
     ["Replace in Document"    reftex-query-replace-document t]
     ["Grep on Document"       reftex-grep-document t]
     "--"
@@ -2447,6 +2458,8 @@
     ["Change Label and Refs"  reftex-change-label t]
     ["Renumber Simple Labels" reftex-renumber-simple-labels t]
     "--"
+    ["Create BibTeX File"     reftex-create-bibtex-file t]
+    "--"
     ["Create TAGS File"       reftex-create-tags-file t]
     "--"
     ["Save Document"          reftex-save-all-document-buffers t])
--- a/lisp/textmodes/sgml-mode.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/textmodes/sgml-mode.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,6 @@
 ;;; sgml-mode.el --- SGML- and HTML-editing modes
 
-;; Copyright (C) 1992, 1995, 1996, 1998, 2001, 2002, 2003, 2004
+;; Copyright (C) 1992, 1995, 1996, 1998, 2001, 2002, 2003, 2004, 2005
 ;;           Free Software Foundation, Inc.
 
 ;; Author: James Clark <jjc@jclark.com>
@@ -392,6 +392,14 @@
 	(concat "<" face ">"))
     (error "Face not configured for %s mode" mode-name)))
 
+(defun sgml-fill-nobreak ()
+  ;; Don't break between a tag name and its first argument.
+  (save-excursion
+    (skip-chars-backward " \t")
+    (and (not (zerop (skip-syntax-backward "w_")))
+	 (skip-chars-backward "/?!")
+	 (eq (char-before) ?<))))
+
 ;;;###autoload
 (define-derived-mode sgml-mode text-mode "SGML"
   "Major mode for editing SGML documents.
@@ -422,6 +430,7 @@
   (set (make-local-variable 'paragraph-separate)
        (concat paragraph-start "$"))
   (set (make-local-variable 'adaptive-fill-regexp) "[ \t]*")
+  (add-hook 'fill-nobreak-predicate 'sgml-fill-nobreak nil t)
   (set (make-local-variable 'indent-line-function) 'sgml-indent-line)
   (set (make-local-variable 'comment-start) "<!-- ")
   (set (make-local-variable 'comment-end) " -->")
@@ -1138,17 +1147,19 @@
 Point is assumed to be outside of any tag.  If we discover that it's
 not the case, the first tag returned is the one inside which we are."
   (let ((here (point))
+	(stack nil)
 	(ignore nil)
 	(context nil)
 	tag-info)
     ;; CONTEXT keeps track of the tag-stack
-    ;; IGNORE keeps track of the nesting level of point relative to the
-    ;;   first (outermost) tag on the context.  This is the list of
-    ;;   enclosing start-tags we'll have to ignore.
+    ;; STACK keeps track of the end tags we've seen (and thus the start-tags
+    ;;   we'll have to ignore) when skipping over matching open..close pairs.
+    ;; IGNORE is a list of tags that can be ignored because they have been
+    ;;   closed implicitly.
     (skip-chars-backward " \t\n")      ; Make sure we're not at indentation.
     (while
 	(and (not (eq until 'now))
-	     (or ignore
+	     (or stack
 		 (not (if until (eq until 'empty) context))
 		 (not (sgml-at-indentation-p))
 		 (and context
@@ -1172,24 +1183,25 @@
        ;; start-tag
        ((eq (sgml-tag-type tag-info) 'open)
 	(cond
-	 ((null ignore)
-	  (if (and context
-                   (sgml-unclosed-tag-p (sgml-tag-name tag-info))
-		   (eq t (compare-strings
-			  (sgml-tag-name tag-info) nil nil
-			  (sgml-tag-name (car context)) nil nil t)))
+	 ((null stack)
+	  (if (member-ignore-case (sgml-tag-name tag-info) ignore)
 	      ;; There was an implicit end-tag.
 	      nil
-	    (push tag-info context)))
+	    (push tag-info context)
+	    ;; We're changing context so the tags implicitly closed inside
+	    ;; the previous context aren't implicitly closed here any more.
+	    ;; [ Well, actually it depends, but we don't have the info about
+	    ;; when it doesn't and when it does.   --Stef ]
+	    (setq ignore nil)))
 	 ((eq t (compare-strings (sgml-tag-name tag-info) nil nil
-				 (car ignore) nil nil t))
-	  (setq ignore (cdr ignore)))
+				 (car stack) nil nil t))
+	  (setq stack (cdr stack)))
 	 (t
 	  ;; The open and close tags don't match.
 	  (if (not sgml-xml-mode)
 	      (unless (sgml-unclosed-tag-p (sgml-tag-name tag-info))
 		(message "Unclosed tag <%s>" (sgml-tag-name tag-info))
-		(let ((tmp ignore))
+		(let ((tmp stack))
 		  ;; We could just assume that the tag is simply not closed
 		  ;; but it's a bad assumption when tags *are* closed but
 		  ;; not properly nested.
@@ -1200,13 +1212,19 @@
 		    (setq tmp (cdr tmp)))
 		  (if (cdr tmp) (setcdr tmp (cddr tmp)))))
 	    (message "Unmatched tags <%s> and </%s>"
-		     (sgml-tag-name tag-info) (pop ignore))))))
+		     (sgml-tag-name tag-info) (pop stack)))))
+	
+	(if (and (null stack) (sgml-unclosed-tag-p (sgml-tag-name tag-info)))
+	    ;; This is a top-level open of an implicitly closed tag, so any
+	    ;; occurrence of such an open tag at the same level can be ignored
+	    ;; because it's been implicitly closed.
+	    (push (sgml-tag-name tag-info) ignore)))
 
        ;; end-tag
        ((eq (sgml-tag-type tag-info) 'close)
 	(if (sgml-empty-tag-p (sgml-tag-name tag-info))
 	    (message "Spurious </%s>: empty tag" (sgml-tag-name tag-info))
-	  (push (sgml-tag-name tag-info) ignore)))
+	  (push (sgml-tag-name tag-info) stack)))
        ))
 
     ;; return context
--- a/lisp/toolbar/README	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/toolbar/README	Sun Jan 16 03:40:12 2005 +0000
@@ -5,4 +5,6 @@
     paste.xpm preferences.xpm print.xpm right_arrow.xpm save.xpm
     saveas.xpm search.xpm spell.xpm undo.xpm up_arrow.xpm
 
+    back_arrow.xpm and fwd_arrow.xpm are slightly modified undo and redo.
+
 They are not part of Emacs, but distributed and used by Emacs.
Binary file lisp/toolbar/back_arrow.pbm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/toolbar/back_arrow.xpm	Sun Jan 16 03:40:12 2005 +0000
@@ -0,0 +1,57 @@
+/* XPM */
+static char *back_arrow_xpm[] = {
+"24 24 30 1",
+"  c #000000",
+". c #53692A",
+"X c #59702D",
+"o c #657255",
+"O c #6D7A5B",
+"+ c #6D8839",
+"@ c #7C9B40",
+"# c #748261",
+"$ c #7F8E6B",
+"% c #818F71",
+"& c #879772",
+"* c #8C9A7F",
+"= c #85A24D",
+"- c #8BA859",
+"; c #92AD62",
+": c #95A77E",
+"> c #98AF74",
+", c #9BB572",
+"< c #9BAA87",
+"1 c #9CAF84",
+"2 c #A4B690",
+"3 c #A8BCA6",
+"4 c #ADBDA0",
+"5 c #AFC394",
+"6 c #BAD09D",
+"7 c #B5C3A9",
+"8 c #BED2A3",
+"9 c #D5E1C6",
+"0 c #FFFFFF",
+"q c None",
+"qqqqqqqqqqqqqqqqqqqqqqqq",
+"qqqqqqqqqqqqqqqqqqqqqqqq",
+"qqqqqqqqqqqqqqqqqqqqqqqq",
+"qqqqqqqqqq qqqqqqqqqqqqq",
+"qqqqqqqqq  qqqqqqqqqqqqq",
+"qqqqqqqq 9 qqqqqqqqqqqqq",
+"qqqqqqq 96    qqqqqqqqqq",
+"qqqqqq 968664% qqqqqqqqq",
+"qqqqq 966666663 qqqqqqqq",
+"qqqq <666666666* qqqqqqq",
+"qqqqq X@@@@@@;67  qqqqqq",
+"qqqqqq .@@@@@@=6$ qqqqqq",
+"qqqqqqq .@   X@,2 qqqqqq",
+"qqqqqqqq X q  +-6 qqqqqq",
+"qqqqqqqqq  qq  @6 qqqqqq",
+"qqqqqqqqqq qqq -: qqqqqq",
+"qqqqqqqqqqqqqq >o qqqqqq",
+"qqqqqqqqqqqqqq 5 qqqqqqq",
+"qqqqqqqqqqqqq 1O qqqqqqq",
+"qqqqqqqqqqqq &# qqqqqqqq",
+"qqqqqqqqqqqqq  qqqqqqqqq",
+"qqqqqqqqqqqqqqqqqqqqqqqq",
+"qqqqqqqqqqqqqqqqqqqqqqqq",
+"qqqqqqqqqqqqqqqqqqqqqqqq"};
Binary file lisp/toolbar/fwd_arrow.pbm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/toolbar/fwd_arrow.xpm	Sun Jan 16 03:40:12 2005 +0000
@@ -0,0 +1,70 @@
+/* XPM */
+static char *fwd_arrow_xpm[] = {
+"24 24 43 1",
+"  c #000000",
+". c #53692A",
+"X c #59702D",
+"o c #657255",
+"O c #6D7A5B",
+"+ c #6D8839",
+"@ c #7C9B40",
+"# c #748261",
+"$ c #7F8E6B",
+"% c #818F71",
+"& c #879772",
+"* c #8C9A7F",
+"= c #85A24D",
+"- c #8BA859",
+"; c #92AD62",
+": c #95A77E",
+"> c #98AF74",
+", c #9BB572",
+"< c #919889",
+"1 c #92998C",
+"2 c #939A8D",
+"3 c #99A28F",
+"4 c #9BAA87",
+"5 c #9CAF84",
+"6 c #A4B690",
+"7 c #A8BCA6",
+"8 c #ADBDA0",
+"9 c #AFC394",
+"0 c #BAD09D",
+"q c #B5C3A9",
+"w c #BED2A3",
+"e c #BFD3A6",
+"r c #C2D5AA",
+"t c #C5D7AE",
+"y c #C8D9B2",
+"u c #CDDCBC",
+"i c #D1DFBE",
+"p c #D2E0BF",
+"a c #D3E0C1",
+"s c #D4E0C5",
+"d c #D5E1C6",
+"f c #FFFFFF",
+"g c None",
+"gggggggggggggggggggggggg",
+"gggggggggggggggggggggggg",
+"gggggggggggggggggggggggg",
+"ggggggggggggg gggggggggg",
+"ggggggggggggg  ggggggggg",
+"ggggggggggggg 2 gggggggg",
+"gggggggggg    02 ggggggg",
+"ggggggggg &6riw03 gggggg",
+"gggggggg 7suat000< ggggg",
+"ggggggg *saie000004 gggg",
+"gggggg  qs;@@@@@@X ggggg",
+"gggggg $y=@@@@@@. gggggg",
+"gggggg 6,@X   @. ggggggg",
+"gggggg 0@+  g X gggggggg",
+"gggggg 0@  gg  ggggggggg",
+"gggggg :- ggg gggggggggg",
+"gggggg o> gggggggggggggg",
+"ggggggg 9 gggggggggggggg",
+"ggggggg O5 ggggggggggggg",
+"gggggggg #& gggggggggggg",
+"ggggggggg  ggggggggggggg",
+"gggggggggggggggggggggggg",
+"gggggggggggggggggggggggg",
+"gggggggggggggggggggggggg"};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/toolbar/lc-back_arrow.xpm	Sun Jan 16 03:40:12 2005 +0000
@@ -0,0 +1,33 @@
+/* XPM */
+static char *back_arrow_xpm[] = {
+"24 24 6 1",
+"  c #000000",
+". c #000100",
+"X c #6B6B66",
+"o c #87AF85",
+"O c #FFFFFF",
+"+ c None",
+"++++++++++++++++++++++++",
+"++++++++++++++++++++++++",
+"++++++++++++++++++++++++",
+"++++++++++ +++++++++++++",
+"+++++++++ .+++++++++++++",
+"++++++++ O.+++++++++++++",
+"+++++++ Oo .  ++++++++++",
+"++++++ Ooooooo +++++++++",
+"+++++ Ooooooooo ++++++++",
+"++++ ooooooooooo.+++++++",
+"+++++ oooooooooo..++++++",
+"++++++.oooooooooo.++++++",
+"+++++++.oo.. oooo.++++++",
+"++++++++.o.+  ooo.++++++",
+"+++++++++..++..oo.++++++",
+"++++++++++.+++.oo.++++++",
+"++++++++++++++.oo.++++++",
+"++++++++++++++.o.+++++++",
+"+++++++++++++.oX.+++++++",
+"++++++++++++.oo.++++++++",
+"+++++++++++++..+++++++++",
+"++++++++++++++++++++++++",
+"++++++++++++++++++++++++",
+"++++++++++++++++++++++++"};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/toolbar/lc-fwd_arrow.xpm	Sun Jan 16 03:40:12 2005 +0000
@@ -0,0 +1,32 @@
+/* XPM */
+static char *fwd_arrow_xpm[] = {
+"24 24 5 1",
+"  c #000000",
+". c #000100",
+"X c #87AF85",
+"o c #FFFFFF",
+"O c None",
+"OOOOOOOOOOOOOOOOOOOOOOOO",
+"OOOOOOOOOOOOOOOOOOOOOOOO",
+"OOOOOOOOOOOOOOOOOOOOOOOO",
+"OOOOOOOOOOOOO OOOOOOOOOO",
+"OOOOOOOOOOOOO  OOOOOOOOO",
+"OOOOOOOOOOOOO X OOOOOOOO",
+"OOOOOOOOOO  . XX.OOOOOOO",
+"OOOOOOOOO oXXXXXX.OOOOOO",
+"OOOOOOOO.oXXXXXXXX.OOOOO",
+"OOOOOOO.oXXXXXXXXXX.OOOO",
+"OOOOOO..XXXXXXXXXX.OOOOO",
+"OOOOOO.XXXXXXXXXX.OOOOOO",
+"OOOOOO.XXXX.  XX.OOOOOOO",
+"OOOOOO.XXX..O X OOOOOOOO",
+"OOOOOO.XX..OO. OOOOOOOOO",
+"OOOOOO.XX.OOO.OOOOOOOOOO",
+"OOOOOO.XX.OOOOOOOOOOOOOO",
+"OOOOOOO.X.OOOOOOOOOOOOOO",
+"OOOOOOO.XX.OOOOOOOOOOOOO",
+"OOOOOOOO.XX.OOOOOOOOOOOO",
+"OOOOOOOOO..OOOOOOOOOOOOO",
+"OOOOOOOOOOOOOOOOOOOOOOOO",
+"OOOOOOOOOOOOOOOOOOOOOOOO",
+"OOOOOOOOOOOOOOOOOOOOOOOO"};
--- a/lisp/type-break.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/type-break.el	Sun Jan 16 03:40:12 2005 +0000
@@ -229,7 +229,8 @@
   :group 'type-break)
 
 (defcustom type-break-file-name (convert-standard-filename "~/.type-break")
-  "*Name of file used to save state across sessions."
+  "*Name of file used to save state across sessions.
+If this is nil, no data will be saved across sessions."
   :type 'file
   :group 'type-break)
 
@@ -389,6 +390,9 @@
       (and (interactive-p)
            (message "Type Break mode is already enabled")))
      (type-break-mode
+      (with-current-buffer (find-file-noselect type-break-file-name 'nowarn)
+        (setq buffer-save-without-query t))
+
       (or global-mode-string
           (setq global-mode-string '("")))
       (or (assq 'type-break-mode-line-message-mode
@@ -399,7 +403,9 @@
       (type-break-keystroke-reset)
       (type-break-mode-line-countdown-or-break nil)
 
-      (setq type-break-time-last-break (type-break-get-previous-time))
+      (setq type-break-time-last-break
+            (or (type-break-get-previous-time)
+                (current-time)))
 
       ;; schedule according to break time from session file
       (type-break-schedule
@@ -431,12 +437,12 @@
       (type-break-mode-line-countdown-or-break nil)
       (type-break-cancel-schedule)
       (do-auto-save)
-      (with-current-buffer (find-file-noselect type-break-file-name
-                                               'nowarn)
-	(setq buffer-save-without-query t)
-	(set-buffer-modified-p nil)
-        (unlock-buffer)
-        (kill-this-buffer))
+      (when type-break-file-name
+	(with-current-buffer (find-file-noselect type-break-file-name
+						 'nowarn)
+	  (set-buffer-modified-p nil)
+	  (unlock-buffer)
+	  (kill-this-buffer)))
       (and (interactive-p)
            (message "Type Break mode is disabled")))))
   type-break-mode)
@@ -496,7 +502,8 @@
 
 (defun type-break-file-time (&optional time)
   "File break time in `type-break-file-name', unless the file is locked."
-  (if (not (stringp (file-locked-p type-break-file-name)))
+  (if (and type-break-file-name
+           (not (stringp (file-locked-p type-break-file-name))))
       (with-current-buffer (find-file-noselect type-break-file-name
                                                'nowarn)
         (let ((inhibit-read-only t))
@@ -507,7 +514,8 @@
 
 (defun type-break-file-keystroke-count ()
   "File keystroke count in `type-break-file-name', unless the file is locked."
-  (if (not (stringp (file-locked-p type-break-file-name)))
+  (if (and type-break-file-name
+           (not (stringp (file-locked-p type-break-file-name))))
       ;; Prevent deactivation of the mark in some other buffer.
       (let (deactivate-mark)
 	(with-current-buffer (find-file-noselect type-break-file-name
@@ -534,6 +542,8 @@
 (defun type-break-choose-file ()
   "Return file to read from."
   (cond
+   ((not type-break-file-name)
+    nil)
    ((and (file-exists-p type-break-auto-save-file-name)
          (file-readable-p type-break-auto-save-file-name))
     type-break-auto-save-file-name)
--- a/lisp/uniquify.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/uniquify.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,7 @@
 ;;; uniquify.el --- unique buffer names dependent on file name
 
-;; Copyright (c) 1989,95,96,97,2001,2003  Free Software Foundation, Inc.
+;; Copyright (c) 1989, 1995, 1996, 1997, 2001, 2003, 2005
+;;           Free Software Foundation, Inc.
 
 ;; Author: Dick King <king@reasoning.com>
 ;; Maintainer: FSF
@@ -187,9 +188,16 @@
 If `uniquify-min-dir-content' > 0, always pulls that many
 file name elements.
 Arguments BASE, DIRNAME, and NEWBUF specify the new buffer that causes
-this rationaliztion."
-  (if (null dirname)
-      (with-current-buffer newbuf (setq uniquify-managed nil))
+this rationalization."
+  (interactive
+   (list (if uniquify-managed
+	     (uniquify-item-base (car uniquify-managed)) (buffer-name))
+	 (uniquify-buffer-file-name (current-buffer))
+	 (current-buffer)))
+  ;; Make sure we don't get confused by outdated uniquify-managed info in
+  ;; this buffer.
+  (with-current-buffer newbuf (setq uniquify-managed nil))
+  (when dirname
     (setq dirname (expand-file-name (directory-file-name dirname)))
     (let ((fix-list (list (uniquify-make-item base dirname newbuf)))
 	  items)
@@ -457,5 +465,5 @@
 
 (provide 'uniquify)
 
-;;; arch-tag: e763faa3-56c9-4903-8eb8-26e1c45a0065
+;; arch-tag: e763faa3-56c9-4903-8eb8-26e1c45a0065
 ;;; uniquify.el ends here
--- a/lisp/url/ChangeLog	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/url/ChangeLog	Sun Jan 16 03:40:12 2005 +0000
@@ -1,3 +1,13 @@
+2005-01-13  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* url.el (url-retrieve-synchronously): Use accept-process-output rather
+	than sit-for.
+
+2005-01-03  Klaus Straubinger  <ksnetz@arcor.de>  (tiny change)
+
+	* url-http.el (url-http-handle-authentication):
+	Don't kill the current buffer.
+
 2004-12-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* url-handlers.el: Don't `require' everything eagerly.
--- a/lisp/url/url-http.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/url/url-http.el	Sun Jan 16 03:40:12 2005 +0000
@@ -322,8 +322,8 @@
 	  (let ((url-request-method url-http-method)
 		(url-request-data url-http-data)
 		(url-request-extra-headers url-http-extra-headers))
-	    (url-retrieve url url-callback-function url-callback-arguments))))
-      (kill-buffer (current-buffer)))))
+	    (url-retrieve url url-callback-function
+                          url-callback-arguments)))))))
 
 (defun url-http-parse-response ()
   "Parse just the response code."
--- a/lisp/url/url.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/url/url.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,7 @@
 ;;; url.el --- Uniform Resource Locator retrieval tool
 
-;; Copyright (c) 1996,1997,1998,1999,2001,2004  Free Software Foundation, Inc.
+;; Copyright (c) 1996, 1997, 1998, 1999, 2001, 2004, 2005
+;;           Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Keywords: comm, data, processes, hypermedia
@@ -169,26 +170,25 @@
 			      (url-debug 'retrieval "Synchronous fetching done (%S)" (current-buffer))
 			      (setq retrieval-done t
 				    asynch-buffer (current-buffer)))))
-    (if (not asynch-buffer)
-	;; We do not need to do anything, it was a mailto or something
-	;; similar that takes processing completely outside of the URL
-	;; package.
-	nil
-      (while (not retrieval-done)
-	(url-debug 'retrieval "Spinning in url-retrieve-synchronously: %S (%S)"
-		   retrieval-done asynch-buffer)
-	;; Quoth Stef:
-	;; It turns out that the problem seems to be that the (sit-for
-	;; 0.1) below doesn't actually process the data: instead it
-	;; returns immediately because there is keyboard input
-	;; waiting, so we end up spinning endlessly waiting for the
-	;; process to finish while not letting it finish.
-
-	;; However, raman claims that it blocks Emacs with Emacspeak
-	;; for unexplained reasons.  Put back for his benefit until
-	;; someone can understand it.
-	;; (sleep-for 0.1)
-	(sit-for 0.1))
+    (let ((proc (and asynch-buffer (get-buffer-process asynch-buffer))))
+      (if (null proc)
+	  ;; We do not need to do anything, it was a mailto or something
+	  ;; similar that takes processing completely outside of the URL
+	  ;; package.
+	  nil
+	(while (not retrieval-done)
+	  (url-debug 'retrieval
+		     "Spinning in url-retrieve-synchronously: %S (%S)"
+		     retrieval-done asynch-buffer)
+	  ;; We used to use `sit-for' here, but in some cases it wouldn't
+	  ;; work because apparently pending keyboard input would always
+	  ;; interrupt it before it got a chance to handle process input.
+	  ;; `sleep-for' was tried but it lead to other forms of
+	  ;; hanging.  --Stef
+	  (unless (accept-process-output proc)
+	    ;; accept-process-output returned nil, maybe because the process
+	    ;; exited (and may have been replaced with another).
+	    (setq proc (get-buffer-process asynch-buffer)))))
       asynch-buffer)))
 
 (defun url-mm-callback (&rest ignored)
--- a/lisp/vc-arch.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/vc-arch.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,6 @@
 ;;; vc-arch.el --- VC backend for the Arch version-control system
 
-;; Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+;; Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 ;;           Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
@@ -270,7 +270,7 @@
 (defun vc-arch-workfile-version (file)
   (let* ((root (expand-file-name "{arch}" (vc-arch-root file)))
 	 (defbranch (vc-arch-default-version file)))
-    (when (and defbranch (string-match "\\`\\(.+@[^/\n]+\\)/\\(\\(\\(.*\\)--.*\\)--.*\\)\\'" defbranch))
+    (when (and defbranch (string-match "\\`\\(.+@[^/\n]+\\)/\\(\\(\\(.*?\\)\\(?:--.*\\)?\\)--.*\\)\\'" defbranch))
       (let* ((archive (match-string 1 defbranch))
 	     (category (match-string 4 defbranch))
 	     (branch (match-string 3 defbranch))
@@ -377,7 +377,7 @@
       (setq newvers nil))
   (if newvers
       (error "Diffing specific revisions not implemented.")
-    (let* ((async (fboundp 'start-process))
+    (let* ((async (and (not vc-disable-async-diff) (fboundp 'start-process)))
 	   ;; Run the command from the root dir.
 	   (default-directory (vc-arch-root file))
 	   (status
--- a/lisp/vc-cvs.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/vc-cvs.el	Sun Jan 16 03:40:12 2005 +0000
@@ -548,7 +548,9 @@
 	       (append (vc-switches nil 'diff) '("/dev/null")))
 	;; Even if it's empty, it's locally modified.
 	1)
-    (let* ((async (and (vc-stay-local-p file) (fboundp 'start-process)))
+    (let* ((async (and (not vc-disable-async-diff) 
+                       (vc-stay-local-p file)
+                       (fboundp 'start-process)))
 	   (status (apply 'vc-cvs-command (or buffer "*vc-diff*")
 			  (if async 'async 1)
 			  file "diff"
--- a/lisp/vc-mcvs.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/vc-mcvs.el	Sun Jan 16 03:40:12 2005 +0000
@@ -446,7 +446,9 @@
 	       (append (vc-switches nil 'diff) '("/dev/null")))
 	;; Even if it's empty, it's locally modified.
 	1)
-    (let* ((async (and (vc-stay-local-p file) (fboundp 'start-process)))
+    (let* ((async (and (not vc-disable-async-diff)
+                       (vc-stay-local-p file) 
+                       (fboundp 'start-process)))
 	   ;; Run the command from the root dir so that `mcvs filt' returns
 	   ;; valid relative names.
 	   (default-directory (vc-mcvs-root file))
--- a/lisp/vc-svn.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/vc-svn.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,6 @@
 ;;; vc-svn.el --- non-resident support for Subversion version-control
 
-;; Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+;; Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 ;;           Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
@@ -352,6 +352,10 @@
 (defun vc-svn-diff (file &optional oldvers newvers buffer)
   "Get a difference report using SVN between two versions of FILE."
   (unless buffer (setq buffer "*vc-diff*"))
+  (if (and oldvers (equal oldvers (vc-workfile-version file)))
+      ;; Use nil rather than the current revision because svn handles it
+      ;; better (i.e. locally).
+      (setq oldvers nil))
   (if (string= (vc-workfile-version file) "0")
       ;; This file is added but not yet committed; there is no master file.
       (if (or oldvers newvers)
@@ -368,7 +372,8 @@
 	    (if vc-svn-diff-switches
 		(vc-switches 'SVN 'diff)
 	      (list "-x" (mapconcat 'identity (vc-switches nil 'diff) " "))))
-	   (async (and (vc-stay-local-p file)
+	   (async (and (not vc-disable-async-diff)
+                       (vc-stay-local-p file)
 		       (or oldvers newvers) ; Svn diffs those locally.
 		       (fboundp 'start-process))))
       (apply 'vc-svn-command buffer
--- a/lisp/vc.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/vc.el	Sun Jan 16 03:40:12 2005 +0000
@@ -152,7 +152,7 @@
 ;;   have such a brief-comparison feature, the default implementation of
 ;;   this function can be used, which delegates to a full
 ;;   vc-BACKEND-diff.  (Note that vc-BACKEND-diff must not run
-;;   asynchronously in this case.)
+;;   asynchronously in this case, see variable `vc-disable-async-diff'.)
 ;;
 ;; - mode-line-string (file)
 ;;
@@ -566,6 +566,15 @@
   :group 'vc
   :version "21.1")
 
+(defcustom vc-allow-async-revert nil
+  "*Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous.
+Enabling this option means that you can confirm a revert operation even
+if the local changes in the file have not been found and displayed yet."
+  :type '(choice (const :tag "No" nil)
+                 (const :tag "Yes" t))
+  :group 'vc
+  :version "21.4")
+
 ;;;###autoload
 (defcustom vc-checkout-hook nil
   "*Normal hook (list of functions) run after checking out a file.
@@ -714,6 +723,11 @@
 (defvar vc-parent-buffer-name nil)
 (put 'vc-parent-buffer-name 'permanent-local t)
 
+(defvar vc-disable-async-diff nil
+  "VC sets this to t locally to disable some async diff operations.
+Backends that offer asynchronous diffs should respect this variable
+in their implementation of vc-BACKEND-diff.")
+
 (defvar vc-log-file)
 (defvar vc-log-version)
 
@@ -2435,11 +2449,13 @@
         (unless (yes-or-no-p "File seems up-to-date.  Revert anyway? ")
           (error "Revert canceled")))
     (unless (vc-workfile-unchanged-p file)
+      (message "Finding changes...")
       ;; vc-diff selects the new window, which is not what we want:
       ;; if the new window is on another frame, that'd require the user
       ;; moving her mouse to answer the yes-or-no-p question.
-      (let ((win (save-selected-window
-		   (setq status (vc-diff nil t)) (selected-window))))
+      (let* ((vc-disable-async-diff (not vc-allow-async-revert))
+             (win (save-selected-window
+                    (setq status (vc-diff nil t)) (selected-window))))
 	(vc-exec-after `(message nil))
 	(when status
 	  (unwind-protect
--- a/lisp/woman.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/woman.el	Sun Jan 16 03:40:12 2005 +0000
@@ -1491,7 +1491,8 @@
 
 (defsubst woman-dired-define-key-maybe (key)
   "If KEY is undefined in Dired, bind it to command `woman-dired-find-file'."
-  (if (eq (lookup-key dired-mode-map key) 'undefined)
+  (if (or (eq (lookup-key dired-mode-map key) 'undefined)
+	  (null (lookup-key dired-mode-map key)))
       (woman-dired-define-key key)))
 
 (defun woman-dired-define-keys ()
--- a/lisp/xt-mouse.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/xt-mouse.el	Sun Jan 16 03:40:12 2005 +0000
@@ -43,14 +43,17 @@
 
 ;; Support multi-click -- somehow.
 
-;; Clicking on the mode-line does not work, although it should.
-
 ;;; Code:
 
 (define-key function-key-map "\e[M" 'xterm-mouse-translate)
 
 (defvar xterm-mouse-last)
 
+;; Mouse events symbols must have an 'event-kind property with
+;; the value 'mouse-click.
+(dolist (event-type '(mouse-1 mouse-2 mouse-3))
+  (put event-type 'event-kind 'mouse-click))
+
 (defun xterm-mouse-translate (event)
   "Read a click and release event from XTerm."
   (save-excursion
@@ -78,7 +81,7 @@
 	       (click-where (nth 1 click-data)))
 	  (if (memq down-binding '(nil ignore))
 	      (if (and (symbolp click-where)
-		       (not (eq 'menu-bar click-where)))
+		       (consp click-where))
 		  (vector (list click-where click-data) click)
 		(vector click))
 	    (setq unread-command-events
@@ -92,10 +95,9 @@
 			 0
 		       (list (intern (format "drag-mouse-%d"
 					     (+ 1 xterm-mouse-last)))
-			     down-data click-data))
-		     )))
+			     down-data click-data)))))
 	    (if (and (symbolp down-where)
-		     (not (eq 'menu-bar down-where)))
+		     (consp down-where))
 		(vector (list down-where down-data) down)
 	      (vector down))))))))
 
@@ -124,30 +126,6 @@
   (let* ((type (- (xterm-mouse-event-read) #o40))
 	 (x (- (xterm-mouse-event-read) #o40 1))
 	 (y (- (xterm-mouse-event-read) #o40 1))
-	 (point (cons x y))
-	 (window (window-at x y))
-	 (where (if window
-		    (coordinates-in-window-p point window)
-		  'menu-bar))
-	 (pos (if (consp where)
-		  (progn
-		    (select-window window)
-		    (goto-char (window-start window))
-		    (move-to-window-line (-
-					  (cdr where)
-					  (if (or header-line-format
-						  default-header-line-format)
-					      1
-					    0)))
-		    (move-to-column (- (+ (car where) (current-column)
-				       (if (string-match "\\` \\*Minibuf"
-							 (buffer-name))
-					   (- (minibuffer-prompt-width))
-					 0)
-				       (max 0 (1- (window-hscroll))))
-				       left-margin-width))
-		    (point))
-		where))
 	 (mouse (intern
 		 ;; For buttons > 3, the release-event looks
 		 ;; differently (see xc/programs/xterm/button.c,
@@ -159,12 +137,18 @@
 			(format "mouse-%d" (+ 1 xterm-mouse-last)))
 		       (t
 			(setq xterm-mouse-last type)
-			(format "down-mouse-%d" (+ 1 type)))))))
+			(format "down-mouse-%d" (+ 1 type))))))
+	 (w (window-at x y))
+         (ltrb (window-edges w))
+         (left (nth 0 ltrb))
+         (top (nth 1 ltrb)))
+
     (setq xterm-mouse-x x
 	  xterm-mouse-y y)
-    (list mouse
-	  (list window pos point
-		(/ (nth 2 (current-time)) 1000)))))
+    (if w
+	(list mouse (posn-at-x-y (- x left) (- y top) w))
+      (list mouse
+	    (append (list nil 'menu-bar) (nthcdr 2 (posn-at-x-y x y w)))))))
 
 ;;;###autoload
 (define-minor-mode xterm-mouse-mode
--- a/lispref/ChangeLog	Sun Jan 02 09:21:32 2005 +0000
+++ b/lispref/ChangeLog	Sun Jan 16 03:40:12 2005 +0000
@@ -1,3 +1,57 @@
+2005-01-14  Kim F. Storm  <storm@cua.dk>
+
+	* commands.texi (Accessing Events): Add WHOLE arg to posn-at-x-y.
+
+	* text.texi (Links and Mouse-1): Fix string and vector item.
+
+2005-01-13  Richard M. Stallman  <rms@gnu.org>
+
+	* keymaps.texi (Active Keymaps): Rewrite the text, and update the
+	descriptions of overriding-local-map and overriding-terminal-local-map.
+
+	* text.texi (Links and Mouse-1): Clarify text.
+
+2005-01-13  Kim F. Storm  <storm@cua.dk>
+
+	* modes.texi (Emulating Mode Line): Update format-mode-line entry.
+
+2005-01-13  Francis Litterio  <franl@world.std.com>  (tiny change)
+
+	* keymaps.texi (Active Keymaps): Fix overriding-local-map description.
+
+2005-01-12  Kim F. Storm  <storm@cua.dk>
+
+	* text.texi (Links and Mouse-1): Rename section from Enabling
+	Mouse-1 to Following Links.  Change xrefs.
+	Add examples for define-button-type and define-widget.
+
+	* display.texi (Button Properties, Button Buffer Commands):
+	Clarify mouse-1 and follow-link functionality.
+
+2005-01-12  Richard M. Stallman  <rms@gnu.org>
+
+	* text.texi (Enabling Mouse-1 to Follow Links): Redo prev. change.
+
+	* display.texi (Beeping): Fix Texinfo usage.
+
+	* modes.texi (Emulating Mode Line): Doc FACE arg in format-header-line.
+
+2005-01-11  Kim F. Storm  <storm@cua.dk>
+
+	* display.texi (Button Properties, Button Buffer Commands):
+	Mention mouse-1 binding.  Add follow-link keyword.
+
+	* text.texi (Text Properties): Add "Enable Mouse-1" to submenu.
+	(Enabling Mouse-1 to Follow Links): New subsection.
+
+2005-01-06  Richard M. Stallman  <rms@gnu.org>
+
+	* text.texi (Special Properties): Minor change.
+
+	* os.texi (Timers): Clarify previous change.
+
+	* modes.texi (Emulating Mode Line): format-mode-line requires 1 arg.
+
 2005-01-01  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* display.texi (Face Attributes): Correct xref to renamed node.
--- a/lispref/commands.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/lispref/commands.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -1843,12 +1843,15 @@
 @var{window}.
 @end defun
 
-@defun posn-at-x-y x y &optional frame-or-window
+@defun posn-at-x-y x y &optional frame-or-window whole
 This function returns position information corresponding to pixel
 coordinates @var{x} and @var{y} in a specified frame or window,
 @var{frame-or-window}, which defaults to the selected window.
 The coordinates @var{x} and @var{y} are relative to the
 frame or window used.
+If @var{whole} is @code{nil}, the coordinates are relative
+to the window text area, otherwise they are relative to
+the entire window area including scroll bars, margins and fringes.
 @end defun
 
   These functions are useful for decoding scroll bar events.
--- a/lispref/display.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/lispref/display.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -3788,10 +3788,12 @@
   The functions @code{create-image}, @code{defimage} and
 @code{find-image} provide convenient ways to create image descriptors.
 
-@defun create-image file &optional type &rest props
+@defun create-image file-or-data &optional type data-p &rest props
 @tindex create-image
 This function creates and returns an image descriptor which uses the
-data in @var{file}.
+data in @var{file-or-data}.  @var{file-or-data} can be a file name or
+a string containing the image data; @var{data-p} should be @code{nil}
+for the former case, non-@code{nil} for the latter case.
 
 The optional argument @var{type} is a symbol specifying the image type.
 If @var{type} is omitted or @code{nil}, @code{create-image} tries to
@@ -3802,7 +3804,7 @@
 properties---for example,
 
 @example
-(create-image "foo.xpm" 'xpm :heuristic-mask t)
+(create-image "foo.xpm" 'xpm nil :heuristic-mask t)
 @end example
 
 The function returns @code{nil} if images of this type are not
@@ -4063,6 +4065,11 @@
 A string displayed by the Emacs tool-tip help system; by default,
 @code{"mouse-2, RET: Push this button"}.
 
+@item follow-link
+@kindex follow-link @r{(button property)}
+The follow-link property, defining how a @key{Mouse-1} click behaves
+on this button, @xref{Links and Mouse-1}.
+
 @item button
 @kindex button @r{(button property)}
 All buttons have a non-@code{nil} @code{button} property, which may be useful
@@ -4242,6 +4249,10 @@
 which uses buttons may want to use @code{button-buffer-map} as a
 parent keymap for its keymap.
 
+If the button has a non-@code{nil} @code{follow-link} property, and
+@var{mouse-1-click-follows-link} is set, a @key{Mouse-1} click will
+also activate the @code{push-button} command.
+
 @deffn Command push-button &optional pos use-mouse-action
 @tindex push-button
 Perform the action specified by a button at location @var{pos}.
--- a/lispref/keymaps.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/lispref/keymaps.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -532,41 +532,46 @@
 @cindex global keymap
 @cindex local keymap
 
-  Emacs normally contains many keymaps; at any given time, just a few of
-them are @dfn{active} in that they participate in the interpretation
-of user input.  These are the global keymap, the current buffer's
-local keymap, and the keymaps of any enabled minor modes.
+  Emacs normally contains many keymaps; at any given time, just a few
+of them are @dfn{active} in that they participate in the
+interpretation of user input.  All the active keymaps are used
+together to determine what command to execute when a key is entered.
+Emacs searches these keymaps one by one, in a standard order, until it
+finds a binding in one of the keymaps.  (Searching a single keymap for a
+binding is called @dfn{key lookup}; see @ref{Key Lookup}.)
+
+  Normally the active keymaps are the @code{keymap} property keymap,
+the keymaps of any enabled minor modes, the current buffer's local
+keymap, and the global keymap, in that order.  Therefore, Emacs
+searches for each input key sequence in all these keymaps.
 
   The @dfn{global keymap} holds the bindings of keys that are defined
 regardless of the current buffer, such as @kbd{C-f}.  The variable
 @code{global-map} holds this keymap, which is always active.
 
-  Each buffer may have another keymap, its @dfn{local keymap}, which may
-contain new or overriding definitions for keys.  The current buffer's
-local keymap is always active except when @code{overriding-local-map}
-overrides it.  Text properties can specify an alternative local map for
-certain parts of the buffer; see @ref{Special Properties}.
+  Each buffer may have another keymap, its @dfn{local keymap}, which
+may contain new or overriding definitions for keys.  The current
+buffer's local keymap is always active except when
+@code{overriding-local-map} overrides it.  The @code{local-map} text
+or overlay property can specify an alternative local keymap for certain
+parts of the buffer; see @ref{Special Properties}.
 
   Each minor mode can have a keymap; if it does, the keymap is active
-when the minor mode is enabled.
-
-  The variable @code{overriding-local-map}, if non-@code{nil}, specifies
-another local keymap that overrides the buffer's local map and all the
-minor mode keymaps.  Modes for emulation can specify additional
-active keymaps through the variable @code{emulation-mode-map-alists}.
-
-  All the active keymaps are used together to determine what command to
-execute when a key is entered.  Emacs searches these maps one by one, in
-order of decreasing precedence, until it finds a binding in one of the
-maps.  The procedure for searching a single keymap is called @dfn{key
-lookup}; see @ref{Key Lookup}.
-
-  Normally, Emacs first searches for the key in the minor mode maps, in
-the order specified by @code{minor-mode-map-alist}; if they do not
-supply a binding for the key, Emacs searches the local map; if that too
-has no binding, Emacs then searches the global map.  However, if
-@code{overriding-local-map} is non-@code{nil}, Emacs searches that map
-first, before the global map.
+when the minor mode is enabled.  Modes for emulation can specify
+additional active keymaps through the variable
+@code{emulation-mode-map-alists}.
+
+  The highest precedence normal keymap comes from the @code{keymap}
+text or overlay property.  If that is non-@code{nil}, it is the first
+keymap to be processed, in normal circumstances.
+
+  However, there are also special circumstances, ways programs can
+substitute other keymaps for some of those.  The variable
+@code{overriding-local-map}, if non-@code{nil}, specifies a keymap
+that replaces all the usual active keymaps except the global keymap.
+Another way to do this is with @code{overriding-terminal-local-map};
+it operates on a per-terminal basis.  These variables are documented
+below.
 
 @cindex major mode keymap
   Since every buffer that uses the same major mode normally uses the
@@ -575,7 +580,7 @@
 example) is seen also in the other buffers that share that keymap.
 
   The local keymaps that are used for Lisp mode and some other major
-modes exist even if they have not yet been used.  These local maps are
+modes exist even if they have not yet been used.  These local keymaps are
 the values of variables such as @code{lisp-mode-map}.  For most major
 modes, which are less frequently used, the local keymap is constructed
 only when the mode is used for the first time in a session.
@@ -594,7 +599,7 @@
 The default global keymap is a full keymap that binds
 @code{self-insert-command} to all of the printing characters.
 
-It is normal practice to change the bindings in the global map, but you
+It is normal practice to change the bindings in the global keymap, but you
 should not assign this variable any value other than the keymap it starts
 out with.
 @end defvar
@@ -701,10 +706,9 @@
 
 @defvar overriding-local-map
 If non-@code{nil}, this variable holds a keymap to use instead of the
-buffer's local keymap, text property or overlay keymaps, and instead
-of all the minor mode keymaps.  This keymap, if any, overrides all
-other maps that would have been active, except for the current global
-map.
+buffer's local keymap, any text property or overlay keymaps, and any
+minor mode keymaps.  This keymap, if specified, overrides all other
+maps that would have been active, except for the current global map.
 @end defvar
 
 @defvar overriding-terminal-local-map
--- a/lispref/modes.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/lispref/modes.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -1736,24 +1736,29 @@
 the text that would appear in a mode line or header line
 based on certain mode-line specification.
 
-@defun format-mode-line &optional format window no-props buffer
+@defun format-mode-line format &optional face window buffer
 This function formats a line of text according to @var{format} as if
 it were generating the mode line for @var{window}, but instead of
 displaying the text in the mode line or the header line, it returns
-the text as a string.
-
-If @var{format} is @code{nil}, that means to use
-@code{mode-line-format} and return the text that would appear in the
-mode line.  If @var{format} is @code{t}, that means to use
-@code{header-line-format} so as to return the text that would appear
-in the header line (@code{""} if the window has no header line).
-The argument @var{window} defaults to the selected window.
+the text as a string.  The argument @var{window} defaults to the
+selected window.  If @var{buffer} is non-@code{nil}, all the
+information used is taken from @var{buffer}; by default, it comes from
+@var{window}'s buffer.
 
 The value string normally has text properties that correspond to the
-faces, keymaps, etc., that the mode line would have.  If
-@var{no-props} is non-@code{nil}, the value has no text properties.
-If @var{buffer} is non-@code{nil}, all the information used is taken 
-from @var{buffer}; by default,it comes from @var{window}'s buffer.
+faces, keymaps, etc., that the mode line would have.  And any character
+for which no @code{face} property is specified gets a default
+value which is usually @var{face}.  (If @var{face} is @code{t},
+that stands for either @code{mode-line} if @var{window} is selected,
+otherwise @code{mode-line-inactive}.)
+
+However, if @var{face} is an integer, the value has no text properties.
+
+For example, @code{(format-mode-line header-line-format)} returns the
+text that would appear in the selected window's header line (@code{""}
+if it has no header line).  @code{(format-mode-line header-line-format
+'header-line)} returns the same text, with each character
+carrying the face that it will have in the header line itself.
 @end defun
 
 @node Imenu
--- a/lispref/os.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/lispref/os.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -1371,7 +1371,8 @@
   It is usually a bad idea for timer functions to alter buffer
 contents.  When they do, they usually should call @code{undo-boundary}
 both before and after changing the buffer, to separate the timer's
-changes from user commands' changes.
+changes from user commands' changes and prevent a single undo entry
+from growing to be quite large.
 
 @deffn Command run-at-time time repeat function &rest args
 This sets up a timer that calls the function @var{function} with
--- a/lispref/text.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/lispref/text.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -2431,6 +2431,7 @@
                              only when text is examined.
 * Clickable Text::         Using text properties to make regions of text
                              do something when you click on them.
+* Links and Mouse-1::      How to make @key{Mouse-1} follow a link.
 * Fields::                 The @code{field} property defines
                              fields within the buffer.
 * Not Intervals::	   Why text properties do not use
@@ -2826,7 +2827,7 @@
 A face name (a symbol or string).
 
 @item
-Starting in Emacs 21, a property list of face attributes.  This has the
+A property list of face attributes.  This has the
 form (@var{keyword} @var{value} @dots{}), where each @var{keyword} is a
 face attribute name and @var{value} is a meaningful value for that
 attribute.  With this feature, you do not need to create a face each
@@ -3388,6 +3389,125 @@
 global definition) remains available for the rest of the text in the
 buffer.
 
+@node Links and Mouse-1
+@subsection Links and Mouse-1
+@cindex follow links
+@cindex mouse-1
+
+  The normal Emacs command for activating text in read-only buffers is
+@key{Mouse-2}, which includes following textual links.  However, most
+graphical applications use @key{Mouse-1} for following links.  For
+compatibility, @key{Mouse-1} follows links in Emacs too, when you
+click on a link quickly without moving the mouse.  The user can
+customize this behaviour through the variable
+@code{mouse-1-click-follows-link}.
+
+  To define text as a link at the Lisp level, you should bind the
+@code{mouse-2} event to a command to follow the link.  Then, to indicate that
+@key{Mouse-1} should also follow the link, you should specify a
+@code{follow-link} condition either as a text property or as a key
+binding:
+
+@table @asis
+@item @code{follow-link} property
+If the clickable text has a non-@code{nil} @code{follow-link} text or overlay
+property, that specifies the condition.
+
+@item @code{follow-link} event
+If there is a binding for the @code{follow-link} event, either on the
+clickable text or in the local keymap, the binding is the condition.
+@end table
+
+  Regardless of how you set the @code{follow-link} condition, its
+value is used as follows to determine whether the given position is
+inside a link, and (if so) to compute an @dfn{action code} saying how
+@key{Mouse-1} should handle the link.
+
+@table @asis
+@item @code{mouse-face}
+If the condition is @code{mouse-face}, a position is inside a link if
+there is a non-@code{nil} @code{mouse-face} property at that position.
+The action code is always @code{t}.
+
+For example, here is how Info mode handles @key{Mouse-1}:
+
+@example
+(define-key Info-mode-map [follow-link] 'mouse-face)
+@end example
+
+@item a function
+If the condition is a valid function, @var{func}, then a position
+@var{pos} is inside a link if @code{(@var{func} @var{pos})} evaluates
+to non-@code{nil}.  The value returned by @var{func} serves as the
+action code.
+
+For example, here is how pcvs enables @key{Mouse-1} to follow links on
+file names only:
+
+@example
+(define-key map [follow-link]
+  (lambda (pos)
+    (if (eq (get-char-property pos 'face) 'cvs-filename-face) t)))
+@end example
+
+@item anything else
+If the condition value is anything else, then the position is inside a
+link and the condition itself is the action code.  Clearly you should
+only specify this kind of condition on the text that constitutes a
+link.
+@end table
+
+@noindent
+The action code tells @key{Mouse-1} how to follow the link:
+
+@table @asis
+@item a string or vector
+If the action code is a string or vector, the @key{Mouse-1} event is
+translated into the first element of the string or vector; i.e., the
+action of the @key{Mouse-1} click is the local or global binding of
+that character or symbol.  Thus, if the action code is @code{"foo"},
+@key{Mouse-1} translates into @kbd{f}.  If it is @code{[foo]},
+@key{Mouse-1} translates into @key{foo}.
+
+@item anything else
+For any other non-@code{nil} action code, the @code{mouse-1} event is
+translated into a @code{mouse-2} event at the same position.
+@end table
+
+  To define @key{Mouse-1} to activate a button defined with
+@code{define-button-type}, give the button a @code{follow-link}
+property with a value as specified above to determine how to follow
+the link.  For example, here is how Help mode handles @key{Mouse-1}:
+
+@smallexample
+(define-button-type 'help-xref
+  'follow-link t
+  'action #'help-button-action)
+@end smallexample
+
+  To define @key{Mouse-1} on a widget defined with
+@code{define-widget}, give the widget a @code{:follow-link} property
+with a value as specified above to determine how to follow the link.
+
+For example, here is how the @code{link} widget specifies that
+a @key{Mouse-1} click shall be translated to @key{RET}:
+
+@smallexample
+(define-widget 'link 'item
+  "An embedded link."
+  :button-prefix 'widget-link-prefix
+  :button-suffix 'widget-link-suffix
+  :follow-link "\C-m"
+  :help-echo "Follow the link."
+  :format "%[%t%]")
+@end smallexample
+
+@defun mouse-on-link-p pos
+@tindex mouse-on-link-p
+This function returns non-@code{nil} if position @var{pos} in the
+current buffer is on a link.
+@end defun
+
 @node Fields
 @subsection Defining and Using Fields
 @cindex fields
--- a/man/ChangeLog	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/ChangeLog	Sun Jan 16 03:40:12 2005 +0000
@@ -1,3 +1,74 @@
+2005-01-15  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
+
+	* man/rmail.texi: Document support for GNU mailutils in rmail.el.
+
+2005-01-13  Richard M. Stallman  <rms@gnu.org>
+
+	* commands.texi (Commands): Clarification.
+
+2005-01-11  Richard M. Stallman  <rms@gnu.org>
+
+	* programs.texi (Multi-line Indent): Fix previous change.
+	(Fortran Autofill): Simplify description of fortran-auto-fill-mode.
+
+2005-01-11  Kim F. Storm  <storm@cua.dk>
+
+	* widget.texi (Basic Types): Add :follow-link keyword.
+
+2005-01-09  Jay Belanger  <belanger@truman.edu>
+
+	* calc.texi (Basic Commands): Describe new behavior of calc-reset.
+
+2005-01-08  Richard M. Stallman  <rms@gnu.org>
+
+	* display.texi (Faces): isearch-lazy-highlight-face renamed to
+	lazy-highlight.
+
+	* search.texi (Query Replace): Mention faces query-replace
+	and lazy-highlight.
+	(Incremental Search): Update isearch highlighting info.
+
+2005-01-08  Jay Belanger  <belanger@truman.edu>
+
+	* calc.texi: Change throughout to reflect new default value of
+	calc-settings-file.
+
+2005-01-06  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* message.texi (Reply): `message-reply-to-function' should return
+	a list.  Suggested by ARISAWA Akihiro <ari@mbf.ocn.co.jp>.
+
+2005-01-06  Hiroshi Fujishima  <pooh@nature.tsukuba.ac.jp>  (tiny change)
+
+	* faq.texi (Changing load-path): Fix typo.
+
+2005-01-05  Jay Belanger  <belanger@truman.edu>
+
+	* calc.texi (Programming Tutorial): Replace kbd command by
+	appropriate characters for a keyboard macro.
+
+2005-01-04  Jay Belanger  <belanger@truman.edu>
+
+	* calc.texi (Basic Tutorial, Programming Tutorial): Remove caveats
+	for Lucid Emacs.
+	(Programming Tutorial): Mention that the user needs to be in the
+	right mode to compute some functions.
+
+2005-01-04  Richard M. Stallman  <rms@gnu.org>
+
+	* custom.texi (Saving Customizations): Minor improvement.
+
+2005-01-04  Jay Belanger  <belanger@truman.edu>
+
+	* calc.texi (Rewrite rules): Remove an exercise (on 0^0) which is
+	no longer applicable.
+
+2005-01-03  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* custom.texi (Saving Customizations): Emacs no longer loads
+	`custom-file' after .emacs.  No longer mention customizing through
+	Custom.
+
 2005-01-01  Jay Belanger  <belanger@truman.edu>
 
 	* calc.texi (Programming Tutorial): Changed description of how to
@@ -50,10 +121,6 @@
 	* basic.texi (Moving Point): C-e now runs move-end-of-line.
 	(Undo): Doc undo-outer-limit.
 
-2004-12-11  Richard M. Stallman  <rms@gnu.org>
-
-	* Makefile.in (MAKEINFO): Add --force.
-
 2004-12-20  Jay Belanger  <belanger@truman.edu>
 
 	* calc.texi (Types Tutorial): Emphasize that you can't divide by
@@ -79,7 +146,6 @@
 	the standard "The GNU Emacs Manual" in fifth argument of @xref's.
 	(Dealing with HTTP documents): @inforef->@xref.
 
->>>>>>> 1.412
 2004-12-15  Juri Linkov  <juri@jurta.org>
 
 	* mark.texi (Transient Mark, Mark Ring): M-< and other
@@ -96,7 +162,6 @@
 
 	* calc.texi: Fix some TeX definitions.
 
->>>>>>> 1.407
 2004-12-12  Juri Linkov  <juri@jurta.org>
 
 	* misc.texi (FFAP): Add C-x C-r, C-x C-v, C-x C-d,
@@ -110,7 +175,6 @@
 	* mark.texi (Marking Objects): Marking commands also extend the
 	region when mark is active in Transient Mark mode.
 
->>>>>>> 1.403
 2004-12-09  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* reftex.texi (Imprint): Remove erroneous @value's.
--- a/man/calc.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/calc.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -2331,9 +2331,8 @@
 to cancel it.  (In fact, you can press @kbd{C-g} to cancel almost
 anything in Emacs.)  To get help on a prefix key, press that key
 followed by @kbd{?}.  Some prefixes have several lines of help,
-so you need to press @kbd{?} repeatedly to see them all.  This may
-not work under Lucid Emacs, but you can also type @kbd{h h} to
-see all the help at once.
+so you need to press @kbd{?} repeatedly to see them all.  
+You can also type @kbd{h h} to see all the help at once.
 
 Try pressing @kbd{t ?} now.  You will see a line of the form,
 
@@ -5859,15 +5858,7 @@
 so that @expr{2 - 3 (x + y) + x y} is a sum of three terms.)
 @xref{Rewrites Answer 5, 5}. (@bullet{})
 
-(@bullet{}) @strong{Exercise 6.}  Calc considers the form @expr{0^0}
-to be ``indeterminate,'' and leaves it unevaluated (assuming Infinite
-mode is not enabled).  Some people prefer to define @expr{0^0 = 1},
-so that the identity @expr{x^0 = 1} can safely be used for all @expr{x}.
-Find a way to make Calc follow this convention.  What happens if you
-now type @kbd{m i} to turn on Infinite mode?
-@xref{Rewrites Answer 6, 6}. (@bullet{})
-
-(@bullet{}) @strong{Exercise 7.}  A Taylor series for a function is an
+(@bullet{}) @strong{Exercise 6.}  A Taylor series for a function is an
 infinite series that exactly equals the value of that function at
 values of @expr{x} near zero.
 
@@ -5913,9 +5904,12 @@
 rearranged or if @kbd{a s} needs to be typed after rewriting.  (This one
 is rather tricky; the solution at the end of this chapter uses 6 rewrite
 rules.  Hint:  The @samp{constant(x)} condition tests whether @samp{x} is
-a number.)  @xref{Rewrites Answer 7, 7}. (@bullet{})
-
-@c [fix-ref Rewrite Rules]
+a number.)  @xref{Rewrites Answer 6, 6}. (@bullet{})
+
+Just for kicks, try adding the rule @code{2+3 := 6} to @code{EvalRules}.
+What happens?  (Be sure to remove this rule afterward, or you might get
+a nasty surprise when you use Calc to balance your checkbook!)
+
 @xref{Rewrite Rules}, for the whole story on rewrite rules.
 
 @node Programming Tutorial, Answers to Exercises, Algebra Tutorial, Tutorial
@@ -5929,9 +5923,6 @@
 all you want to do is define a new function or repeat a command a few
 times.  Calc has features that allow you to do these things easily.
 
-(Note that the programming commands relating to user-defined keys
-are not yet supported under Lucid Emacs 19.)
-
 One very limited form of programming is defining your own functions.
 Calc's @kbd{Z F} command allows you to define a function name and
 key sequence to correspond to any formula.  Programming commands use
@@ -5993,8 +5984,9 @@
 with any integrand @samp{f(t)}.  Define a @kbd{z s} command and
 @code{Si} function that implement this.  You will need to edit the
 default argument list a bit.  As a test, @samp{Si(1)} should return
-0.946083.  (Hint:  @code{ninteg} will run a lot faster if you reduce
-the precision to, say, six digits beforehand.)
+0.946083. (If you don't get this answer, you might want to check that
+Calc is in Radians mode.  Also, @code{ninteg} will run a lot faster if
+you reduce the precision to, say, six digits beforehand.)
 @xref{Programming Answer 1, 1}. (@bullet{})
 
 The simplest way to do real ``programming'' of Emacs is to define a
@@ -6404,7 +6396,7 @@
 @example
 @group
 Z ` 0 t 1
-    1 @key{TAB}
+    1 TAB
     Z (  & s + 1  1 Z )
     r 1
 Z '
@@ -6643,8 +6635,7 @@
 * Rewrites Answer 3::      Rewriting opt(a) + opt(b) x
 * Rewrites Answer 4::      Sequence of integers
 * Rewrites Answer 5::      Number of terms in sum
-* Rewrites Answer 6::      Defining 0^0 = 1
-* Rewrites Answer 7::      Truncated Taylor series
+* Rewrites Answer 6::      Truncated Taylor series
 * Programming Answer 1::   Fresnel's C(x)
 * Programming Answer 2::   Negate third stack element
 * Programming Answer 3::   Compute sin(x) / x, etc.
@@ -9094,48 +9085,9 @@
 match before later rules; @samp{nterms(x)} will only be tried if we
 already know that @samp{x} is not a sum.
 
-@node Rewrites Answer 6, Rewrites Answer 7, Rewrites Answer 5, Answers to Exercises
+@node Rewrites Answer 6, Programming Answer 1, Rewrites Answer 5, Answers to Exercises
 @subsection Rewrites Tutorial Exercise 6
 
-Just put the rule @samp{0^0 := 1} into @code{EvalRules}.  For example,
-before making this definition we have:
-
-@smallexample
-@group
-2:  [-2, -1, 0, 1, 2]                1:  [1, 1, 0^0, 1, 1]
-1:  0                                    .
-    .
-
-    v x 5 @key{RET}  3 -  0                    V M ^
-@end group
-@end smallexample
-
-@noindent
-But then:
-
-@smallexample
-@group
-2:  [-2, -1, 0, 1, 2]                1:  [1, 1, 1, 1, 1]
-1:  0                                    .
-    .
-
-    U  ' 0^0:=1 @key{RET} s t EvalRules @key{RET}    V M ^
-@end group
-@end smallexample
-
-Perhaps more surprisingly, this rule still works with Infinite mode
-turned on.  Calc tries @code{EvalRules} before any built-in rules for
-a function.  This allows you to override the default behavior of any
-Calc feature:  Even though Calc now wants to evaluate @expr{0^0} to
-@code{nan}, your rule gets there first and evaluates it to 1 instead.
-
-Just for kicks, try adding the rule @code{2+3 := 6} to @code{EvalRules}.
-What happens?  (Be sure to remove this rule afterward, or you might get
-a nasty surprise when you use Calc to balance your checkbook!)
-
-@node Rewrites Answer 7, Programming Answer 1, Rewrites Answer 6, Answers to Exercises
-@subsection Rewrites Tutorial Exercise 7
-
 @noindent
 Here is a rule set that will do the job:
 
@@ -9208,7 +9160,7 @@
 this it would probably be better to write the formatting routine
 in Lisp.)
 
-@node Programming Answer 1, Programming Answer 2, Rewrites Answer 7, Answers to Exercises
+@node Programming Answer 1, Programming Answer 2, Rewrites Answer 6, Answers to Exercises
 @subsection Programming Tutorial Exercise 1
 
 @noindent
@@ -10029,11 +9981,16 @@
 @kindex M-# 0
 @pindex calc-reset
 The @kbd{M-# 0} command (@code{calc-reset}; that's @kbd{M-#} followed
-by a zero) resets the Calculator to its default state.  This clears
-the stack, resets all the modes, clears the caches (@pxref{Caches}),
-and so on.  (It does @emph{not} erase the values of any variables.)
-With a numeric prefix argument, @kbd{M-# 0} preserves the contents
-of the stack but resets everything else.
+by a zero) resets the Calculator to its initial state.  This clears
+the stack, resets all the modes to their initial values (the values
+that were saved with @kbd{m m} (@code{calc-save-modes})), clears the
+caches (@pxref{Caches}), and so on.  (It does @emph{not} erase the
+values of any variables.) With an argument of 0, Calc will be reset to
+its default state; namely, the modes will be given their default values.
+With a positive prefix argument, @kbd{M-# 0} preserves the contents of
+the stack but resets everything else to its initial state; with a
+negative prefix argument, @kbd{M-# 0} preserves the contents of the
+stack but resets everything else to its default state.
 
 @pindex calc-version
 The @kbd{M-x calc-version} command displays the current version number
@@ -12295,16 +12252,18 @@
 @cindex Continuous memory
 @cindex Saving mode settings
 @cindex Permanent mode settings
-@cindex @file{.emacs} file, mode settings
-You can save all of the current mode settings in your @file{.emacs} file
-with the @kbd{m m} (@code{calc-save-modes}) command.  This will cause
-Emacs to reestablish these modes each time it starts up.  The modes saved
-in the file include everything controlled by the @kbd{m} and @kbd{d}
-prefix keys, the current precision and binary word size, whether or not
-the trail is displayed, the current height of the Calc window, and more.
-The current interface (used when you type @kbd{M-# M-#}) is also saved.
-If there were already saved mode settings in the file, they are replaced.
-Otherwise, the new mode information is appended to the end of the file.
+@cindex Calc init file, mode settings
+You can save all of the current mode settings in your Calc init file 
+(the file given by the variable @code{calc-settings-file}, typically
+@file{~/.calc.el}) with the @kbd{m m} (@code{calc-save-modes}) command.
+This will cause Emacs to reestablish these modes each time it starts up.
+The modes saved in the file include everything controlled by the @kbd{m}
+and @kbd{d} prefix keys, the current precision and binary word size,
+whether or not the trail is displayed, the current height of the Calc
+window, and more.  The current interface (used when you type @kbd{M-#
+M-#}) is also saved.  If there were already saved mode settings in the
+file, they are replaced.  Otherwise, the new mode information is
+appended to the end of the file.
 
 @kindex m R
 @pindex calc-mode-record-mode
@@ -12316,22 +12275,22 @@
 @kindex m F
 @pindex calc-settings-file-name
 The @kbd{m F} (@code{calc-settings-file-name}) command allows you to
-choose a different place than your @file{.emacs} file for @kbd{m m},
-@kbd{Z P}, and similar commands to save permanent information.
+choose a different file than the current value of @code{calc-settings-file}
+for @kbd{m m}, @kbd{Z P}, and similar commands to save permanent information.
 You are prompted for a file name.  All Calc modes are then reset to
 their default values, then settings from the file you named are loaded
 if this file exists, and this file becomes the one that Calc will
 use in the future for commands like @kbd{m m}.  The default settings
-file name is @file{~/.emacs}.  You can see the current file name by
+file name is @file{~/.calc.el}.  You can see the current file name by
 giving a blank response to the @kbd{m F} prompt.  See also the
 discussion of the @code{calc-settings-file} variable; @pxref{Installation}.
 
-If the file name you give contains the string @samp{.emacs} anywhere
-inside it, @kbd{m F} will not automatically load the new file.  This
-is because you are presumably switching to your @file{~/.emacs} file,
-which may contain other things you don't want to reread.  You can give
+If the file name you give is your user init file (typically
+@file{~/.emacs}), @kbd{m F} will not automatically load the new file.  This
+is because your user init file may contain other things you don't want
+to reread.  You can give 
 a numeric prefix argument of 1 to @kbd{m F} to force it to read the
-file no matter what its name.  Conversely, an argument of @mathit{-1} tells
+file no matter what.  Conversely, an argument of @mathit{-1} tells
 @kbd{m F} @emph{not} to read the new file.  An argument of 2 or @mathit{-2}
 tells @kbd{m F} not to reset the modes to their defaults beforehand,
 which is useful if you intend your new file to have a variant of the
@@ -15920,7 +15879,7 @@
 Selections show deep structure (@kbd{j b}; @pxref{Making Selections}).
 
 @item Save
-Record modes in @file{~/.emacs} (@kbd{m R}; @pxref{General Mode Commands}).
+Record modes in @file{~/.calc.el} (@kbd{m R}; @pxref{General Mode Commands}).
 
 @item Local
 Record modes in Embedded buffer (@kbd{m R}).
@@ -27807,13 +27766,14 @@
 
 @kindex u p
 @pindex calc-permanent-units
-@cindex @file{.emacs} file, user-defined units
+@cindex Calc init file, user-defined units
 The @kbd{u p} (@code{calc-permanent-units}) command stores the user-defined
-units in your @file{.emacs} file, so that the units will still be
-available in subsequent Emacs sessions.  If there was already a set of
-user-defined units in your @file{.emacs} file, it is replaced by the
-new set.  (@xref{General Mode Commands}, for a way to tell Calc to use
-a different file instead of @file{.emacs}.)
+units in your Calc init file (the file given by the variable
+@code{calc-settings-file}, typically @file{~/.calc.el}), so that the
+units will still be available in subsequent Emacs sessions.  If there
+was already a set of user-defined units in your Calc init file, it
+is replaced by the new set.  (@xref{General Mode Commands}, for a way to
+tell Calc to use a different file for the Calc init file.)
 
 @node Store and Recall, Graphics, Units, Top
 @chapter Storing and Recalling
@@ -28198,14 +28158,15 @@
 @pindex calc-permanent-variable
 @cindex Storing variables
 @cindex Permanent variables
-@cindex @file{.emacs} file, variables
+@cindex Calc init file, variables
 The @kbd{s p} (@code{calc-permanent-variable}) command saves a
-variable's value permanently in your @file{.emacs} file, so that its
-value will still be available in future Emacs sessions.  You can
-re-execute @w{@kbd{s p}} later on to update the saved value, but the
-only way to remove a saved variable is to edit your @file{.emacs} file
+variable's value permanently in your Calc init file (the file given by
+the variable @code{calc-settings-file}, typically @file{~/.calc.el}), so
+that its value will still be available in future Emacs sessions.  You
+can re-execute @w{@kbd{s p}} later on to update the saved value, but the
+only way to remove a saved variable is to edit your calc init file
 by hand.  (@xref{General Mode Commands}, for a way to tell Calc to
-use a different file instead of @file{.emacs}.)
+use a different file for the Calc init file.)
 
 If you do not specify the name of a variable to save (i.e.,
 @kbd{s p @key{RET}}), all Calc variables with defined values
@@ -28224,7 +28185,7 @@
 The variables are written with the prefix @code{var-} in the form of
 Lisp @code{setq} commands 
 which store the values in string form.  You can place these commands
-in your @file{.emacs} buffer if you wish, though in this case it
+in your Calc init file (or @file{.emacs}) if you wish, though in this case it
 would be easier to use @kbd{s p @key{RET}}.  (Note that @kbd{s i}
 omits the same set of variables as @w{@kbd{s p @key{RET}}}; the difference
 is that @kbd{s i} will store the variables in any buffer, and it also
@@ -28411,7 +28372,7 @@
 @vindex calc-gnuplot-name
 If you have GNUPLOT installed on your system but Calc is unable to
 find it, you may need to set the @code{calc-gnuplot-name} variable
-in your @file{.emacs} file.  You may also need to set some Lisp
+in your Calc init file or @file{.emacs}.  You may also need to set some Lisp
 variables to show Calc how to run GNUPLOT on your system; these
 are described under @kbd{g D} and @kbd{g O} below.  If you are
 using the X window system, Calc will configure GNUPLOT for you
@@ -30466,7 +30427,8 @@
 
 Two more mode-recording modes selectable by @kbd{m R} are @code{Save}
 (which works even outside of Embedded mode), in which mode settings
-are recorded permanently in your Emacs startup file @file{~/.emacs}
+are recorded permanently in your Calc init file (the file given by the
+variable @code{calc-settings-file}, typically @file{~/.calc.el})
 rather than by annotating the current document, and no-recording
 mode (where there is no symbol like @code{Save} or @code{Local} in
 the mode line), in which mode-changing commands do not leave any
@@ -30482,8 +30444,8 @@
 You can modify Embedded mode's behavior by setting various Lisp
 variables described here.  Use @kbd{M-x set-variable} or
 @kbd{M-x edit-options} to adjust a variable on the fly, or
-put a suitable @code{setq} statement in your @file{~/.emacs}
-file to set a variable permanently.  (Another possibility would
+put a suitable @code{setq} statement in your Calc init file (or 
+@file{~/.emacs}) to set a variable permanently.  (Another possibility would
 be to use a file-local variable annotation at the end of the
 file; @pxref{File Variables, , Local Variables in Files, emacs, the
 Emacs manual}.)
@@ -30721,15 +30683,16 @@
 @pindex calc-user-define-permanent
 @cindex Storing user definitions
 @cindex Permanent user definitions
-@cindex @file{.emacs} file, user-defined commands
+@cindex Calc init file, user-defined commands
 The @kbd{Z P} (@code{calc-user-define-permanent}) command makes a key
 binding permanent so that it will remain in effect even in future Emacs
 sessions.  (It does this by adding a suitable bit of Lisp code into
-your @file{.emacs} file.)  For example, @kbd{Z P s} would register
-our @code{sincos} command permanently.  If you later wish to unregister
-this command you must edit your @file{.emacs} file by hand.
-(@xref{General Mode Commands}, for a way to tell Calc to use a
-different file instead of @file{.emacs}.)
+your Calc init file; that is, the file given by the variable
+@code{calc-settings-file}, typically @file{~/.calc.el}.)  For example,
+@kbd{Z P s} would register our @code{sincos} command permanently.  If
+you later wish to unregister this command you must edit your Calc init
+file by hand.  (@xref{General Mode Commands}, for a way to tell Calc to
+use a different file for the Calc init file.)
 
 The @kbd{Z P} command also saves the user definition, if any, for the
 command bound to the key.  After @kbd{Z F} and @kbd{Z C}, a given user
@@ -31444,12 +31407,17 @@
 :"n * myfact(n-1)"
 @end example
 
+A good place to put your @code{defmath} commands is your Calc init file
+(the file given by @code{calc-settings-file}, typically
+@file{~/.calc.el}), which will not be loaded until Calc starts.
 If a file named @file{.emacs} exists in your home directory, Emacs reads
 and executes the Lisp forms in this file as it starts up.  While it may
-seem like a good idea to put your favorite @code{defmath} commands here,
+seem reasonable to put your favorite @code{defmath} commands there,
 this has the unfortunate side-effect that parts of the Calculator must be
 loaded in to process the @code{defmath} commands whether or not you will
-actually use the Calculator!  A better effect can be had by writing
+actually use the Calculator!  If you want to put the @code{defmath}
+commands there (for example, if you redefine @code{calc-settings-file}
+to be @file{.emacs}), a better effect can be had by writing
 
 @example
 (put 'calc-define 'thing '(progn
@@ -34402,7 +34370,7 @@
 @defvar calc-mode-save-hook
 This hook is called by the @code{calc-save-modes} command,
 after Calc's own mode features have been inserted into the
-@file{.emacs} buffer and just before the ``End of mode settings''
+Calc init file and just before the ``End of mode settings''
 message is inserted.
 @end defvar
 
@@ -34545,8 +34513,8 @@
 Another variable you might want to set is @code{calc-settings-file},
 which holds the file name in which commands like @kbd{m m} and @kbd{Z P}
 store ``permanent'' definitions.  The default value for this variable
-is @code{"~/.emacs"}.  If @code{calc-settings-file} does not contain
-@code{".emacs"} as a substring, and if the variable
+is @code{"~/.calc.el"}.  If @code{calc-settings-file} is not your user
+init file (typically @file{~/.emacs}) and if the variable
 @code{calc-loaded-settings-file} is @code{nil}, then Calc will
 automatically load your settings file (if it exists) the first time
 Calc is invoked.
@@ -35893,7 +35861,7 @@
 corresponding Lisp variable.
 
 The remaining variables are Lisp variables suitable for @code{setq}ing
-in your @file{.emacs} file.
+in your Calc init file or @file{.emacs} file.
 
 @printindex vr
 
--- a/man/commands.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/commands.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -222,13 +222,15 @@
 forward by words instead.  Rebinding keys is a common method of
 customization.@refill
 
-  In the rest of this manual, we usually ignore this subtlety to keep
-things simple.  To give the information needed for customization, we
-state the name of the command which really does the work in parentheses
+  In the rest of this manual, we usually ignore this distinction to
+keep things simple.  We will often speak of keys like @kbd{C-n} as
+commands, even though strictly speaking a key is bound to some
+command.  To give the information needed for customization, we state
+the name of the command which really does the work in parentheses
 after mentioning the key that runs it.  For example, we will say that
 ``The command @kbd{C-n} (@code{next-line}) moves point vertically
-down,'' meaning that @code{next-line} is a command that moves vertically
-down, and @kbd{C-n} is a key that is normally bound to it.
+down,'' meaning that @code{next-line} is a command that moves
+vertically down, and @kbd{C-n} is a key that is normally bound to it.
 
   While we are on the subject of information for customization only,
 it's a good time to tell you about @dfn{variables}.  Often the
--- a/man/custom.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/custom.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -487,21 +487,12 @@
   The customization buffer normally saves customizations in
 @file{~/.emacs}.  If you wish, you can save customizations in another
 file instead.  To make this work, your @file{~/.emacs} should set
-@code{custom-file} to the name of that file.  If you are using Emacs
-version 21.4 or later, Emacs loads the file right after your
-@file{.emacs} if you did not load it already.  In earlier versions,
-you have to load the file in your @file{~/emacs}.  If you customize
-@code{custom-file} through the @samp{Customize} interface, you still
-need to load it in your @file{.emacs}, but there is no need to set
-it.  For example:
+@code{custom-file} to the name of that file.  Then you should load the
+file by calling @code{load}.  For example:
 
 @example
-;; @r{if not set through the @samp{Customize} interface:}
-(setq custom-file "~/.emacs-custom")
-
-;; @r{in Emacs versions before 21.4 or if set through}
-;; @r{the @samp{Customize} interface.}
-(load "~/.emacs-custom")
+(setq custom-file "~/.emacs-custom.el")
+(load custom-file)
 @end example
 
   You can also use @code{custom-file} to specify different
--- a/man/display.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/display.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -120,9 +120,9 @@
 For example, mouse-sensitive text is highlighted using this face.
 @item isearch
 This face is used for highlighting Isearch matches.
-@item isearch-lazy-highlight-face
-This face is used for lazy highlighting of Isearch matches other than
-the current one.
+@item lazy-highlight
+This face is used for lazy highlighting of Isearch and Query Replace
+matches other than the current one.
 @item region
 This face is used for displaying a selected region (when Transient Mark
 mode is enabled---see below).
--- a/man/faq.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/faq.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -1583,7 +1583,7 @@
 To do this relative to your home directory:
 
 @lisp
-(setq load-path (cons "~/mysubdir/" load-path)
+(setq load-path (cons "~/mysubdir/" load-path))
 @end lisp
 
 @node Using an already running Emacs process, Compiler error messages, Changing load-path, Common requests
--- a/man/message.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/message.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -146,16 +146,15 @@
 This function will be called narrowed to the head of the article that is
 being replied to.
 
-As you can see, this function should return a string if it has an
-opinion as to what the To header should be.  If it does not, it should
-just return @code{nil}, and the normal methods for determining the To
-header will be used.
-
-This function can also return a list.  In that case, each list element
-should be a cons, where the @sc{car} should be the name of a header
-(e.g. @code{Cc}) and the @sc{cdr} should be the header value
-(e.g. @samp{larsi@@ifi.uio.no}).  All these headers will be inserted into
-the head of the outgoing mail.
+As you can see, this function should return a list.  In this case, it
+returns @code{((To . "Whom"))} if it has an opinion as to what the To
+header should be.  If it does not, it should just return @code{nil}, and
+the normal methods for determining the To header will be used.
+
+Each list element should be a cons, where the @sc{car} should be the
+name of a header (e.g. @code{Cc}) and the @sc{cdr} should be the header
+value (e.g. @samp{larsi@@ifi.uio.no}).  All these headers will be
+inserted into the head of the outgoing mail.
 
 
 @node Wide Reply
--- a/man/org.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/org.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -3,7 +3,7 @@
 @setfilename ../info/org
 @settitle Org Mode Manual
 
-@set VERSION 3.03
+@set VERSION 3.04
 @set DATE December 2004
 
 @dircategory Emacs
@@ -119,6 +119,7 @@
 
 * Built-in table editor::       Simple tables
 * table.el::                    Complex tables
+* orgtbl-mode::                 The table editor as minor mode
 
 Hyperlinks
 
@@ -202,6 +203,17 @@
 @r{@bullet{} as a full agenda and planner with deadlines and work scheduling}
 @end example
 
+The Org-mode table editor can be used integrated into any major mode
+by activating the minor Ortbl-mode.
+
+There is a website for Org-mode which provides links to the newest
+version of Org-mode, as well as additional information, screen shots
+and example files.  This page is located at
+@uref{http://www.astro.uva.nl/~dominik/Tools/org/}.
+
+
+@page
+
 @node Installation,  , Summary, Introduction
 @section Installation
 @cindex installation
@@ -223,12 +235,13 @@
 define @emph{global} keys for the commands @command{org-store-link}
 and @command{org-agenda} - please choose suitable keys yourself.
 
-@c FIXME: autoloads not necessary when part of emacs
 @lisp
 (autoload 'org-mode "org" "Org mode" t)
 (autoload 'org-diary "org" "Diary entries from Org mode")
 (autoload 'org-agenda "org" "Multi-file agenda from Org mode" t)
 (autoload 'org-store-link "org" "Store a link to the current location" t)
+(autoload 'orgtbl-mode "org" "Org tables as a minor mode" t)
+(autoload 'turn-on-orgtbl "org" "Org tables as a minor mode")
 (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
 (define-key global-map "\C-cl" 'org-store-link)
 (define-key global-map "\C-ca" 'org-agenda)
@@ -656,6 +669,7 @@
 @menu
 * Built-in table editor::       Simple tables
 * table.el::                    Complex tables
+* orgtbl-mode::                 The table editor as minor mode
 @end menu
 
 @node Built-in table editor, table.el, Tables, Tables
@@ -855,7 +869,7 @@
 @noindent The only table command which then still works is
 @kbd{C-c C-c} to do a manual re-align.
 
-@node table.el,  , Built-in table editor, Tables
+@node table.el, orgtbl-mode, Built-in table editor, Tables
 @section The @file{table.el} package
 @kindex C-c C-c
 @cindex table editor, table.el
@@ -879,6 +893,20 @@
 possible.
 @end table
 
+@node orgtbl-mode,  , table.el, Tables
+@section The Orgtbl minor mode
+@cindex orgtbl-mode
+@cindex Minor mode for tables
+
+If you like the intuitive way the Org-mode table editor works, you
+might want to use it also in other modes like text-mode or mail-mode.
+The minor mode Orgtbl-mode make 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
+
 @node Hyperlinks, Timestamps, Tables, Top
 @chapter Hyperlinks
 @cindex hyperlinks
@@ -1084,7 +1112,7 @@
 @cindex deadline
 If a time stamp is preceded by the word @samp{DEADLINE:}, the task
 (most likely a TODO item) is supposed to be finished on that date, and
-it will be listed then In addition, the compilation for the
+it will be listed then.  In addition, the compilation for the
 @emph{current day} will carry a warning about the approaching or
 missed deadline, starting @code{org-deadline-warning-days} before the
 due date, and continuing until the entry is marked DONE.  An example:
--- a/man/programs.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/programs.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -17,9 +17,9 @@
 Apply the usual indentation conventions of the language
 (@pxref{Program Indent}).
 @item
-Insert, kill or align comments (@pxref{Comments}).
+Balance parentheses (@pxref{Parentheses}).
 @item
-Balance parentheses (@pxref{Parentheses}).
+Insert, kill or align comments (@pxref{Comments}).
 @item
 Highlight program syntax (@pxref{Font Lock}).
 @end itemize
@@ -81,7 +81,7 @@
 @cindex PostScript mode
   The existing programming language major modes include Lisp, Scheme (a
 variant of Lisp) and the Scheme-based DSSSL expression language, Ada,
-AWK, C, C++, Delphi (Object Pascal), Fortran (free format and fixed
+ASM, AWK, C, C++, Delphi (Object Pascal), Fortran (free format and fixed
 format), Icon, IDL (CORBA), IDLWAVE, Java, Metafont (@TeX{}'s
 companion for font creation), Modula2, Objective-C, Octave, Pascal,
 Perl, Pike, PostScript, Prolog, Simula, Tcl, and VHDL.  There is
@@ -316,11 +316,11 @@
 @vindex which-func-modes
   To enable (or disable) Which Function mode, use the command @kbd{M-x
 which-function-mode}.  This command is global; it applies to all
-buffers, both existing ones and those yet to be created.  However,
-it only takes effect in certain major modes, those listed in the value of
-@code{which-func-modes}.  If the value is @code{t}, then Which
-Function mode applies to all major modes that know how to support
-it---in other words, all the major modes that support Imenu.
+buffers, both existing ones and those yet to be created.  However, it
+takes effect only in certain major modes, those listed in the value of
+@code{which-func-modes}.  If the value is @code{t}, then Which Function
+mode applies to all major modes that know how to support it---in other
+words, all the major modes that support Imenu.
 
 @node Program Indent
 @section Indentation for Programs
@@ -365,7 +365,7 @@
   The basic indentation command is @key{TAB}, which gives the current line
 the correct indentation as determined from the previous lines.  The
 function that @key{TAB} runs depends on the major mode; it is
-@code{indent-for-tab-command}
+@code{lisp-indent-line}
 in Lisp mode, @code{c-indent-command} in C mode, etc.  These functions
 understand the syntax and conventions of different languages, but they all do
 conceptually the same job: @key{TAB} in any programming-language major mode
@@ -411,7 +411,7 @@
 
 @table @kbd
 @item C-M-q
-Reindent all the lines within one parenthetical grouping(@code{indent-sexp}).
+Reindent all the lines within one parenthetical grouping (@code{indent-pp-sexp}).
 @item C-M-\
 Reindent all lines in the region (@code{indent-region}).
 @item C-u @key{TAB}
@@ -423,12 +423,12 @@
 @end table
 
 @kindex C-M-q
-@findex indent-sexp
+@findex indent-pp-sexp
   You can reindent the contents of a single parenthetical grouping by
 positioning point before the beginning of it and typing @kbd{C-M-q}
-(@code{indent-sexp} in Lisp mode, @code{c-indent-exp} in C mode; also
+(@code{indent-pp-sexp} in Lisp mode, @code{c-indent-exp} in C mode; also
 bound to other suitable commands in other modes).  The indentation of
-the line where the grouping starts is not changed; therefore, this
+the line where the grouping starts is not changed; therefore this
 changes only the relative indentation within the grouping, not its
 overall indentation.  To correct that as well, type @key{TAB} first.
 
@@ -455,6 +455,7 @@
 region sideways, like @code{indent-rigidly} does (@pxref{Indentation
 Commands}).  It doesn't alter the indentation of lines that start
 inside a string, unless the region also starts inside that string.
+The prefix arg specifies the number of columns to indent.
 
 @node Lisp Indent
 @subsection Customizing Lisp Indentation
@@ -638,7 +639,7 @@
 @item C-M-f
 Move forward over a balanced expression (@code{forward-sexp}).
 @item C-M-b
-Move backward over a balanced expression(@code{backward-sexp}).
+Move backward over a balanced expression (@code{backward-sexp}).
 @item C-M-k
 Kill balanced expression forward (@code{kill-sexp}).
 @item C-M-t
@@ -746,7 +747,7 @@
 @item C-M-n
 Move forward over a parenthetical group (@code{forward-list}).
 @item C-M-p
-Move backward over a parenthetical group(@code{backward-list}).
+Move backward over a parenthetical group (@code{backward-list}).
 @item C-M-u
 Move up in parenthesis structure (@code{backward-up-list}).
 @item C-M-d
@@ -797,8 +798,9 @@
 @vindex blink-matching-paren
 @vindex blink-matching-paren-distance
 @vindex blink-matching-delay
-  Three variables control parenthesis match display.
-@code{blink-matching-paren} turns the feature on or off: @code{nil}
+  Three variables control parenthesis match display:
+
+  @code{blink-matching-paren} turns the feature on or off: @code{nil}
 disables it, but the default is @code{t} to enable match display.
 
   @code{blink-matching-delay} says how many seconds to leave the
@@ -1142,7 +1144,7 @@
 program.}.  Unlike @kbd{M-x man}, it does not run any external
 programs to format and display the man pages; instead it does the job
 in Emacs Lisp, so it works on systems such as MS-Windows, where the
-@code{man} program (and the other programs it uses) are not generally
+@code{man} program (and other programs it uses) are not generally
 available.
 
   @kbd{M-x woman} prompts for a name of a manual page, and provides
@@ -1220,8 +1222,9 @@
 mode constantly displays in the echo area the argument list for the
 function being called at point.  (In other words, it finds the
 function call that point is contained in, and displays the argument
-list of that function.)  Eldoc mode applies in Emacs Lisp and Lisp
-Interaction modes only.  Use the command @kbd{M-x eldoc-mode} to
+list of that function.)  If point is over a documented variable, it
+shows the variable's docstring.  Eldoc mode applies in Emacs Lisp and
+Lisp Interaction modes only.  Use the command @kbd{M-x eldoc-mode} to
 enable or disable this feature.
 
 @node Hideshow
@@ -1259,9 +1262,9 @@
 @item C-c @@ C-s
 Show the current block (@code{hs-show-block}).
 @item C-c @@ C-c
-Either hide or show the current block (@code{hs-toggle-hiding})
+Either hide or show the current block (@code{hs-toggle-hiding}).
 @item S-Mouse-2
-Either hide or show the block you click on (@code{hs-mouse-toggle-hiding})
+Either hide or show the block you click on (@code{hs-mouse-toggle-hiding}).
 @item C-c @@ C-M-h
 Hide all top-level blocks (@code{hs-hide-all}).
 @item C-c @@ C-M-s
@@ -1282,7 +1285,7 @@
 
 @item hs-isearch-open
 Specifies what kind of hidden blocks to open in Isearch mode.
-The value should be one of these four symbols.
+The value should be one of these four symbols:
 
 @table @code
 @item code
@@ -1735,8 +1738,8 @@
 @findex c-show-syntactic-information
 @kindex C-c C-s @r{(C mode)}
 Display the syntactic information about the current source line
-(@code{c-show-syntactic-information}).  This is the information that
-directs how the line is indented.
+(@code{c-show-syntactic-information}).  This information directs how
+the line is indented.
 
 @item M-x cwarn-mode
 @itemx M-x global-cwarn-mode
@@ -1958,16 +1961,15 @@
   Line numbers of four digits or less are normally indented one space.
 The variable @code{fortran-line-number-indent} controls this; it
 specifies the maximum indentation a line number can have.  Line numbers
-are indented to right-justify them to end in column 4 unless that would
-require more than this maximum indentation.  The default value of the
-variable is 1.
+are right-justified to end in column 4 unless that would require more
+than this maximum indentation.  The default value of the variable is 1.
 
 @vindex fortran-electric-line-number
   Simply inserting a line number is enough to indent it according to
 these rules.  As each digit is inserted, the indentation is recomputed.
 To turn off this feature, set the variable
-@code{fortran-electric-line-number} to @code{nil}.  Then inserting line
-numbers is like inserting anything else.
+@code{fortran-electric-line-number} to @code{nil}.  
+
 
 @node ForIndent Conv
 @subsubsection Syntactic Conventions
@@ -2064,7 +2066,7 @@
 
 @table @kbd
 @item M-;
-Align comment or insert new comment (@code{fortran-comment-indent}).
+Align comment or insert new comment (@code{fortran-indent-comment}).
 
 @item C-x ;
 Applies to nonstandard @samp{!} comments only.
@@ -2075,7 +2077,7 @@
 @end table
 
   @kbd{M-;} in Fortran mode is redefined as the command
-@code{fortran-comment-indent}.  Like the usual @kbd{M-;} command, this
+@code{fortran-indent-comment}.  Like the usual @kbd{M-;} command, this
 recognizes any kind of existing comment and aligns its text appropriately;
 if there is no existing comment, a comment is inserted and aligned.  But
 inserting and aligning comments are not the same in Fortran mode as in
@@ -2111,7 +2113,7 @@
 @code{fortran-comment-line-extra-indent} columns of indentation.
 
 @item nil
-Don't move text in full-line comments automatically at all.
+Don't move text in full-line comments automatically.
 @end table
 
 @vindex fortran-comment-indent-char
@@ -2165,14 +2167,11 @@
 also in the Fortran indentation commands.
 
 @findex fortran-auto-fill-mode
-  @kbd{M-x fortran-auto-fill-mode} turns Fortran Auto Fill mode on if it
-was off, or off if it was on.  This command works the same as @kbd{M-x
-auto-fill-mode} does for normal Auto Fill mode (@pxref{Filling}).  A
-positive numeric argument turns Fortran Auto Fill mode on, and a
-negative argument turns it off.  You can see when Fortran Auto Fill mode
-is in effect by the presence of the word @samp{Fill} in the mode line,
-inside the parentheses.  Fortran Auto Fill mode is a minor mode, turned
-on or off for each buffer individually.  @xref{Minor Modes}.
+  @kbd{M-x fortran-auto-fill-mode} toggles Fortran Auto Fill mode,
+which is a variant of normal Auto Fill mode (@pxref{Filling}) designed
+for Fortran programs.  Fortran Auto Fill mode is a buffer-local minor
+mode (@pxref{Minor Modes}).  When Fortran Auto Fill mode is in effect,
+the word @samp{Fill} appears in the mode line inside the parentheses.
 
 @vindex fortran-break-before-delimiters
    Fortran Auto Fill mode breaks lines at spaces or delimiters when the
@@ -2183,8 +2182,7 @@
 @code{fortran-break-before-delimiters} is @code{nil}.  Otherwise (and by
 default), the break comes before the delimiter.
 
-  By default, Fortran Auto Fill mode is not enabled.  If you want this
-feature turned on permanently, add a hook function to
+  To enable this mode permanently, add a hook function to
 @code{fortran-mode-hook} to execute @code{(fortran-auto-fill-mode 1)}.
 @xref{Hooks}.
 
@@ -2223,12 +2221,13 @@
 
 @vindex fortran-column-ruler-fixed
 @vindex fortran-column-ruler-tabs
-  The text used to display the column ruler depends on the value of
-the variable @code{indent-tabs-mode}.  If @code{indent-tabs-mode} is
+  The text used to display the column ruler depends on the value of the
+variable @code{indent-tabs-mode}.  If @code{indent-tabs-mode} is
 @code{nil}, then the value of the variable
 @code{fortran-column-ruler-fixed} is used as the column ruler.
-Otherwise, the variable @code{fortran-column-ruler-tab} is displayed.
-By changing these variables, you can change the column ruler display.
+Otherwise, the value of the variable @code{fortran-column-ruler-tab} is
+displayed.  By changing these variables, you can change the column ruler
+display.
 
 @kindex C-c C-w @r{(Fortran mode)}
 @findex fortran-window-create-momentarily
--- a/man/reftex.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/reftex.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -5,9 +5,17 @@
 @synindex ky cp
 @syncodeindex vr cp
 @syncodeindex fn cp
-@set VERSION 4.19
-@set EDITION 4.19
-@set DATE August 2002
+
+@c Version and Contact Info
+@set VERSION 4.24
+@set EDITION 4.24
+@set DATE August 2004
+@set AUCTEXSITE @uref{http://www.nongnu.org/auctex/,AUCTeX distribution site}
+@set MAINTAINERSITE @uref{http://www.astro.uva.nl/~dominik/Tools/,maintainers webpage}
+@set MAINTAINER Carsten Dominik
+@set MAINTAINEREMAIL @email{dominik@@science.uva.nl}
+@set MAINTAINERCONTACT @uref{mailto:dominik@@science.uva.nl,contact the maintainer}
+@set XEMACSFTP @uref{ftp://ftp.xemacs.org/pub/xemacs/packages/,XEmacs ftp site}.
 @c %**end of header
 
 @copying
@@ -15,7 +23,7 @@
 citations and indices for LaTeX documents with Emacs.
 
 This is edition @value{EDITION} of the @b{Ref@TeX{}} User Manual for
-@b{Ref@TeX{}} @value{VERSION}.
+@b{Ref@TeX{}} @value{VERSION}
 
 Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 
@@ -73,13 +81,13 @@
 @node Top,,,(dir)
 
 @b{Ref@TeX{}} is a package for managing Labels, References,
-Citations and index entries with GNU Emacs.@refill
+Citations and index entries with GNU Emacs.
 
 Don't be discouraged by the size of this manual, which covers
 @b{Ref@TeX{}} in great depth.  All you need to know to use
 @b{Ref@TeX{}} can be summarized on two pages (@pxref{RefTeX in a
 Nutshell}).  You can go back later to other parts of this document when
-needed.@refill
+needed.
 
 @menu
 * Introduction::                     Quick-Start information.
@@ -145,6 +153,7 @@
 * Citation Info::                    View the corresponding database entry.
 * Chapterbib and Bibunits::          Multiple bibliographies in a Document.
 * Citations Outside LaTeX::          How to make citations in Emails etc.
+* BibTeX Database Subsets::          Extract parts of a big database. 
 
 Index Support
 
@@ -196,7 +205,7 @@
 different parts of the document and searching through BibTeX database
 files.  @b{Ref@TeX{}} automates these time--consuming tasks almost
 entirely.  It also provides functions to display the structure of a
-document and to move around in this structure quickly.@refill
+document and to move around in this structure quickly.
 
 @iftex
 Don't be discouraged by the size of this manual, which covers @b{Ref@TeX{}}
@@ -217,17 +226,15 @@
 @section Installation
 @cindex Installation
 
-@b{Ref@TeX{}} is bundled and pre--installed with Emacs since version 20.2.
-It was also bundled and pre--installed with XEmacs 19.16--20.x.  XEmacs
-21.x users want to install the corresponding plug-in package which is
-available from the
-@uref{ftp://ftp.xemacs.org/pub/xemacs/packages/,XEmacs ftp site}.  See
-the XEmacs 21.x documentation on package installation for
-details.@refill
+@b{Ref@TeX{}} is bundled and pre--installed with Emacs since version
+20.2.  It was also bundled and pre--installed with XEmacs 19.16--20.x.
+XEmacs 21.x users want to install the corresponding plug-in package
+which is available from the @value{XEMACSFTP}.  See the XEmacs 21.x
+documentation on package installation for details.
 
 Users of earlier Emacs distributions (including Emacs 19) can get a copy
 of the @b{Ref@TeX{}} distribution from the maintainers web-page.
-@xref{Imprint}, for more information.@refill
+@xref{Imprint}, for more information.
 
 @section Environment
 @cindex Finding files
@@ -254,7 +261,7 @@
 @vindex latex-mode-hook
 To turn @b{Ref@TeX{}} Mode on and off in a particular buffer, use
 @kbd{M-x reftex-mode}.  To turn on @b{Ref@TeX{}} Mode for all LaTeX
-files, add the following lines to your @file{.emacs} file:@refill
+files, add the following lines to your @file{.emacs} file:
 
 @example
 (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
@@ -275,7 +282,7 @@
 a table of contents of the document.  This buffer can display sections,
 labels and index entries defined in the document.  From the buffer, you
 can jump quickly to every part of your document.  Press @kbd{?} to get
-help.@refill
+help.
 
 @item
 @b{Labels and References}@* @b{Ref@TeX{}} helps to create unique labels
@@ -283,7 +290,7 @@
 labels for different environments, knows about all standard
 environments (and many others), and can be configured to recognize any
 additional labeled environments you have defined yourself (variable
-@code{reftex-label-alist}).@refill
+@code{reftex-label-alist}).
 
 @itemize @bullet
 @item
@@ -297,18 +304,18 @@
 prompt for a label string (default for figures and tables) or
 @item
 insert a simple label made of a prefix and a number (all other
-environments)@refill
+environments)
 @end itemize
 @noindent
 Which labels are created how is configurable with the variable
-@code{reftex-insert-label-flags}.@refill
+@code{reftex-insert-label-flags}.
 
 @item
 @b{Referencing Labels}@* To make a reference, type @kbd{C-c )}
 (@code{reftex-reference}).  This shows an outline of the document with
 all labels of a certain type (figure, equation,...) and some label
 context.  Selecting a label inserts a @code{\ref@{@var{label}@}} macro
-into the original buffer.@refill
+into the original buffer.
 @end itemize
 
 @item
@@ -319,7 +326,7 @@
 matches for you to choose from.  The list is @emph{formatted} and
 sorted.  The selected article is referenced as @samp{\cite@{@var{key}@}}
 (see the variable @code{reftex-cite-format} if you want to insert
-different macros).@refill
+different macros).
 
 @item
 @b{Index Support}@*
@@ -328,7 +335,7 @@
 can use to check and edit the entries.  @b{Ref@TeX{}} knows about the
 standard index macros and can be configured to recognize any additional
 macros you have defined (@code{reftex-index-macros}).  Multiple indices
-are supported.@refill
+are supported.
 
 @itemize @bullet
 @item
@@ -337,20 +344,20 @@
 (@code{reftex-index-selection-or-word}).  The default macro
 @code{reftex-index-default-macro} will be used.  For a more complex entry
 type @kbd{C-c <} (@code{reftex-index}), select any of the index macros
-and enter the arguments with completion.@refill
+and enter the arguments with completion.
 
 @item
 @b{The Index Phrases File (Delayed Indexing)}@*
 Type @kbd{C-c \} (@code{reftex-index-phrase-selection-or-word}) to add
 the current word or selection to a special @emph{index phrase file}.
 @b{Ref@TeX{}} can later search the document for occurrences of these
-phrases and let you interactively index the matches.@refill
+phrases and let you interactively index the matches.
 
 @item
 @b{Displaying and Editing the Index}@*
 To display the compiled index in a special buffer, type @kbd{C-c >}
 (@code{reftex-display-index}).  From that buffer you can check and edit
-all entries.@refill
+all entries.
 @end itemize
 
 @page
@@ -360,10 +367,10 @@
 @code{\index}, and variations) or inside a BibTeX database entry, you
 can press @kbd{C-c &} (@code{reftex-view-crossref}) to display
 corresponding locations in the document and associated BibTeX database
-files.@refill @*
+files. @*
 When the enclosing macro is @code{\cite} or @code{\ref} and no other
 message occupies the echo area, information about the citation or label
-will automatically be displayed in the echo area.@refill
+will automatically be displayed in the echo area.
 
 @item
 @b{Multifile Documents}@*
@@ -371,7 +378,7 @@
 file variable @code{TeX-master} or @code{tex-main-file} pointing to the
 master file.  @b{Ref@TeX{}} provides cross-referencing information from
 all parts of the document, and across document borders
-(@file{xr.sty}).@refill
+(@file{xr.sty}).
 
 @item
 @b{Document Parsing}@* @b{Ref@TeX{}} needs to parse the document in
@@ -380,14 +387,14 @@
 @code{reftex-index} are used.  To enforce reparsing, call any of the
 commands described above with a raw @kbd{C-u} prefix, or press the
 @kbd{r} key in the label selection buffer, the table of contents
-buffer, or the index buffer.@refill
+buffer, or the index buffer.
 
 @item
 @b{AUCTeX} @* If your major LaTeX mode is AUCTeX, @b{Ref@TeX{}} can
 cooperate with it (see variable @code{reftex-plug-into-AUCTeX}).  AUCTeX
 contains style files which trigger appropriate settings in
 @b{Ref@TeX{}}, so that for many of the popular LaTeX packages no
-additional customizations will be necessary.@refill
+additional customizations will be necessary.
 
 @item
 @b{Useful Settings}@*
@@ -397,7 +404,7 @@
 @end lisp
 
 To make your own LaTeX macro definitions known to @b{Ref@TeX{}},
-customize the variables@refill
+customize the variables
 @example
 @code{reftex-label-alist}          @r{(for label macros/environments)}
 @code{reftex-section-levels}       @r{(for sectioning commands)}
@@ -407,7 +414,7 @@
 @end example
 If you have a large number of macros defined, you may want to write
 an AUCTeX style file to support them with both AUCTeX and
-@b{Ref@TeX{}}.@refill
+@b{Ref@TeX{}}.
 
 @item @b{Where Next?}@* Go ahead and use @b{Ref@TeX{}}.  Use its menus
 until you have picked up the key bindings.  For an overview of what you
@@ -415,12 +422,13 @@
 the manual if you get stuck, of if you are curious what else might be
 available.  The first part of the manual explains in
 a tutorial way how to use and customize @b{Ref@TeX{}}.  The second
-part is a command and variable reference.@refill
+part is a command and variable reference.
 @end enumerate
 
 @node Table of Contents, Labels and References, Introduction, Top
 @chapter Table of Contents
 @cindex @file{*toc*} buffer
+@cindex Structure editing
 @cindex Table of contents buffer
 @findex reftex-toc
 @kindex C-c =
@@ -429,16 +437,16 @@
 contents of the document.  By default, this @file{*toc*} buffer shows
 only the sections of a document.  Using the @kbd{l} and @kbd{i} keys you
 can display all labels and index entries defined in the document as
-well.@refill
+well.
 
 With the cursor in any of the lines denoting a location in the
 document, simple key strokes will display the corresponding part in
-another window, jump to that location, or perform other actions.@refill
+another window, jump to that location, or perform other actions.
 
 @kindex ?
 Here is a list of special commands in the @file{*toc*} buffer.  A
 summary of this information is always available by pressing
-@kbd{?}.@refill
+@kbd{?}.
 
 @table @kbd
 
@@ -458,19 +466,19 @@
 
 @item C-c C-n
 Goto next section heading.  Useful when many labels and index entries
-separate section headings.@refill
+separate section headings.
 
 @item C-c C-p
 Goto previous section heading.
 
 @item N z
 Jump to section N, using the prefix arg.  For example, @kbd{3 z} jumps
-to section 3.@refill
+to section 3.
 
 @tablesubheading{Access to document locations}
 @item @key{SPC}
 Show the corresponding location in another window.  This command does
-@emph{not} select that other window.@refill
+@emph{not} select that other window.
 
 @item @key{TAB}
 Goto the location in another window.
@@ -478,13 +486,13 @@
 @item @key{RET}
 Go to the location and hide the @file{*toc*} buffer.  This will restore
 the window configuration before @code{reftex-toc} (@kbd{C-c =}) was
-called.@refill
+called.
 
 @item mouse-2
 @vindex reftex-highlight-selection
 Clicking with mouse button 2 on a line has the same effect as @key{RET}.
 See also variable @code{reftex-highlight-selection}, @ref{Options
-(Fontification)}.@refill
+(Fontification)}.
 
 @item f
 @vindex reftex-toc-follow-mode
@@ -496,21 +504,47 @@
 @code{reftex-toc-follow-mode}.  Note that only context in files already
 visited is shown.  @b{Ref@TeX{}} will not visit a file just for follow
 mode.  See, however, the variable
-@code{reftex-revisit-to-follow}.@refill
+@code{reftex-revisit-to-follow}.
 
 @item .
 Show calling point in another window.  This is the point from where
 @code{reftex-toc} was last called.
 
 @page
+@tablesubheading{Promotion and Demotion}
+
+@item <
+Promote the current section.  This will convert @code{\section} to
+@code{\chapter}, @code{\subsection} to @code{\section} etc. If there is
+an active region, all sections in the region will be promoted, including
+the one at point.  To avoid mistakes, @b{Ref@TeX{}} requires a fresh
+document scan before executing this command - if necessary, it will
+automatically do this scan and ask the user to repeat the promotion
+command.
+
+@item >
+Demote the current section.  This is the opposite of promotion.  It will
+convert @code{\chapter} to @code{\section} etc.  If there is an active
+region, all sections in the region will be demoted, including the one at
+point.
+
+@item M-%
+Rename the label at point.  While generally not recommended, this can be
+useful when a package like @file{fancyref} is used where the label
+prefix determines the wording of a reference.  After a
+promotion/demotion it may be necessary to change a few labels from
+@samp{sec:xyz} to @samp{cha:xyz} or vice versa.  This command can be
+used to do this - it launches a query replace to rename the definition
+and all references of a label.
+
 @tablesubheading{Exiting}
 @item q
 Hide the @file{*toc*} buffer, return to the position where
-@code{reftex-toc} was last called.@refill
+@code{reftex-toc} was last called.
 
 @item k
 Kill the @file{*toc*} buffer, return to the position where
-@code{reftex-toc} was last called.@refill
+@code{reftex-toc} was last called.
 
 @item C-c >
 Switch to the @file{*Index*} buffer of this document.  With prefix
@@ -527,13 +561,13 @@
 @var{arg} (3 in this case).  Chapters are level 1, sections are level 2.
 The mode line @samp{T<>} indicator shows the current value.  The default
 depth can be configured with the variable
-@code{reftex-toc-max-level}.@refill
+@code{reftex-toc-max-level}.
 
 @item F
 @vindex reftex-toc-include-file-boundaries
 Toggle the display of the file borders of a multifile document in the
 @file{*toc*} buffer.  The default for this flag can be set with the
-variable @code{reftex-toc-include-file-boundaries}.@refill
+variable @code{reftex-toc-include-file-boundaries}.
 
 @item l
 @vindex reftex-toc-include-labels
@@ -542,7 +576,7 @@
 @code{reftex-toc-include-labels}.  When called with a prefix argument,
 @b{Ref@TeX{}} will prompt for a label type and include only labels of
 the selected type in the @file{*toc*} buffer.  The mode line @samp{L<>}
-indicator shows which labels are included.@refill
+indicator shows which labels are included.
 
 @item i
 @vindex reftex-toc-include-index-entries
@@ -551,47 +585,57 @@
 @code{reftex-toc-include-index-entries}.  When called with a prefix
 argument, @b{Ref@TeX{}} will prompt for a specific index and include
 only entries in the selected index in the @file{*toc*} buffer.  The mode
-line @samp{I<>} indicator shows which index is used.@refill
+line @samp{I<>} indicator shows which index is used.
 
 @item c
 @vindex reftex-toc-include-context
 Toggle the display of label and index context in the @file{*toc*}
 buffer.  The default for this flag can be set with the variable
-@code{reftex-toc-include-context}.@refill
+@code{reftex-toc-include-context}.
 
 @tablesubheading{Updating the buffer}
 
 @item g
 Rebuild the @file{*toc*} buffer.  This does @emph{not} rescan the
-document.@refill
+document.
 
 @item r
 @vindex reftex-enable-partial-scans
 Reparse the LaTeX document and rebuild the @file{*toc*} buffer.  When
 @code{reftex-enable-partial-scans} is non-@code{nil}, rescan only the file this
-location is defined in, not the entire document.@refill
+location is defined in, not the entire document.
 
 @item C-u r
 Reparse the @emph{entire} LaTeX document and rebuild the @file{*toc*}
-buffer.@refill
+buffer.
 
 @item x
 Switch to the @file{*toc*} buffer of an external document.  When the
 current document is using the @code{xr} package (@pxref{xr (LaTeX
 package)}), @b{Ref@TeX{}} will switch to one of the external
-documents.@refill
+documents.
+
+
+@tablesubheading{Automatic recentering}
+
+@item d
+Toggle the display of a dedicated frame displaying just the @file{*toc*}
+buffer.  Follow mode and visiting locations will not work that frame,
+but automatic recentering will make this frame always show your current
+editing location in the document (see below).
 
 @item a
 Toggle the automatic recentering of the @file{*toc*} buffer.  When this
 option is on, moving around in the document will cause the @file{*toc*}
-to always highlight the current section.  This can be enabled by default
-with the variable @code{reftex-auto-recenter-toc}.
+to always highlight the current section.  By default, this option is
+active while the dedicated @file{*TOC*} frame exists.  See also the
+variable @code{reftex-auto-recenter-toc}.
 
 @end table
 
 @vindex reftex-toc-map
 In order to define additional commands for the @file{*toc*} buffer, the
-keymap @code{reftex-toc-map} may be used.@refill
+keymap @code{reftex-toc-map} may be used.
 
 @findex reftex-toc-recenter
 @vindex reftex-auto-recenter-toc
@@ -605,13 +649,15 @@
 The command @kbd{C-c -} (@code{reftex-toc-recenter}) will only redisplay
 the @file{*toc*} buffer and highlight the correct line without actually
 selecting the @file{*toc*} window.  This can be useful to quickly find
-out where in the document you currently are.  If you want the TOC buffer
-to show the current section automatically whenever you stop typing, try
+out where in the document you currently are.  You can also automate this
+by asking RefTeX to keep track of your current editing position in the
+TOC.  The TOC window will then be updated whenever you stop typing for
+more than @code{reftex-idle-time} seconds.  By default this works only
+with the dedicated @file{*TOC*} frame.  But you can also force automatic
+recentering of the TOC window on the current frame with
 @lisp
 (setq reftex-auto-recenter-toc t)
 @end lisp
-When this is turned on, the toc buffer will be recentered whenever Emacs
-is idle for more than @code{reftex-idle-time} seconds.
 
 
 @cindex Sectioning commands
@@ -641,17 +687,17 @@
 label, like @samp{\label@{mark@}}.  LaTeX records the current value of a
 certain counter when a label is defined.  Later references to this label
 (like @samp{\ref@{mark@}}) will produce the recorded value of the
-counter.@refill
+counter.
 
 Labels can be used to mark sections, figures, tables, equations,
 footnotes, items in enumerate lists etc.  LaTeX is context sensitive in
 doing this: A label defined in a figure environment automatically
-records the figure counter, not the section counter.@refill
+records the figure counter, not the section counter.
 
 Several different environments can share a common counter and therefore
 a common label category.  E.g.  labels in both @code{equation} and
 @code{eqnarray} environments record the value of the same counter - the
-equation counter.@refill
+equation counter.
 
 @menu
 * Creating Labels::
@@ -677,7 +723,7 @@
 and will figure out the environment it currently is in and adapt the
 label to that environment.  A label usually consists of a short prefix
 indicating the type of the label and a unique mark.  @b{Ref@TeX{}} has
-3 different modes to create this mark.@refill
+3 different modes to create this mark.
 
 @enumerate
 @item
@@ -698,7 +744,7 @@
 where the section heading is used to construct a label.  In fact,
 @b{Ref@TeX{}}'s default settings use this method only for section
 labels.  You will be asked to confirm the derived label, or edit
-it.@refill
+it.
 
 @item
 We may also use a simple unique number to identify a label.  This is
@@ -709,7 +755,7 @@
 to come up with good names for each of them.  These simple labels are
 inserted without query, and are therefore very fast.  Good descriptive
 names are not really necessary as @b{Ref@TeX{}} will provide context to
-reference a label (@pxref{Referencing Labels}).@refill
+reference a label (@pxref{Referencing Labels}).
 
 @item
 The third method is to ask the user for a label.  This is most
@@ -719,13 +765,13 @@
 @samp{\label@{mark@}}.  The advantage of using @code{reftex-label}
 anyway is that @b{Ref@TeX{}} will know that a new label has been defined.
 It will then not be necessary to rescan the document in order to access
-this label later.@refill
+this label later.
 @end enumerate
 
 @vindex reftex-insert-label-flags
 If you want to change the way certain labels are created, check out the
 variable @code{reftex-insert-label-flags} (@pxref{Options (Creating
-Labels)}).@refill
+Labels)}).
 
 If you are using AUCTeX to write your LaTeX documents, you can
 set it up to delegate the creation of labels to
@@ -741,16 +787,25 @@
 @kindex C-c )
 @findex reftex-reference
 
+@vindex reftex-trust-label-prefix
+@b{Ref@TeX{}} scans the document in order to find all labels.  To make
+referencing labels easier, it assigns to each label a category, the
+@emph{label type} (for example section, table, figure, equation, etc.).
+In order to determine the label type, RefTeX parses around each label
+to see in what kind of environments it is located.  You can speed up
+the parsing by using type-specific prefixes for labels and configuring
+the variable @code{reftex-trust-label-prefix}.
+
 Referencing Labels is really at the heart of @b{Ref@TeX{}}.  Press @kbd{C-c
 )} in order to reference a label (reftex-reference).  This will start a
 selection process and finally insert the complete @samp{\ref@{label@}}
-into the buffer.@refill
+into the buffer.
 
 First, @b{Ref@TeX{}} will determine the label category which is required.
 Often that can be figured out from context.  For example, if you
 write @samp{As shown in eq.} and the press @kbd{C-c )}, @b{Ref@TeX{}} knows
 that an equation label is going to be referenced.  If it cannot figure
-out what label category is needed, it will query for one.@refill
+out what label category is needed, it will query for one.
 
 You will then be presented with a label selection menu.  This is a
 special buffer which contains an outline of the document along with all
@@ -759,7 +814,7 @@
 text in the buffer near the label definition.  Usually this is
 sufficient to identify the label.  If you are unsure about a certain
 label, pressing @key{SPC} will show the label definition point in
-another window.@refill
+another window.
 
 In order to reference a label, move to cursor to the correct label and
 press @key{RET}.  You can also reference several labels with a single
@@ -769,7 +824,7 @@
 @kindex ?
 Here is a list of special commands in the selection buffer.  A summary
 of this information is always available from the selection process by
-pressing @kbd{?}.@refill
+pressing @kbd{?}.
 
 
 
@@ -790,7 +845,7 @@
 
 @item b
 Jump back to the position where you last left the selection buffer.
-Normally this should get you back to the last referenced label.@refill
+Normally this should get you back to the last referenced label.
 
 @item C-c C-n
 Goto next section heading.
@@ -800,12 +855,12 @@
 
 @item N z
 Jump to section N, using the prefix arg.  For example @kbd{3 z} jumps to
-section 3.@refill
+section 3.
 
 @tablesubheading{Displaying Context}
 @item @key{SPC}
 Show the surroundings of the definition of the current label in another
-window.  See also the @kbd{f} key.@refill
+window.  See also the @kbd{f} key.
 
 @item f
 @vindex reftex-revisit-to-follow
@@ -814,23 +869,23 @@
 to pressing @key{SPC} after each cursor motion.  Note that only context
 in files already visited is shown.  @b{RefTeX} will not visit a file
 just for follow mode.  See, however, the variable
-@code{reftex-revisit-to-follow}.@refill
+@code{reftex-revisit-to-follow}.
 
 @item .
 Show insertion point in another window.  This is the point from where you
-called @code{reftex-reference}.@refill
+called @code{reftex-reference}.
 
 @tablesubheading{Selecting a label and creating the reference}
 @item @key{RET}
 Insert a reference to the label at point into the buffer from which the
 selection process was started.  When entries have been marked, @key{RET}
-references all marked labels.@refill
+references all marked labels.
 
 @item mouse-2
 @vindex reftex-highlight-selection
 Clicking with mouse button 2 on a label will accept it like @key{RET}
 would. See also variable @code{reftex-highlight-selection}, @ref{Options
-(Misc)}.@refill
+(Misc)}.
 
 @vindex reftex-multiref-punctuation
 @item m - + ,
@@ -853,11 +908,11 @@
 @item a
 Accept the marked entries and put all labels as a comma-separated list
 into one @emph{single} @code{\ref} macro.  Some packages like
-@file{saferef.sty} support multiple references in this way.@refill
+@file{saferef.sty} support multiple references in this way.
 
 @item l
 Use the last referenced label(s) again.  This is equivalent to moving to
-that label and pressing @key{RET}.@refill
+that label and pressing @key{RET}.
 
 @item @key{TAB}
 Enter a label with completion.  This may also be a label which does not
@@ -871,7 +926,7 @@
 @code{\vref} macro is defined in the @code{varioref} LaTeX package.
 With this key you can force @b{Ref@TeX{}} to insert a @code{\vref}
 macro.  The current state of this flag is displayed by the @samp{S<>}
-indicator in the mode line of the selection buffer.@refill
+indicator in the mode line of the selection buffer.
 
 @item V
 @cindex @code{fancyref}, LaTeX package
@@ -889,7 +944,7 @@
 
 @item q
 Exit the selection process without inserting any reference into the
-buffer.@refill
+buffer.
 
 @tablesubheading{Controlling what gets displayed}
 @vindex reftex-label-menu-flags
@@ -898,30 +953,30 @@
 
 @item c
 Toggle the display of the one-line label definition context in the
-selection buffer.@refill
+selection buffer.
 
 @item F
 Toggle the display of the file borders of a multifile document in the
-selection buffer.@refill
+selection buffer.
 
 @item t
 Toggle the display of the table of contents in the selection buffer.
 With prefix @var{arg}, change the maximum level of toc entries displayed
-to @var{arg}.  Chapters are level 1, section are level 2.@refill
+to @var{arg}.  Chapters are level 1, section are level 2.
 
 @item #
-Toggle the display of a label counter in the selection buffer.@refill
+Toggle the display of a label counter in the selection buffer.
 
 @item %
 Toggle the display of labels hidden in comments in the selection
 buffers.  Sometimes, you may have commented out parts of your document.
 If these parts contain label definitions, @b{Ref@TeX{}} can still display
-and reference these labels.@refill
+and reference these labels.
 
 @tablesubheading{Updating the buffer}
 @item g
 Update the menu.  This will rebuilt the menu from the internal label
-list, but not reparse the document (see @kbd{r}).@refill
+list, but not reparse the document (see @kbd{r}).
 
 @item r
 @vindex reftex-enable-partial-scans
@@ -929,27 +984,27 @@
 the menu.  If the variable @code{reftex-enable-partial-scans} is
 non-@code{nil} and your document is a multifile document, this will
 reparse only a part of the document (the file in which the label at
-point was defined).@refill
+point was defined).
 
 @item C-u r
 Reparse the @emph{entire} document.
 
 @item s
 Switch the label category.  After prompting for another label category,
-a menu for that category will be shown.@refill
+a menu for that category will be shown.
 
 @item x
 Reference a label from an external document.  With the LaTeX package
 @code{xr} it is possible to reference labels defined in another
 document.  This key will switch to the label menu of an external
 document and let you select a label from there (@pxref{xr (LaTeX
-package),,xr}).@refill
+package),,xr}).
 
 @end table
 
 @vindex reftex-select-label-map
 In order to define additional commands for the selection process, the
-keymap @code{reftex-select-label-map} may be used.@refill
+keymap @code{reftex-select-label-map} may be used.
 
 @node Builtin Label Environments, Defining Label Environments, Referencing Labels, Labels and References
 @section Builtin Label Environments
@@ -963,7 +1018,7 @@
 with a label (i.e. which carry their own counters).  By default, @b{Ref@TeX{}}
 recognizes all labeled environments and macros discussed in @cite{The
 LaTeX Companion by Goossens, Mittelbach & Samarin, Addison-Wesley
-1994.}.  These are:@refill
+1994.}.  These are:
 
 @itemize @minus
 @item
@@ -979,7 +1034,7 @@
 @cindex LaTeX core
 @code{figure}, @code{figure*}, @code{table}, @code{table*}, @code{equation},
 @code{eqnarray}, @code{enumerate}, the @code{\footnote} macro (this is
-the LaTeX core stuff)@refill
+the LaTeX core stuff)
 @item
 @cindex AMS-LaTeX
 @cindex @code{amsmath}, LaTeX package
@@ -994,7 +1049,7 @@
 @cindex @code{subequations}, AMS-LaTeX environment
 @code{align}, @code{gather}, @code{multline}, @code{flalign},
 @code{alignat}, @code{xalignat}, @code{xxalignat}, @code{subequations}
-(from AMS-LaTeX's @file{amsmath.sty} package)@refill
+(from AMS-LaTeX's @file{amsmath.sty} package)
 @item
 @cindex @code{endnote}, LaTeX package
 @cindex LaTeX packages, @code{endnote}
@@ -1039,7 +1094,7 @@
 @cindex @code{subfigure}, LaTeX environment
 @cindex @code{subfigure*}, LaTeX environment
 @code{subfigure}, @code{subfigure*}, the @code{\subfigure} macro
-(@file{subfigure.sty})@refill
+(@file{subfigure.sty})
 @item
 @cindex @code{supertab}, LaTeX package
 @cindex LaTeX packages, @code{supertab}
@@ -1054,7 +1109,7 @@
 
 If you want to use other labeled environments, defined with
 @code{\newtheorem}, @b{Ref@TeX{}} needs to be configured to recognize
-them (@pxref{Defining Label Environments}).@refill
+them (@pxref{Defining Label Environments}).
 
 @node Defining Label Environments, Reference Info, Builtin Label Environments, Labels and References
 @section Defining Label Environments
@@ -1077,7 +1132,7 @@
 It can also be instructive to look at the constant
 @code{reftex-label-alist-builtin} which contains the entries for
 all the builtin environments and macros (@pxref{Builtin Label
-Environments}).@refill
+Environments}).
 
 @menu
 * Theorem and Axiom::                Defined with @code{\newenvironment}.
@@ -1096,7 +1151,7 @@
 @cindex @code{\newtheorem}
 
 Suppose you are using @code{\newtheorem} in LaTeX in order to define two
-new environments, @code{theorem} and @code{axiom}@refill
+new environments, @code{theorem} and @code{axiom}
 
 @example
 \newtheorem@{axiom@}@{Axiom@}
@@ -1128,7 +1183,7 @@
 prompts when @b{Ref@TeX{}} queries for a label type.  @code{?h}
 was chosen for @code{theorem} since @code{?t} is already taken by
 @code{table}.  Note that also @code{?s}, @code{?f}, @code{?e},
-@code{?i}, @code{?n} are already used for standard environments.@refill
+@code{?i}, @code{?n} are already used for standard environments.
 
 @noindent
 The labels for Axioms and Theorems will have the prefixes @samp{ax:} and
@@ -1149,28 +1204,28 @@
 
 @noindent
 The @samp{~\ref@{%s@}} is a format string indicating how to insert
-references to these labels.@refill
+references to these labels.
 
 @noindent
-The next item indicates how to grab context of the label definition.@refill
+The next item indicates how to grab context of the label definition.
 @itemize @minus
 @item
 @code{t} means to get it from a default location (from the beginning of
 a @code{\macro} or after the @code{\begin} statement).  @code{t} is
-@emph{not} a good choice for eqnarray and similar environments.@refill
-@item
-@code{nil} means to use the text right after the label definition.@refill
+@emph{not} a good choice for eqnarray and similar environments.
+@item
+@code{nil} means to use the text right after the label definition.
 @item
 For more complex ways of getting context, see the variable
 @code{reftex-label-alist} (@ref{Options (Defining Label
-Environments)}).@refill
+Environments)}).
 @end itemize
 
 The following list of strings is used to guess the correct label type
 from the word before point when creating a reference.  E.g. if you
 write: @samp{As we have shown in Theorem} and then press @kbd{C-c )},
 @b{Ref@TeX{}} will know that you are looking for a theorem label and
-restrict the menu to only these labels without even asking.@refill
+restrict the menu to only these labels without even asking.
 
 The final item in each entry is the level at which the environment
 should produce entries in the table of context buffer.  If the number is
@@ -1178,11 +1233,11 @@
 @code{\section}), if it is negative the entries will be unnumbered (like
 @code{\section*}).  Use this only for environments which structure the
 document similar to sectioning commands.  For everything else, omit the
-item.@refill
+item.
 
 To do the same configuration with @code{customize}, you need to click on
 the @code{[INS]} button twice to create two templates and fill them in
-like this:@refill
+like this:
 
 @example
 Reftex Label Alist: [Hide]
@@ -1218,7 +1273,7 @@
 and @samp{h} to some of the flags in the variables
 @code{reftex-insert-label-flags} (@pxref{Options (Creating Labels)})
 and @code{reftex-label-menu-flags} (@pxref{Options (Referencing
-Labels)}).@refill
+Labels)}).
 
 
 @node Quick Equation, Figure Wrapper, Theorem and Axiom , Defining Label Environments
@@ -1252,7 +1307,7 @@
 an equation label, the different @code{nil} elements indicate to use the
 default values for equations.  The @samp{1} as the fifth element
 indicates that the context of the label definition should be the 1st
-argument of the macro.@refill
+argument of the macro.
 
 Here is again how this would look in the customization buffer:
 
@@ -1295,7 +1350,7 @@
 
 Now we need to tell @b{Ref@TeX{}} that the 4th argument of the
 @code{\myfig} macro @emph{is itself} a figure label, and where to find
-the context.@refill
+the context.
 
 @lisp
 (setq reftex-label-alist
@@ -1308,12 +1363,12 @@
 labels from normal figure environments.  The @code{nil} entries for
 prefix and reference format mean to use the defaults for figure labels.
 The @samp{3} for the context method means to grab the 3rd macro argument
-- the caption.@refill
+- the caption.
 
 As a side effect of this configuration, @code{reftex-label} will now
 insert the required naked label (without the @code{\label} macro) when
 point is directly after the opening parenthesis of a @code{\myfig} macro
-argument.@refill
+argument.
 
 Again, here the configuration in the customization buffer:
 
@@ -1341,7 +1396,7 @@
 information associated with a label category is done by giving
 @code{nil} for the environment name and then specify the items you want
 to define.  Here is an example which adds German magic words to all
-predefined label categories.@refill
+predefined label categories.
 
 @lisp
 (setq reftex-label-alist
@@ -1370,7 +1425,7 @@
 @end lisp
 
 @b{Ref@TeX{}} has also a predefined symbol for this special purpose.  The
-following is equivalent to the line above.@refill
+following is equivalent to the line above.
 
 @lisp
 (setq reftex-label-alist '(AMSTeX))
@@ -1378,7 +1433,7 @@
 
 Note that this is automatically done by the @file{amsmath.el} style file
 of AUCTeX (@pxref{Style Files}) - so if you use AUCTeX,
-this configuration will not be necessary.@refill
+this configuration will not be necessary.
 
 @node Non-Standard Environments, Putting it Together, Using \eqref, Defining Label Environments
 @subsection Non-standard Environments
@@ -1397,7 +1452,7 @@
 environment.  The return value must be @code{nil} on failure to detect
 the environment.  The function is called with one argument @var{bound}.
 If non-@code{nil}, @var{bound} is a boundary for backwards searches
-which should be observed.  We will discuss two examples.@refill
+which should be observed.  We will discuss two examples.
 
 @cindex LaTeX commands, abbreviated
 
@@ -1409,7 +1464,7 @@
 @code{\be}, point is in this environment and the function must return
 the beginning of the match.  To avoid scanning too far, we can also look
 for empty lines which cannot occur inside an equation environment.
-Here is the setup:@refill
+Here is the setup:
 
 @lisp
 ;; Setup entry in reftex-label-alist, using all defaults for equations
@@ -1429,7 +1484,7 @@
 @cindex LaTeX packages, @code{linguex}
 A more complex example is the @file{linguex.sty} package which defines
 list macros @samp{\ex.}, @samp{\a.}, @samp{\b.} etc. for lists which are
-terminated by @samp{\z.} or by an empty line.@refill
+terminated by @samp{\z.} or by an empty line.
 
 @example
 \ex.  \label@{ex:12@} Some text in an exotic language ...
@@ -1519,7 +1574,7 @@
 @b{Ref@TeX{}} can also display the label definition corresponding to a
 @code{\ref} macro, or all reference locations corresponding to a
 @code{\label} macro.  @xref{Viewing Cross-References}, for more
-information.@refill
+information.
 
 @node xr (LaTeX package), varioref (LaTeX package), Reference Info, Labels and References
 @section @code{xr}: Cross-Document References
@@ -1532,7 +1587,7 @@
 
 The LaTeX package @code{xr} makes it possible to create references to
 labels defined in external documents.  The preamble of a document using
-@code{xr} will contain something like this:@refill
+@code{xr} will contain something like this:
 
 @example
 \usepackage@{xr@}
@@ -1543,18 +1598,18 @@
 @noindent
 and we can make references to any labels defined in these
 external documents by using the prefixes @samp{V1-} and @samp{V3-},
-respectively.@refill
+respectively.
 
 @b{Ref@TeX{}} can be used to create such references as well.  Start the
 referencing process normally, by pressing @kbd{C-c )}.  Select a label
 type if necessary.  When you see the label selection buffer, pressing
 @kbd{x} will switch to the label selection buffer of one of the external
 documents.  You may then select a label as before and @b{Ref@TeX{}} will
-insert it along with the required prefix.@refill
+insert it along with the required prefix.
 
 For this kind of inter-document cross-references, saving of parsing
 information and the use of multiple selection buffers can mean a large
-speed-up (@pxref{Optimizations}).@refill
+speed-up (@pxref{Optimizations}).
 
 @node varioref (LaTeX package), fancyref (LaTeX package), xr (LaTeX package), Labels and References
 @section @code{varioref}: Variable Page References
@@ -1572,7 +1627,7 @@
 customizing the variable @code{reftex-vref-is-default}.  If this
 toggling seems too inconvenient, you can also use the command
 @code{reftex-varioref-vref}@footnote{bind it to @kbd{C-c v}.}.
-Or use AUCTeX to create your macros (@pxref{AUCTeX}).@refill
+Or use AUCTeX to create your macros (@pxref{AUCTeX}).
 
 @node fancyref (LaTeX package), , varioref (LaTeX package), Labels and References
 @section @code{fancyref}: Fancy Cross References
@@ -1594,7 +1649,7 @@
 inconvenient, you can also use the commands @code{reftex-fancyref-fref}
 and @code{reftex-fancyref-Fref}@footnote{bind them to @kbd{C-c
 f} and @kbd{C-c F}.}.  Or use AUCTeX to create your macros
-(@pxref{AUCTeX}).@refill
+(@pxref{AUCTeX}).
 
 @node Citations, Index Support, Labels and References, Top
 @chapter Citations
@@ -1605,7 +1660,7 @@
 it.  The argument of the macro is a citation key which identifies an
 article or book in either a BibTeX database file or in an explicit
 @code{thebibliography} environment in the document.  @b{Ref@TeX{}}'s
-support for citations helps to select the correct key quickly.@refill
+support for citations helps to select the correct key quickly.
 
 @menu
 * Creating Citations::               How to create them.
@@ -1613,6 +1668,7 @@
 * Citation Info::                    View the corresponding database entry.
 * Chapterbib and Bibunits::          Multiple bibliographies in a Document.
 * Citations Outside LaTeX::          How to make citations in Emails etc.
+* BibTeX Database Subsets::          Extract parts of a big database. 
 @end menu
 
 @node Creating Citations, Citation Styles, , Citations
@@ -1628,7 +1684,7 @@
 prompts for a regular expression which will be used to search through
 the database and present the list of matches to choose from in a
 selection process similar to that for selecting labels
-(@pxref{Referencing Labels}).@refill
+(@pxref{Referencing Labels}).
 
 The regular expression uses an extended syntax: @samp{&&} defines a
 logic @code{and} for regular expressions. For example
@@ -1638,7 +1694,7 @@
 known citation keys.  RefTeX also offers a default when prompting for a
 regular expression.  This default is the word before the cursor or the
 word before the current @samp{\cite} command.  Sometimes this may be a
-good search key.@refill
+good search key.
 
 @cindex @code{\bibliography}
 @cindex @code{thebibliography}, LaTeX environment
@@ -1653,12 +1709,12 @@
 information from there.  Note that in this case the information
 presented in the selection buffer will just be a copy of relevant
 @code{\bibitem} entries, not the structured listing available with
-BibTeX database files.@refill
+BibTeX database files.
 
 @kindex ?
 In the selection buffer, the following keys provide special commands.  A
 summary of this information is always available from the selection
-process by pressing @kbd{?}.@refill
+process by pressing @kbd{?}.
 
 @table @kbd
 @tablesubheading{General}
@@ -1678,24 +1734,24 @@
 @tablesubheading{Access to full database entries}
 @item @key{SPC}
 Show the database entry corresponding to the article at point, in
-another window.  See also the @kbd{f} key.@refill
+another window.  See also the @kbd{f} key.
 
 @item f
 Toggle follow mode.  When follow mode is active, the other window will
 always display the full database entry of the current article.  This is
 equivalent to pressing @key{SPC} after each cursor motion.  With BibTeX
-entries, follow mode can be rather slow.@refill
+entries, follow mode can be rather slow.
 
 @tablesubheading{Selecting entries and creating the citation}
 @item @key{RET}
 Insert a citation referencing the article at point into the buffer from
-which the selection process was started.@refill
+which the selection process was started.
 
 @item mouse-2
 @vindex reftex-highlight-selection
 Clicking with mouse button 2 on a citation will accept it like @key{RET}
 would.  See also variable @code{reftex-highlight-selection}, @ref{Options
-(Misc)}.@refill
+(Misc)}.
 
 @item m
 Mark the current entry.  When one or several entries are marked,
@@ -1707,11 +1763,21 @@
 
 @item a
 Accept all (marked) entries in the selection buffer and create a single
-@code{\cite} macro referring to them.@refill
+@code{\cite} macro referring to them.
 
 @item A
 Accept all (marked) entries in the selection buffer and create a
-separate @code{\cite} macro for each of it.@refill
+separate @code{\cite} macro for each of it.
+
+@item e
+Create a new BibTeX database file which contains all @i{marked} entries
+in the selection buffer.  If no entries are marked, all entries are
+selected. 
+
+@item E
+Create a new BibTeX database file which contains all @i{unmarked}
+entries in the selection buffer.  If no entries are marked, all entries
+are selected. 
 
 @item @key{TAB}
 Enter a citation key with completion.  This may also be a key which does
@@ -1719,30 +1785,30 @@
 
 @item .
 Show insertion point in another window.  This is the point from where you
-called @code{reftex-citation}.@refill
+called @code{reftex-citation}.
 
 @tablesubheading{Exiting}
 @item q
 Exit the selection process without inserting a citation into the
-buffer.@refill
+buffer.
 
 @tablesubheading{Updating the buffer}
 
 @item g
 Start over with a new regular expression.  The full database will be
-rescanned with the new expression (see also @kbd{r}).@refill
+rescanned with the new expression (see also @kbd{r}).
 
 @c FIXME: Should we use something else here? r is usually rescan!
 @item r
 Refine the current selection with another regular expression.  This will
 @emph{not} rescan the entire database, but just the already selected
-entries.@refill
+entries.
 
 @end table
 
 @vindex reftex-select-bib-map
 In order to define additional commands for this selection process, the
-keymap @code{reftex-select-bib-map} may be used.@refill
+keymap @code{reftex-select-bib-map} may be used.
 
 @node Citation Styles, Citation Info, Creating Citations, Citations
 @section Citation Styles
@@ -1782,11 +1848,15 @@
 [y]    \citeyear@{%l@}
 @end example
 
+@vindex reftex-cite-prompt-optional-args
+If cite formats contain empty paris of square brackets, RefTeX can
+will prompt for values of these optional arguments if you call the
+@code{reftex-citation} command with a @kbd{C-u} prefix.
 Following the most generic of these packages, @code{natbib}, the builtin
 citation packages always accept the @kbd{t} key for a @emph{textual}
 citation (like: @code{Jones et al. (1997) have shown...})  as well as
 the @kbd{p} key for a parenthetical citation (like: @code{As shown
-earlier (Jones et al, 1997)}).@refill
+earlier (Jones et al, 1997)}).
 
 To make one of these styles the default, customize the variable
 @code{reftex-cite-format} or put into @file{.emacs}:
@@ -1798,7 +1868,7 @@
 You can also use AUCTeX style files to automatically set the
 citation style based on the @code{usepackage} commands in a given
 document.  @xref{Style Files}, for information on how to set up the style
-files correctly.@refill
+files correctly.
 
 @node Citation Info, Chapterbib and Bibunits, Citation Styles, Citations, Top
 @section Citation Info
@@ -1819,7 +1889,7 @@
 @b{Ref@TeX{}} can also display the @code{\bibitem} or BibTeX database
 entry corresponding to a @code{\cite} macro, or all citation locations
 corresponding to a @code{\bibitem} or BibTeX database entry.
-@xref{Viewing Cross-References}.@refill
+@xref{Viewing Cross-References}.
 
 @node Chapterbib and Bibunits, Citations Outside LaTeX, Citation Info, Citations
 @section Chapterbib and Bibunits
@@ -1836,7 +1906,7 @@
 you have multiple bibliographies within a @emph{single file}, this may
 or may not be the case.
 
-@node Citations Outside LaTeX, , Chapterbib and Bibunits, Citations
+@node Citations Outside LaTeX, BibTeX Database Subsets, Chapterbib and Bibunits, Citations
 @section Citations outside LaTeX
 @cindex Citations outside LaTeX
 @vindex reftex-default-bibliography
@@ -1850,7 +1920,7 @@
 @code{locally} does a decent job of putting all relevant information
 about a citation directly into the buffer.  Here is the lisp code to add
 the @kbd{C-c [} binding to the mail buffer.  It also provides a local
-binding for @code{reftex-cite-format}.@refill
+binding for @code{reftex-cite-format}.
 
 @lisp
 (add-hook 'mail-setup-hook
@@ -1861,6 +1931,34 @@
                            (reftex-citation))))))
 @end lisp
 
+@node BibTeX Database Subsets, , Citations Outside LaTeX, Citations
+@section Database Subsets
+@cindex BibTeX database subsets
+@findex reftex-create-bibtex-file
+
+@b{Ref@TeX{}} offers two ways to create a new BibTeX database file.
+
+The first option produces a file which contains only the entries
+actually referenced in the current document.  This can be useful if
+the database in only meant for a single document and you want to clean
+it of old and unused ballast.  It can also be useful while writing a
+document together with collaborators, in order to avoid sending around
+the entire (possibly very large) database.  To create the file, use
+@kbd{M-x reftex-create-bibtex-file}, also available from the menu
+under @code{Ref->Global Actions->Create Bibtex File}.  The command will
+prompt for a BibTeX file name and write the extracted entries to that
+file.
+
+The second option makes use of the selection process started by the
+command @kbd{C-c [} (@pxref{Creating Citations}).  This command uses a
+regular expression to select entries, and lists them in a formatted
+selection buffer.  After pressing the @kbd{e} key (mnemonics: Export),
+the command will prompt for the name of a new BibTeX file and write
+the selected entries to that file.  You can also first mark some
+entries in the selection buffer with the @kbd{m} key and then export
+either the @i{marked} entries (with the @kbd{e} key) or the
+@i{unmarked} entries (with the @kbd{E} key).
+
 @node Index Support, Viewing Cross-References, Citations, Top
 @chapter Index Support
 @cindex Index Support
@@ -1875,7 +1973,7 @@
 All entries defined in a document are written out to the @file{.aux}
 file.  A separate tool must be used to convert this information into a
 nicely formatted index.  Tools used with LaTeX include @code{MakeIndex}
-and @code{xindy}.@refill
+and @code{xindy}.
 
 Indexing is a very difficult task.  It must follow strict conventions to
 make the index consistent and complete.  There are basically two
@@ -1893,7 +1991,7 @@
 time make an index entry, possibly with special formatting to make the
 reference page in the index bold or underlined.  To make @b{Ref@TeX{}}
 support for indexing possible, these special macros must be added to
-@b{Ref@TeX{}}'s configuration (@pxref{Defining Index Macros}).@refill
+@b{Ref@TeX{}}'s configuration (@pxref{Defining Index Macros}).
 
 @item
 The rest of the index is often just a collection of where in the
@@ -1901,7 +1999,7 @@
 difficult to develop along with the document, because consistent entries
 for each occurrence are needed and are best selected when the document
 is ready.  @b{Ref@TeX{}} supports this with an @emph{index phrases file}
-which collects phrases and helps indexing the phrases globally.@refill
+which collects phrases and helps indexing the phrases globally.
 @end enumerate
 
 Before you start, you need to make sure that @b{Ref@TeX{}} knows about
@@ -1913,7 +2011,7 @@
 sufficiently new version of AUCTeX (9.10c or later) will do this
 automatically.  If you really don't use AUCTeX (you should!), this
 configuration needs to be done by hand with the menu (@code{Ref->Index
-Style}), or globally for all your documents with@refill
+Style}), or globally for all your documents with
 
 @lisp
 (setq reftex-index-macros '(multind))     @r{or}
@@ -1957,7 +2055,7 @@
 available for the index entry and, if applicable, the index tag.  The
 index tag is a string identifying one of multiple indices.  With the
 @file{multind} and @file{index} packages, this tag is the first argument
-to the redefined @code{\index} macro.@refill
+to the redefined @code{\index} macro.
 
 @node The Index Phrases File, Displaying and Editing the Index, Creating Index Entries, Index Support
 @section The Index Phrases File
@@ -1977,7 +2075,7 @@
 @code{reftex-index-macros} (@pxref{Defining Index Macros}).  You can
 edit the header as needed, but if you define new LaTeX indexing macros,
 don't forget to add them to @code{reftex-index-macros} as well.  Here is
-a phrase file header example:@refill
+a phrase file header example:
 
 @example
 % -*- mode: reftex-index-phrases -*-
@@ -1999,7 +2097,7 @@
 @samp{\index@{@var{word}@}@var{word}} (@var{repeat} = @code{t}).  In the
 above example it is assumed that the macro @code{\index*@{@var{word}@}}
 already typesets its argument in the text, so that it is unnecessary to
-repeat @var{word} outside the macro.@refill
+repeat @var{word} outside the macro.
 
 @menu
 * Collecting Phrases::               Collecting from document or external.
@@ -2049,7 +2147,7 @@
 able to choose at each match between several different index arguments,
 separate them with @samp{ || }@footnote{@samp{||} with optional spaces,
 see @code{reftex-index-phrases-logical-or-regexp}.}.  Here is an
-example:@refill
+example:
 
 @example
 %--------------------------------------------------------------------
@@ -2071,7 +2169,7 @@
 a subitem of @samp{Planets}, @samp{Gods} or @samp{Chocolate Bars}.
 Finally, every occurrence of @samp{Pluto} will be indexed as
 @samp{\index@{Planets!Pluto@}\index@{Kuiper Belt Objects!Pluto@}Pluto}
-and will therefore create two different index entries.@refill
+and will therefore create two different index entries.
 
 @node Consistency Checks, Global Indexing, Collecting Phrases, The Index Phrases File
 @subsection Consistency Checks
@@ -2087,13 +2185,13 @@
 buffer alphabetically by search phrase.  If you want to group certain
 phrases and only sort within the groups, insert empty lines between the
 groups.  Sorting will only change the sequence of phrases within each
-group (see the variable @code{reftex-index-phrases-sort-in-blocks}).@refill
+group (see the variable @code{reftex-index-phrases-sort-in-blocks}).
 
 @kindex C-c C-i
 A useful command is @kbd{C-c C-i} (@code{reftex-index-phrases-info})
 which lists information about the phrase at point, including an example
 of how the index entry will look like and the number of expected matches
-in the document.@refill
+in the document.
 
 @kindex C-c C-t
 Another important check is to find out if there are double or
@@ -2104,7 +2202,7 @@
 (@code{reftex-index-find-next-conflict-phrase}) finds the next phrase in
 the buffer which is either duplicate or a subphrase of another phrase.
 In order to check the whole buffer like this, start at the beginning and
-execute this command repeatedly.@refill
+execute this command repeatedly.
 
 @node Global Indexing, , Consistency Checks, The Index Phrases File
 @subsection Global Indexing
@@ -2119,13 +2217,13 @@
 the current phrase line, @kbd{C-c C-r} on all lines in the current
 region and @kbd{C-c C-a} on all phrase lines in the buffer.  It is
 probably good to do indexing in small chunks since your concentration
-may not last long enough to do everything in one go.@refill
+may not last long enough to do everything in one go.
 
 @b{Ref@TeX{}} will start at the first phrase line and search the phrase
 globally in the whole document.  At each match it will stop, compute the
 replacement string and offer you the following choices@footnote{Windows
 users: Restrict yourself to the described keys during indexing.  Pressing
-@key{Help} at the indexing prompt can apparently hang Emacs.}:@refill
+@key{Help} at the indexing prompt can apparently hang Emacs.}:
 
 @table @kbd
 @item y
@@ -2177,7 +2275,7 @@
 either the argument of an index macro, or if an index macro is directly
 (without whitespace separation) before or after the match.  Index macros
 are those configured in @code{reftex-index-macros}.  Intended for
-re-indexing a documents after changes have been made.@refill
+re-indexing a documents after changes have been made.
 @end table
 
 Even though indexing should be the last thing you do to a document, you
@@ -2185,7 +2283,7 @@
 to the changed regions.  The command
 @code{reftex-index-phrases-apply-to-region} is designed for this
 purpose.  When called from a LaTeX document with active region, it will
-apply @code{reftex-index-all-phrases} to the current region.@refill
+apply @code{reftex-index-all-phrases} to the current region.
 
 @node Displaying and Editing the Index, Builtin Index Macros, The Index Phrases File, Index Support
 @section Displaying and Editing the Index
@@ -2201,7 +2299,7 @@
 document uses multiple indices, @b{Ref@TeX{}} will ask you to select
 one.  Then, all index entries will be sorted alphabetically and
 displayed in a special buffer, the @file{*Index*} buffer.  From that
-buffer you can check and edit each entry.@refill
+buffer you can check and edit each entry.
 
 The index can be restricted to the current section or the region.  Then
 only entries in that part of the document will go into the compiled
@@ -2210,7 +2308,7 @@
 region, make the region active and use a numeric prefix @samp{3} (press
 @kbd{C-u 3 C-c >}).  From within the @file{*Index*} buffer the
 restriction can be moved from one section to the next by pressing the
-@kbd{<} and @kbd{>} keys.@refill
+@kbd{<} and @kbd{>} keys.
 
 One caveat: @b{Ref@TeX{}} finds the definition point of an index entry
 by searching near the buffer position where it had found to macro during
@@ -2220,12 +2318,12 @@
 @file{*Index*} buffer and the definition locations.  It is therefore
 advisable to rescan the document (with @kbd{r} or @kbd{C-u r})
 frequently while editing the index from the @file{*Index*}
-buffer.@refill
+buffer.
 
 @kindex ?
 Here is a list of special commands available in the @file{*Index*} buffer.  A
 summary of this information is always available by pressing
-@kbd{?}.@refill
+@kbd{?}.
 
 @table @kbd
 @tablesubheading{General}
@@ -2240,23 +2338,23 @@
 Pressing any capital letter will jump to the corresponding section in
 the @file{*Index*} buffer.  The exclamation mark is special and jumps to
 the first entries alphabetically sorted below @samp{A}.  These are
-usually non-alphanumeric characters.@refill
+usually non-alphanumeric characters.
 @item n
-Go to next entry.@refill
+Go to next entry.
 @item p
-Go to previous entry.@refill
+Go to previous entry.
 
 @tablesubheading{Access to document locations}
 @item @key{SPC}
-Show the place in the document where this index entry is defined.@refill
+Show the place in the document where this index entry is defined.
 
 @item @key{TAB}
 Go to the definition of the current index entry in another
-window.@refill
+window.
 
 @item @key{RET}
 Go to the definition of the current index entry and hide the
-@file{*Index*} buffer window.@refill
+@file{*Index*} buffer window.
 
 @item f
 @vindex reftex-index-follow-mode
@@ -2268,20 +2366,20 @@
 @code{reftex-index-follow-mode}.  Note that only context in files
 already visited is shown.  @b{Ref@TeX{}} will not visit a file just for
 follow mode.  See, however, the variable
-@code{reftex-revisit-to-follow}.@refill
+@code{reftex-revisit-to-follow}.
 
 @tablesubheading{Entry editing}
 @item e
 Edit the current index entry.  In the minibuffer, you can edit the
-index macro which defines this entry.@refill
+index macro which defines this entry.
 
 @item C-k
 Kill the index entry.  Currently not implemented because I don't know
-how to implement an @code{undo} function for this.@refill
+how to implement an @code{undo} function for this.
 
 @item *
 Edit the @var{key} part of the entry.  This is the initial part of the
-entry which determines the location of the entry in the index.@refill
+entry which determines the location of the entry in the index.
 
 @item |
 Edit the @var{attribute} part of the entry.  This is the part after the
@@ -2289,82 +2387,82 @@
 macro.  With @code{xindy}, it is called @emph{attribute} and is a
 property of the index entry that can lead to special formatting.  When
 called with @kbd{C-u} prefix, kill the entire @var{attribute}
-part.@refill
+part.
 
 @item @@
 Edit the @var{visual} part of the entry.  This is the part after the
 @samp{@@} which is used by @code{MakeIndex} to change the visual
 appearance of the entry in the index.  When called with @kbd{C-u}
-prefix, kill the entire @var{visual} part.@refill
+prefix, kill the entire @var{visual} part.
 
 @item (
 Toggle the beginning of page range property @samp{|(} of the
-entry.@refill
+entry.
 
 @item )
-Toggle the end of page range property @samp{|)} of the entry.@refill
+Toggle the end of page range property @samp{|)} of the entry.
 
 @item _
 Make the current entry a subentry.  This command will prompt for the
-superordinate entry and insert it.@refill
+superordinate entry and insert it.
 
 @item ^
 Remove the highest superordinate entry.  If the current entry is a
 subitem (@samp{aaa!bbb!ccc}), this function moves it up the hierarchy
-(@samp{bbb!ccc}).@refill
+(@samp{bbb!ccc}).
 
 @tablesubheading{Exiting}
 @item q
-Hide the @file{*Index*} buffer.@refill
+Hide the @file{*Index*} buffer.
 
 @item k
-Kill the @file{*Index*} buffer.@refill
+Kill the @file{*Index*} buffer.
 
 @item C-c =
-Switch to the Table of Contents buffer of this document.@refill
+Switch to the Table of Contents buffer of this document.
 
 @tablesubheading{Controlling what gets displayed}
 @item c
 @vindex reftex-index-include-context
 Toggle the display of short context in the @file{*Index*} buffer.  The
 default for this flag can be set with the variable
-@code{reftex-index-include-context}.@refill
+@code{reftex-index-include-context}.
 
 @item @}
 Restrict the index to a single document section.  The corresponding
 section number will be displayed in the @code{R<>} indicator in the
-mode line and in the header of the @file{*Index*} buffer.@refill
+mode line and in the header of the @file{*Index*} buffer.
 
 @item @{
-Widen the index to contain all entries of the document.@refill
+Widen the index to contain all entries of the document.
 
 @item <
 When the index is currently restricted, move the restriction to the
-previous section.@refill
+previous section.
 
 @item >
 When the index is currently restricted, move the restriction to the
-next section.@refill
+next section.
 
 @tablesubheading{Updating the buffer}
 @item g
 Rebuild the @file{*Index*} buffer.  This does @emph{not} rescan the
 document.  However, it sorts the entries again, so that edited entries
-will move to the correct position.@refill
+will move to the correct position.
 
 @item r
 @vindex reftex-enable-partial-scans
 Reparse the LaTeX document and rebuild the @file{*Index*} buffer.  When
 @code{reftex-enable-partial-scans} is non-@code{nil}, rescan only the file this
-location is defined in, not the entire document.@refill
+location is defined in, not the entire document.
 
 @item C-u r
 Reparse the @emph{entire} LaTeX document and rebuild the @file{*Index*}
-buffer.@refill
+buffer.
 
 @item s
 Switch to a different index (for documents with multiple
-indices).@refill
+indices).
 @end table
 
 
@@ -2481,7 +2579,7 @@
 which specifies that the macro identified with the character @code{?x} (the
 @code{\ix} macro) should be used for indexing phrases and words already
 in the buffer with @kbd{C-c /} (@code{reftex-index-selection-or-word}).
-The index tag is "idx".@refill
+The index tag is "idx".
 
 @node Viewing Cross-References, RefTeXs Menu, Index Support, Top
 @chapter Viewing Cross--References
@@ -2495,13 +2593,13 @@
 matching location(s) in another window.  The @code{\label} and @code{\ref}
 macros are one way of establishing such a link.  Also, a @code{\cite}
 macro is linked to the corresponding @code{\bibitem} macro or a BibTeX
-database entry.@refill
+database entry.
 
 The feature is invoked by pressing @kbd{C-c &}
 (@code{reftex-view-crossref}) while point is on the @var{key} argument
 of a macro involved in cross--referencing.  You can also click with
 @kbd{S-mouse-2} on the macro argument.  Here is what will happen for
-individual classes of macros:@refill
+individual classes of macros:
 
 @table @asis
 
@@ -2512,7 +2610,7 @@
 @samp{ref} or @samp{refrange}} of the @code{\ref} macro are active for
 cross--reference display.  This works also for labels defined in an
 external document when the current document refers to them through the
-@code{xr} interface (@pxref{xr (LaTeX package)}).@refill
+@code{xr} interface (@pxref{xr (LaTeX package)}).
 
 @item @code{\label}
 @cindex @code{\label}
@@ -2521,20 +2619,20 @@
 @kbd{C-c &} several times moves through the entire document and finds
 all locations.  Not only the @code{\label} macro but also other macros
 with label arguments (as configured with @code{reftex-label-alist}) are
-active for cross--reference display.@refill
+active for cross--reference display.
 
 @item @code{\cite}
 @cindex @code{\cite}
 Display the corresponding BibTeX database entry or @code{\bibitem}.
 All usual variants@footnote{all macros that either start or end with
 @samp{cite}} of the @code{\cite} macro are active for cross--reference
-display.@refill
+display.
 
 @item @code{\bibitem}
 @cindex @code{\bibitem}
 Display a document location which cites this article. Pressing
 @kbd{C-c &} several times moves through the entire document and finds
-all locations.@refill
+all locations.
 
 @item BibTeX
 @cindex BibTeX buffer, viewing cite locations from
@@ -2544,14 +2642,14 @@
 On first use, @b{Ref@TeX{}} will prompt for a buffer which belongs to
 the document you want to search.  Subsequent calls will use the same
 document, until you break this link with a prefix argument to @kbd{C-c
-&}.@refill
+&}.
 
 @item @code{\index}
 @cindex @code{\index}
 Display other locations in the document which are marked by an index
 macro with the same key argument.  Along with the standard @code{\index}
 and @code{\glossary} macros, all macros configured in
-@code{reftex-index-macros} will be recognized.@refill
+@code{reftex-index-macros} will be recognized.
 @end table
 
 @vindex reftex-view-crossref-extra
@@ -2572,7 +2670,7 @@
 which support this.  From this menu you can access all of
 @b{Ref@TeX{}}'s commands and a few of its options.  There is also a
 @code{Customize} submenu which can be used to access @b{Ref@TeX{}}'s
-entire set of options.@refill
+entire set of options.
 
 @node Key Bindings, Faces, RefTeXs Menu, Top
 @section Default Key Bindings
@@ -2609,10 +2707,10 @@
 
 Note that the @kbd{S-mouse-2} binding is only provided if this key is
 not already used by some other package.  @b{Ref@TeX{}} will not override an
-existing binding to @kbd{S-mouse-2}.@refill
+existing binding to @kbd{S-mouse-2}.
 
 Personally, I also bind some functions in the users @kbd{C-c} map for
-easier access.@refill
+easier access.
 
 @c FIXME: Do we need bindings for the Index macros here as well?
 @c C-c i   C-c I or so????
@@ -2658,7 +2756,7 @@
 use faces only when @code{font-lock} is loaded.  This seems to be
 reasonable because people who like faces will very likely have it
 loaded.  If you wish to turn off fontification or change the involved
-faces, see @ref{Options (Fontification)}.@refill
+faces, see @ref{Options (Fontification)}.
 
 @node Multifile Documents, Language Support, AUCTeX, Top
 @section Multifile Documents
@@ -2666,7 +2764,7 @@
 @cindex Documents, spread over files
 
 The following is relevant when working with documents spread over many
-files:@refill
+files:
 
 @itemize @bullet
 @item
@@ -2674,7 +2772,7 @@
 several (multifile) documents at the same time without conflicts.
 @b{Ref@TeX{}} provides functions to run @code{grep}, @code{search} and
 @code{query-replace} on all files which are part of a multifile
-document.@refill
+document.
 
 @item
 @vindex tex-main-file
@@ -2683,7 +2781,7 @@
 Variable (@code{TeX-master} for AUCTeX or @code{tex-main-file} for the
 standard Emacs LaTeX mode) containing the name of the master file.  For
 example, to set the file variable @code{TeX-master}, include something
-like the following at the end of each TeX file:@refill
+like the following at the end of each TeX file:
 
 @example
 %%% Local Variables: ***
@@ -2703,14 +2801,14 @@
 the AUCTeX (@pxref{Multifile,,,auctex, The AUC TeX User Manual}), the
 documentation about the Emacs (La)TeX mode (@pxref{TeX Print,,,emacs,
 The GNU Emacs Manual}) and the Emacs documentation on File Variables
-(@pxref{File Variables,,,emacs, The GNU Emacs Manual}).@refill
+(@pxref{File Variables,,,emacs, The GNU Emacs Manual}).
 
 @item
 The context of a label definition must be found in the same file as the
 label itself in order to be processed correctly by @b{Ref@TeX{}}.  The only
 exception is that section labels referring to a section statement
 outside the current file can still use that section title as
-context.@refill
+context.
 @end itemize
 
 @node Language Support, Finding Files, Multifile Documents, Top
@@ -2853,7 +2951,7 @@
 Implementing the principle of least surprises, the default settings of
 @b{Ref@TeX{}} ensure a safe ride for beginners and casual users.  However,
 when using @b{Ref@TeX{}} for a large project and/or on a small computer,
-there are ways to improve speed or memory usage.@refill
+there are ways to improve speed or memory usage.
 
 @itemize @bullet
 @item
@@ -2887,7 +2985,7 @@
 the label or section macro near the cursor was defined.  Re-parsing of
 the entire document is still available by using @kbd{C-u C-u} as a
 prefix, or the capital @kbd{R} key in the menus.  To use this feature,
-try@refill
+try
 
 @vindex reftex-enable-partial-scans
 @lisp
@@ -2906,7 +3004,7 @@
 @file{MASTER.tex}.  It is written automatically when you kill a buffer
 in @code{reftex-mode} or when you exit Emacs.  The information is
 restored when you begin working with a document in a new editing
-session.  To use this feature, put into @file{.emacs}:@refill
+session.  To use this feature, put into @file{.emacs}:
 
 @vindex reftex-save-parse-info
 @lisp
@@ -2914,6 +3012,25 @@
 @end lisp
 
 @item
+@b{Identifying label types by prefix}@*
+@cindex Parse information, saving to a file
+@vindex reftex-trust-label-prefix
+@b{Ref@TeX{}} normally parses around each label to check in which
+environment this label is located, in order to assign a label type to
+the label.  If your document contains thousands of labels, document
+parsing will take considerable time.  If you have been using label prefixes
+like tab: and fn: consistently, you can tell @b{Ref@TeX{}} to get the
+label type directly from the prefix, without additional parsing.  This
+will be faster and also allow labels to end up in the correct category
+if for some reason it is not possible to derive the correct type from
+context.  For example, to enable this feature for footnote and
+equation labels, use
+
+@lisp
+(setq reftex-trust-label-prefix '("fn:" "eq:"))
+@end lisp
+
+@item
 @b{Automatic Document Scans}@*
 @cindex Automatic document scans
 @cindex Document scanning, automatic
@@ -2927,7 +3044,7 @@
 
 @b{Ref@TeX{}} will then occasionally annotate new labels in the selection
 buffer, saying that their position in the label list in uncertain.  A
-manual document scan will fix this.@refill
+manual document scan will fix this.
 
 @item
 @b{Multiple Selection Buffers}@*
@@ -2941,7 +3058,7 @@
 only when a new label has been added in the buffers category with
 @code{reftex-label}.  Updating the buffer takes as long as recreating it
 - so the time saving is limited to cases where no new labels of that
-category have been added.  To turn on this feature, use@refill
+category have been added.  To turn on this feature, use
 
 @vindex reftex-use-multiple-selection-buffers
 @lisp
@@ -2953,7 +3070,7 @@
 You can also inhibit the automatic updating entirely.  Then the
 selection buffer will always pop up very fast, but may not contain the
 most recently defined labels.  You can always update the buffer by hand,
-with the @kbd{g} key.  To get this behavior, use instead@refill
+with the @kbd{g} key.  To get this behavior, use instead
 
 @vindex reftex-auto-update-selection-buffers
 @lisp
@@ -2984,8 +3101,7 @@
 files with Emacs (@pxref{Top,AUCTeX,,auctex, The AUCTeX User Manual}).
 If AUCTeX is not part of your Emacs distribution, you can get
 it@footnote{XEmacs 21.x users may want to install the corresponding
-XEmacs package.} by ftp from the
-@uref{ftp://ftp.gnu.org/pub/gnu/auctex,AUCTeX distribution site}.
+XEmacs package.} by ftp from the @value{AUCTEXSITE}.
 
 @menu
 * AUCTeX-RefTeX Interface::          How both packages work together
@@ -3002,7 +3118,7 @@
 indirectly as part of the AUCTeX
 environment@footnote{@b{Ref@TeX{}} 4.0 and AUCTeX 9.10c will be
 needed for all of this to work.  Parts of it work also with earlier
-versions.}.  The interface is turned on with@refill
+versions.}.  The interface is turned on with
 
 @lisp
 (setq reftex-plug-into-AUCTeX t)
@@ -3046,7 +3162,7 @@
 @item
 @b{AUCTeX tells @b{Ref@TeX{}} about new sections}@*
 When creating a new section with @kbd{C-c C-s}, @b{Ref@TeX{}} will not
-have to rescan the buffer in order to see it.@refill
+have to rescan the buffer in order to see it.
 
 @item
 @findex reftex-arg-label
@@ -3070,7 +3186,7 @@
 supplies the macro arguments with @b{Ref@TeX{}'s} mechanisms.  For
 example, when you type @kbd{C-c @key{RET} ref @key{RET}}, @b{Ref@TeX{}}
 will supply its label selection process (@pxref{Referencing
-Labels}).@refill
+Labels}).
 
 @item
 @b{@b{Ref@TeX{}} tells AUCTeX about new labels, citation-- and index keys}@*
@@ -3088,16 +3204,16 @@
 defines macros or environments connected with labels, citations, or the
 index.  Many style files (e.g. @file{amsmath.el} or @file{natbib.el})
 distributed with AUCTeX already support @b{Ref@TeX{}} in this
-way.@refill
+way.
 
 Before calling a @b{Ref@TeX{}} function, the style hook should always
 test for the availability of the function, so that the style file will
-also work for people who do not use @b{Ref@TeX{}}. @refill
+also work for people who do not use @b{Ref@TeX{}}. 
 
 Additions made with style files in the way described below remain local
 to the current document.  For example, if one package uses AMSTeX, the
 style file will make @b{Ref@TeX{}} switch over to @code{\eqref}, but
-this will not affect other documents.@refill
+this will not affect other documents.
 
 @findex reftex-add-label-environments
 @findex reftex-add-to-label-alist
@@ -3107,7 +3223,7 @@
 alias for compatibility.}  which defines additions to
 @code{reftex-label-alist}.  The argument taken by this function must have
 the same format as @code{reftex-label-alist}.  The @file{amsmath.el}
-style file of AUCTeX for example contains the following:@refill
+style file of AUCTeX for example contains the following:
 
 @lisp
 @group
@@ -3121,7 +3237,7 @@
 @noindent
 @findex LaTeX-add-environments, @r{AUCTeX}
 while a package @code{myprop} defining a @code{proposition} environment
-with @code{\newtheorem} might use@refill
+with @code{\newtheorem} might use
 
 @lisp
 @group
@@ -3139,7 +3255,7 @@
 Similarly, a style hook may contain a call to
 @code{reftex-set-cite-format} to set the citation format.  The style
 file @file{natbib.el} for the Natbib citation style does switch
-@b{Ref@TeX{}}'s citation format like this:@refill
+@b{Ref@TeX{}}'s citation format like this:
 
 @lisp
 (TeX-add-style-hook "natbib"
@@ -3210,14 +3326,14 @@
 highlighting is provided (among other things) by Peter S. Galbraith's
 @file{bib-cite.el}.  There is some overlap in the functionalities of
 Bib-cite and @b{Ref@TeX{}}.  Bib-cite.el comes bundled with
-AUCTeX.@refill
+AUCTeX.
 
 Bib-cite version 3.06 and later can be configured so that bib-cite's
 mouse functions use @b{Ref@TeX{}} for displaying references and citations.
 This can be useful in particular when working with the LaTeX @code{xr}
 package or with an explicit @code{thebibliography} environment (rather
 than BibTeX).  Bib-cite cannot handle those, but @b{Ref@TeX{}} does.  To
-make use of this feature, try@refill
+make use of this feature, try
 
 @vindex bib-cite-use-reftex-view-crossref
 @lisp
@@ -3234,13 +3350,13 @@
 @b{LaTeX commands}@*
 @cindex LaTeX commands, not found
 @code{\input}, @code{\include}, and @code{\section} (etc.) statements
-have to be first on a line (except for white space).@refill
+have to be first on a line (except for white space).
 
 @item
 @b{Commented regions}@*
 @cindex Labels, commented out
 @b{Ref@TeX{}} sees also labels in regions commented out and will refuse to
-make duplicates of such labels.  This is considered to be a feature.@refill
+make duplicates of such labels.  This is considered to be a feature.
 
 @item
 @b{Wrong section numbers}@*
@@ -3248,7 +3364,7 @@
 @vindex reftex-enable-partial-scans
 When using partial scans (@code{reftex-enable-partial-scans}), the section
 numbers in the table of contents may eventually become wrong.  A full
-scan will fix this.@refill
+scan will fix this.
 
 @item
 @b{Local settings}@*
@@ -3263,7 +3379,7 @@
 @code{reftex-add-label-environments}, @code{reftex-set-cite-format},
 @code{reftex-add-index-macros}, and @code{reftex-add-section-levels}.
 Settings made with these functions remain local to the current
-document. @xref{AUCTeX}.@refill
+document. @xref{AUCTeX}.
 
 @item
 @b{Funny display in selection buffer}@*
@@ -3282,21 +3398,21 @@
 headings may look different from what you usually see on your screen.
 In rare cases @code{reftex-toc} may have problems to jump to an affected
 section heading.  There are three possible ways to deal with
-this:@refill
+this:
 @itemize @minus
 @item
 @vindex reftex-keep-temporary-buffers
 @code{(setq reftex-keep-temporary-buffers t)}@*
 This implies that @b{Ref@TeX{}} will load all parts of a multifile
-document into Emacs (i.e. there won't be any temporary buffers).@refill
+document into Emacs (i.e. there won't be any temporary buffers).
 @item
 @vindex reftex-initialize-temporary-buffers
 @code{(setq reftex-initialize-temporary-buffers t)}@*
 This means full initialization of temporary buffers.  It involves
-a penalty when the same unvisited file is used for lookup often.@refill
+a penalty when the same unvisited file is used for lookup often.
 @item
 Set @code{reftex-initialize-temporary-buffers} to a list of hook
-functions doing a minimal initialization.@refill
+functions doing a minimal initialization.
 @end itemize
 @vindex reftex-refontify-context
 See also the variable @code{reftex-refontify-context}.
@@ -3332,7 +3448,7 @@
 argument (which really is a second argument to the macro @code{\begin})
 as a label of type @code{?p}.  Argument count for this macro starts only
 after the @samp{@{step+@}}, also when specifying how to get
-context.@refill
+context.
 
 @item
 @b{Idle timers in XEmacs}@*
@@ -3352,7 +3468,7 @@
 @cindex Key bindings, problems with Viper mode
 @findex viper-harness-minor-mode
 With @i{Viper} mode prior to Vipers version 3.01, you need to protect
-@b{Ref@TeX{}}'s keymaps with@refill
+@b{Ref@TeX{}}'s keymaps with
 
 @lisp
 (viper-harness-minor-mode "reftex")
@@ -3373,19 +3489,19 @@
 
 @b{Ref@TeX{}} was written by @i{Carsten Dominik}
 @email{dominik@@science.uva.nl}, with contributions by @i{Stephen
-Eglen}.  @b{Ref@TeX{}} is currently maintained by @refill
+Eglen}.  @b{Ref@TeX{}} is currently maintained by 
 
 @noindent
-Carsten Dominik @email{dominik@@science.uva.nl}
+Carsten Dominik <dominik@@science.uva.nl>
 
 If you have questions about @b{Ref@TeX{}}, there are several Usenet
 groups which have competent readers: @code{comp.emacs},
-@code{gnu.emacs.help}, @code{comp.emacs.xemacs}, @code{comp.text.tex}.
-You can also write directly to the maintainer.
+@code{gnu.emacs.help}, @code{comp.emacs.xemacs}, @code{comp.text.tex},
+@code{de.comp.text.tex}.  You can also write directly to the
+maintainer.
 
 If you find a bug in @b{Ref@TeX{}} or its documentation, or if you want
-to contribute code or ideas, please
-@uref{mailto:dominik@@science.uva.nl,contact the maintainer}.  Remember
+to contribute code or ideas, please @value{MAINTAINERCONTACT}.  Remember
 to provide all necessary information such as version numbers of Emacs
 and @b{Ref@TeX{}}, and the relevant part of your configuration in
 @file{.emacs}.  When reporting a bug which throws an exception, please
@@ -3394,31 +3510,30 @@
 @b{Ref@TeX{}} is bundled and pre-installed with Emacs since version 20.2.
 It was also bundled and pre-installed with XEmacs 19.16--20.x.  XEmacs
 21.x users want to install the corresponding plugin package which is
-available from the XEmacs @code{ftp} site.  See the XEmacs 21.x
-documentation on package installation for details.@refill
+available from the @value{XEMACSFTP}.  See the XEmacs 21.x
+documentation on package installation for details.
 
 Users of earlier Emacs distributions (including Emacs 19) can get a
-@b{Ref@TeX{}} distribution from the
-@uref{http://www.strw.leidenuniv.nl/~dominik/Tools/,maintainers
-webpage}.  Note that the Emacs 19 version supports many but not all
-features described in this manual.@refill
+@b{Ref@TeX{}} distribution from the @value{MAINTAINERSITE}.  Note that
+the Emacs 19 version supports many but not all features described in
+this manual.
 
 Thanks to the people on the Net who have used @b{Ref@TeX{}} and helped
 developing it with their reports.  In particular thanks to @i{Fran
 Burstall, Alastair Burt, Lars Clausen, Soren Dayton, Stephen Eglen, Karl
-Eichwalder, Erik Frik, Erik Frisk, Peter Galbraith, Kai Grossjohann,
-Frank Harrell, Stephan Heuel, Alan Ho, Lute Kamstra, Dieter Kraft,
-Adrian Lanz, Rory Molinari, Stefan Monnier, Laurent Mugnier, Sudeep
-Kumar Palat, Daniel Polani, Alan Shutko, Robin Socha, Richard Stanton,
-Allan Strand, Jan Vroonhof, Christoph Wedler, Alan Williams, Roland
-Winkler, Eli Zaretskii}.@refill
+Eichwalder, Erik Frisk, Peter Galbraith, Kai Grossjohann, Frank Harrell,
+Peter Heslin, Stephan Heuel, Alan Ho, Lute Kamstra, Dieter Kraft, David
+Kastrup, Adrian Lanz, Rory Molinari, Stefan Monnier, Laurent Mugnier,
+Sudeep Kumar Palat, Daniel Polani, Alan Shutko, Robin Socha, Richard
+Stanton, Allan Strand, Jan Vroonhof, Christoph Wedler, Alan Williams,
+Roland Winkler, Hans-Christoph Wirth, Eli Zaretskii}.
 
 The @code{view-crossref} feature was inspired by @i{Peter Galbraith's}
-@file{bib-cite.el}.@refill
-
-Finally thanks to @i{Uwe Bolick} who first got me (some years ago) into
+@file{bib-cite.el}.
+
+Finally thanks to @i{Uwe Bolick} who first got me interested in
 supporting LaTeX labels and references with an editor (which was
-MicroEmacs at the time).@refill
+MicroEmacs at the time).
 
 @node Commands, Options, Imprint, Top
 @chapter Commands
@@ -3431,7 +3546,7 @@
 
 @deffn Command reftex-toc
 Show the table of contents for the current document.  When called with
-one ore two @kbd{C-u} prefixes, rescan the document first.@refill
+one ore two @kbd{C-u} prefixes, rescan the document first.
 @end deffn
 
 @deffn Command reftex-label
@@ -3450,17 +3565,17 @@
 @code{\bibliography} command or a @code{thebibliography} environment)
 and offers the matching entries for selection.  The selected entry is
 formatted according to @code{reftex-cite-format} and inserted into the
-buffer.@refill @*
-When called with one or two @kbd{C-u} prefixes, first rescans the
-document.  When called with a numeric prefix, make that many citations.
+buffer. @*
+When called with a @kbd{C-u} prefixe, prompt for optional arguments in
+cite macros.  When called with a numeric prefix, make that many citations.
 When called with point inside the braces of a @code{\cite} command, it
 will add another key, ignoring the value of
-@code{reftex-cite-format}.@refill @*
+@code{reftex-cite-format}. @*
 The regular expression uses an expanded syntax: @samp{&&} is interpreted
 as @code{and}.  Thus, @samp{aaaa&&bbb} matches entries which contain
 both @samp{aaaa} and @samp{bbb}.  While entering the regexp, completion
 on knows citation keys is possible.  @samp{=} is a good regular
-expression to match all entries in all files.@refill
+expression to match all entries in all files.
 @end deffn
 
 @deffn Command reftex-index
@@ -3468,7 +3583,7 @@
 index macros available are those defined in @code{reftex-index-macro} or
 by a call to @code{reftex-add-index-macros}, typically from an AUCTeX
 style file.  @b{Ref@TeX{}} provides completion for the index tag and the
-index key, and will prompt for other arguments.@refill
+index key, and will prompt for other arguments.
 @end deffn
 
 @deffn Command reftex-index-selection-or-word
@@ -3480,7 +3595,7 @@
 @kbd{C-u} as prefix, also ask for the index macro and other stuff.  When
 called inside TeX math mode as determined by the @file{texmathp.el}
 library which is part of AUCTeX, the string is first processed with the
-@code{reftex-index-math-format}, which see.@refill
+@code{reftex-index-math-format}, which see.
 @end deffn
 
 @deffn Command reftex-index-phrase-selection-or-word
@@ -3507,7 +3622,7 @@
 When index support is turned off, offer to turn it on.
 With one or two @kbd{C-u} prefixes, rescan document first.
 With prefix 2, restrict index to current document section.
-With prefix 3, restrict index to active region.@refill
+With prefix 3, restrict index to active region.
 @end deffn
 
 @deffn Command reftex-view-crossref
@@ -3532,25 +3647,25 @@
 @deffn Command reftex-create-tags-file
 Create TAGS file by running @code{etags} on the current document.  The
 TAGS file is also immediately visited with
-@code{visit-tags-table}.@refill
+@code{visit-tags-table}.
 @end deffn
 
 @deffn Command reftex-grep-document
 Run grep query through all files related to this document.
 With prefix arg, force to rescan document.
-No active TAGS table is required.@refill
+No active TAGS table is required.
 @end deffn
 
 @deffn Command reftex-search-document
 Regexp search through all files of the current document.
 Starts always in the master file.  Stops when a match is found.
-No active TAGS table is required.@refill
+No active TAGS table is required.
 @end deffn
 
 @deffn Command reftex-query-replace-document
 Run a query-replace-regexp of @var{from} with @var{to} over the entire
 document.  With prefix arg, replace only word-delimited matches.  No
-active TAGS table is required.@refill
+active TAGS table is required.
 @end deffn
 
 @deffn Command reftex-goto-label
@@ -3563,7 +3678,7 @@
 @deffn Command reftex-change-label
 Query replace @var{from} with @var{to} in all @code{\label} and
 @code{\ref} commands.  Works on the entire multifile document.  No
-active TAGS table is required.@refill
+active TAGS table is required.
 @end deffn
 
 @deffn Command reftex-renumber-simple-labels
@@ -3575,11 +3690,19 @@
 arguments of any macros which either start or end with the string
 @samp{ref}.  This command should be used with care, in particular in
 multifile documents.  You should not use it if another document refers
-to this one with the @code{xr} package.@refill
+to this one with the @code{xr} package.
 @end deffn
 
 @deffn Command reftex-find-duplicate-labels
-Produce a list of all duplicate labels in the document.@refill
+Produce a list of all duplicate labels in the document.
+@end deffn
+
+@deffn Command reftex-create-bibtex-file
+Create a new BibTeX database file with all entries referenced in document.
+The command prompts for a filename and writes the collected entries to
+that file.  Only entries referenced in the current document with
+any @code{\cite}-like macros are used. 
+The sequence in the new file is the same as it was in the old database.
 @end deffn
 
 @deffn Command reftex-customize
@@ -3607,7 +3730,7 @@
 variables have customize support - so if you are not familiar with Emacs
 Lisp (and even if you are) you might find it more comfortable to use
 @code{customize} to look at and change these variables. @kbd{M-x
-reftex-customize} will get you there.@refill
+reftex-customize} will get you there.
 
 @menu
 * Options (Table of Contents)::
@@ -3643,16 +3766,21 @@
 Commands and levels used for defining sections in the document.  The
 @code{car} of each cons cell is the name of the section macro.  The
 @code{cdr} is a number indicating its level.  A negative level means the
-same as the positive value, but the section will never get a
-number.  The @code{cdr} may also be a function which then has to return
-the level.@refill
+same as the positive value, but the section will never get a number.
+The @code{cdr} may also be a function which then has to return the
+level.  This list is also used for promotion and demption of sectioning
+commands.  If you are using a document class which has several sets of
+sectioning commands, promotion only works correctly if this list is
+sorted first by set, then within each set by level.  The promotion
+commands always select the nearest entry with the correct new level.
+
 @end defopt
 
 @defopt reftex-toc-max-level
 The maximum level of toc entries which will be included in the TOC.
 Section headings with a bigger level will be ignored.  In RefTeX,
 chapters are level 1, sections level 2 etc.  This variable can be
-changed from within the @file{*toc*} buffer with the @kbd{t} key.@refill
+changed from within the @file{*toc*} buffer with the @kbd{t} key.
 @end defopt
 
 @defopt reftex-part-resets-chapter
@@ -3664,11 +3792,21 @@
 @end defopt
 
 @defopt reftex-auto-recenter-toc
-Non-@code{nil} means, initially turn automatic recentering of toc on.
-When active, the @file{*TOC*} buffer will always show the section you
-are currently working in.  Recentering happens whenever Emacs is idle
-for more than `reftex-idle-time' seconds.
-This feature can be turned on and off from the menu
+Non-@code{nil} means, turn automatic recentering of @file{*TOC*} window on.
+When active, the @file{*TOC*} window will always show the section you
+are currently working in.  Recentering happens whenever Emacs is idle for
+more than @code{reftex-idle-time} seconds.
+
+Value @code{t} means, turn on immediately when RefTeX gets started.  Then,
+recentering will work for any toc window created during the session.
+
+Value @code{frame} (the default) means, turn automatic recentering on
+only while the dedicated TOC frame does exist, and do the recentering
+only in that frame.  So when creating that frame (with @kbd{d} key in an
+ordinary TOC window), the automatic recentering is turned on.  When the
+frame gets destroyed, automatic recentering is turned off again.
+
+This feature can be turned on and off from the menu 
 (Ref->Options).
 @end defopt
 
@@ -3677,10 +3815,8 @@
 horizontally.  The default is to split vertically.
 @end defopt
 
-@defopt reftex-toc-split-windows-horizontally-fraction
-Fraction of the horizontal width of the frame to be used for TOC window.
-Only relevant when @code{reftex-toc-split-windows-horizontally} is
-non-@code{nil}.
+@defopt reftex-toc-split-windows-fraction
+Fraction of the width or height of the frame to be used for TOC window.
 @end defopt
 
 @defopt reftex-toc-keep-other-windows
@@ -3688,19 +3824,19 @@
 @file{*toc*} buffer.  This helps to keep the window configuration, but
 makes the @file{*toc*} small.  When @code{nil}, all other windows except
 the selected one will be deleted, so that the @file{*toc*} window fills
-half the frame.@refill
+half the frame.
 @end defopt
 
 @defopt reftex-toc-include-file-boundaries
 Non-@code{nil} means, include file boundaries in @file{*toc*} buffer.
 This flag can be toggled from within the @file{*toc*} buffer with the
-@kbd{i} key.@refill
+@kbd{i} key.
 @end defopt
 
 @defopt reftex-toc-include-labels
 Non-@code{nil} means, include labels in @file{*toc*} buffer.  This flag
 can be toggled from within the @file{*toc*} buffer with the @kbd{l}
-key.@refill
+key.
 @end defopt
 
 @defopt reftex-toc-include-index-entries
@@ -3713,7 +3849,7 @@
 Non-@code{nil} means, include context with labels in the @file{*toc*}
 buffer.  Context will only be shown if the labels are visible as well.
 This flag can be toggled from within the @file{*toc*} buffer with the
-@kbd{c} key.@refill
+@kbd{c} key.
 @end defopt
 
 @defopt reftex-toc-follow-mode
@@ -3721,17 +3857,17 @@
 table-of-contents buffer) will cause other window to follow.  The other
 window will show the corresponding part of the document.  This flag can
 be toggled from within the @file{*toc*} buffer with the @kbd{f}
-key.@refill
+key.
 @end defopt
 
 @deffn {Normal Hook} reftex-toc-mode-hook
 Normal hook which is run when a @file{*toc*} buffer is
-created.@refill
+created.
 @end deffn
 
 @deffn Keymap reftex-toc-map
 The keymap which is active in the @file{*toc*} buffer.
-(@pxref{Table of Contents}).@refill
+(@pxref{Table of Contents}).
 @end deffn
 
 @node Options (Defining Label Environments), Options (Creating Labels), Options (Table of Contents), Options
@@ -3742,7 +3878,7 @@
 @defopt reftex-default-label-alist-entries
 Default label alist specifications.  It is a list of symbols with
 associations in the constant @code{reftex-label-alist-builtin}.
-@code{LaTeX} should always be the last entry.@refill
+@code{LaTeX} should always be the last entry.
 @end defopt
 
 @defopt reftex-label-alist
@@ -3750,7 +3886,7 @@
 @code{reftex-default-label-alist-entries}.  The only things you
 @emph{must not} change is that @code{?s} is the type indicator for
 section labels, and @key{SPC} for the @code{any} label type.  These are
-hard-coded at other places in the code.@refill
+hard-coded at other places in the code.
 
 The value of the variable must be a list of items.  Each item is a list
 itself and has the following structure:
@@ -3763,7 +3899,7 @@
 Each list entry describes either an environment carrying a counter for
 use with @code{\label} and @code{\ref}, or a LaTeX macro defining a
 label as (or inside) one of its arguments.  The elements of each list
-entry are:@refill
+entry are:
 
 @table @asis
 @item @var{env-or-macro}
@@ -3772,10 +3908,10 @@
 @samp{\myfig[]@{@}@{@}@{*@}@{@}}.  Use square brackets for optional
 arguments, a star to mark the label argument, if any.  The macro does
 not have to have a label argument - you could also use
-@samp{\label@{...@}} inside one of its arguments.@refill
+@samp{\label@{...@}} inside one of its arguments.
 
 Special names: @code{section} for section labels, @code{any} to define a
-group which contains all labels.@refill
+group which contains all labels.
 
 This may also be a function to do local parsing and identify point to be
 in a non-standard label environment.  The function must take an
@@ -3783,11 +3919,11 @@
 should return either nil or a cons cell @code{(@var{function}
 . @var{position})} with the function symbol and the position where the
 special environment starts.  See the Info documentation for an
-example.@refill
+example.
 
 Finally this may also be @code{nil} if the entry is only meant to change
 some settings associated with the type indicator character (see
-below).@refill
+below).
 
 @item @var{type-key}
 Type indicator character, like @code{?t}, must be a printable ASCII
@@ -3798,35 +3934,37 @@
 label type (like @code{equation} and @code{eqnarray}).  If the type
 indicator is @code{nil} and the macro has a label argument @samp{@{*@}},
 the macro defines neutral labels just like @code{\label}.  In this case
-the reminder of this entry is ignored.@refill
+the reminder of this entry is ignored.
 
 @item @var{label-prefix}
 Label prefix string, like @samp{tab:}.  The prefix is a short string
 used as the start of a label.  It may be the empty string.  The prefix
-may contain the following @samp{%} escapes:@refill
+may contain the following @samp{%} escapes:
 
 @example
 %f Current file name, directory and extension stripped.
 %F Current file name relative to master file directory.
+%m Master file name, directory and extension stripped.
+%M Directory name (without path) where master file is located.
 %u User login name, on systems which support this.
 %S A section prefix derived with variable @code{reftex-section-prefixes}.
 @end example
 
 @noindent
 Example: In a file @file{intro.tex}, @samp{eq:%f:} will become
-@samp{eq:intro:}.@refill
+@samp{eq:intro:}.
 
 @item @var{reference-format}
 Format string for reference insert in buffer.  @samp{%s} will be
 replaced by the label.  When the format starts with @samp{~}, this
 @samp{~} will only be inserted when the character before point is
-@emph{not} a whitespace.@refill
+@emph{not} a whitespace.
 
 @item @var{context-method}
 Indication on how to find the short context.
 @itemize @minus
 @item
-If @code{nil}, use the text following the @samp{\label@{...@}} macro.@refill
+If @code{nil}, use the text following the @samp{\label@{...@}} macro.
 @item
 If @code{t}, use
 @itemize @minus
@@ -3835,32 +3973,32 @@
 @item
 text following the @samp{\begin@{...@}} statement of environments (not
 a good choice for environments like eqnarray or enumerate, where one has
-several labels in a single environment).@refill
+several labels in a single environment).
 @item
 text after the macro name (starting with the first arg) for
-macros.@refill
+macros.
 @end itemize
 @item
 If an integer, use the nth argument of the macro.  As a special case,
-1000 means to get text after the last macro argument.@refill
+1000 means to get text after the last macro argument.
 @item
 If a string, use as regexp to search @emph{backward} from the label.
 Context is then the text following the end of the match.  E.g. putting
 this to @samp{\\caption[[@{]} will use the caption in a figure or table
 environment.  @samp{\\begin@{eqnarray@}\|\\\\} works for
-eqnarrays.@refill
+eqnarrays.
 @item
 If any of @code{caption}, @code{item}, @code{eqnarray-like},
 @code{alignat-like}, this symbol will internally be translated into an
 appropriate regexp (see also the variable
-@code{reftex-default-context-regexps}).@refill
+@code{reftex-default-context-regexps}).
 @item
 If a function, call this function with the name of the environment/macro
 as argument.  On call, point will be just after the @code{\label} macro.
 The function is expected to return a suitable context string.  It should
 throw an exception (error) when failing to find context.  As an example,
 here is a function returning the 10 chars following the label macro as
-context:@refill
+context:
 
 @example
 (defun my-context-function (env-or-mac)
@@ -3875,7 +4013,7 @@
 method for each of these, specify them as a dotted pair.
 E.g. @code{(nil . t)} uses the text after the label (@code{nil}) for
 display, and text from the default position (@code{t}) to derive a label
-string.  This is actually used for section labels.@refill
+string.  This is actually used for section labels.
 
 @item @var{magic-word-list}
 List of magic words which identify a reference to be of this type.  If
@@ -3883,7 +4021,7 @@
 @code{reftex-reference}, the label list offered will be automatically
 restricted to labels of the correct type.  If the first element of this
 word--list is the symbol `regexp', the strings are interpreted as regular
-expressions.@refill
+expressions.
 
 @item @var{toc-level}
 The integer level at which this environment should be added to the table
@@ -3892,11 +4030,11 @@
 level.  A negative value will make unnumbered entries.  Useful only for
 theorem-like environments which structure the document.  Will be ignored
 for macros.  When omitted or @code{nil}, no TOC entries will be
-made.@refill
+made.
 @end table
 
 If the type indicator characters of two or more entries are the same,
-@b{Ref@TeX{}} will use@refill
+@b{Ref@TeX{}} will use
 @itemize @minus
 @item
 the first non-@code{nil} format and prefix
@@ -3907,7 +4045,7 @@
 Any list entry may also be a symbol.  If that has an association in
 @code{reftex-label-alist-builtin}, the @code{cddr} of that association is
 spliced into the list.  However, builtin defaults should normally be set
-with the variable @code{reftex-default-label-alist-entries}.@refill
+with the variable @code{reftex-default-label-alist-entries}.
 @end defopt
 
 @defopt reftex-section-prefixes
@@ -3924,7 +4062,39 @@
 Alist with default regular expressions for finding context.  The emacs
 lisp form @w{@code{(format regexp (regexp-quote environment))}} is used
 to calculate the final regular expression - so @samp{%s} will be
-replaced with the environment or macro.@refill
+replaced with the environment or macro.
+@end defopt
+
+@defopt reftex-trust-label-prefix
+Non-@code{nil} means, trust the label prefix when determining label type.
+It is customary to use special label prefixes to distinguish different label
+types.  The label prefixes have no syntactic meaning in LaTeX (unless
+special packages like fancyref) are being used.  RefTeX can and by
+default does parse around each label to detect the correct label type,
+but this process can be slow when a document contains thousands of
+labels.  If you use label prefixes consistently, you may speed up
+document parsing by setting this variable to a non-nil value.  RefTeX
+will then compare the label prefix with the prefixes found in
+`reftex-label-alist' and derive the correct label type in this way.
+Possible values for this option are:
+
+@example
+t       @r{This means to trust any label prefixes found.}
+regexp  @r{If a regexp, only prefixes matched by the regexp are trusted.}
+list    @r{List of accepted prefixes, as strings.  The colon is part of}
+        @r{the prefix, e.g. ("fn:" "eqn:" "item:").}   
+nil     @r{Never trust a label prefix.}
+@end example
+The only disadvantage of using this feature is that the label context
+displayed in the label selection buffer along with each label is
+simply some text after the label definition.  This is no problem if you
+place labels keeping this in mind (e.g. @i{before} the equation, @i{at
+the beginning} of a fig/tab caption ...).  Anyway, it is probably best
+to use the regexp or the list value types to fine-tune this feature.
+For example, if your document contains thousands of footnotes with
+labels fn:xxx, you may want to set this variable to the value "^fn:$" or
+("fn:").  Then RefTeX will still do extensive parsing for any
+non-footnote labels.
 @end defopt
 
 @node Options (Creating Labels), Options (Referencing Labels), Options (Defining Label Environments), Options
@@ -3945,14 +4115,14 @@
 governed by the specifications given in
 @code{reftex-derive-label-parameters}.  If @var{derive} is @code{nil},
 the default label will consist of the prefix and a unique number, like
-@samp{eq:23}.@refill
+@samp{eq:23}.
 
 If @var{prompt} is @code{t}, the user will be prompted for a label
 string.  When @var{prompt} is @code{nil}, the default label will be
-inserted without query.@refill
+inserted without query.
 
 So the combination of @var{derive} and @var{prompt} controls label
-insertion.  Here is a table describing all four possibilities:@refill
+insertion.  Here is a table describing all four possibilities:
 
 @example
 @group
@@ -3970,12 +4140,12 @@
 the combination may be set differently for each label type.  The default
 settings @samp{"s"} and @samp{"sft"} mean: Derive section labels from
 headings (with confirmation).  Prompt for figure and table labels.  Use
-simple labels without confirmation for everything else.@refill
+simple labels without confirmation for everything else.
 
 The available label types are: @code{s} (section), @code{f} (figure),
 @code{t} (table), @code{i} (item), @code{e} (equation), @code{n}
 (footnote), @code{N} (endnote) plus any definitions in
-@code{reftex-label-alist}.@refill
+@code{reftex-label-alist}.
 @end defopt
 
 @deffn Hook reftex-format-label-function
@@ -3983,13 +4153,13 @@
 insert as a label definition.  The function will be called with two
 arguments, the @var{label} and the @var{default-format} (usually
 @samp{\label@{%s@}}).  It should return the string to insert into the
-buffer.@refill
+buffer.
 @end deffn
 
 @deffn Hook reftex-string-to-label-function
 Function to turn an arbitrary string into a legal label.
 @b{Ref@TeX{}}'s default function uses the variable
-@code{reftex-derive-label-parameters}.@refill
+@code{reftex-derive-label-parameters}.
 @end deffn
 
 @deffn Hook reftex-translate-to-ascii-function
@@ -3998,12 +4168,12 @@
 Mule characters into something legal in labels.  The default function
 @code{reftex-latin1-to-ascii} removes the accents from Latin-1
 characters.  X-Symbol (>=2.6) sets this variable to the much more
-general @code{x-symbol-translate-to-ascii}.@refill
+general @code{x-symbol-translate-to-ascii}.
 @end deffn
 
 @defopt reftex-derive-label-parameters
 Parameters for converting a string into a label.  This variable is a
-list of the following items:@refill
+list of the following items:
 @table @asis
 @item @var{nwords}
 Number of words to use.
@@ -4030,16 +4200,16 @@
 @end defopt
 
 @defopt reftex-abbrev-parameters
-Parameters for abbreviation of words.  A list of four parameters.@refill
+Parameters for abbreviation of words.  A list of four parameters.
 @table @asis
 @item @var{min-chars}
 Minimum number of characters remaining after abbreviation.
 @item @var{min-kill}
-Minimum number of characters to remove when abbreviating words.@refill
+Minimum number of characters to remove when abbreviating words.
 @item @var{before}
-Character class before abbrev point in word.@refill
+Character class before abbrev point in word.
 @item @var{after}
-Character class after  abbrev point in word.@refill
+Character class after  abbrev point in word.
 @end table
 @end defopt
 
@@ -4052,21 +4222,21 @@
 List of flags governing the label menu makeup. The flags are:
 @table @asis
 @item @var{table-of-contents}
-Show the labels embedded in a table of context.@refill
+Show the labels embedded in a table of context.
 @item @var{section-numbers}
-Include section numbers (like 4.1.3) in table of contents.@refill
+Include section numbers (like 4.1.3) in table of contents.
 @item @var{counters}
-Show counters.  This just numbers the labels in the menu.@refill
+Show counters.  This just numbers the labels in the menu.
 @item @var{no-context}
-Non-@code{nil} means do @emph{not} show the short context.@refill
+Non-@code{nil} means do @emph{not} show the short context.
 @item @var{follow}
-Follow full context in other window.@refill
+Follow full context in other window.
 @item @var{show-commented}
-Show labels from regions which are commented out.@refill
+Show labels from regions which are commented out.
 @item @var{match-everywhere}
-Obsolete flag.@refill
+Obsolete flag.
 @item @var{show-files}
-Show begin and end of included files.@refill
+Show begin and end of included files.
 @end table
 
 Each of these flags can be set to @code{t} or @code{nil}, or to a string
@@ -4074,15 +4244,15 @@
 These strings work like character classes in regular expressions.  Thus,
 setting one of the flags to @samp{"sf"} makes the flag true for section
 and figure labels, @code{nil} for everything else.  Setting it to
-@samp{"^sf"} makes it the other way round.@refill
+@samp{"^sf"} makes it the other way round.
 
 The available label types are: @code{s} (section), @code{f} (figure),
 @code{t} (table), @code{i} (item), @code{e} (equation), @code{n}
-(footnote), plus any definitions in @code{reftex-label-alist}.@refill
+(footnote), plus any definitions in @code{reftex-label-alist}.
 
 Most options can also be switched from the label menu itself - so if you
 decide here to not have a table of contents in the label menu, you can
-still get one interactively during selection from the label menu.@refill
+still get one interactively during selection from the label menu.
 @end defopt
 
 @defopt reftex-multiref-punctuation
@@ -4092,7 +4262,7 @@
 inserted into the buffer before the corresponding @code{\ref} macro.
 This is used to string together whole reference sets, like
 @samp{eqs. 1,2,3-5,6 and 7} in a single call to
-@code{reftex-reference}.@refill
+@code{reftex-reference}.
 @end defopt
 
 @defopt reftex-vref-is-default
@@ -4102,7 +4272,7 @@
 determines the default which is active when entering the selection
 process.  Instead of @code{nil} or @code{t}, this may also be a string
 of type letters indicating the label types for which it should be
-true.@refill
+true.
 @end defopt
 
 @defopt reftex-fref-is-default
@@ -4123,11 +4293,11 @@
 even if you set this, your setting will be ignored by the special
 commands.  The function will be called with two arguments, the
 @var{label} and the @var{default-format} (usually @samp{~\ref@{%s@}}).
-It should return the string to insert into the buffer.@refill
+It should return the string to insert into the buffer.
 @end deffn
 
 @defopt reftex-level-indent
-Number of spaces to be used for indentation per section level.@refill
+Number of spaces to be used for indentation per section level.
 @end defopt
 
 @defopt reftex-guess-label-type
@@ -4137,29 +4307,29 @@
 @code{reftex-label-alist}.  When it finds a match, @b{Ref@TeX{}} will
 immediately offer the correct label menu - otherwise it will prompt you
 for a label type.  If you set this variable to @code{nil}, @b{Ref@TeX{}}
-will always prompt for a label type.@refill
+will always prompt for a label type.
 @end defopt
 
 @deffn {Normal Hook} reftex-display-copied-context-hook
 Normal Hook which is run before context is displayed anywhere.  Designed
-for @w{@code{X-Symbol}}, but may have other uses as well.@refill
+for @w{@code{X-Symbol}}, but may have other uses as well.
 @end deffn
 
 @deffn Hook reftex-pre-refontification-functions
 @code{X-Symbol} specific hook.  Probably not useful for other purposes.
 The functions get two arguments, the buffer from where the command
 started and a symbol indicating in what context the hook is
-called.@refill
+called.
 @end deffn
 
 @deffn {Normal Hook} reftex-select-label-mode-hook
 Normal hook which is run when a selection buffer enters
-@code{reftex-select-label-mode}.@refill
+@code{reftex-select-label-mode}.
 @end deffn
 
 @deffn Keymap reftex-select-label-map
 The keymap which is active in the labels selection process
-(@pxref{Referencing Labels}).@refill
+(@pxref{Referencing Labels}).
 @end deffn
 
 @node Options (Creating Citations), Options (Index Support), Options (Referencing Labels), Options
@@ -4176,7 +4346,7 @@
 @code{\\bibliography@{..@}}.  File names matched by any of these regexps
 will not be parsed.  Intended for files which contain only
 @code{@@string} macro definitions and the like, which are ignored by
-@b{Ref@TeX{}} anyway.@refill
+@b{Ref@TeX{}} anyway.
 @end defopt
 
 @defopt reftex-default-bibliography
@@ -4185,12 +4355,12 @@
 a @samp{\bibliography@{...@}} statement nor a @code{thebibliography}
 environment, @b{Ref@TeX{}} will scan these files instead.  Intended for
 using @code{reftex-citation} in non-LaTeX files.  The files will be
-searched along the BIBINPUTS or TEXBIB path.@refill
+searched along the BIBINPUTS or TEXBIB path.
 @end defopt
 
 @defopt reftex-sort-bibtex-matches
 Sorting of the entries found in BibTeX databases by reftex-citation.
-Possible values:@refill
+Possible values:
 @example
 nil          @r{Do not sort entries.}
 author       @r{Sort entries by author name.}
@@ -4203,10 +4373,10 @@
 The format of citations to be inserted into the buffer.  It can be a
 string, an alist or a symbol.  In the simplest case this is just the string
 @samp{\cite@{%l@}}, which is also the default.  See the definition of
-@code{reftex-cite-format-builtin} for more complex examples.@refill
+@code{reftex-cite-format-builtin} for more complex examples.
 
 If @code{reftex-cite-format} is a string, it will be used as the format.
-In the format, the following percent escapes will be expanded.@refill
+In the format, the following percent escapes will be expanded.
 
 @table @code
 @item %l
@@ -4219,7 +4389,7 @@
 First author name only.
 @item %e
 Works like @samp{%a}, but on list of editor names. (@samp{%2e} and
-@samp{%E} work a well).@refill
+@samp{%E} work a well).
 @end table
 
 It is also possible to access all other BibTeX database fields:
@@ -4235,52 +4405,72 @@
 
 @noindent
 Usually, only @samp{%l} is needed.  The other stuff is mainly for the
-echo area display, and for @code{(setq reftex-comment-citations t)}.@refill
+echo area display, and for @code{(setq reftex-comment-citations t)}.
 
 @samp{%<} as a special operator kills punctuation and space around it
-after the string has been formatted.@refill
+after the string has been formatted.
+
+A pair of square brackets indicates an optional argument, and RefTeX
+will prompt for the values of these arguments.
 
 Beware that all this only works with BibTeX database files.  When
 citations are made from the @code{\bibitems} in an explicit
-@code{thebibliography} environment, only @samp{%l} is available.@refill
+@code{thebibliography} environment, only @samp{%l} is available.
 
 If @code{reftex-cite-format} is an alist of characters and strings, the
 user will be prompted for a character to select one of the possible
-format strings.@refill
+format strings.
 
 In order to configure this variable, you can either set
 @code{reftex-cite-format} directly yourself or set it to the
 @emph{symbol} of one of the predefined styles.  The predefined symbols
 are those which have an association in the constant
 @code{reftex-cite-format-builtin})  E.g.: @code{(setq reftex-cite-format
-'natbib)}.@refill
+'natbib)}.
 @end defopt
 
 @deffn Hook reftex-format-cite-function
-
 If non-@code{nil}, should be a function which produces the string to
 insert as a citation.  Note that the citation format can also be changed
 with the variable @code{reftex-cite-format}.  The function will be
 called with two arguments, the @var{citation-key} and the
 @var{default-format} (taken from @code{reftex-cite-format}).  It should
-return the string to insert into the buffer.@refill
+return the string to insert into the buffer.
 @end deffn
 
+@defopt reftex-cite-prompt-optional-args
+Non-@code{nil} means, prompt for empty optional arguments in cite macros.
+When an entry in @code{reftex-cite-format} ist given with square brackets to
+indicate optional arguments (for example @samp{\\cite[][]@{%l@}}), RefTeX can
+prompt for values.  Possible values are:
+@example
+nil     @r{Never prompt for optional arguments}
+t       @r{Always prompt}
+maybe   @r{Prompt only if @code{reftex-citation} was called with C-u prefix arg}@end example
+Unnecessary empty optional arguments are removed before insertion into
+the buffer.  See @code{reftex-cite-cleanup-optional-args}.
+@end defopt
+
+@defopt reftex-cite-cleanup-optional-args
+Non-@code{nil} means, remove empty optional arguments from cite macros
+if possible.
+@end defopt
+
 @defopt reftex-comment-citations
 Non-@code{nil} means add a comment for each citation describing the full
 entry.  The comment is formatted according to
-@code{reftex-cite-comment-format}.@refill
+@code{reftex-cite-comment-format}.
 @end defopt
 
 @defopt reftex-cite-comment-format
 Citation format used for commented citations.  Must @emph{not} contain
 @samp{%l}.  See the variable @code{reftex-cite-format} for possible
-percent escapes.@refill
+percent escapes.
 @end defopt
 
 @defopt reftex-cite-punctuation
 Punctuation for formatting of name lists in citations.  This is a list
-of 3 strings.@refill
+of 3 strings.
 @enumerate
 @item
 normal names separator, like @samp{, } in Jones, Brown and Miller
@@ -4294,12 +4484,12 @@
 
 @deffn {Normal Hook} reftex-select-bib-mode-hook
 Normal hook which is run when a selection buffer enters
-@code{reftex-select-bib-mode}.@refill
+@code{reftex-select-bib-mode}.
 @end deffn
 
 @deffn Keymap reftex-select-bib-map
 The keymap which is active in the citation-key selection process
-(@pxref{Creating Citations}).@refill
+(@pxref{Creating Citations}).
 @end deffn
 
 @node Options (Index Support), Options (Viewing Cross-References), Options (Creating Citations),  Options
@@ -4313,7 +4503,7 @@
 information can become quite big.  Therefore it can be turned off.  When
 this is @code{nil} and you execute a command which requires index
 support, you will be asked for confirmation to turn it on and rescan the
-document.@refill
+document.
 @end defopt
 
 @defopt reftex-index-special-chars
@@ -4331,35 +4521,35 @@
 
 @var{macro} is the macro.  Arguments should be denoted by empty braces,
 as for example in @samp{\index[]@{*@}}.  Use square brackets to denote
-optional arguments.  The star marks where the index key is.@refill
+optional arguments.  The star marks where the index key is.
 
 @var{index-tag} is a short name of the index.  @samp{idx} and @samp{glo}
 are reserved for the default index and the glossary.  Other indices can
 be defined as well.  If this is an integer, the Nth argument of the
-macro holds the index tag.@refill
+macro holds the index tag.
 
 @var{key} is a character which is used to identify the macro for input
 with @code{reftex-index}.  @samp{?i}, @samp{?I}, and @samp{?g} are
-reserved for default index and glossary.@refill
+reserved for default index and glossary.
 
 @var{prefix} can be a prefix which is added to the @var{key} part of the
 index entry.  If you have a macro
 @code{\newcommand@{\molec@}[1]@{#1\index@{Molecules!#1@}}, this prefix
-should be @samp{Molecules!}.@refill
+should be @samp{Molecules!}.
 
 @var{exclude} can be a function.  If this function exists and returns a
 non-@code{nil} value, the index entry at point is ignored.  This was
 implemented to support the (deprecated) @samp{^} and @samp{_} shortcuts
-in the LaTeX2e @code{index} package.@refill
+in the LaTeX2e @code{index} package.
 
 @var{repeat}, if non-@code{nil}, means the index macro does not typeset
 the entry in the text, so that the text has to be repeated outside the
 index macro.  Needed for @code{reftex-index-selection-or-word} and for
-indexing from the phrase buffer.@refill
+indexing from the phrase buffer.
 
 The final entry may also be a symbol.  It must have an association in
 the variable @code{reftex-index-macros-builtin} to specify the main
-indexing package you are using.  Legal values are currently@refill
+indexing package you are using.  Legal values are currently
 @example
 default         @r{The LaTeX default - unnecessary to specify this one}
 multind         @r{The multind.sty package}
@@ -4383,7 +4573,7 @@
 @var{tag} argument.  When this is @code{nil} and a @var{tag} is needed,
 @b{Ref@TeX{}} will ask for it.  When this is the empty string and the
 TAG argument of the index macro is optional, the TAG argument will be
-omitted.@refill
+omitted.
 @end defopt
 
 @defopt reftex-index-default-tag
@@ -4391,7 +4581,7 @@
 for an index tag when creating index entries or displaying a specific
 index.  This variable controls the default offered for these queries.
 The default can be selected with @key{RET} during selection or
-completion.  Legal values of this variable are:@refill
+completion.  Legal values of this variable are:
 @example
 nil        @r{Do not provide a default index}
 "tag"      @r{The default index tag given as a string, e.g. "idx"}
@@ -4405,7 +4595,7 @@
 the index key copied from the buffer is processed with this format
 string through the @code{format} function.  This can be used to add the
 math delimiters (e.g. @samp{$}) to the string.  Requires the
-@file{texmathp.el} library which is part of AUCTeX.@refill
+@file{texmathp.el} library which is part of AUCTeX.
 @end defopt
 
 @defopt reftex-index-phrase-file-extension
@@ -4420,7 +4610,7 @@
 the search phrase will produce @emph{several} different index entries.
 Make sure this does no match things which are not separators.  This
 logical @samp{and} has higher priority than the logical @samp{or}
-specified in @code{reftex-index-phrases-logical-or-regexp}.@refill
+specified in @code{reftex-index-phrases-logical-or-regexp}.
 @end defopt
 
 @defopt reftex-index-phrases-logical-or-regexp
@@ -4431,7 +4621,7 @@
 number key @kbd{1}--@kbd{9} must be pressed to switch to another.  Make
 sure this does no match things which are not separators.  The logical
 @samp{and} specified in @code{reftex-index-phrases-logical-or-regexp}
-has higher priority than this logical @samp{or}.@refill
+has higher priority than this logical @samp{or}.
 @end defopt
 
 @defopt reftex-index-phrases-search-whole-words
@@ -4443,7 +4633,7 @@
 
 @defopt reftex-index-phrases-case-fold-search
 Non-@code{nil} means, searching for index phrases will ignore
-case.@refill
+case.
 @end defopt
 
 @defopt reftex-index-verify-function
@@ -4459,7 +4649,7 @@
 will even be the norm.  When this variable is non-@code{nil},
 @b{Ref@TeX{}} checks if the match is an index macro argument, or if an
 index macro is directly before or after the phrase.  If that is the
-case, that match will be ignored.@refill
+case, that match will be ignored.
 @end defopt
 
 @defopt reftex-index-phrases-wrap-long-lines
@@ -4468,7 +4658,7 @@
 so long that it does not fit onto the screen.  When this variable is
 non-@code{nil}, newlines will be added as necessary before and/or after the
 indexing command to keep lines short.  However, the matched text
-phrase and its index command will always end up on a single line.@refill
+phrase and its index command will always end up on a single line.
 @end defopt
 
 @defopt reftex-index-phrases-sort-prefers-entry
@@ -4476,7 +4666,7 @@
 is used. Phrase lines in the phrases buffer contain a search phrase, and
 sorting is normally based on these.  Some phrase lines also have
 an explicit index argument specified.  When this variable is
-non-@code{nil}, the index argument will be used for sorting.@refill
+non-@code{nil}, the index argument will be used for sorting.
 @end defopt
 
 @defopt reftex-index-phrases-sort-in-blocks
@@ -4491,7 +4681,7 @@
 
 @defopt reftex-index-phrases-mode-hook
 Normal hook which is run when a buffer is put into
-@code{reftex-index-phrases-mode}.@refill
+@code{reftex-index-phrases-mode}.
 @end defopt
 
 @defopt reftex-index-section-letters
@@ -4501,7 +4691,7 @@
 thinks is correct.  In addition to these letters, @b{Ref@TeX{}} will
 create a group @samp{!} which contains all entries sorted below the
 lowest specified letter.  In the @file{*Index*} buffer, pressing any of
-these capital letters or @kbd{!} will jump to that section.@refill
+these capital letters or @kbd{!} will jump to that section.
 @end defopt
 
 @defopt reftex-index-include-context
@@ -4519,7 +4709,7 @@
 
 @deffn Keymap reftex-index-map
 The keymap which is active in the @file{*Index*} buffer
-(@pxref{Index Support}).@refill
+(@pxref{Index Support}).
 @end deffn
 
 @node Options (Viewing Cross-References), Options (Finding Files), Options (Index Support),  Options
@@ -4552,18 +4742,18 @@
 that cross reference.  You can also set the variable to the symbol
 @code{window}.  In this case a small temporary window is used for the
 display.  This feature can be turned on and off from the menu
-(Ref->Options).@refill
+(Ref->Options).
 @end defopt
 
 @defopt reftex-idle-time
 Time (secs) Emacs has to be idle before automatic crossref display
-or toc recentering is done.@refill
+or toc recentering is done.
 @end defopt
 
 @defopt reftex-cite-view-format
 Citation format used to display citation info in the message area.  See
 the variable @code{reftex-cite-format} for possible percent
-escapes.@refill
+escapes.
 @end defopt
 
 @defopt reftex-revisit-to-echo
@@ -4571,7 +4761,7 @@
 necessary.  When nil, citation display in echo area will only be active
 for cached echo strings (see @code{reftex-cache-cite-echo}), or for
 BibTeX database files which are already visited by a live associated
-buffers.@refill
+buffers.
 @end defopt
 
 @defopt reftex-cache-cite-echo
@@ -4588,11 +4778,11 @@
 
 @defopt reftex-texpath-environment-variables
 List of specifications how to retrieve the search path for TeX files.
-Several entries are possible.@refill
+Several entries are possible.
 @itemize @minus
 @item
 If an element is the name of an environment variable, its content is
-used.@refill
+used.
 @item
 If an element starts with an exclamation mark, it is used as a command
 to retrieve the path.  A typical command with the kpathsearch library
@@ -4607,11 +4797,11 @@
 
 @defopt reftex-bibpath-environment-variables
 List of specifications how to retrieve the search path for BibTeX
-files.  Several entries are possible.@refill
+files.  Several entries are possible.
 @itemize @minus
 @item
 If an element is the name of an environment variable, its content is
-used.@refill
+used.
 @item
 If an element starts with an exclamation mark, it is used as a command
 to retrieve the path.  A typical command with the kpathsearch library
@@ -4634,7 +4824,7 @@
 @var{other-ext}:  @r{Any number of other legal extensions for this file type.}
 @end example
 When a files is searched and it does not have any of the legal extensions,
-we try the default extension first, and then the naked file name.@refill
+we try the default extension first, and then the naked file name.
 @end defopt
 
 @defopt reftex-search-unrecursed-path-first
@@ -4645,7 +4835,7 @@
 before @samp{/tex/}.  This is mainly for speed - most of the time the
 recursive path is for the system files and not for the user files.  Set
 this to @code{nil} if the default makes @b{Ref@TeX{}} finding files with
-equal names in wrong sequence.@refill
+equal names in wrong sequence.
 @end defopt
 
 @defopt reftex-use-external-file-finders
@@ -4667,7 +4857,7 @@
 @code{%f} will be replaced by the name of the file to be found.  Note
 that these commands will be executed directly, not via a shell.  Only
 relevant when @code{reftex-use-external-file-finders} is
-non-@code{nil}.@refill
+non-@code{nil}.
 @end defopt
 
 @page
@@ -4679,17 +4869,17 @@
 @defopt reftex-keep-temporary-buffers
 Non-@code{nil} means, keep buffers created for parsing and lookup.
 @b{Ref@TeX{}} sometimes needs to visit files related to the current
-document.  We distinguish files visited for@refill
+document.  We distinguish files visited for
 @table @asis
 @item PARSING
 Parts of a multifile document loaded when (re)-parsing the
-document.@refill
+document.
 @item LOOKUP
 BibTeX database files and TeX files loaded to find a reference, to
-display label context, etc.@refill
+display label context, etc.
 @end table
 The created buffers can be kept for later use, or be thrown away
-immediately after use, depending on the value of this variable:@refill
+immediately after use, depending on the value of this variable:
 
 @table @code
 @item nil
@@ -4698,13 +4888,13 @@
 Keep everything.
 @item 1
 Throw away buffers created for parsing, but keep the ones created for
-lookup.@refill
+lookup.
 @end table
 
 If a buffer is to be kept, the file is visited normally (which is
 potentially slow but will happen only once). If a buffer is to be thrown
 away, the initialization of the buffer depends upon the variable
-@code{reftex-initialize-temporary-buffers}.@refill
+@code{reftex-initialize-temporary-buffers}.
 @end defopt
 
 @defopt reftex-initialize-temporary-buffers
@@ -4713,7 +4903,7 @@
 other stuff to briefly visit a file. When @code{t}, the full default
 initializations are done (@code{find-file-hook} etc.).  Instead of
 @code{t} or @code{nil}, this variable may also be a list of hook
-functions to do a minimal initialization.@refill
+functions to do a minimal initialization.
 @end defopt
 
 @defopt reftex-no-include-regexps
@@ -4731,7 +4921,7 @@
 or the file associated with the label or section heading near point in a
 menu.  Requesting re-parsing of an entire multifile document then
 requires a @kbd{C-u C-u} prefix or the capital @kbd{R} key in
-menus.@refill
+menus.
 @end defopt
 
 @defopt reftex-save-parse-info
@@ -4742,10 +4932,10 @@
 @item
 accessing the parsing information for the first time in an editing
 session will read that file (if available) instead of parsing the
-document.@refill
+document.
 @item
 exiting Emacs or killing a buffer in reftex-mode will cause a new
-version of the file to be written.@refill
+version of the file to be written.
 @end itemize
 @end defopt
 
@@ -4766,7 +4956,7 @@
 not to be created for each use - so the menu generally comes up faster.
 The selection buffers will be erased (and therefore updated)
 automatically when new labels in its category are added.  See the
-variable @code{reftex-auto-update-selection-buffers}.@refill
+variable @code{reftex-auto-update-selection-buffers}.
 @end defopt
 
 @defopt reftex-auto-update-selection-buffers
@@ -4777,7 +4967,7 @@
 alone and have to be updated by hand, with the @kbd{g} key from the
 label selection process.  The value of this variable will only have any
 effect when @code{reftex-use-multiple-selection-buffers} is
-non-@code{nil}.@refill
+non-@code{nil}.
 @end defopt
 
 @node Options (Fontification), Options (Misc), Options (Optimizations), Options
@@ -4789,13 +4979,13 @@
 Non-@code{nil} means, use fonts in label menu and on-the-fly help.
 Font-lock must be loaded as well to actually get fontified
 display.  After changing this option, a rescan may be necessary to
-activate it.@refill
+activate it.
 @end defopt
 
 @defopt reftex-refontify-context
 Non-@code{nil} means, re-fontify the context in the label menu with
 font-lock.  This slightly slows down the creation of the label menu.  It
-is only necessary when you definitely want the context fontified.@refill
+is only necessary when you definitely want the context fontified.
 
 This option may have 3 different values:
 @table @code
@@ -4805,9 +4995,9 @@
 Always refontify.
 @item 1
 Refontify when necessary, e.g. with old versions of the x-symbol
-package.@refill
+package.
 @end table
-The option is ignored when @code{reftex-use-fonts} is @code{nil}.@refill
+The option is ignored when @code{reftex-use-fonts} is @code{nil}.
 @end defopt
 
 @defopt reftex-highlight-selection
@@ -4817,7 +5007,7 @@
 keys in the selection and @file{*toc*} buffers act on.  However, if you
 mainly use the mouse to select an item, you may find it nice to have
 mouse-triggered highlighting @emph{instead} or @emph{as well}. The
-variable may have one of these values:@refill
+variable may have one of these values:
 
 @example
 nil      @r{No highlighting.}
@@ -4827,16 +5017,16 @@
 @end example
 
 Changing this variable requires to rebuild the selection and *toc*
-buffers to become effective (keys @kbd{g} or @kbd{r}).@refill
+buffers to become effective (keys @kbd{g} or @kbd{r}).
 @end defopt
 
 @defopt reftex-cursor-selected-face
 Face name to highlight cursor selected item in toc and selection buffers.
-See also the variable @code{reftex-highlight-selection}.@refill
+See also the variable @code{reftex-highlight-selection}.
 @end defopt
 @defopt reftex-mouse-selected-face
 Face name to highlight mouse selected item in toc and selection buffers.
-See also the variable @code{reftex-highlight-selection}.@refill
+See also the variable @code{reftex-highlight-selection}.
 @end defopt
 @defopt reftex-file-boundary-face
 Face name for file boundaries in selection buffer.
@@ -4885,13 +5075,13 @@
 @defopt reftex-extra-bindings
 Non-@code{nil} means, make additional key bindings on startup.  These
 extra bindings are located in the users @samp{C-c letter}
-map.  @xref{Key Bindings}.@refill
+map.  @xref{Key Bindings}.
 @end defopt
 
 @defopt reftex-plug-into-AUCTeX
 Plug-in flags for AUCTeX interface.  This variable is a list of
 5 boolean flags.  When a flag is non-@code{nil}, @b{Ref@TeX{}}
-will@refill
+will
 
 @example
 - supply labels in new sections and environments  (flag 1)
@@ -4920,7 +5110,7 @@
 whitespace.  When this is @code{t}, the @samp{aaa} in @w{@samp{\bbb
 [xxx] @{aaa@}}} will be considered an argument of @code{\bb}.  Note that
 this will be the case even if @code{\bb} is defined with zero or one
-argument.@refill
+argument.
 @end defopt
 
 @node Keymaps and Hooks, Changes, Options, Top
@@ -4938,14 +5128,14 @@
 @end deffn
 
 @deffn {Normal Hook} reftex-mode-hook
-Normal hook which is being run when turning on @b{Ref@TeX{}} mode.@refill
+Normal hook which is being run when turning on @b{Ref@TeX{}} mode.
 @end deffn
 
 Furthermore, the 4 modes used for referencing labels, creating
 citations, the table of contents buffer and the phrases buffer have
 their own keymaps and mode hooks.  See the respective sections.  There
 are many more hooks which are described in the relevant sections about
-options for a specific part of @b{Ref@TeX{}}.@refill
+options for a specific part of @b{Ref@TeX{}}.
 
 @node Changes, , Keymaps and Hooks, Top
 @chapter Changes
@@ -4953,296 +5143,396 @@
 
 Here is a list of recent changes to @b{Ref@TeX{}}.
 
-@ignore
-@noindent @b{Version 1.00}
+@noindent @b{Version 4.26}
 @itemize @bullet
 @item
-released on 7 Jan 1997.
+Bug fixes only.
 @end itemize
 
-@noindent @b{Version 1.04}
+@noindent @b{Version 4.25}
 @itemize @bullet
 @item
-Macros as wrappers, AMSTeX support, delayed context parsing for
-new labels.@refill
+Fixed bug with @samp{%F} in a label prefix.  Added new escapes
+@samp{%m} and @samp{%M} for mater file name and master directory.
 @end itemize
 
-@noindent @b{Version 1.05}
+@noindent @b{Version 4.24}
 @itemize @bullet
-@item
-XEmacs port.
-@end itemize
-
-@noindent @b{Version 1.07}
-@itemize @bullet
-@item
-@b{Ref@TeX{}} gets its own menu.
+@item 
+Inserting citation commands now prompts for optional arguments
+when called with a prefix argument.  Related new options are
+@code{reftex-cite-prompt-optional-args} and
+@code{reftex-cite-cleanup-optional-args}. 
+@item
+New option @code{reftex-trust-label-prefix}.  Configure this variable
+if you'd like RefTeX to base its classification of labels on prefixes.
+This can speed-up document parsing, but may in some cases reduce the
+quality of the context used by RefTeX to describe a label.
+@item
+Fixed bug in @code{reftex-create-bibtex-file} when @code{reftex-comment-citations}
+is non-nil.
+@item
+Fixed bugs in indexing: Case-sensitive search, quotes before and/or
+after words.  Disabbled indexing in comment lines.
 @end itemize
 
-@noindent @b{Version 1.09}
+@noindent @b{Version 4.22}
 @itemize @bullet
-@item
-Support for @code{tex-main-file}, an analogue for
-@code{TeX-master}.@refill
-@item
-MS-DOS support.
+@item 
+New command @code{reftex-create-bibtex-file} to create a new database
+with all entries referenced in the current document.
+@item
+New keys @kbd{e} and @kbd{E} allow to produce a BibTeX database file
+from entries marked in a citation selection buffer.
+@end itemize
+
+@noindent @b{Version 4.21}
+@itemize @bullet
+@item 
+Renaming labels from the toc buffer with key @kbd{M-%}.
 @end itemize
 
-@noindent @b{Version 2.00}
+@noindent @b{Version 4.20}
 @itemize @bullet
 @item
-Labels can be derived from context (default for sections).
-@item
-Configuration of label insertion and label referencing revised.
-@item
-Crossref fields in BibTeX database entries.
-@item
-@code{reftex-toc} introduced (thanks to Stephen Eglen).
+Structure editing capabilities.  The command keys @kbd{<} and @kbd{>} in
+the TOC buffer promote/demote the section at point or all sections in
+the current region.
+@item
+New option @code{reftex-toc-split-windows-fraction} to set the size of
+the window used by the TOC.  This makes the old variable
+@code{reftex-toc-split-windows-horizontally-fraction} obsolete.
+@item
+A dedicated frame can show the TOC with the current section
+always automatically highlighted.  The frame is created and
+deleted from the toc buffer with the @kbd{d} key.
 @end itemize
 
-@noindent @b{Version 2.03}
+@noindent @b{Version 4.19}
 @itemize @bullet
 @item
-@code{figure*}, @code{table*}, @code{sidewaysfigure/table} added to
-default environments.@refill
-@item
-@code{reftex-bibfile-ignore-list} introduced (thanks to Rory Molinari).
-@item
-New functions @code{reftex-arg-label}, @code{reftex-arg-ref},
-@code{reftex-arg-cite}.@refill
-@item
-Emacs/XEmacs compatibility reworked.  XEmacs 19.15 now is
-required.@refill
-@item
-@code{reftex-add-to-label-alist} (to be called from AUCTeX style
-files).@refill
-@item
-Finding context with a hook function.
-@item
-Sorting BibTeX entries (new variable:
-@code{reftex-sort-bibtex-matches}).
+New command `reftex-toc-recenter' (@kbd{C-c -}) which shows the current
+section in the TOC buffer without selecting the TOC window.
+@item
+Recentering happens automatically in idle time when the option
+@code{reftex-auto-recenter-toc} is turned on.
+@item
+Fixed several bugs related to automatic cursor positioning in the TOC
+buffer.
+@item
+The highlight in the TOC buffer stays when the focus moves to a
+different window.
+@item
+New command `reftex-goto-label'.
+@item
+Part numbers are no longer included in chapter numbers, and a new
+part does not reset the chapter counter.  See new option
+@code{reftex-part-resets-chapter}.
+@end itemize
+
+@noindent @b{Version 4.18}
+@itemize @bullet
+@item
+@code{reftex-citation} uses the word before the cursor as a default
+search string.
+@item
+Simplified several regular expressions for speed.
+@item
+Better support for chapterbib.
 @end itemize
 
-@noindent @b{Version 2.05}
+@noindent @b{Version 4.17}
 @itemize @bullet
 @item
-Support for @file{custom.el}.
-@item
-New function @code{reftex-grep-document} (thanks to Stephen Eglen).
-@end itemize
-
-@noindent @b{Version 2.07}
-@itemize @bullet
-@item
-New functions @code{reftex-search-document},
-@code{reftex-query-replace-document}.
+The toc window can be split off horizontally.  See new options
+@code{reftex-toc-split-windows-horizontally},
+@code{reftex-toc-split-windows-horizontally-fraction}.
+@item
+It is possible to specify a function which verifies an index match
+during global indexing.  See new option @code{reftex-index-verify-function}.
+@item
+The macros which input a file in LaTeX (like \input, \include) can
+be configured.  See new option @code{reftex-include-file-commands}.
+@item
+The macros which specify the bibliography file (like \bibliography) can
+be configured.  See new option @code{reftex-bibliography-commands}.
+@item
+The regular expression used to search for the \bibliography macro has
+been relaxed to allow for @samp{@{\bibliography@{...@}@}} needed by
+chapterbib.
+@item
+Small bug fixes.
 @end itemize
 
-@noindent @b{Version 2.11}
+@noindent @b{Version 4.15}
 @itemize @bullet
 @item
-Submitted for inclusion to Emacs and XEmacs.
+Fixed bug with parsing of BibTeX files, when fields contain quotes or
+unmatched parenthesis.
+@item
+Small bug fixes.
+@item
+Improved interaction with Emacs LaTeX mode.
 @end itemize
 
-@noindent @b{Version 2.14}
+@noindent @b{Version 4.12}
 @itemize @bullet
 @item
-Variable @code{reftex-plug-into-AUCTeX} simplifies cooperation with
-AUCTeX.@refill
+Support for @file{bibentry} citation style.
 @end itemize
 
-@noindent @b{Version 2.17}
+@noindent @b{Version 4.11}
+@itemize @bullet
+@item
+Fixed bug which would parse @samp{\Section} just like @samp{\section}.
+@end itemize
+
+@noindent @b{Version 4.10}
 @itemize @bullet
 @item
-Label prefix expands % escapes with current file name and other stuff.
-@item
-Citation format now with % escapes.  This is not backward
-compatible!@refill
-@item
-TEXINPUTS variable recognized when looking for input files.
-@item
-Context can be the nth argument of a macro.@refill
-@item
-Searching in the select buffer is now possible (@kbd{C-s} and
-@kbd{C-r}).@refill
-@item
-Display and derive-label can use two different context methods.
-@item
-AMSmath @code{xalignat} and @code{xxalignat} added.
+Renamed @file{reftex-vcr.el} to @file{reftex-dcr.el} because of conflict
+with @file{reftex-vars.el} on DOS machines.
+@item
+New options @code{reftex-parse-file-extension} and
+@code{reftex-index-phrase-file-extension}.
 @end itemize
 
-@noindent @b{Version 3.00}
+@noindent [.....]
+@ignore
+@noindent @b{Version 4.09}
 @itemize @bullet
 @item
-@b{Ref@TeX{}} should work better for very large projects:
-@item
-The new parser works without creating a master buffer.
-@item
-Rescanning can be limited to a part of a multifile document.
-@item
-Information from the parser can be stored in a file.
-@item
-@b{Ref@TeX{}} can deal with macros having a naked label as an argument.
-@item
-Macros may have white space and newlines between arguments.
-@item
-Multiple identical section headings no longer confuse
-@code{reftex-toc}.@refill
-@item
-@b{Ref@TeX{}} should work correctly in combination with buffer-altering
-packages like outline, folding, x-symbol, iso-cvt, isotex, etc.@refill
-@item
-All labeled environments discussed in @emph{The LaTeX Companion} by
-Goossens, Mittelbach & Samarin, Addison-Wesley 1994) are part of
-@b{Ref@TeX{}}'s defaults.@refill
+New option @code{reftex-toc-max-level} to limit the depth of the toc.
+New key binding @kbd{t} in the @file{*toc*} buffer to change this
+setting.
+@item
+RefTeX maintains an @file{Index Phrases} file in which phrases can be
+collected.  When the document is ready, RefTeX can search all
+these phrases and assist indexing all matches.
+@item
+The variables @code{reftex-index-macros} and
+@code{reftex-index-default-macro} have changed their syntax slightly.
+The @var{repeat} parameter has move from the latter to the former.
+Also calls to @code{reftex-add-index-macros} from AUCTeX style files
+need to be adapted.
+@item
+The variable @code{reftex-section-levels} no longer contains the
+default stuff which has been moved to a constant.
+@item
+Environments like theorems can be placed into the TOC by putting
+entries for @samp{"begin@{theorem@}"} in
+@code{reftex-setion-levels}.
+@end itemize
+
+@noindent @b{Version 4.06}
+@itemize @bullet
+@item
+@code{reftex-section-levels} can contain a function to compute the level
+of a sectioning command.
+@item
+Multiple @code{thebibliography} environments recognized.
+@end itemize
+
+@noindent @b{Version 4.04}
+@itemize @bullet
+@item
+New option @code{reftex-index-default-tag} implements a default for queries.
 @end itemize
 
-@noindent @b{Version 3.03}
+@noindent @b{Version 4.02}
 @itemize @bullet
 @item
-Support for the LaTeX package @code{xr}, for inter-document
-references.@refill
-@item
-A few (minor) Mule-related changes.
-@item
-Fixed bug which could cause @emph{huge} @file{.rel} files.
-@item
-Search for input and @file{.bib} files with recursive path definitions.
+macros ending in @samp{refrange} are considered to contain references.
+@item
+Index entries made with @code{reftex-index-selection-or-word} in TeX
+math mode automatically get enclosing @samp{$} to preserve math mode.  See
+new option @code{reftex-index-math-format}.  Requires AUCTeX.
 @end itemize
 
-@noindent @b{Version 3.04}
+@noindent @b{Version 4.01}
 @itemize @bullet
 @item
-Fixed BUG in the @emph{xr} support.
-@end itemize
-
-@noindent @b{Version 3.05}
-@itemize @bullet
-@item
-Compatibility code now first checks for XEmacs feature.
+New command @code{reftex-index-globally} to index a word in many
+places in the document.  Also available from the index buffer with
+@kbd{&}.
+@item
+The first item in a @code{reftex-label-alist} entry may now also be a parser
+function to do non-standard parsing.
+@item
+@code{reftex-auto-view-crossref} no longer interferes with
+@code{pop-up-frames} (patch from Stefan Monnier).
 @end itemize
 
-@noindent @b{Version 3.07}
+@noindent @b{Version 4.00}
 @itemize @bullet
 @item
-@code{Ref} menu improved.
+RefTeX has been split into several smaller files which are autoloaded on
+demand.
+@item
+Index support, along with many new options.
+@item
+The selection of keys for @code{\ref} and @code{\cite} now allows to
+select multiple items by marking entries with the @kbd{m} key.
+@item
+Fancyref support.
 @end itemize
 
-@noindent @b{Version 3.10}
+@noindent @b{Version 3.43}
 @itemize @bullet
 @item
-Fixed a bug which made reftex 3.07 fail on [X]Emacs version 19.
-@item
-Removed unimportant code which caused OS/2 Emacs to crash.
-@item
-All customization variables now accessible from menu.
+Viewing cross-references generalized.  Now works on @code{\label},
+@code{\ref}, @code{\cite}, @code{\bibitem}, @code{\index}, variations of
+these, and from BibTeX buffers.
+@item
+New option @code{reftex-view-crossref-extra}.
+@item
+Support for the additional sectioning commands @code{\addchap} and
+@code{\addsec} which are defined in the LaTeX KOMA-Script classes.
+@item
+Files in @code{reftex-default-bibliography} will be searched along
+@code{BIBINPUTS} path.
+@item
+Reading a parse file now checks consistency.
 @end itemize
 
-@noindent @b{Version 3.11}
-@itemize @bullet
-@item
-Fixed bug which led to naked label in (e.g.) footnotes.
-@item
-Added scroll-other-window functions to RefTeX-Select.
-@end itemize
-
-@noindent @b{Version 3.12}
+@noindent @b{Version 3.42}
 @itemize @bullet
 @item
-There are 3 new keymaps for customization: @code{reftex-toc-map},
-@code{reftex-select-label-map}, @code{reftex-select-bib-map}.
-@item
-Refontification uses more standard font-lock stuff.
-@item
-When no BibTeX database files are specified, citations can also use
-@code{\bibitem} entries from a @code{thebibliography} environment.@refill
+File search further refined.  New option @code{reftex-file-extensions}.
+@item
+@file{*toc*} buffer can show the file boundaries of a multifile
+document, all labels and associated context.  New keys @kbd{i}, @kbd{l},
+and @kbd{c}.  New options @code{reftex-toc-include-labels},
+@code{reftex-toc-include-context},
+@code{reftex-toc-include-file-boundaries}. 
 @end itemize
 
-@noindent @b{Version 3.14}
+@noindent @b{Version 3.41}
 @itemize @bullet
 @item
-Selection buffers can be kept between selections: this is faster.
-See new variable @code{reftex-use-multiple-selection-buffers}.@refill
-@item
-Prefix interpretation of reftex-view-crossref changed.
-@item
-Support for the @code{varioref} package (@kbd{v} key in selection
-buffer).@refill
+New options @code{reftex-texpath-environment-variables},
+@code{reftex-use-external-file-finders},
+@code{reftex-external-file-finders},
+@code{reftex-search-unrecursed-path-first}.
+@item
+@emph{kpathsearch} support.  See new options and
+@code{reftex-bibpath-environment-variables}.
+@end itemize
+
+@noindent @b{Version 3.38}
+@itemize @bullet
+@item
+@code{reftex-view-crossref} no longer moves to find a macro.  Point has
+to be on the macro argument.
+@end itemize
+
+@noindent @b{Version 3.36}
+@itemize @bullet
+@item
+New value @code{window} for option @code{reftex-auto-view-crossref}.
 @end itemize
 
-@noindent @b{Version 3.16}
+@noindent @b{Version 3.35}
+@itemize @bullet
+@item
+ISO 8859 Latin-1 chars are converted to ASCII to derive better labels.
+This takes back the related changes in 3.34 for safety reasons.
+@end itemize
+
+@noindent @b{Version 3.34}
 @itemize @bullet
 @item
-New hooks @code{reftex-format-label-function},
-@code{reftex-format-ref-function}, @code{reftex-format-cite-function}.@refill
-@item
-TeXInfo documentation completed.
-@item
-Some restrictions in Label inserting and referencing removed.
-@item
-New variable @code{reftex-default-bibliography}.
+Additional flag in @code{reftex-derive-label-parameters} do make only
+lowercase labels (default @code{t}).
+@item
+All @file{.rel} files have a final newline to avoid queries.
+@item
+Single byte representations of accented European letters (ISO-8859-1)
+are now legal in labels.
 @end itemize
 
-@noindent @b{Version 3.17}
+@noindent @b{Version 3.33}
 @itemize @bullet
 @item
-Additional bindings in selection and @file{*toc*} buffers.  @kbd{g}
-redefined.
-@item
-New command @code{reftex-save-all-document-buffers}.
-@item
-Magic word matching made more intelligent.
-@item
-Selection process can switch to completion (with @key{TAB}).
-@item
-@code{\appendix} is now recognized and influences section numbering.
-@item
-File commentary shortened considerably (use Info documentation).
-@item
-New option @code{reftex-no-include-regexps} to skip some include files.
-@item
-New option @code{reftex-revisit-to-follow}.
+Multiple selection buffers are now hidden buffers (they start with a
+SPACE).
+@item
+Fixed bug with file search when TEXINPUTS environment variable is empty.
 @end itemize
 
-@noindent @b{Version 3.18}
+@noindent @b{Version 3.30}
+@itemize @bullet
+@item
+In @code{reftex-citation}, the regular expression used to scan BibTeX
+files can be specified using completion on known citation keys.
+@item
+New keys @kbd{a} and @kbd{A} in BibTeX selection process to cite @emph{all}
+entries.
+@item
+New command @code{reftex-renumber-simple-labels} to renumber simple
+labels like @samp{eq:13} sequentially through a document.
+@end itemize
+
+@noindent @b{Version 3.28}
 @itemize @bullet
 @item
-The selection now uses a recursive edit, much like minibuffer input.
-This removes all restrictions during selection.  E.g. you can now
-switch buffers at will, use the mouse etc.@refill
-@item
-New option @code{reftex-highlight-selection}.
-@item
-@kbd{mouse-2} can be used to select in selection and @file{*toc*}
-buffers.@refill
-@item
-Fixed some problems regarding the interaction with VIPER mode.
-@item
-Follow-mode is now only used after point motion.
-@item
-@b{Ref@TeX{}} now finally does not fontify temporary files anymore.
+Auto view crossref for XEmacs uses @code{post-command-hook} to restart the
+timer, since itimer restart is not reliable.
+@item
+Option @code{reftex-bibfile-ignore-list} renamed to @code{-regexps}.
+@item
+Expansion of recursive tex and bib path rewritten.
+@item
+Fixed problem where @b{Ref@TeX{}} did not scan unsaved buffers.
+@item
+Fixed bug with section numbering after *-red sections.
 @end itemize
 
-@noindent @b{Version 3.19}
+@noindent @b{Version 3.27}
+@itemize @bullet
+@item
+Macros can define @emph{neutral} labels, just like @code{\label}
+itself.
+@item
+New option @code{reftex-allow-detached-macro-args}, default @code{nil}!
+@end itemize
+
+@noindent @b{Version 3.26}
 @itemize @bullet
 @item
-Fixed bug with AUCTeX @code{TeX-master}.
-@end itemize
-
-@noindent @b{Version 3.21}
-@itemize @bullet
-@item
-New options for all faces used by @b{Ref@TeX{}}. They're in the
-customization group @code{reftex-fontification-configurations}.@refill
+[X]Emacs 19 no longer supported.  Use 3.22 for Emacs 19.
+@item
+New hooks @code{reftex-translate-to-ascii-function},
+@code{reftex-string-to-label-function}.
+@item
+Made sure automatic crossref display will not visit/scan files.
 @end itemize
 
-@noindent @b{Version 3.22}
+@noindent @b{Version 3.25}
 @itemize @bullet
 @item
-Fixed bug with empty context strings.
-@item
-@code{reftex-mouse-view-crossref} is now bound by default at
-@kbd{S-mouse-2}.@refill
+Echoing of citation info caches the info for displayed entries.
+New option @code{reftex-cache-cite-echo}.
+@item
+@kbd{M-x reftex-reset-mode} now also removes the file with parsing
+info.
+@item
+Default of @code{reftex-revisit-to-follow} changed to nil.
+@end itemize
+
+@noindent @b{Version 3.24}
+@itemize @bullet
+@item
+New option @code{reftex-revisit-to-echo}.
+@item
+Interface with X-Symbol (>=2.6) is now complete and stable.
+@item
+Adapted to new outline, which uses overlays.
+@item
+File names in @code{\bibliography} may now have the @code{.bib}
+extension.
+@item
+Fixed Bug with parsing "single file" from master file buffer.
 @end itemize
 
 @noindent @b{Version 3.23}
@@ -5278,310 +5568,301 @@
 Safety-net for name change of @code{font-lock-reference-face}.
 @end itemize
 
-@noindent @b{Version 3.24}
+@noindent @b{Version 3.22}
 @itemize @bullet
 @item
-New option @code{reftex-revisit-to-echo}.
-@item
-Interface with X-Symbol (>=2.6) is now complete and stable.
-@item
-Adapted to new outline, which uses overlays.
-@item
-File names in @code{\bibliography} may now have the @code{.bib}
-extension.@refill
-@item
-Fixed Bug with parsing "single file" from master file buffer.
+Fixed bug with empty context strings.
+@item
+@code{reftex-mouse-view-crossref} is now bound by default at
+@kbd{S-mouse-2}.
 @end itemize
 
-@noindent @b{Version 3.25}
+@noindent @b{Version 3.21}
 @itemize @bullet
 @item
-Echoing of citation info caches the info for displayed entries.
-New option @code{reftex-cache-cite-echo}.@refill
-@item
-@kbd{M-x reftex-reset-mode} now also removes the file with parsing
-info.@refill
-@item
-Default of @code{reftex-revisit-to-follow} changed to nil.
+New options for all faces used by @b{Ref@TeX{}}. They're in the
+customization group @code{reftex-fontification-configurations}.
 @end itemize
 
-@noindent @b{Version 3.26}
+@noindent @b{Version 3.19}
+@itemize @bullet
+@item
+Fixed bug with AUCTeX @code{TeX-master}.
+@end itemize
+
+@noindent @b{Version 3.18}
 @itemize @bullet
 @item
-[X]Emacs 19 no longer supported.  Use 3.22 for Emacs 19.
-@item
-New hooks @code{reftex-translate-to-ascii-function},
-@code{reftex-string-to-label-function}.@refill
-@item
-Made sure automatic crossref display will not visit/scan files.
+The selection now uses a recursive edit, much like minibuffer input.
+This removes all restrictions during selection.  E.g. you can now
+switch buffers at will, use the mouse etc.
+@item
+New option @code{reftex-highlight-selection}.
+@item
+@kbd{mouse-2} can be used to select in selection and @file{*toc*}
+buffers.
+@item
+Fixed some problems regarding the interaction with VIPER mode.
+@item
+Follow-mode is now only used after point motion.
+@item
+@b{Ref@TeX{}} now finally does not fontify temporary files anymore.
 @end itemize
 
-@noindent @b{Version 3.27}
+@noindent @b{Version 3.17}
 @itemize @bullet
 @item
-Macros can define @emph{neutral} labels, just like @code{\label}
-itself.@refill
-@item
-New option @code{reftex-allow-detached-macro-args}, default @code{nil}!
-@end itemize
-
-@noindent @b{Version 3.28}
-@itemize @bullet
-@item
-Auto view crossref for XEmacs uses @code{post-command-hook} to restart the
-timer, since itimer restart is not reliable.@refill
-@item
-Option @code{reftex-bibfile-ignore-list} renamed to @code{-regexps}.
-@item
-Expansion of recursive tex and bib path rewritten.
-@item
-Fixed problem where @b{Ref@TeX{}} did not scan unsaved buffers.
-@item
-Fixed bug with section numbering after *-red sections.
+Additional bindings in selection and @file{*toc*} buffers.  @kbd{g}
+redefined.
+@item
+New command @code{reftex-save-all-document-buffers}.
+@item
+Magic word matching made more intelligent.
+@item
+Selection process can switch to completion (with @key{TAB}).
+@item
+@code{\appendix} is now recognized and influences section numbering.
+@item
+File commentary shortened considerably (use Info documentation).
+@item
+New option @code{reftex-no-include-regexps} to skip some include files.
+@item
+New option @code{reftex-revisit-to-follow}.
 @end itemize
 
-@noindent @b{Version 3.30}
+@noindent @b{Version 3.16}
 @itemize @bullet
 @item
-In @code{reftex-citation}, the regular expression used to scan BibTeX
-files can be specified using completion on known citation keys.
-@item
-New keys @kbd{a} and @kbd{A} in BibTeX selection process to cite @emph{all}
-entries.
-@item
-New command @code{reftex-renumber-simple-labels} to renumber simple
-labels like @samp{eq:13} sequentially through a document.
+New hooks @code{reftex-format-label-function},
+@code{reftex-format-ref-function}, @code{reftex-format-cite-function}.
+@item
+TeXInfo documentation completed.
+@item
+Some restrictions in Label inserting and referencing removed.
+@item
+New variable @code{reftex-default-bibliography}.
 @end itemize
-@noindent @b{Version 3.33}
+
+@noindent @b{Version 3.14}
 @itemize @bullet
 @item
-Multiple selection buffers are now hidden buffers (they start with a
-SPACE).
-@item
-Fixed bug with file search when TEXINPUTS environment variable is empty.
+Selection buffers can be kept between selections: this is faster.
+See new variable @code{reftex-use-multiple-selection-buffers}.
+@item
+Prefix interpretation of reftex-view-crossref changed.
+@item
+Support for the @code{varioref} package (@kbd{v} key in selection
+buffer).
 @end itemize
-@noindent @b{Version 3.34}
+
+@noindent @b{Version 3.12}
 @itemize @bullet
 @item
-Additional flag in @code{reftex-derive-label-parameters} do make only
-lowercase labels (default @code{t}).
-@item
-All @file{.rel} files have a final newline to avoid queries.
-@item
-Single byte representations of accented European letters (ISO-8859-1)
-are now legal in labels.
+There are 3 new keymaps for customization: @code{reftex-toc-map},
+@code{reftex-select-label-map}, @code{reftex-select-bib-map}.
+@item
+Refontification uses more standard font-lock stuff.
+@item
+When no BibTeX database files are specified, citations can also use
+@code{\bibitem} entries from a @code{thebibliography} environment.
 @end itemize
-@noindent @b{Version 3.35}
+
+@noindent @b{Version 3.11}
 @itemize @bullet
 @item
-ISO 8859 Latin-1 chars are converted to ASCII to derive better labels.
-This takes back the related changes in 3.34 for safety reasons.@refill
-@end itemize
-@noindent @b{Version 3.36}
-@itemize @bullet
-@item
-New value @code{window} for option @code{reftex-auto-view-crossref}.
+Fixed bug which led to naked label in (e.g.) footnotes.
+@item
+Added scroll-other-window functions to RefTeX-Select.
 @end itemize
-@noindent @b{Version 3.38}
+
+@noindent @b{Version 3.10}
 @itemize @bullet
 @item
-@code{reftex-view-crossref} no longer moves to find a macro.  Point has
-to be on the macro argument.
+Fixed a bug which made reftex 3.07 fail on [X]Emacs version 19.
+@item
+Removed unimportant code which caused OS/2 Emacs to crash.
+@item
+All customization variables now accessible from menu.
 @end itemize
-@noindent @b{Version 3.41}
+
+@noindent @b{Version 3.07}
 @itemize @bullet
 @item
-New options @code{reftex-texpath-environment-variables},
-@code{reftex-use-external-file-finders},
-@code{reftex-external-file-finders},
-@code{reftex-search-unrecursed-path-first}.
-@item
-@emph{kpathsearch} support.  See new options and
-@code{reftex-bibpath-environment-variables}.
+@code{Ref} menu improved.
+@end itemize
+
+@noindent @b{Version 3.05}
+@itemize @bullet
+@item
+Compatibility code now first checks for XEmacs feature.
 @end itemize
-@noindent @b{Version 3.42}
+
+@noindent @b{Version 3.04}
+@itemize @bullet
+@item
+Fixed BUG in the @emph{xr} support.
+@end itemize
+
+@noindent @b{Version 3.03}
 @itemize @bullet
 @item
-File search further refined.  New option @code{reftex-file-extensions}.
-@item
-@file{*toc*} buffer can show the file boundaries of a multifile
-document, all labels and associated context.  New keys @kbd{i}, @kbd{l},
-and @kbd{c}.  New options @code{reftex-toc-include-labels},
-@code{reftex-toc-include-context},
-@code{reftex-toc-include-file-boundaries}. @refill
+Support for the LaTeX package @code{xr}, for inter-document
+references.
+@item
+A few (minor) Mule-related changes.
+@item
+Fixed bug which could cause @emph{huge} @file{.rel} files.
+@item
+Search for input and @file{.bib} files with recursive path definitions.
 @end itemize
-@noindent @b{Version 3.43}
-@itemize @bullet
-@item
-Viewing cross-references generalized.  Now works on @code{\label},
-@code{\ref}, @code{\cite}, @code{\bibitem}, @code{\index}, variations of
-these, and from BibTeX buffers.@refill
-@item
-New option @code{reftex-view-crossref-extra}.@refill
-@item
-Support for the additional sectioning commands @code{\addchap} and
-@code{\addsec} which are defined in the LaTeX KOMA-Script classes.@refill
-@item
-Files in @code{reftex-default-bibliography} will be searched along
-@code{BIBINPUTS} path.@refill
-@item
-Reading a parse file now checks consistency.
-@end itemize
-@noindent @b{Version 4.00}
+
+@noindent @b{Version 3.00}
 @itemize @bullet
 @item
-RefTeX has been split into several smaller files which are autoloaded on
-demand.
-@item
-Index support, along with many new options.
-@item
-The selection of keys for @code{\ref} and @code{\cite} now allows to
-select multiple items by marking entries with the @kbd{m} key.
-@item
-Fancyref support.
+@b{Ref@TeX{}} should work better for very large projects:
+@item
+The new parser works without creating a master buffer.
+@item
+Rescanning can be limited to a part of a multifile document.
+@item
+Information from the parser can be stored in a file.
+@item
+@b{Ref@TeX{}} can deal with macros having a naked label as an argument.
+@item
+Macros may have white space and newlines between arguments.
+@item
+Multiple identical section headings no longer confuse
+@code{reftex-toc}.
+@item
+@b{Ref@TeX{}} should work correctly in combination with buffer-altering
+packages like outline, folding, x-symbol, iso-cvt, isotex, etc.
+@item
+All labeled environments discussed in @emph{The LaTeX Companion} by
+Goossens, Mittelbach & Samarin, Addison-Wesley 1994) are part of
+@b{Ref@TeX{}}'s defaults.
 @end itemize
-@noindent @b{Version 4.01}
+
+@noindent @b{Version 2.17}
 @itemize @bullet
 @item
-New command @code{reftex-index-globally} to index a word in many
-places in the document.  Also available from the index buffer with
-@kbd{&}.
-@item
-The first item in a @code{reftex-label-alist} entry may now also be a parser
-function to do non-standard parsing.
-@item
-@code{reftex-auto-view-crossref} no longer interferes with
-@code{pop-up-frames} (patch from Stefan Monnier).
+Label prefix expands % escapes with current file name and other stuff.
+@item
+Citation format now with % escapes.  This is not backward
+compatible!
+@item
+TEXINPUTS variable recognized when looking for input files.
+@item
+Context can be the nth argument of a macro.
+@item
+Searching in the select buffer is now possible (@kbd{C-s} and
+@kbd{C-r}).
+@item
+Display and derive-label can use two different context methods.
+@item
+AMSmath @code{xalignat} and @code{xxalignat} added.
 @end itemize
-@noindent @b{Version 4.02}
+
+@noindent @b{Version 2.14}
 @itemize @bullet
 @item
-macros ending in @samp{refrange} are considered to contain references.
-@item
-Index entries made with @code{reftex-index-selection-or-word} in TeX
-math mode automatically get enclosing @samp{$} to preserve math mode.  See
-new option @code{reftex-index-math-format}.  Requires AUCTeX.
+Variable @code{reftex-plug-into-AUCTeX} simplifies cooperation with
+AUCTeX.
 @end itemize
-@noindent @b{Version 4.04}
+
+@noindent @b{Version 2.11}
+@itemize @bullet
+@item
+Submitted for inclusion to Emacs and XEmacs.
+@end itemize
+
+@noindent @b{Version 2.07}
 @itemize @bullet
 @item
-New option @code{reftex-index-default-tag} implements a default for queries.
+New functions @code{reftex-search-document},
+@code{reftex-query-replace-document}.
 @end itemize
-@noindent @b{Version 4.06}
+
+@noindent @b{Version 2.05}
+@itemize @bullet
+@item
+Support for @file{custom.el}.
+@item
+New function @code{reftex-grep-document} (thanks to Stephen Eglen).
+@end itemize
+
+@noindent @b{Version 2.03}
 @itemize @bullet
 @item
-@code{reftex-section-levels} can contain a function to compute the level
-of a sectioning command.
-@item
-Multiple @code{thebibliography} environments recognized.
+@code{figure*}, @code{table*}, @code{sidewaysfigure/table} added to
+default environments.
+@item
+@code{reftex-bibfile-ignore-list} introduced (thanks to Rory Molinari).
+@item
+New functions @code{reftex-arg-label}, @code{reftex-arg-ref},
+@code{reftex-arg-cite}.
+@item
+Emacs/XEmacs compatibility reworked.  XEmacs 19.15 now is
+required.
+@item
+@code{reftex-add-to-label-alist} (to be called from AUCTeX style
+files).
+@item
+Finding context with a hook function.
+@item
+Sorting BibTeX entries (new variable:
+@code{reftex-sort-bibtex-matches}).
 @end itemize
-@noindent @b{Version 4.09}
+
+@noindent @b{Version 2.00}
 @itemize @bullet
 @item
-New option @code{reftex-toc-max-level} to limit the depth of the toc.
-New key binding @kbd{t} in the @file{*toc*} buffer to change this
-setting.@refill
-@item
-RefTeX maintains an @file{Index Phrases} file in which phrases can be
-collected.  When the document is ready, RefTeX can search all
-these phrases and assist indexing all matches.@refill
-@item
-The variables @code{reftex-index-macros} and
-@code{reftex-index-default-macro} have changed their syntax slightly.
-The @var{repeat} parameter has move from the latter to the former.
-Also calls to @code{reftex-add-index-macros} from AUCTeX style files
-need to be adapted.@refill
-@item
-The variable @code{reftex-section-levels} no longer contains the
-default stuff which has been moved to a constant.@refill
-@item
-Environments like theorems can be placed into the TOC by putting
-entries for @samp{"begin@{theorem@}"} in
-@code{reftex-setion-levels}.@refill
+Labels can be derived from context (default for sections).
+@item
+Configuration of label insertion and label referencing revised.
+@item
+Crossref fields in BibTeX database entries.
+@item
+@code{reftex-toc} introduced (thanks to Stephen Eglen).
 @end itemize
-@noindent @b{Version 4.10}
+
+@noindent @b{Version 1.09}
 @itemize @bullet
 @item
-Renamed @file{reftex-vcr.el} to @file{reftex-dcr.el} because of conflict
-with @file{reftex-vars.el} on DOS machines.
-@item
-New options @code{reftex-parse-file-extension} and
-@code{reftex-index-phrase-file-extension}.
+Support for @code{tex-main-file}, an analogue for
+@code{TeX-master}.
+@item
+MS-DOS support.
 @end itemize
-@noindent @b{Version 4.11}
-@itemize @bullet
-@item
-Fixed bug which would parse @samp{\Section} just like @samp{\section}.
-@end itemize
-@noindent @b{Version 4.12}
+
+@noindent @b{Version 1.07}
 @itemize @bullet
 @item
-Support for @file{bibentry} citation style.
+@b{Ref@TeX{}} gets its own menu.
 @end itemize
-@noindent @b{Version 4.15}
+
+@noindent @b{Version 1.05}
 @itemize @bullet
 @item
-Fixed bug with parsing of BibTeX files, when fields contain quotes or
-unmatched parenthesis.
-@item
-Small bug fixes.
-@item
-Improved interaction with Emacs LaTeX mode.
+XEmacs port.
+@end itemize
+
+@noindent @b{Version 1.04}
+@itemize @bullet
+@item
+Macros as wrappers, AMSTeX support, delayed context parsing for
+new labels.
 @end itemize
 @end ignore
-@noindent @b{Version 4.17}
-@itemize @bullet
-@item
-The toc window can be split off horizontally.  See new options
-@code{reftex-toc-split-windows-horizontally},
-@code{reftex-toc-split-windows-horizontally-fraction}.
-@item
-It is possible to specify a function which verifies an index match
-during global indexing.  See new option @code{reftex-index-verify-function}.
-@item
-The macros which input a file in LaTeX (like \input, \include) can
-be configured.  See new option @code{reftex-include-file-commands}.
-@item
-The macros which specify the bibliography file (like \bibliography) can
-be configured.  See new option @code{reftex-bibliography-commands}.
-@item
-The regular expression used to search for the \bibliography macro has
-been relaxed to allow for @samp{@{\bibliography@{...@}@}} needed by
-chapterbib.
-@item
-Small bug fixes.
-@end itemize
-@noindent @b{Version 4.18}
+
+@noindent @b{Version 1.00}
 @itemize @bullet
 @item
-@code{reftex-citation} uses the word before the cursor as a default
-search string.
-@item
-Simplified several regular expressions for speed.
-@item
-Better support for chapterbib.
+released on 7 Jan 1997.
 @end itemize
-@noindent @b{Version 4.19}
-@itemize @bullet
-@item
-New command `reftex-toc-recenter' (@kbd{C-c -}) which shows the current
-section in the TOC buffer without selecting the TOC window.
-@item
-Recentering happens automatically in idle time when the option
-@code{reftex-auto-recenter-toc} is turned on.
-@item
-Fixed several bugs related to automatic cursor positioning in the TOC
-buffer.
-@item
-The highlight in the TOC buffer stays when the focus moves to a
-different window.
-@item
-New command `reftex-goto-label'.
-@item
-Part numbers are no longer included in chapter numbers, and a new
-part does not reset the chapter counter.  See new option
-@code{reftex-part-resets-chapter}.
-@end itemize
+
+
+
+
 
 @node Index,  , , Top
 @unnumbered Index
--- a/man/rmail.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/rmail.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -37,7 +37,10 @@
 * Digest: Rmail Digest.      Extracting the messages from a digest message.
 * Out of Rmail::	     Converting an Rmail file to mailbox format.
 * Rot13: Rmail Rot13.	     Reading messages encoded in the rot13 code.
-* Movemail: Movemail.        More details of fetching new mail.
+* Movemail::                 More details of fetching new mail.
+* Remote Mailboxes::         Retrieving Mail from Remote Mailboxes.
+* Other Mailbox Formats::    Retrieving Mail from Local Mailboxes in
+                             Various Formats
 @end menu
 
 @node Rmail Basics
@@ -1152,9 +1155,115 @@
 which applies the code when displaying the text.
 
 @node Movemail
-@section @code{movemail} and POP
+@section @code{movemail} program
 @cindex @code{movemail} program
 
+  When invoked for the first time, Rmail attempts to locate
+@code{movemail} program and determine its version.  There are
+two versions of @code{movemail} program: the native one, shipped with
+GNU Emacs (we will refer to it as @samp{emacs version}) and the one
+coming from GNU mailutils (@xref{movemail,,,mailutils,GNU mailutils},
+we will refer to it as @samp{mailutils version}).  Both versions are
+compatible with each other in the sense that they support the same
+command line syntax and the same basic subset of options.  However,
+the @samp{mailutils} version offers a much richer set of
+features.
+
+The @samp{Emacs version} of @code{movemail} is able to retrieve mail from usual
+UNIX mailbox formats and from remote mailboxes using the POP3 protocol.
+
+The @samp{Mailutils version} is able to handle a wide set of mailbox
+formats, such as plain UNIX mailboxes, @code{maildir} and @code{MH}
+mailboxes, etc.  It is able to retrieve remote mail using POP3 or IMAP4
+protocol.  In the latter case, @code{mailutils movemail} can be
+instructed to retrieve mail using a TLS encrypted channel.
+
+The @samp{Mailutils movemail} accepts mailbox argument in the @acronym{URL}
+form.  The detailed description of mailbox @acronym{URL}s can be found
+in @ref{URL,,,mailutils,Mailbox URL Formats}.  In short, a
+@acronym{URL} is:
+
+@smallexample
+@var{proto}://[@var{user}[:@var{password}]@@]@var{host-or-file-name}
+@end smallexample
+
+@noindent
+where square brackets denote optional elements.
+
+@table @var
+@item proto
+Specifies the @dfn{mailbox protocol}, or @dfn{format} to
+use.  The exact semantics of the rest of @acronym{URL} elements depends
+on the actual value of @var{proto}.
+
+@item user
+User name to access the remote mailbox.
+
+@item password
+User password to access the remote mailbox.
+
+@item host-or-file-name
+Hostname of the remote server for remote mailboxes or file name of a
+local mailbox.
+@end table
+
+@var{Proto} can be one of:
+
+@table @asis
+@item mbox
+Usual UNIX mailbox format.  In this case, neither @var{user} nor
+@var{pass} are used, and @var{host-or-file-name} denotes the file name of
+the mailbox file, e.g., @code{mbox://var/spool/mail/smith}.
+
+@item mh
+A local mailbox in the @acronym{MH} format.  @var{User} and
+@var{pass} are not used.  @var{Host-or-file-name} denotes the name of
+@acronym{MH} folder, e.g., @code{mh://Mail/inbox}.
+
+@item maildir
+A local mailbox in the @acronym{maildir} format.  @var{User} and
+@var{pass} are not used, and @var{host-or-file-name} denotes the name of
+@code{maildir} mailbox, e.g., @code{maildir://mail/inbox}.
+
+@item file
+Any local mailbox format.  Its actual format is detected automatically
+by @code{movemail}.
+
+@item pop
+A remote mailbox to be accessed via POP3 protocol.  @var{User}
+specifies the remote user name to use, @var{pass} may be used to
+specify the user password, @var{host-or-file-name} is the name or IP
+address of the remote mail server to connect to; e.g.,
+@code{pop://smith:guessme@@remote.server.net}.
+ 
+@item imap
+A remote mailbox to be accessed via IMAP4 protocol.  @var{User}
+specifies the remote user name to use, @var{pass} may be used to
+specify the user password, @var{host-or-file-name} is the name or IP
+address of the remote mail server to connect to;
+e.g., @code{imap://smith:guessme@@remote.server.net}.
+@end table
+
+Alternatively, the mailbox may be specified as a file name of the
+mailbox to use.  This is equivalent to specifying the @samp{file} protocol:
+
+@smallexample
+/var/spool/mail/user @equiv{} file://var/spool/mail/user
+@end smallexample
+
+@vindex rmail-movemail-program
+@vindex rmail-movemail-search-path
+ To determine which version of @code{movemail} is being used, Rmail
+examines the value of @code{rmail-movemail-program} variable.  If it
+is set, its value is used as a full path to the @code{movemail} binary.
+Otherwise, Rmail searches for @code{movemail} in the list of directories
+constructed by appending the values of @code{rmail-movemail-search-path} and
+@code{exec-path} to @code{exec-directory}.  
+  
+@node Remote Mailboxes
+@section Retrieving Mail from Remote Mailboxes
+@pindex movemail
+
 @vindex rmail-preserve-inbox
   When getting new mail, Rmail first copies the new mail from the inbox
 file to the Rmail file; then it saves the Rmail file; then it truncates
@@ -1175,7 +1284,6 @@
 exist, and Rmail will use it again the next time it gets new mail from
 that inbox.
 
-@pindex movemail
   If Rmail is unable to convert the data in
 @file{~/.newmail-@var{inboxname}} into Babyl format, it renames the file
 to @file{~/RMAILOSE.@var{n}} (@var{n} is an integer chosen to make the
@@ -1186,30 +1294,72 @@
 the corrected file.
 
   Some sites use a method called POP for accessing users' inbox data
-instead of storing the data in inbox files.  @code{movemail} can work
-with POP if you compile it with the macro @code{MAIL_USE_POP} defined.
-(You can achieve that by specifying @samp{--with-pop} when you run
-@code{configure} during the installation of Emacs.)
-@code{movemail} only works with POP3, not with older
+instead of storing the data in inbox files.  The @code{Emacs
+movemail} can work with POP if you compile it with the macro
+@code{MAIL_USE_POP} defined.  (You can achieve that by specifying
+@samp{--with-pop} when you run @code{configure} during the
+installation of Emacs.)
+
+The @code{Mailutils movemail} by default supports POP, unless configured
+with @samp{--disable-pop} option.
+
+Both versions of @code{movemail} only work with POP3, not with older
 versions of POP.
 
 @cindex @env{MAILHOST} environment variable
-@cindex POP inboxes
-  Assuming you have compiled and installed @code{movemail}
-appropriately, you can specify a POP inbox by using a ``file name'' of
-the form @samp{po:@var{username}}, in the inbox list of an Rmail file.
-@code{movemail} handles such a name by opening a connection to the POP
-server.  The @env{MAILHOST} environment variable specifies the machine
-to look for the server on; alternatively, you can specify the POP server
-host name as part of the mailbox name using the syntax
-@samp{po:@var{username}:@var{hostname}}.
+@cindex POP mailboxes
+  No matter which flavor of @code{movemail} you use, you can specify
+POP inbox by using POP @dfn{URL} (@pxref{Movemail}).  A POP
+@acronym{URL} is a ``file name'' of the form
+@samp{pop://@var{username}@@@var{hostname}}, where
+@var{hostname} is the host name or IP address of the remote mail
+server and @var{username} is the user name on that server.
+Additionally, you may specify the password in the mailbox @acronym{URL}:
+@samp{pop://@var{username}:@var{password}@@@var{hostname}}.  In this
+case, @var{password} takes preference over the one set by
+@code{rmail-remote-password}.  This is especially useful if you have
+several remote mailboxes with different passwords. 
 
+  For backward compatibility Rmail also supports two alternative ways
+of specifying remote POP mailboxes.  Specifying inbox name in the form
+@samp{po:@var{username}:@var{hostname}} is equivalent to 
+@samp{pop://@var{username}@@@var{hostname}}.  Alternatively, you may set
+a ``file name'' of @samp{po:@var{username}} in the inbox list of an
+Rmail file.  @code{Movemail} will handle such a name by opening a
+connection to the POP server.  The @env{MAILHOST} environment variable
+will in this case specify the machine to look for the server on.
+
+@cindex IMAP mailboxes
+  Another method for accessing remote mailboxes is IMAP.  This method is
+supported only by the @code{mailutils movemail}.  To specify an IMAP
+mailbox in the inbox list, use the following mailbox @acronym{URL}:
+@samp{imap://@var{username}[:@var{password}]@@@var{hostname}}.  The
+@var{password} part is optional, as descrbed above.
+
+@vindex rmail-remote-password
+@vindex rmail-remote-password-required
 @vindex rmail-pop-password
 @vindex rmail-pop-password-required
-  Accessing mail via POP may require a password.  If the variable
-@code{rmail-pop-password} is non-@code{nil}, it specifies the password
-to use for POP.  Alternatively, if @code{rmail-pop-password-required} is
-non-@code{nil}, then Rmail asks you for the password to use.
+  Accessing a remote mailbox may require a password.  Rmail uses the
+following algorithm to retrieve it:
+
+@enumerate
+@item 
+If the @var{password} is present in mailbox URL (see above), it is
+used.
+@item 
+If the variable @code{rmail-remote-password} is non-@code{nil}, its
+value is used.
+@item
+Otherwise, if @code{rmail-remote-password-required} is non-@code{nil},
+then Rmail will ask you for the password to use.
+@item
+Otherwise, Rmail assumes no password is required.
+@end enumerate
+
+  For compatibility with previous versions, @code{rmail-pop-password}
+and @code{rmail-pop-password-required} may be used instead of
+@code{rmail-remote-password} and @code{rmail-remote-password-required}.
 
 @vindex rmail-movemail-flags
   If you need to pass additional command-line flags to @code{movemail},
@@ -1231,6 +1381,25 @@
 downloaded messages by adding the @samp{-r} flag to
 @code{rmail-movemail-flags}.
 
+@cindex TLS encryption (Rmail)
+  @code{Mailutils movemail} supports TLS encryption.  If you wish to
+use it, add the @samp{--tls} flag to @code{rmail-movemail-flags}.
+
+@node Other Mailbox Formats
+@section Retrieving Mail from Local Mailboxes in Various Formats
+
+  If your incoming mail is stored on a local machine in a format other
+than UNIX mailbox, you will need the @code{mailutils movemail} to retrieve
+it.  @xref{Movemail}, for the detailed description of @code{movemail}
+versions.
+
+  For example, to retrieve mail from a @code{maildir} inbox located in
+@file{/var/spool/mail/in}, you would set the following in Rmail inbox list:
+
+@smallexample
+maildir://var/spool/mail/in
+@end smallexample
+
 @ignore
    arch-tag: 034965f6-38df-47a2-a9f1-b8bc8ab37e23
 @end ignore
--- a/man/search.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/search.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -219,7 +219,8 @@
 
   @kbd{M-%} typed in incremental search invokes @code{query-replace}
 or @code{query-replace-regexp} (depending on search mode) with the
-current search string used as the string to replace.
+current search string used as the string to replace.  @xref{Query
+Replace}.
 
 @cindex lazy search highlighting
 @vindex isearch-lazy-highlight
@@ -231,11 +232,11 @@
 If you don't like this feature, you can turn it off by setting
 @code{isearch-lazy-highlight} to @code{nil}.
 
-@vindex isearch-lazy-highlight-face
 @cindex faces for highlighting search matches
   You can control how this highlighting looks by customizing the faces
-@code{isearch} (used for the current match) and
-@code{isearch-lazy-highlight-face} (for all the other matches).
+@code{isearch} (used for the current match) and @code{lazy-highlight}
+(for all the other matches).  The latter is also used for other matches
+inside @code{query-replace}.
 
 @vindex isearch-mode-map
   To customize the special characters that incremental search understands,
@@ -1153,6 +1154,14 @@
 @kindex C-M-%
 @findex query-replace-regexp
   @kbd{C-M-%} performs regexp search and replace (@code{query-replace-regexp}).
+It works like @code{replace-regexp} except that it queries
+like @code{query-replace}.
+
+@cindex faces for highlighting query replace
+  These commands highlight the current match using the face
+@code{query-replace}.  They highlight other matches using
+@code{lazy-highlight} just like incremental search (@pxref{Incremental
+Search}).
 
   The characters you can type when you are shown a match for the string
 or regexp are:
--- a/man/widget.texi	Sun Jan 02 09:21:32 2005 +0000
+++ b/man/widget.texi	Sun Jan 16 03:40:12 2005 +0000
@@ -10,7 +10,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 2000, 2002, 2003 Free Software Foundation, Inc.
+Copyright @copyright{} 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -593,6 +593,11 @@
 which should return a string to display, or a form that evaluates to
 such a string.
 
+@vindex follow-link@r{ keyword}
+@item :follow-link
+Specifies how to interpret a @key{mouse-1} click on the widget.
+@xref{Enabling Mouse-1 to Follow Links,,, elisp, the Emacs Lisp Reference Manual}.
+
 @vindex indent@r{ keyword}
 @item :indent
 An integer indicating the absolute number of spaces to indent children
--- a/src/ChangeLog	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/ChangeLog	Sun Jan 16 03:40:12 2005 +0000
@@ -1,3 +1,206 @@
+2005-01-15  Steven Tamm  <steventamm@mac.com>
+
+	* macterm.c (Vmac_use_core_graphics): defined for
+	mac-allow-anti-aliasing
+	(syms_of_macterm): Added mac-allow-anti-aliasing
+	(mac_draw_string_common): Use core graphics text rendering if
+	mac-allow-anti-aliasing is enabled.
+
+	* macfns.c (Fx_file_dialog): Save As dialog includes only the
+	file name in the text box.
+
+2005-01-15  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macfns.c (x_set_foreground_color, x_set_background_color): Sync
+	with xfns.c.
+	(mac_window, x_create_tip_frame): Use XSetWindowBackground.
+	* macterm.c (XSetBackground, XSetWindowBackground): New functions.
+	* macterm.h (XSetBackground, XSetWindowBackground): Add externs.
+
+2005-01-14  Kim F. Storm  <storm@cua.dk>
+
+	* keyboard.c (Fposn_at_x_y): Add optional arg WHOLE.
+
+2005-01-13  Richard M. Stallman  <rms@gnu.org>
+
+	* keymap.c (Fcurrent_active_maps): Ignore Voverriding_local_map
+	if Voverriding_terminal_local_map is non-nil.
+
+	* keyboard.c (syms_of_keyboard): Doc fix.
+
+2005-01-13  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (Fformat_mode_line): Fix last change.  Remove NO_PROPS arg
+	(specify 0 for FACE instead). Reorder arg list.  Doc fix.
+
+2005-01-12  Richard M. Stallman  <rms@gnu.org>
+
+	* xdisp.c (Fformat_mode_line): New arg FACE specifies a default
+	face property for characters that don't specify one.
+
+	* fns.c (Frequire): Record in load-history unconditionally.
+
+2005-01-10  Kim F. Storm  <storm@cua.dk>
+
+	* dispextern.h (merge_faces): Rename from merge_into_realized_face.
+
+	* xfaces.c (merge_faces): Rename from merge_into_realized_face.
+	Callers changed.
+	Add support to merge with lisp face id too (if face_name is t).
+
+	* xdisp.c (get_next_display_element, next_element_from_display_vector):
+	Don't lookup lface_id from display table glyphs here; instead use
+	merge_faces to merge the lisp face id into current face.
+
+2005-01-09  Kim F. Storm  <storm@cua.dk>
+
+	* dispextern.h (struct it): New member dpvec_face_id.
+	(merge_into_realized_face): Add prototype.
+
+	* xfaces.c (merge_into_realized_face): New function.  Used to
+	merge escape-glyph face or face from display table into current	face.
+
+	* xdisp.c (Vshow_nonbreak_escape): New lisp var.
+	(syms_of_xdisp): DEFVAR_LISP it.
+	(escape_glyph_face): Remove var.
+	(redisplay_window): Don't initialize it.
+	(setup_for_ellipsis, get_next_display_element):
+	Set it->dpvec_face_id to -1.
+	(get_next_display_element): Test Vshow_nonbreak_escape.
+	Do not setup escape_glyph_face.
+	Properly merge escape-glyph face or face from display table with
+	current face for escape and control characters.  Set
+	it->dpvec_face_id to relevant face id instead of adding it to each
+	element of display vector.
+	(next_element_from_display_vector): If it->dpvec_face_id is set,
+	use that instead of lface_id from glyph itself.
+
+2005-01-08  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* xterm.h (struct x_output): New member, toolbar_detached.
+
+	* gtkutil.c (xg_create_frame_widgets): Set initial tool bar height to
+	38.
+	(xg_tool_bar_detach_callback): Set toolbar_detached to 1.
+	(xg_tool_bar_attach_callback): Set toolbar_detached to 0.
+	(xg_create_tool_bar): Initialize toolbar_detached.
+	(update_frame_tool_bar): Only set FRAME_TOOLBAR_HEIGHT (f) if
+	toolbar_detached is zero.
+
+2005-01-07  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* xmenu.c (create_and_show_popup_menu): Pass zero as button to
+	gtk_menu_popup if not for_click, so callbacks for the menu are called.
+
+	* gtkutil.c (xg_gtk_scroll_destroy, xg_create_scroll_bar)
+	(xg_tool_bar_callback, xg_tool_bar_help_callback)
+	(update_frame_tool_bar): Cast to EMACS_INT to avoid compiler
+	warning.
+
+	* xselect.c (x_get_foreign_selection, x_fill_property_data)
+	(Fx_get_atom_name, Fx_send_client_event): Replace XFLOAT with
+	XFLOAT_DATA to get extract number from Lisp object.
+
+2005-01-07  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (set_iterator_to_next): Fix 2004-12-13 change.
+	Set stop_charpos to current charpos instead of 0.
+
+2005-01-06  Nick Roberts  <nickrob@snap.net.nz>
+
+	* xdisp.c (Fformat_mode_line): First arg now required.
+
+2005-01-06  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macterm.c (XLoadQueryFont): Correctly handle 0 size
+	font widths that are returned from some Japanese fonts.
+
+2005-01-06  Kim F. Storm  <storm@cua.dk>
+
+	* fringe.c (fringe_faces): Change to Lisp_Object pointer.
+	(draw_fringe_bitmap_1): Lookup user defined fringe faces here.
+	(destroy_fringe_bitmap): Set fringe_faces element to nil.
+	(Fdefine_fringe_bitmap, init_fringe): Change allocation of
+	fringe_faces array and init elements to nil.
+	(Fset_fringe_bitmap_face): Set fringe_faces to face name instead of
+	non-persistent face id.
+	(mark_fringe_data): New function for GC.
+
+	* alloc.c (mark_fringe_data): Declare extern.
+	(Fgarbage_collect): Call mark_fringe_data.
+
+	* alloc.c (overrun_check_free): Invalidate freed memory if
+	XMALLOC_CLEAR_FREE_MEMORY is defined.
+
+2005-01-05  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macfns.c: Include sys/param.h.
+	[TARGET_API_MAC_CARBON] (mac_nav_event_callback): New declaration
+	and function.
+	[TARGET_API_MAC_CARBON] (Fx_file_dialog): Use MAXPATHLEN for size
+	of filename string.  Set event callback function when creating
+	dialog boxes.  Add code conversions for filenames.  Don't dispose
+	apple event descriptor record if failed to create it.
+
+	* macterm.c: Include sys/param.h.
+	[USE_CARBON_EVENTS] (mac_handle_window_event): Add handler for
+	kEventWindowUpdate.
+	(install_window_handler) [USE_CARBON_EVENTS]: Register it.
+	(do_ae_open_documents) [TARGET_API_MAC_CARBON]: Get FSRef instead
+	of FSSpec from apple event descriptor record.
+	(do_ae_open_documents) [TARGET_API_MAC_CARBON]: Use MAXPATHLEN for
+	size of filename string.
+	[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Likewise.
+	[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Return error when a
+	file dialog is in action.
+	[TARGET_API_MAC_CARBON] (mac_do_track_drag): Likewise.  Reject
+	only when there are no filename items.  Set background color
+	before (un)highlighting the window below the dragged items.
+	(XTread_socket) [!USE_CARBON_EVENTS]: Don't call do_window_update.
+
+2005-01-05  Romain Francoise  <romain@orebokech.com>
+
+	* term.c (encode_terminal_code): Fix buffer size computation.
+
+2005-01-04  Richard M. Stallman  <rms@gnu.org>
+
+	* xdisp.c (Fformat_mode_line): Doc fix.
+
+2005-01-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* alloc.c (refill_memory_reserve): Move.
+	(emacs_blocked_free, emacs_blocked_malloc, emacs_blocked_realloc)
+	(reset_malloc_hooks, uninterrupt_malloc) [SYNC_INPUT]: Don't define.
+
+2005-01-03  Richard M. Stallman  <rms@gnu.org>
+
+	* window.c (window_scroll_pixel_based): Don't correct preserve_y
+	for CURRENT_HEADER_LINE_HEIGHT when moving backwards.
+
+2005-01-03  Jason Rumney  <jasonr@gnu.org>
+
+	* w32bdf.c (w32_load_bdf_font): Set fontp->average_width and
+	fontp->space_width to FONT_WIDTH so they are valid.
+
+	* w32fns.c (w32_load_system_font): Set FONT_WIDTH to maximum, not
+	average width. Set fontp->average_width and fontp->space_width to
+	their appropriate values.
+
+	* w32term.c (x_new_font): Set FRAME_COLUMN_WIDTH to
+	fontp->average_width, not FONT_WIDTH.  Set FRAME_SPACE_WIDTH to
+	fontp->space_width.
+
+2005-01-03  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macterm.c (x_new_font): Set FRAME_SPACE_WIDTH.
+	(x_font_min_bounds, XLoadQueryFont): Use the correct font width
+	metrics for max and min bounds.
+	(x_load_font): Correctly calculate average font width metrics.
+
+2005-01-02  Richard M. Stallman  <rms@gnu.org>
+
+	* alloc.c (Fgarbage_collect): Don't truncate_undo_list on dead buffers.
+
 2004-12-31  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* xterm.c (handle_one_xevent): Clear area in expose event for GTK.
@@ -48,7 +251,7 @@
 
 	* xterm.c (x_new_font): Set FRAME_COLUMN_WIDTH to
 	fontp->average_width, not FONT_WIDTH.  Set FRAME_SPACE_WIDTH to
-	fontp-?space_width..
+	fontp->space_width.
 	(x_load_font): Calculate fontp->space_width and
 	fontp->average_width.
 	(x_term_init): Initialize dpyinfo->Xatom_AVERAGE_WIDTH.
@@ -298,6 +501,10 @@
 	* gtkutil.c (xg_initialize): Install bindings for C-g so that
 	dialogs and menus pop down.
 
+2004-12-27  Kenichi Handa  <handa@m17n.org>
+
+	* coding.c (code_convert_region): Fix calculation of `ratio'.
+
 2004-12-25  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* gtkutil.c (update_frame_tool_bar): Make the value of
--- a/src/alloc.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/alloc.c	Sun Jan 16 03:40:12 2005 +0000
@@ -103,7 +103,7 @@
    that the backend handles concurrent access to malloc within its own threads
    but Emacs code running in the main thread is not included in that control).
 
-   When UNBLOCK_INPUT is called, revoke_input_signal may be called.  If this
+   When UNBLOCK_INPUT is called, reinvoke_input_signal may be called.  If this
    happens in one of the backend threads we will have two threads that tries
    to run Emacs code at once, and the code is not prepared for that.
    To prevent that, we only call BLOCK/UNBLOCK from the main thread.  */
@@ -309,6 +309,7 @@
 static void mark_face_cache P_ ((struct face_cache *));
 
 #ifdef HAVE_WINDOW_SYSTEM
+extern void mark_fringe_data P_ ((void));
 static void mark_image P_ ((struct image *));
 static void mark_image_cache P_ ((struct frame *));
 #endif /* HAVE_WINDOW_SYSTEM */
@@ -704,9 +705,14 @@
 		val + osize,
 		XMALLOC_OVERRUN_CHECK_SIZE))
 	abort ();
+#ifdef XMALLOC_CLEAR_FREE_MEMORY
+      val -= XMALLOC_OVERRUN_CHECK_SIZE;
+      memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2);
+#else
       bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE);
       val -= XMALLOC_OVERRUN_CHECK_SIZE;
       bzero (val, XMALLOC_OVERRUN_CHECK_SIZE);
+#endif
     }
 
   free (val);
@@ -1113,17 +1119,34 @@
 }
 
 
+#ifndef SYSTEM_MALLOC
+
+/* If we released our reserve (due to running out of memory),
+   and we have a fair amount free once again,
+   try to set aside another reserve in case we run out once more.
+
+   This is called when a relocatable block is freed in ralloc.c.  */
+
+void
+refill_memory_reserve ()
+{
+  if (spare_memory == 0)
+    spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
+}
+
+
 /* Arranging to disable input signals while we're in malloc.
 
    This only works with GNU malloc.  To help out systems which can't
    use GNU malloc, all the calls to malloc, realloc, and free
    elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT
-   pairs; unfortunately, we have no idea what C library functions
+   pair; unfortunately, we have no idea what C library functions
    might call malloc, so we can't really protect them unless you're
    using GNU malloc.  Fortunately, most of the major operating systems
    can use GNU malloc.  */
 
-#ifndef SYSTEM_MALLOC
+#ifndef SYNC_INPUT
+
 #ifndef DOUG_LEA_MALLOC
 extern void * (*__malloc_hook) P_ ((size_t));
 extern void * (*__realloc_hook) P_ ((void *, size_t));
@@ -1182,20 +1205,6 @@
 }
 
 
-/* If we released our reserve (due to running out of memory),
-   and we have a fair amount free once again,
-   try to set aside another reserve in case we run out once more.
-
-   This is called when a relocatable block is freed in ralloc.c.  */
-
-void
-refill_memory_reserve ()
-{
-  if (spare_memory == 0)
-    spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
-}
-
-
 /* This function is the malloc hook that Emacs uses.  */
 
 static void *
@@ -1347,6 +1356,7 @@
   __realloc_hook = emacs_blocked_realloc;
 }
 
+#endif /* not SYNC_INPUT */
 #endif /* not SYSTEM_MALLOC */
 
 
@@ -4640,7 +4650,7 @@
 	   turned off in that buffer.  Calling truncate_undo_list on
 	   Qt tends to return NULL, which effectively turns undo back on.
 	   So don't call truncate_undo_list if undo_list is Qt.  */
-	if (! EQ (nextb->undo_list, Qt))
+	if (! NILP (nextb->name) && ! EQ (nextb->undo_list, Qt))
 	  truncate_undo_list (nextb);
 
 	/* Shrink buffer gaps, but skip indirect and dead buffers.  */
@@ -4752,6 +4762,10 @@
     }
   mark_backtrace ();
 
+#ifdef HAVE_WINDOW_SYSTEM
+  mark_fringe_data ();
+#endif
+
 #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
   mark_stack ();
 #endif
--- a/src/dispextern.h	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/dispextern.h	Sun Jan 16 03:40:12 2005 +0000
@@ -1841,6 +1841,9 @@
      means that no such character is involved.  */
   int dpvec_char_len;
 
+  /* Face id to use for all characters in display vector.  -1 if unused. */
+  int dpvec_face_id;
+
   /* Face id of the iterator saved in case a glyph from dpvec contains
      a face.  The face is restored when all glyphs from dpvec have
      been delivered.  */
@@ -2755,6 +2758,7 @@
 				 int, int));
 int face_at_string_position P_ ((struct window *, Lisp_Object, int, int, int,
 				 int, int *, enum face_id, int));
+int merge_faces P_ ((struct frame *, Lisp_Object, int, int));
 int compute_char_face P_ ((struct frame *, int, Lisp_Object));
 void free_all_realized_faces P_ ((Lisp_Object));
 void free_realized_face P_ ((struct frame *, struct face *));
--- a/src/fns.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/fns.c	Sun Jan 16 03:40:12 2005 +0000
@@ -2906,6 +2906,10 @@
 
   CHECK_SYMBOL (feature);
 
+  /* Record the presence of `require' in this file
+     even if the feature specified is already loaded.  */
+  LOADHIST_ATTACH (Fcons (Qrequire, feature));
+
   tem = Fmemq (feature, Vfeatures);
 
   if (NILP (tem))
@@ -2913,8 +2917,6 @@
       int count = SPECPDL_INDEX ();
       int nesting = 0;
 
-      LOADHIST_ATTACH (Fcons (Qrequire, feature));
-
       /* This is to make sure that loadup.el gives a clear picture
 	 of what files are preloaded and when.  */
       if (! NILP (Vpurify_flag))
--- a/src/fringe.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/fringe.c	Sun Jan 16 03:40:12 2005 +0000
@@ -446,7 +446,7 @@
 };
 
 static struct fringe_bitmap **fringe_bitmaps;
-static unsigned *fringe_faces;
+static Lisp_Object *fringe_faces;
 static int max_fringe_bitmaps;
 
 static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
@@ -547,7 +547,13 @@
     }
 
   if (face_id == DEFAULT_FACE_ID)
-    face_id = fringe_faces[which];
+    {
+      Lisp_Object face;
+
+      if ((face = fringe_faces[which], NILP (face))
+	  || (face_id = lookup_named_face (f, face, 'A', 1), face_id < 0))
+	face_id = FRINGE_FACE_ID;
+    }
 
   fb = fringe_bitmaps[which];
   if (fb == NULL)
@@ -574,7 +580,8 @@
 
   if (p.face == NULL)
     {
-      /* Why does this happen?  ++kfs */
+      /* This could happen after clearing face cache.
+	 But it shouldn't happen anymore.  ++kfs */
       return;
     }
 
@@ -1073,7 +1080,7 @@
 {
   struct fringe_bitmap **fbp;
 
-  fringe_faces[n] = FRINGE_FACE_ID;
+  fringe_faces[n] = Qnil;
 
   fbp = &fringe_bitmaps[n];
   if (*fbp && (*fbp)->dynamic)
@@ -1294,12 +1301,12 @@
 		= ((struct fringe_bitmap **)
 		   xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *)));
 	      fringe_faces
-		= (unsigned *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (unsigned));
+		= (unsigned *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (Lisp_Object));
 
 	      for (; i < max_fringe_bitmaps; i++)
 		{
 		  fringe_bitmaps[i] = NULL;
-		  fringe_faces[i] = FRINGE_FACE_ID;
+		  fringe_faces[i] = Qnil;
 		}
 	    }
 	}
@@ -1357,10 +1364,8 @@
       if (face_id < 0)
 	error ("No such face");
     }
-  else
-    face_id = FRINGE_FACE_ID;
 
-  fringe_faces[n] = face_id;
+  fringe_faces[n] = face;
 
   return Qnil;
 }
@@ -1434,6 +1439,18 @@
   Vfringe_bitmaps = Qnil;
 }
 
+/* Garbage collection hook */
+
+void
+mark_fringe_data ()
+{
+  int i;
+
+  for (i = 0; i < max_fringe_bitmaps; i++)
+    if (!NILP (fringe_faces[i]))
+      mark_object (fringe_faces[i]);
+}
+
 /* Initialize this module when Emacs starts.  */
 
 void
@@ -1455,12 +1472,12 @@
   fringe_bitmaps
     = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *));
   fringe_faces
-    = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (unsigned));
+    = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (Lisp_Object));
 
   for (i = 0; i < max_fringe_bitmaps; i++)
     {
       fringe_bitmaps[i] = NULL;
-      fringe_faces[i] = FRINGE_FACE_ID;
+      fringe_faces[i] = Qnil;
     }
 }
 
--- a/src/gtkutil.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/gtkutil.c	Sun Jan 16 03:40:12 2005 +0000
@@ -756,7 +756,7 @@
      So we cheat a bit by setting a height that is what it will have
      later on when tool bar items are added.  */
   if (FRAME_EXTERNAL_TOOL_BAR (f) && f->n_tool_bar_items == 0)
-    FRAME_TOOLBAR_HEIGHT (f) = 34;
+    FRAME_TOOLBAR_HEIGHT (f) = 38;
 
 
   /* We don't want this widget double buffered, because we draw on it
@@ -2850,7 +2850,7 @@
      gpointer data;
 {
   gpointer p;
-  int id = (int)data;
+  int id = (int) (EMACS_INT) data; /* The EMACS_INT cast avoids a warning. */
 
   p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA);
   if (p) xfree (p);
@@ -2920,10 +2920,11 @@
                     "value-changed",
                     scroll_callback,
                     (gpointer) bar);
+  /* The EMACS_INT cast avoids a warning. */
   g_signal_connect (G_OBJECT (wscroll),
                     "destroy",
                     G_CALLBACK (xg_gtk_scroll_destroy),
-                    (gpointer) scroll_id);
+                    (gpointer) (EMACS_INT) scroll_id);
 
   /* Connect to button press and button release to detect if any scroll bar
      has the pointer.  */
@@ -3112,7 +3113,8 @@
      GtkWidget *w;
      gpointer client_data;
 {
-  int idx = (int)client_data;
+  /* The EMACS_INT cast avoids a warning. */
+  int idx = (int) (EMACS_INT) client_data;
   FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA);
   Lisp_Object key, frame;
   struct input_event event;
@@ -3154,6 +3156,8 @@
 
   if (f)
     {
+      FRAME_X_OUTPUT (f)->toolbar_detached = 1;
+
       /* When detaching a tool bar, not everything dissapear.  There are
          a few pixels left that are used to drop the tool bar back into
          place.  */
@@ -3185,11 +3189,13 @@
     {
       GtkRequisition req;
 
+      FRAME_X_OUTPUT (f)->toolbar_detached = 0;
+
       gtk_widget_size_request (w, &req);
       FRAME_TOOLBAR_HEIGHT (f) = req.height;
 
       /* The height has changed, resize outer widget and set columns
-         rows to what we had before detaching the tool bar.  */
+         rows to what we had before attaching the tool bar.  */
       xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f));
     }
 }
@@ -3209,7 +3215,8 @@
      GdkEventCrossing *event;
      gpointer client_data;
 {
-  int idx = (int)client_data;
+  /* The EMACS_INT cast avoids a warning. */
+  int idx = (int) (EMACS_INT) client_data;
   FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA);
   Lisp_Object help, frame;
 
@@ -3302,6 +3309,8 @@
 
   x->toolbar_widget = gtk_toolbar_new ();
   x->handlebox_widget = gtk_handle_box_new ();
+  x->toolbar_detached = 0;
+
   gtk_container_add (GTK_CONTAINER (x->handlebox_widget),
                      x->toolbar_widget);
 
@@ -3452,11 +3461,12 @@
 
           gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
 
+          /* The EMACS_INT cast avoids a warning. */
           gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget),
                                    0, 0, 0,
                                    w,
                                    GTK_SIGNAL_FUNC (xg_tool_bar_callback),
-                                   (gpointer)i);
+                                   (gpointer) (EMACS_INT) i);
 
           /* Save the image so we can see if an update is needed when
              this function is called again.  */
@@ -3486,14 +3496,15 @@
                  rather than the GtkButton specific signals "enter" and
                  "leave", so we can have only one callback.  The event
                  will tell us what kind of event it is.  */
+              /* The EMACS_INT cast avoids a warning. */
               g_signal_connect (G_OBJECT (w),
                                 "enter-notify-event",
                                 G_CALLBACK (xg_tool_bar_help_callback),
-                                (gpointer)i);
+                                (gpointer) (EMACS_INT) i);
               g_signal_connect (G_OBJECT (w),
                                 "leave-notify-event",
                                 G_CALLBACK (xg_tool_bar_help_callback),
-                                (gpointer)i);
+                                (gpointer) (EMACS_INT) i);
             }
         }
       else
@@ -3532,7 +3543,8 @@
     }
 
   gtk_widget_size_request (x->toolbar_widget, &new_req);
-  if (old_req.height != new_req.height)
+  if (old_req.height != new_req.height
+      && ! FRAME_X_OUTPUT (f)->toolbar_detached)
     {
       FRAME_TOOLBAR_HEIGHT (f) = new_req.height;
       xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f));
--- a/src/keyboard.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/keyboard.c	Sun Jan 16 03:40:12 2005 +0000
@@ -6845,7 +6845,7 @@
 #else
   SIGNAL_THREAD_CHECK (signo);
 #endif
-  
+
   if (input_available_clear_time)
     EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
 
@@ -10516,17 +10516,19 @@
   return Flist (sizeof (val) / sizeof (val[0]), val);
 }
 
-DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 3, 0,
+DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 4, 0,
        doc: /* Return position information for pixel coordinates X and Y.
 By default, X and Y are relative to text area of the selected window.
 Optional third arg FRAME_OR_WINDOW non-nil specifies frame or window.
+If optional fourth arg WHOLE is non-nil, X is relative to the left
+edge of the window.
 
 The return value is similar to a mouse click position:
    (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
     IMAGE (DX . DY) (WIDTH . HEIGHT))
 The `posn-' functions access elements of such lists.  */)
-  (x, y, frame_or_window)
-     Lisp_Object x, y, frame_or_window;
+  (x, y, frame_or_window, whole)
+     Lisp_Object x, y, frame_or_window, whole;
 {
   if (NILP (frame_or_window))
     frame_or_window = selected_window;
@@ -10539,7 +10541,10 @@
 
       w = XWINDOW (frame_or_window);
       XSETINT (x, (WINDOW_TO_FRAME_PIXEL_X (w, XINT (x))
-		   + window_box_left_offset (w, TEXT_AREA)));
+		   + (NILP (whole)
+		      ? window_box_left_offset (w, TEXT_AREA)
+		      : - (WINDOW_LEFT_SCROLL_BAR_COLS (w)
+			   * WINDOW_FRAME_COLUMN_WIDTH (w)))));
       XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y)));
       frame_or_window = w->frame;
     }
@@ -10567,7 +10572,7 @@
 
   tem = Fpos_visible_in_window_p (pos, window, Qt);
   if (!NILP (tem))
-    tem = Fposn_at_x_y (XCAR (tem), XCAR (XCDR (tem)), window);
+    tem = Fposn_at_x_y (XCAR (tem), XCAR (XCDR (tem)), window, Qnil);
   return tem;
 }
 
@@ -11267,14 +11272,15 @@
 		 doc: /* Per-terminal keymap that overrides all other local keymaps.
 If this variable is non-nil, it is used as a keymap instead of the
 buffer's local map, and the minor mode keymaps and text property keymaps.
-It also overrides `overriding-local-map'.
+It also replaces `overriding-local-map'.
+
 This variable is intended to let commands such as `universal-argument'
 set up a different keymap for reading the next command.  */);
 
   DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map,
 	       doc: /* Keymap that overrides all other local keymaps.
-If this variable is non-nil, it is used as a keymap instead of the
-buffer's local map, and the minor mode keymaps and text property keymaps.  */);
+If this variable is non-nil, it is used as a keymap--replacing the
+buffer's local map, the minor mode keymaps, and char property keymaps.  */);
   Voverriding_local_map = Qnil;
 
   DEFVAR_LISP ("overriding-local-map-menu-flag", &Voverriding_local_map_menu_flag,
--- a/src/keymap.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/keymap.c	Sun Jan 16 03:40:12 2005 +0000
@@ -1519,10 +1519,13 @@
 
   if (!NILP (olp))
     {
-      if (!NILP (Voverriding_local_map))
-	keymaps = Fcons (Voverriding_local_map, keymaps);
       if (!NILP (current_kboard->Voverriding_terminal_local_map))
 	keymaps = Fcons (current_kboard->Voverriding_terminal_local_map, keymaps);
+      /* The doc said that overriding-terminal-local-map should
+	 override overriding-local-map.  The code used them both,
+	 but it seems clearer to use just one.  rms, jan 2005.  */
+      else if (!NILP (Voverriding_local_map))
+	keymaps = Fcons (Voverriding_local_map, keymaps);
     }
   if (NILP (XCDR (keymaps)))
     {
@@ -1530,16 +1533,20 @@
       Lisp_Object *maps;
       int nmaps, i;
 
+      /* This usually returns the buffer's local map,
+	 but that can be overridden by a `local-map' property.  */
       local = get_local_map (PT, current_buffer, Qlocal_map);
       if (!NILP (local))
 	keymaps = Fcons (local, keymaps);
 
+      /* Now put all the minor mode keymaps on the list.  */
       nmaps = current_minor_maps (0, &maps);
 
       for (i = --nmaps; i >= 0; i--)
 	if (!NILP (maps[i]))
 	  keymaps = Fcons (maps[i], keymaps);
 
+      /* This returns nil unless there is a `keymap' property.  */
       local = get_local_map (PT, current_buffer, Qkeymap);
       if (!NILP (local))
 	keymaps = Fcons (local, keymaps);
--- a/src/macfns.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/macfns.c	Sun Jan 16 03:40:12 2005 +0000
@@ -55,6 +55,7 @@
 #include <ctype.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/param.h>
 
 #include <stdlib.h>
 #include <string.h>
@@ -1384,6 +1385,7 @@
      struct frame *f;
      Lisp_Object arg, oldval;
 {
+  struct mac_output *mac = f->output_data.mac;
   unsigned long fg, old_fg;
 
   fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
@@ -1392,10 +1394,28 @@
 
   if (FRAME_MAC_WINDOW (f) != 0)
     {
+      Display *dpy = FRAME_MAC_DISPLAY (f);
+
+      BLOCK_INPUT;
+      XSetForeground (dpy, mac->normal_gc, fg);
+      XSetBackground (dpy, mac->reverse_gc, fg);
+
+      if (mac->cursor_pixel == old_fg)
+	{
+	  unload_color (f, mac->cursor_pixel);
+	  mac->cursor_pixel = fg;
+	  XSetBackground (dpy, mac->cursor_gc, mac->cursor_pixel);
+	}
+
+      UNBLOCK_INPUT;
+
       update_face_from_frame_parameter (f, Qforeground_color, arg);
+
       if (FRAME_VISIBLE_P (f))
         redraw_frame (f);
     }
+
+  unload_color (f, old_fg);
 }
 
 void
@@ -1403,11 +1423,24 @@
      struct frame *f;
      Lisp_Object arg, oldval;
 {
-  FRAME_BACKGROUND_PIXEL (f)
-    = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
+  struct mac_output *mac = f->output_data.mac;
+  unsigned long bg;
+
+  bg = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
+  unload_color (f, FRAME_BACKGROUND_PIXEL (f));
+  FRAME_BACKGROUND_PIXEL (f) = bg;
 
   if (FRAME_MAC_WINDOW (f) != 0)
     {
+      Display *dpy = FRAME_MAC_DISPLAY (f);
+
+      BLOCK_INPUT;
+      XSetBackground (dpy, mac->normal_gc, bg);
+      XSetForeground (dpy, mac->reverse_gc, bg);
+      XSetWindowBackground (dpy, FRAME_MAC_WINDOW (f), bg);
+      XSetForeground (dpy, mac->cursor_gc, bg);
+
+      UNBLOCK_INPUT;
       update_face_from_frame_parameter (f, Qbackground_color, arg);
 
       if (FRAME_VISIBLE_P (f))
@@ -2296,6 +2329,10 @@
   /* so that update events can find this mac_output struct */
   f->output_data.mac->mFP = f;  /* point back to emacs frame */
 
+  if (FRAME_MAC_WINDOW (f))
+    XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f),
+			  FRAME_BACKGROUND_PIXEL (f));
+
   validate_x_resource_name ();
 
   /* x_set_name normally ignores requests to set the name if the
@@ -3855,6 +3892,8 @@
 #endif
       {
 	FRAME_MAC_WINDOW (f) = tip_window;
+	XSetWindowBackground (FRAME_MAC_DISPLAY(f), tip_window,
+			      FRAME_BACKGROUND_PIXEL (f));
 	SetWRefCon (tip_window, (long) f->output_data.mac);
 	/* so that update events can find this mac_output struct */
 	f->output_data.mac->mFP = f;
@@ -4237,6 +4276,9 @@
 			File selection dialog
  ***********************************************************************/
 
+static pascal void mac_nav_event_callback P_ ((NavEventCallbackMessage,
+					       NavCBRecPtr, void *));
+
 /**
    There is a relatively standard way to do this using applescript to run
    a (choose file) method.  However, this doesn't do "the right thing"
@@ -4261,8 +4303,9 @@
   Lisp_Object file = Qnil;
   int count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
-  char filename[1001];
+  char filename[MAXPATHLEN];
   int default_filter_index = 1; /* 1: All Files, 2: Directories only  */
+  static NavEventUPP mac_nav_event_callbackUPP = NULL;
 
   GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p);
   CHECK_STRING (prompt);
@@ -4290,16 +4333,20 @@
     options.optionFlags |= kNavSelectAllReadableItem;
     if (!NILP(prompt))
       {
-	message = cfstring_create_with_utf8_cstring (SDATA (prompt));
+	message =
+	  cfstring_create_with_utf8_cstring (SDATA (ENCODE_UTF_8 (prompt)));
 	options.message = message;
       }
     /* Don't set the application, let it use default.
     options.clientName = CFSTR ("Emacs");
     */
 
+    if (mac_nav_event_callbackUPP == NULL)
+      mac_nav_event_callbackUPP = NewNavEventUPP (mac_nav_event_callback);
+
     if (!NILP (only_dir_p))
-      status = NavCreateChooseFolderDialog(&options, NULL, NULL, NULL,
-					   &dialogRef);
+      status = NavCreateChooseFolderDialog(&options, mac_nav_event_callbackUPP,
+					   NULL, NULL, &dialogRef);
     else if (NILP (mustmatch)) 
       { 
 	/* This is a save dialog */
@@ -4309,21 +4356,26 @@
 
 	if (!NILP(default_filename))
 	  {
-	    saveName =
-	      cfstring_create_with_utf8_cstring (SDATA (default_filename));
+	    Lisp_Object utf8 = ENCODE_UTF_8 (default_filename);
+	    char *begPtr = SDATA(utf8);
+	    char *filePtr = begPtr + SBYTES(utf8);
+	    while (filePtr != begPtr && !IS_DIRECTORY_SEP(filePtr[-1]))
+	      filePtr--;
+	    saveName = cfstring_create_with_utf8_cstring (filePtr);
 	    options.saveFileName = saveName;
 	    options.optionFlags |= kNavSelectDefaultLocation;
 	  }
 	  status = NavCreatePutFileDialog(&options, 
 					  'TEXT', kNavGenericSignature,
-					  NULL, NULL, &dialogRef);
+					  mac_nav_event_callbackUPP, NULL,
+					  &dialogRef);
 	}
     else
       {
 	/* This is an open dialog*/
 	status = NavCreateChooseFileDialog(&options, fileTypes,
-					   NULL, NULL, NULL, NULL, 
-					   &dialogRef);
+					   mac_nav_event_callbackUPP, NULL,
+					   NULL, NULL, &dialogRef);
       }
     
     /* Set the default location and continue*/
@@ -4331,13 +4383,13 @@
       if (!NILP(dir)) {
 	FSRef defLoc;
 	AEDesc defLocAed;
-	status = FSPathMakeRef(SDATA(dir), &defLoc, NULL);
+	status = FSPathMakeRef(SDATA(ENCODE_FILE(dir)), &defLoc, NULL);
 	if (status == noErr) 
 	  {
 	    AECreateDesc(typeFSRef, &defLoc, sizeof(FSRef), &defLocAed);
 	    NavCustomControl(dialogRef, kNavCtlSetLocation, (void*) &defLocAed);
+	    AEDisposeDesc(&defLocAed);
 	  }
-	AEDisposeDesc(&defLocAed);
       }
 
       status = NavDialogRun(dialogRef);
@@ -4363,7 +4415,7 @@
 	    status = NavDialogGetReply(dialogRef, &reply);
 	    AECoerceDesc(&reply.selection, typeFSRef, &aed);
 	    AEGetDescData(&aed, (void *) &fsRef, sizeof (FSRef));
-	    FSRefMakePath(&fsRef, (UInt8 *) filename, 1000);
+	    FSRefMakePath(&fsRef, (UInt8 *) filename, sizeof (filename));
 	    AEDisposeDesc(&aed);
 	    if (reply.saveFileName)
 	      {
@@ -4372,9 +4424,11 @@
 		if (len && filename[len-1] != '/')
 		  filename[len++] = '/';
 		CFStringGetCString(reply.saveFileName, filename+len, 
-				   1000-len, kCFStringEncodingUTF8);
+				   sizeof (filename) - len,
+				   kCFStringEncodingUTF8);
 	      }
-	    file = DECODE_FILE(build_string (filename));
+	    file = DECODE_FILE (make_unibyte_string (filename,
+						     strlen (filename)));
 	    NavDisposeReply(&reply);
 	  }
 	  break;
@@ -4400,6 +4454,15 @@
 }
 
 
+/* Need to register some event callback function for enabling drag and
+   drop in Navigation Service dialogs.  */
+static pascal void
+mac_nav_event_callback (selector, parms, data)
+     NavEventCallbackMessage selector;
+     NavCBRecPtr parms;
+     void *data ;
+{
+}
 #endif
 
 /***********************************************************************
--- a/src/macterm.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/macterm.c	Sun Jan 16 03:40:12 2005 +0000
@@ -69,6 +69,7 @@
 #include <errno.h>
 #include <setjmp.h>
 #include <sys/stat.h>
+#include <sys/param.h>
 
 #include "keyboard.h"
 #include "frame.h"
@@ -102,6 +103,10 @@
 
 Lisp_Object Vx_toolkit_scroll_bars;
 
+/* If Non-nil, the text will be rendered using Core Graphics text rendering which may anti-alias the text.  */
+Lisp_Object Vmac_use_core_graphics;
+
+
 /* Non-zero means that a HELP_EVENT has been generated since Emacs
    start.  */
 
@@ -726,6 +731,13 @@
      int nchars, mode, bytes_per_char;
 {
   SetPortWindowPort (w);
+#ifdef MAC_OSX
+  UInt32 textFlags, savedFlags;
+  if (!NILP(Vmac_use_core_graphics)) {
+    textFlags = kQDUseCGTextRendering;
+    savedFlags = SwapQDTextFlags(textFlags);
+  }
+#endif
 
   mac_set_colors (gc);
 
@@ -736,6 +748,10 @@
 
   MoveTo (x, y);
   DrawText (buf, 0, nchars * bytes_per_char);
+#ifdef MAC_OSX
+  if (!NILP(Vmac_use_core_graphics))
+    SwapQDTextFlags(savedFlags);
+#endif
 }
 
 
@@ -1092,6 +1108,62 @@
 }
 
 
+/* Mac replacement for XSetBackground.  */
+
+void
+XSetBackground (display, gc, color)
+     Display *display;
+     GC gc;
+     unsigned long color;
+{
+  gc->background = color;
+}
+
+
+/* Mac replacement for XSetWindowBackground.  */
+
+void
+XSetWindowBackground (display, w, color)
+     Display *display;
+     WindowPtr w;
+     unsigned long color;
+{
+#if !TARGET_API_MAC_CARBON
+  AuxWinHandle aw_handle;
+  CTabHandle ctab_handle;
+  ColorSpecPtr ct_table;
+  short ct_size;
+#endif
+  RGBColor bg_color;
+
+  bg_color.red = RED16_FROM_ULONG (color);
+  bg_color.green = GREEN16_FROM_ULONG (color);
+  bg_color.blue = BLUE16_FROM_ULONG (color);
+
+#if TARGET_API_MAC_CARBON
+  SetWindowContentColor (w, &bg_color);
+#else
+  if (GetAuxWin (w, &aw_handle))
+    {
+      ctab_handle = (*aw_handle)->awCTable;
+      HandToHand ((Handle *) &ctab_handle);
+      ct_table = (*ctab_handle)->ctTable;
+      ct_size = (*ctab_handle)->ctSize;
+      while (ct_size > -1)
+	{
+	  if (ct_table->value == 0)
+	    {
+	      ct_table->rgb = bg_color;
+	      CTabChanged (ctab_handle);
+	      SetWinColor (w, (WCTabHandle) ctab_handle);
+	    }
+	  ct_size--;
+	}
+    }
+#endif
+}
+
+
 /* Mac replacement for XSetFont.  */
 
 static void
@@ -4963,7 +5035,8 @@
   FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;
   FRAME_FONTSET (f) = -1;
 
-  FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f));
+  FRAME_COLUMN_WIDTH (f) = fontp->average_width;
+  FRAME_SPACE_WIDTH (f) = fontp->space_width;
   FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f));
 
   compute_fringe_widths (f, 1);
@@ -6499,12 +6572,8 @@
      MacFontStruct *font;
      int *w, *h;
 {
-  /*
-   * TODO: Windows does not appear to offer min bound, only
-   * average and maximum width, and maximum height.
-   */
   *h = FONT_HEIGHT (font);
-  *w = FONT_WIDTH (font);
+  *w = font->min_bounds.width;
 }
 
 
@@ -6732,17 +6801,28 @@
       font->per_char = (XCharStruct *)
 	xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1));
       {
-        int c;
-
+        int c, min_width, max_width;
+
+	min_width = max_width = char_width;
         for (c = 0x20; c <= 0xff; c++)
           {
-            font->per_char[c - 0x20] = font->max_bounds;
-            font->per_char[c - 0x20].width =
-	      font->per_char[c - 0x20].rbearing = CharWidth (c);
-          }
+	    font->per_char[c - 0x20] = font->max_bounds;
+	    char_width = CharWidth (c);
+	    font->per_char[c - 0x20].width = char_width;
+	    font->per_char[c - 0x20].rbearing = char_width;
+	    /* Some Japanese fonts (in SJIS encoding) return 0 as the
+	       character width of 0x7f.  */
+	    if (char_width > 0)
+	      {
+		min_width = min (min_width, char_width);
+		max_width = max (max_width, char_width);
+	      }
+            }
+	font->min_bounds.width = min_width;
+	font->max_bounds.width = max_width;
       }
     }
-
+  
   TextFont (old_fontnum);  /* restore previous font number, size and face */
   TextSize (old_fontsize);
   TextFace (old_fontface);
@@ -6847,6 +6927,35 @@
     fontp->name = (char *) xmalloc (strlen (font->fontname) + 1);
     bcopy (font->fontname, fontp->name, strlen (font->fontname) + 1);
 
+    if (font->min_bounds.width == font->max_bounds.width)
+      {
+	/* Fixed width font.  */
+	fontp->average_width = fontp->space_width = font->min_bounds.width;
+      }
+    else
+      {
+	XChar2b char2b;
+	XCharStruct *pcm;
+
+	char2b.byte1 = 0x00, char2b.byte2 = 0x20;
+	pcm = mac_per_char_metric (font, &char2b, 0);
+	if (pcm)
+	  fontp->space_width = pcm->width;
+	else
+	  fontp->space_width = FONT_WIDTH (font);
+
+	if (pcm)
+	  {
+	    int width = pcm->width;
+	    for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++)
+	      if ((pcm = mac_per_char_metric (font, &char2b, 0)) != NULL)
+		width += pcm->width;
+	    fontp->average_width = width / 95;
+	  }
+	else
+	  fontp->average_width = FONT_WIDTH (font);
+      }
+
     fontp->full_name = fontp->name;
 
     fontp->size = font->max_bounds.width;
@@ -7861,6 +7970,14 @@
 
   switch (GetEventKind (event))
     {
+    case kEventWindowUpdate:
+      result = CallNextEventHandler (next_handler, event);
+      if (result != eventNotHandledErr)
+	return result;
+
+      do_window_update (wp);
+      break;
+
     case kEventWindowBoundsChanging:
       result = CallNextEventHandler (next_handler, event);
       if (result != eventNotHandledErr)
@@ -7918,7 +8035,8 @@
 {
   OSErr err = noErr;
 #if USE_CARBON_EVENTS
-  EventTypeSpec specs[] = {{kEventClassWindow, kEventWindowBoundsChanging}};
+  EventTypeSpec specs[] = {{kEventClassWindow, kEventWindowUpdate},
+			   {kEventClassWindow, kEventWindowBoundsChanging}};
   static EventHandlerUPP handle_window_event_UPP = NULL;
 
   if (handle_window_event_UPP == NULL)
@@ -8013,24 +8131,28 @@
         int i;
 
         /* AE file list is one based so just use that for indexing here.  */
-        for (i = 1; (err == noErr) && (i <= num_files_to_open); i++)
+        for (i = 1; i <= num_files_to_open; i++)
 	  {
+#ifdef MAC_OSX
+	    FSRef fref;
+	    char unix_path_name[MAXPATHLEN];
+
+	    err = AEGetNthPtr (&the_desc, i, typeFSRef, &keyword,
+			       &actual_type, &fref, sizeof (FSRef),
+			       &actual_size);
+	    if (err != noErr || actual_type != typeFSRef)
+	      continue;
+
+	    if (FSRefMakePath (&fref, unix_path_name, sizeof (unix_path_name))
+		== noErr)
+#else
 	    FSSpec fs;
 	    Str255 path_name, unix_path_name;
-#ifdef MAC_OSX
-	    FSRef fref;
-#endif
 
 	    err = AEGetNthPtr(&the_desc, i, typeFSS, &keyword, &actual_type,
 			      (Ptr) &fs, sizeof (fs), &actual_size);
-	    if (err != noErr) break;
-
-#ifdef MAC_OSX
-	    err = FSpMakeFSRef (&fs, &fref);
-	    if (err != noErr) break;
-
-	    if (FSRefMakePath (&fref, unix_path_name, 255) == noErr)
-#else
+	    if (err != noErr) continue;
+
 	    if (path_from_vol_dir_name (path_name, 255, fs.vRefNum, fs.parID,
 					fs.name) &&
 		mac_to_posix_pathname (path_name, unix_path_name, 255))
@@ -8066,18 +8188,21 @@
   FlavorFlags theFlags;
   OSErr result;
 
+  if (GetFrontWindowOfClass (kMovableModalWindowClass, false))
+    return dragNotAcceptedErr;
+
   switch (message)
     {
     case kDragTrackingEnterHandler:
       CountDragItems (theDrag, &items);
-      can_accept = 1;
+      can_accept = 0;
       for (index = 1; index <= items; index++)
 	{
 	  GetDragItemReferenceNumber (theDrag, index, &theItem);
 	  result = GetFlavorFlags (theDrag, theItem, flavorTypeHFS, &theFlags);
-	  if (result != noErr)
+	  if (result == noErr)
 	    {
-	      can_accept = 0;
+	      can_accept = 1;
 	      break;
 	    }
 	}
@@ -8088,7 +8213,9 @@
 	{
 	  RgnHandle hilite_rgn = NewRgn ();
 	  Rect r;
-
+	  struct frame *f = mac_window_to_frame (window);
+
+	  mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f));
 	  GetWindowPortBounds (window, &r);
 	  OffsetRect (&r, -r.left, -r.top);
 	  RectRgn (hilite_rgn, &r);
@@ -8104,6 +8231,9 @@
     case kDragTrackingLeaveWindow:
       if (can_accept)
 	{
+	  struct frame *f = mac_window_to_frame (window);
+
+	  mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f));
 	  HideDragHilite (theDrag);
 	  SetThemeCursor (kThemeArrowCursor);
 	}
@@ -8127,9 +8257,11 @@
   OSErr result;
   ItemReference theItem;
   HFSFlavor data;
-  FSRef fref;
   Size size = sizeof (HFSFlavor);
 
+  if (GetFrontWindowOfClass (kMovableModalWindowClass, false))
+    return dragNotAcceptedErr;
+
   drag_and_drop_file_list = Qnil;
   GetDragMouse (theDrag, &mouse, 0L);
   CountDragItems (theDrag, &items);
@@ -8141,11 +8273,11 @@
       if (result == noErr)
 	{
 #ifdef MAC_OSX
-	  FSRef frref;
+	  FSRef fref;
+	  char unix_path_name[MAXPATHLEN];
 #else
-	  Str255 path_name;
-#endif
-	  Str255 unix_path_name;
+	  Str255 path_name, unix_path_name;
+#endif
 	  GetFlavorData (theDrag, theItem, flavorTypeHFS, &data, &size, 0L);
 #ifdef MAC_OSX
 	  /* Use Carbon routines, otherwise it converts the file name
@@ -8163,8 +8295,6 @@
 					  strlen (unix_path_name)),
 		     drag_and_drop_file_list);
 	}
-      else
-	continue;
     }
   /* If there are items in the list, construct an event and post it to
      the queue like an interrupt using kbd_buffer_store_event.  */
@@ -8724,8 +8854,9 @@
 	  if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
 	      != eventNotHandledErr)
 	    break;
-#endif
+#else
 	  do_window_update ((WindowPtr) er.message);
+#endif
 	  break;
 
 	case osEvt:
@@ -9811,7 +9942,16 @@
    doc: /* If non-nil, the Mac \"Control\" key is passed on to the Mac
 Toolbox for processing before Emacs sees it.  */);
   Vmac_pass_control_to_system = Qt;
-#endif
+
+  DEFVAR_LISP ("mac-pass-control-to-system", &Vmac_pass_control_to_system,
+   doc: /* If non-nil, the Mac \"Control\" key is passed on to the Mac
+Toolbox for processing before Emacs sees it.  */);
+  Vmac_pass_control_to_system = Qt;
+#endif
+
+  DEFVAR_LISP ("mac-allow-anti-aliasing", &Vmac_use_core_graphics,
+   doc: /* If non-nil, the text will be rendered using Core Graphics text rendering which may anti-alias the text.  */);
+  Vmac_use_core_graphics = Qnil;
 
   DEFVAR_INT ("mac-keyboard-text-encoding", &mac_keyboard_text_encoding,
     doc: /* One of the Text Encoding Base constant values defined in the
--- a/src/macterm.h	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/macterm.h	Sun Jan 16 03:40:12 2005 +0000
@@ -602,6 +602,8 @@
 					       unsigned int));
 extern void XFreePixmap P_ ((Display *, Pixmap));
 extern void XSetForeground P_ ((Display *, GC, unsigned long));
+extern void XSetBackground P_ ((Display *, GC, unsigned long));
+extern void XSetWindowBackground P_ ((Display *, WindowPtr, unsigned long));
 extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int,
 					 int, int));
 extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *));
--- a/src/term.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/term.c	Sun Jan 16 03:40:12 2005 +0000
@@ -1,5 +1,5 @@
 /* Terminal control module for terminals described by TERMCAP
-   Copyright (C) 1985, 86, 87, 93, 94, 95, 98, 2000, 2001, 2002
+   Copyright (C) 1985, 86, 87, 93, 94, 95, 98, 2000, 2001, 2002, 2005
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -894,7 +894,7 @@
 	      if (! STRING_MULTIBYTE (string))
 		string = string_to_multibyte (string);
 	      nbytes = buf - encode_terminal_src;
-	      if (nbytes + SBYTES (string) < encode_terminal_src_size)
+	      if (encode_terminal_src_size < nbytes + SBYTES (string))
 		{
 		  encode_terminal_src_size = nbytes + SBYTES (string);
 		  encode_terminal_src = xrealloc (encode_terminal_src,
--- a/src/w32bdf.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/w32bdf.c	Sun Jan 16 03:40:12 2005 +0000
@@ -774,7 +774,10 @@
   fontp->name = (char *) xmalloc (strlen (fontname) + 1);
   bcopy (fontname, fontp->name, strlen (fontname) + 1);
   fontp->full_name = fontp->name;
-  fontp->size = FONT_WIDTH (font);
+  /* FIXME: look at BDF spec to see if there are better ways of finding
+     average_width and space_width, hopefully that don't involve working out
+     the values for ourselves from the data.  */
+  fontp->size = fontp->average_width = fontp->space_width = FONT_WIDTH (font);
   fontp->height = FONT_HEIGHT (font);
 
     /* The slot `encoding' specifies how to map a character
--- a/src/w32fns.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/w32fns.c	Sun Jan 16 03:40:12 2005 +0000
@@ -65,6 +65,7 @@
 extern int w32_console_toggle_lock_key P_ ((int, Lisp_Object));
 extern void w32_menu_display_help P_ ((HWND, HMENU, UINT, UINT));
 extern void w32_free_menu_strings P_ ((HWND));
+extern XCharStruct *w32_per_char_metric P_ ((XFontStruct *, wchar_t *, int));
 
 extern int quit_char;
 
@@ -4545,7 +4546,7 @@
         /* Fill out details in lf according to the font that was
            actually loaded.  */
         lf.lfHeight = font->tm.tmInternalLeading - font->tm.tmHeight;
-        lf.lfWidth = font->tm.tmAveCharWidth;
+        lf.lfWidth = font->tm.tmMaxCharWidth;
         lf.lfWeight = font->tm.tmWeight;
         lf.lfItalic = font->tm.tmItalic;
         lf.lfCharSet = font->tm.tmCharSet;
@@ -4593,6 +4594,25 @@
     fontp->name = (char *) xmalloc (strlen (fontname) + 1);
     bcopy (fontname, fontp->name, strlen (fontname) + 1);
 
+    if (lf.lfPitchAndFamily == FIXED_PITCH)
+      {
+	/* Fixed width font.  */
+	fontp->average_width = fontp->space_width = FONT_WIDTH (font);
+      }
+    else
+      {
+	wchar_t space = 32;
+	XCharStruct* pcm;
+	pcm = w32_per_char_metric (font, &space, ANSI_FONT);
+	if (pcm)
+	  fontp->space_width = pcm->width;
+	else
+	  fontp->space_width = FONT_WIDTH (font);
+
+	fontp->average_width = font->tm.tmAveCharWidth;
+      }
+
+
     fontp->charset = -1;
     charset = xlfd_charset_of_font (fontname);
 
--- a/src/w32term.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/w32term.c	Sun Jan 16 03:40:12 2005 +0000
@@ -1,5 +1,5 @@
 /* Implementation of GUI terminal on the Microsoft W32 API.
-   Copyright (C) 1989, 93, 94, 95, 96, 1997, 1998, 1999, 2000, 2001
+   Copyright (C) 1989, 93, 94, 95, 96, 1997, 1998, 1999, 2000, 2001, 2005
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -846,8 +846,7 @@
 
 /* Function prototypes of this page.  */
 
-static XCharStruct *w32_per_char_metric P_ ((XFontStruct *,
-                                             wchar_t *, int));
+XCharStruct *w32_per_char_metric P_ ((XFontStruct *, wchar_t *, int));
 static int w32_encode_char P_ ((int, wchar_t *, struct font_info *,
 				struct charset *, int *));
 
@@ -985,7 +984,7 @@
 }
 
 
-static XCharStruct *
+XCharStruct *
 w32_per_char_metric (font, char2b, font_type)
      XFontStruct *font;
      wchar_t *char2b;
@@ -5446,7 +5445,8 @@
   FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;
   FRAME_FONTSET (f) = -1;
 
-  FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f));
+  FRAME_COLUMN_WIDTH (f) = fontp->average_width;
+  FRAME_SPACE_WIDTH (f) = fontp->space_width;
   FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f));
 
   compute_fringe_widths (f, 1);
--- a/src/window.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/window.c	Sun Jan 16 03:40:12 2005 +0000
@@ -4688,7 +4688,8 @@
 	;
       else if (preserve_y >= 0)
 	{
-	  /* If we have a header line, take account of it.  */
+	  /* If we have a header line, take account of it.
+	     This is necessary because we set it.current_y to 0, above.  */
 	  if (WINDOW_WANTS_HEADER_LINE_P (w))
 	    preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
 
@@ -4728,9 +4729,14 @@
 	{
 	  SET_TEXT_POS_FROM_MARKER (start, w->start);
 	  start_display (&it, w, start);
+#if 0  /* It's wrong to subtract this here
+	  because we called start_display again
+	  and did not alter it.current_y this time.  */
+
 	  /* If we have a header line, take account of it.  */
 	  if (WINDOW_WANTS_HEADER_LINE_P (w))
 	    preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
+#endif
 
 	  move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
 	  SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
--- a/src/xdisp.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/xdisp.c	Sun Jan 16 03:40:12 2005 +0000
@@ -1,6 +1,6 @@
 /* Display generation from window structure and buffer text.
-   Copyright (C) 1985,86,87,88,93,94,95,97,98,99,2000,01,02,03,04
-   Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1997, 1998, 1999,
+     2000, 2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -319,6 +319,10 @@
 
 Lisp_Object Vshow_trailing_whitespace;
 
+/* Non-nil means escape non-break space and hyphens.  */
+
+Lisp_Object Vshow_nonbreak_escape;
+
 #ifdef HAVE_WINDOW_SYSTEM
 extern Lisp_Object Voverflow_newline_into_fringe;
 
@@ -346,7 +350,6 @@
 /* Name and number of the face used to highlight escape glyphs.  */
 
 Lisp_Object Qescape_glyph;
-int escape_glyph_face;
 
 /* The symbol `image' which is the car of the lists used to represent
    images in Lisp.  */
@@ -3268,6 +3271,7 @@
 
   it->dpvec_char_len = len;
   it->current.dpvec_index = 0;
+  it->dpvec_face_id = -1;
 
   /* Remember the current face id in case glyphs specify faces.
      IT's face is restored in set_iterator_to_next.  */
@@ -5007,6 +5011,7 @@
 		  it->dpvec = v->contents;
 		  it->dpend = v->contents + v->size;
 		  it->current.dpvec_index = 0;
+		  it->dpvec_face_id = -1;
 		  it->saved_face_id = it->face_id;
 		  it->method = next_element_from_display_vector;
 		  it->ellipsis_p = 0;
@@ -5038,8 +5043,9 @@
 		       || (it->c != '\n' && it->c != '\t'))
 		    : (it->multibyte_p
 		       ? (!CHAR_PRINTABLE_P (it->c)
-			  || it->c == 0xA0 /* NO-BREAK SPACE */
-			  || it->c == 0xAD /* SOFT HYPHEN */)
+			  || (!NILP (Vshow_nonbreak_escape)
+			      && (it->c == 0xA0 /* NO-BREAK SPACE */
+				  || it->c == 0xAD /* SOFT HYPHEN */)))
 		       : (it->c >= 127
 			  && (! unibyte_display_via_language_environment
 			      || (UNIBYTE_CHAR_HAS_MULTIBYTE_P (it->c)))))))
@@ -5051,21 +5057,8 @@
 		 display.  Then, set IT->dpvec to these glyphs.  */
 	      GLYPH g;
 	      int ctl_len;
-	      int face_id = escape_glyph_face;
-
-	      /* Find the face id if `escape-glyph' unless we recently did.  */
-	      if (face_id < 0)
-		{
-		  Lisp_Object tem = Fget (Qescape_glyph, Qface);
-		  if (INTEGERP (tem))
-		    face_id = XINT (tem);
-		  else
-		    face_id = 0;
-		  /* If there's overflow, use 0 instead.  */
-		  if (FAST_GLYPH_FACE (FAST_MAKE_GLYPH (0, face_id)) != face_id)
-		    face_id = 0;
-		  escape_glyph_face = face_id;
-		}
+	      int face_id, lface_id;
+	      GLYPH escape_glyph;
 
 	      if (it->c < 128 && it->ctl_arrow_p)
 		{
@@ -5073,62 +5066,83 @@
 		  if (it->dp
 		      && INTEGERP (DISP_CTRL_GLYPH (it->dp))
 		      && GLYPH_CHAR_VALID_P (XINT (DISP_CTRL_GLYPH (it->dp))))
-		    g = XINT (DISP_CTRL_GLYPH (it->dp));
-		  else
-		    g = FAST_MAKE_GLYPH ('^', face_id);
-		  XSETINT (it->ctl_chars[0], g);
-
-		  g = FAST_MAKE_GLYPH (it->c ^ 0100, face_id);
-		  XSETINT (it->ctl_chars[1], g);
-		  ctl_len = 2;
-		}
-	      else if (it->c == 0xA0 || it->c == 0xAD)
-		{
-		  /* Set IT->ctl_chars[0] to the glyph for `\\'.  */
-		  if (it->dp
-		      && INTEGERP (DISP_ESCAPE_GLYPH (it->dp))
-		      && GLYPH_CHAR_VALID_P (XINT (DISP_ESCAPE_GLYPH (it->dp))))
-		    g = XINT (DISP_ESCAPE_GLYPH (it->dp));
-		  else
-		    g = FAST_MAKE_GLYPH ('\\', face_id);
-		  XSETINT (it->ctl_chars[0], g);
-
-		  g = FAST_MAKE_GLYPH (it->c == 0xAD ? '-' : ' ', face_id);
-		  XSETINT (it->ctl_chars[1], g);
-		  ctl_len = 2;
-		}
-	      else
-		{
-		  unsigned char str[MAX_MULTIBYTE_LENGTH];
-		  int len;
-		  int i;
-		  GLYPH escape_glyph;
-
-		  /* Set IT->ctl_chars[0] to the glyph for `\\'.  */
-		  if (it->dp
-		      && INTEGERP (DISP_ESCAPE_GLYPH (it->dp))
-		      && GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp))))
-		    escape_glyph = XFASTINT (DISP_ESCAPE_GLYPH (it->dp));
-		  else
-		    escape_glyph = FAST_MAKE_GLYPH ('\\', face_id);
-
-		  if (CHAR_BYTE8_P (it->c))
 		    {
-		      str[0] = CHAR_TO_BYTE8 (it->c);
-		      len = 1;
-		    }
-		  else if (it->c < 256)
-		    {
-		      str[0] = it->c;
-		      len = 1;
+		      g = XINT (DISP_CTRL_GLYPH (it->dp));
+		      lface_id = FAST_GLYPH_FACE (g);
+		      if (lface_id)
+			{
+			  g = FAST_GLYPH_CHAR (g);
+			  face_id = merge_faces (it->f, Qt, lface_id,
+						 it->face_id);
+			}
 		    }
 		  else
 		    {
-		      /* It's an invalid character, which
-			 shouldn't happen actually, but due to
-			 bugs it may happen.  Let's print the char
-			 as is, there's not much meaningful we can
-			 do with it.  */
+		      /* Merge the escape-glyph face into the current face.  */
+		      face_id = merge_faces (it->f, Qescape_glyph, 0,
+					     it->face_id);
+		      g = '^';
+		    }
+
+		  XSETINT (it->ctl_chars[0], g);
+		  g = it->c ^ 0100;
+		  XSETINT (it->ctl_chars[1], g);
+		  ctl_len = 2;
+		  goto display_control;
+		}
+
+	      if (it->dp
+		  && INTEGERP (DISP_ESCAPE_GLYPH (it->dp))
+		  && GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp))))
+		{
+		  escape_glyph = XFASTINT (DISP_ESCAPE_GLYPH (it->dp));
+		  lface_id = FAST_GLYPH_FACE (escape_glyph);
+		  if (lface_id)
+		    {
+		      escape_glyph = FAST_GLYPH_CHAR (escape_glyph);
+		      face_id = merge_faces (it->f, Qt, lface_id,
+					     it->face_id);
+		    }
+		}
+	      else
+		{
+		  /* Merge the escape-glyph face into the current face.  */
+		  face_id = merge_faces (it->f, Qescape_glyph, 0,
+					 it->face_id);
+		  escape_glyph = '\\';
+		}
+
+	      if (it->c == 0xA0 || it->c == 0xAD)
+		{
+		  XSETINT (it->ctl_chars[0], escape_glyph);
+		  g = it->c == 0xAD ? '-' : ' ';
+		  XSETINT (it->ctl_chars[1], g);
+		  ctl_len = 2;
+		  goto display_control;
+		}
+
+	      {
+		unsigned char str[MAX_MULTIBYTE_LENGTH];
+		int len;
+		int i;
+
+		/* Set IT->ctl_chars[0] to the glyph for `\\'.  */
+		if (CHAR_BYTE8_P (it->c))
+		  {
+		    str[0] = CHAR_TO_BYTE8 (it->c);
+		    len = 1;
+		  }
+		else if (it->c < 256)
+		  {
+		    str[0] = it->c;
+		    len = 1;
+		  }
+		else
+		  {
+		    /* It's an invalid character, which shouldn't
+		       happen actually, but due to bugs it may
+		       happen.  Let's print the char as is, there's
+		       not much meaningful we can do with it.  */
 		      str[0] = it->c;
 		      str[1] = it->c >> 8;
 		      str[2] = it->c >> 16;
@@ -5136,29 +5150,28 @@
 		      len = 4;
 		    }
 
-		  for (i = 0; i < len; i++)
-		    {
-		      XSETINT (it->ctl_chars[i * 4], escape_glyph);
-		      /* Insert three more glyphs into IT->ctl_chars for
-			 the octal display of the character.  */
-		      g = FAST_MAKE_GLYPH (((str[i] >> 6) & 7) + '0',
-					   face_id);
-		      XSETINT (it->ctl_chars[i * 4 + 1], g);
-		      g = FAST_MAKE_GLYPH (((str[i] >> 3) & 7) + '0',
-					   face_id);
-		      XSETINT (it->ctl_chars[i * 4 + 2], g);
-		      g = FAST_MAKE_GLYPH ((str[i] & 7) + '0',
-					   face_id);
-		      XSETINT (it->ctl_chars[i * 4 + 3], g);
-		    }
-		  ctl_len = len * 4;
-		}
-
+		for (i = 0; i < len; i++)
+		  {
+		    XSETINT (it->ctl_chars[i * 4], escape_glyph);
+		    /* Insert three more glyphs into IT->ctl_chars for
+		       the octal display of the character.  */
+		    g = ((str[i] >> 6) & 7) + '0';
+		    XSETINT (it->ctl_chars[i * 4 + 1], g);
+		    g = ((str[i] >> 3) & 7) + '0';
+		    XSETINT (it->ctl_chars[i * 4 + 2], g);
+		    g = (str[i] & 7) + '0';
+		    XSETINT (it->ctl_chars[i * 4 + 3], g);
+		  }
+		ctl_len = len * 4;
+	      }
+
+	    display_control:
 	      /* Set up IT->dpvec and return first character from it.  */
 	      it->dpvec_char_len = it->len;
 	      it->dpvec = it->ctl_chars;
 	      it->dpend = it->dpvec + ctl_len;
 	      it->current.dpvec_index = 0;
+	      it->dpvec_face_id = face_id;
 	      it->saved_face_id = it->face_id;
 	      it->method = next_element_from_display_vector;
 	      it->ellipsis_p = 0;
@@ -5288,9 +5301,6 @@
 	  it->dpvec = NULL;
 	  it->current.dpvec_index = -1;
 
-	  /* Recheck faces after display vector */
-	  it->stop_charpos = 0;
-
 	  /* Skip over characters which were displayed via IT->dpvec.  */
 	  if (it->dpvec_char_len < 0)
 	    reseat_at_next_visible_line_start (it, 1);
@@ -5299,6 +5309,9 @@
 	      it->len = it->dpvec_char_len;
 	      set_iterator_to_next (it, reseat_p);
 	    }
+
+	  /* Recheck faces after display vector */
+	  it->stop_charpos = IT_CHARPOS (*it);
 	}
     }
   else if (it->method == next_element_from_string)
@@ -5378,7 +5391,6 @@
   if (INTEGERP (*it->dpvec)
       && GLYPH_CHAR_VALID_P (XFASTINT (*it->dpvec)))
     {
-      int lface_id;
       GLYPH g;
 
       g = XFASTINT (it->dpvec[it->current.dpvec_index]);
@@ -5388,13 +5400,14 @@
       /* The entry may contain a face id to use.  Such a face id is
 	 the id of a Lisp face, not a realized face.  A face id of
 	 zero means no face is specified.  */
-      lface_id = FAST_GLYPH_FACE (g);
-      if (lface_id)
-	{
-	  /* The function returns -1 if lface_id is invalid.  */
-	  int face_id = ascii_face_of_lisp_face (it->f, lface_id);
-	  if (face_id >= 0)
-	    it->face_id = face_id;
+      if (it->dpvec_face_id >= 0)
+	it->face_id = it->dpvec_face_id;
+      else
+	{
+	  int lface_id = FAST_GLYPH_FACE (g);
+	  if (lface_id > 0)
+	    it->face_id = merge_faces (it->f, Qt, lface_id,
+				       it->saved_face_id);
 	}
     }
   else
@@ -11766,9 +11779,6 @@
   *w->desired_matrix->method = 0;
 #endif
 
-  /* Force this to be looked up again for each redisp of each window.  */
-  escape_glyph_face = -1;
-
   specbind (Qinhibit_point_motion_hooks, Qt);
 
   reconsider_clip_changes (w, buffer);
@@ -16071,22 +16081,30 @@
 
 
 DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line,
-       0, 4, 0,
-       doc: /* Return the mode-line of selected window as a string.
-First optional arg FORMAT specifies a different format string (see
-`mode-line-format' for details) to use.  If FORMAT is t, return
-the buffer's header-line.  Second optional arg WINDOW specifies a
-different window to use as the context for the formatting.
-If third optional arg NO-PROPS is non-nil, string is not propertized.
-Fourth optional arg BUFFER specifies which buffer to use.  */)
-  (format, window, no_props, buffer)
-     Lisp_Object format, window, no_props, buffer;
+       1, 4, 0,
+       doc: /* Format a string out of a mode line format specification.
+First arg FORMAT specifies the mode line format (see `mode-line-format'
+for details) to use.
+
+Optional second arg FACE specifies the face property to put
+on all characters for which no face is specified.
+t means whatever face the window's mode line currently uses
+\(either `mode-line' or `mode-line-inactive', depending).
+nil means the default is no face property.
+If FACE is an integer, the value string has no text properties.
+
+Optional third and fourth args WINDOW and BUFFER specify the window
+and buffer to use as the context for the formatting (defaults
+are the selected window and the window's buffer).  */)
+  (format, face, window, buffer)
+     Lisp_Object format, face, window, buffer;
 {
   struct it it;
   int len;
   struct window *w;
   struct buffer *old_buffer = NULL;
-  enum face_id face_id = DEFAULT_FACE_ID;
+  int face_id = -1;
+  int no_props = INTEGERP (face);
 
   if (NILP (window))
     window = selected_window;
@@ -16095,37 +16113,37 @@
 
   if (NILP (buffer))
     buffer = w->buffer;
-
   CHECK_BUFFER (buffer);
 
+  if (NILP (format))
+    return build_string ("");
+
+  if (no_props)
+    face = Qnil;
+
+  if (!NILP (face))
+    {
+      if (EQ (face, Qt))
+	face = (EQ (window, selected_window) ? Qmode_line : Qmode_line_inactive);
+      face_id = lookup_named_face (XFRAME (WINDOW_FRAME (w)), face, 0, 0);
+    }
+
+  if (face_id < 0)
+    face_id = DEFAULT_FACE_ID;
+
   if (XBUFFER (buffer) != current_buffer)
     {
       old_buffer = current_buffer;
       set_buffer_internal_1 (XBUFFER (buffer));
     }
 
-  if (NILP (format) || EQ (format, Qt))
-    {
-      face_id = (NILP (format)
-		 ? CURRENT_MODE_LINE_FACE_ID (w)
-		 : HEADER_LINE_FACE_ID);
-      format = (NILP (format)
-		? current_buffer->mode_line_format
-		: current_buffer->header_line_format);
-    }
-
   init_iterator (&it, w, -1, -1, NULL, face_id);
 
-  if (NILP (no_props))
-    {
-      mode_line_string_face
-	= (face_id == MODE_LINE_FACE_ID ? Qmode_line
-	   : face_id == MODE_LINE_INACTIVE_FACE_ID ? Qmode_line_inactive
-	   : face_id == HEADER_LINE_FACE_ID ? Qheader_line : Qnil);
-
+  if (!no_props)
+    {
+      mode_line_string_face = face;
       mode_line_string_face_prop
-	= (NILP (mode_line_string_face) ? Qnil
-	   : Fcons (Qface, Fcons (mode_line_string_face, Qnil)));
+	= (NILP (face) ? Qnil : Fcons (Qface, Fcons (face, Qnil)));
 
       /* We need a dummy last element in mode_line_string_list to
 	 indicate we are building the propertized mode-line string.
@@ -16148,7 +16166,7 @@
   if (old_buffer)
     set_buffer_internal_1 (old_buffer);
 
-  if (NILP (no_props))
+  if (!no_props)
     {
       Lisp_Object str;
       mode_line_string_list = Fnreverse (mode_line_string_list);
@@ -22498,6 +22516,10 @@
 The face used for trailing whitespace is `trailing-whitespace'.  */);
   Vshow_trailing_whitespace = Qnil;
 
+  DEFVAR_LISP ("show-nonbreak-escape", &Vshow_nonbreak_escape,
+    doc: /* *Non-nil means display escape character before non-break space and hyphen.  */);
+  Vshow_nonbreak_escape = Qt;
+
   DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer,
     doc: /* *The pointer shape to show in void text areas.
 Nil means to show the text pointer.  Other options are `arrow', `text',
--- a/src/xfaces.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/xfaces.c	Sun Jan 16 03:40:12 2005 +0000
@@ -7881,6 +7881,69 @@
 }
 
 
+/* Merge a face into a realized face.
+
+   F is frame where faces are (to be) realized.
+
+   FACE_NAME is named face to merge.
+
+   If FACE_NAME is nil, FACE_ID is face_id of realized face to merge.
+
+   If FACE_NAME is t, FACE_ID is lface_id of face to merge.
+
+   BASE_FACE_ID is realized face to merge into.
+
+   Return new face id.
+*/
+
+int
+merge_faces (f, face_name, face_id, base_face_id)
+     struct frame *f;
+     Lisp_Object face_name;
+     int face_id, base_face_id;
+{
+  Lisp_Object attrs[LFACE_VECTOR_SIZE];
+  struct face *base_face;
+
+  base_face = FACE_FROM_ID (f, base_face_id);
+  if (!base_face)
+    return base_face_id;
+
+  if (EQ (face_name, Qt))
+    {
+      if (face_id < 0 || face_id >= lface_id_to_name_size)
+	return base_face_id;
+      face_name = lface_id_to_name[face_id];
+      face_id = lookup_derived_face (f, face_name, 0, base_face_id);
+      if (face_id >= 0)
+	return face_id;
+      return base_face_id;
+    }
+
+  /* Begin with attributes from the base face.  */
+  bcopy (base_face->lface, attrs, sizeof attrs);
+
+  if (!NILP (face_name))
+    {
+      if (!merge_named_face (f, face_name, attrs, 0))
+	return base_face_id;
+    }
+  else
+    {
+      struct face *face;
+      if (face_id < 0)
+	return base_face_id;
+      face = FACE_FROM_ID (f, face_id);
+      if (!face)
+	return base_face_id;
+      merge_face_vectors (f, face->lface, attrs, 0);
+    }
+
+  /* Look up a realized face with the given face attributes,
+     or realize a new one for ASCII characters.  */
+  return lookup_face (f, attrs, 0, NULL);
+}
+
 
 /***********************************************************************
 				Tests
--- a/src/xmenu.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/xmenu.c	Sun Jan 16 03:40:12 2005 +0000
@@ -2454,10 +2454,6 @@
                            G_CALLBACK (menu_highlight_callback));
   xg_crazy_callback_abort = 0;
 
-  for (i = 0; i < 5; i++)
-    if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i))
-      break;
-
   if (! for_click)
     {
       /* Not invoked by a click.  pop up at x/y.  */
@@ -2470,8 +2466,16 @@
       popup_x_y.x = x;
       popup_x_y.y = y;
       popup_x_y.f = f;
+
+      i = 0;  /* gtk_menu_popup needs this to be 0 for a non-button popup.  */
     }
-
+  else
+    {
+      for (i = 0; i < 5; i++)
+        if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i))
+          break;
+    }
+  
   /* Display the menu.  */
   gtk_widget_show_all (menu);
   gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0);
--- a/src/xselect.c	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/xselect.c	Sun Jan 16 03:40:12 2005 +0000
@@ -1383,7 +1383,7 @@
       else if (INTEGERP (time_stamp))
         requestor_time = (Time) XUINT (time_stamp);
       else if (FLOATP (time_stamp))
-        requestor_time = (Time) XFLOAT (time_stamp);
+        requestor_time = (Time) XFLOAT_DATA (time_stamp);
       else
         error ("TIME_STAMP must be cons or number");
     }
@@ -2468,7 +2468,7 @@
    DPY is the display use to look up X atoms.
    DATA is a Lisp list of values to be converted.
    RET is the C array that contains the converted values.  It is assumed
-   it is big enough to hol all values.
+   it is big enough to hold all values.
    FORMAT is 8, 16 or 32 and gives the size in bits for each C value to
    be stored in RET.  */
 
@@ -2492,7 +2492,7 @@
       if (INTEGERP (o))
         val = (CARD32) XFASTINT (o);
       else if (FLOATP (o))
-        val = (CARD32) XFLOAT (o);
+        val = (CARD32) XFLOAT_DATA (o);
       else if (CONSP (o))
         val = (CARD32) cons_to_long (o);
       else if (STRINGP (o))
@@ -2597,7 +2597,7 @@
   if (INTEGERP (value))
     atom = (Atom) XUINT (value);
   else if (FLOATP (value))
-    atom = (Atom) XFLOAT (value);
+    atom = (Atom) XFLOAT_DATA (value);
   else if (CONSP (value))
     atom = (Atom) cons_to_long (value);
   else
@@ -2729,7 +2729,7 @@
   else if (INTEGERP (dest))
     wdest = (Window) XFASTINT (dest);
   else if (FLOATP (dest))
-    wdest =  (Window) XFLOAT (dest);
+    wdest =  (Window) XFLOAT_DATA (dest);
   else if (CONSP (dest))
     {
       if (! NUMBERP (XCAR (dest)) || ! NUMBERP (XCDR (dest)))
--- a/src/xterm.h	Sun Jan 02 09:21:32 2005 +0000
+++ b/src/xterm.h	Sun Jan 16 03:40:12 2005 +0000
@@ -502,6 +502,8 @@
   GtkWidget *toolbar_widget;
   /* The handle box that makes the tool bar detachable.  */
   GtkWidget *handlebox_widget;
+  /* Non-zero if the tool bar is detached.  */
+  int toolbar_detached;
 
   /* The last size hints set.  */
   GdkGeometry size_hints;