changeset 83241:3dcba0bc766b

Merged in changes from CVS trunk. (Long time no see!) :-) Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-83 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-84 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-1 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-2 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-3 Update from CVS * 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 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-7 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-8 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-9 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-10 Update from CVS * 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 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-14 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-15 Update from CVS * 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 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-19 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-20 Update from CVS * 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 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-24 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-25 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-26 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-27 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-28 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-29 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-30 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-31 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-32 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-33 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-34 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-35 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-36 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-37 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-38 Update from CVS * 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/emacs--cvs-trunk--0--patch-41 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-42 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-43 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-44 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-45 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-46 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-47 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-48 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-49 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-50 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-51 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-52 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-53 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-54 Update from CVS: lisp/cus-start.el (all): Add `undo-outer-limit'. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-55 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-56 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-57 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-58 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-59 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-60 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-61 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-62 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-63 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-64 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-65 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-66 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-67 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-68 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-69 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-70 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-71 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-72 src/dispextern.h (xassert): Enable unconditionally. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-73 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-74 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-75 Update from CVS * 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 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-4 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-5 Update from CVS: exi/gnus-faq.texi ([4.1]): Typo. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-6 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-7 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-8 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-9 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-10 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-11 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-281
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 03 Feb 2005 23:28:36 +0000
parents 62cbc3806a41 (current diff) 0d396bc457d8 (diff)
children 2ca9731170cd
files ChangeLog admin/FOR-RELEASE etc/TODO lisp/ChangeLog lisp/bindings.el lisp/cus-face.el lisp/faces.el lisp/files.el lisp/international/mule-cmds.el lisp/progmodes/gdb-ui.el lisp/simple.el lisp/startup.el lisp/subr.el lisp/type-break.el lisp/url/url-http.el lisp/url/url.el lisp/vc-cvs.el lisp/vc.el man/ChangeLog src/.gdbinit src/alloc.c src/buffer.c src/coding.c src/config.in src/dispextern.h src/dispnew.c src/emacs.c src/fileio.c src/fringe.c src/indent.c src/keyboard.c src/keymap.c src/lisp.h src/macterm.c src/macterm.h src/process.c src/term.c src/w32term.c src/window.c src/xdisp.c src/xfaces.c src/xfns.c src/xmenu.c src/xselect.c src/xterm.c src/xterm.h
diffstat 238 files changed, 12080 insertions(+), 5777 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Feb 03 22:58:27 2005 +0000
+++ b/ChangeLog	Thu Feb 03 23:28:36 2005 +0000
@@ -1,3 +1,8 @@
+2005-01-19  Steven Tamm  <steventamm@mac.com>
+
+	* configure.in: Check for <sys/utsname.h>.
+	* configure: Regenerate.
+
 2004-12-11  Kim F. Storm  <storm@cua.dk>
 
 	* Makefile.in (info): Undo 2004-12-05 change.
--- a/admin/FOR-RELEASE	Thu Feb 03 22:58:27 2005 +0000
+++ b/admin/FOR-RELEASE	Thu Feb 03 23:28:36 2005 +0000
@@ -4,13 +4,15 @@
 
 ** Face remapping.
 
-** Make Rmail find the best version of movemail.
-To be done by Sergey Poznyakoff <gray@Mirddin.farlep.net>.
-
 ** Make VC-over-Tramp work where possible, or at least fail
 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.
+
+** Update Speedbar.
+
 * FATAL ERRORS
 
 ** Investigate face cache related crash.
@@ -32,9 +34,10 @@
 
 ** Fix up url-ldap.el.
 
-* BUGS
+** url/*.el has lots of `(declare (special ...))' which
+are meaningless.  What's that trying to do?
 
-** Incomplete overlay mouse-face highlight bug (Ralf Angeli, Oct 18)
+* BUGS
 
 ** Ange-ftp should ignore irrelevant IPv6 errors:
 
@@ -62,48 +65,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.
 
-** Mailabbrev should quote addresses to correspond to RFC 822.
-See http://article.gmane.org/gmane.emacs.devel/27585
-
-** The '@' character should not expand addresses in mailabbrev
-See http://article.gmane.org/gmane.emacs.devel/27585
-
-** 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
 
@@ -189,48 +150,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>
-Date: Mon, 18 Oct 2004 19:09:19 +0200
-
-If you put
-
-(let* ((length (+ (- (window-width) (current-column)) 40))
-       (start (point))
-       (end (+ (point) length))
-       (string (make-string length ?x))
-       ov)
-  (insert string)
-  (setq ov (make-overlay start end))
-  (overlay-put ov 'mouse-face 'highlight)
-  (overlay-put ov 'display string))
-
-into the *scratch* buffer and type `C-x C-e' with point at the last
-parenthesis, you will get a string which does not fit into the line
-and has to be wrapped.  If you move over it with your mouse, you
-should see that only the part on the second line is being highlighted.
-The full string is highlighted only if the 'display property is not
-set.
-
-
-
 * DOCUMENTATION
 
 ** Document Custom Themes.
@@ -251,9 +170,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
@@ -261,9 +181,9 @@
 man/abbrevs.texi
 man/anti.texi
 man/basic.texi      "Luc Teirlinck"
-man/buffers.texi    "Luc Teirlinck"
+man/buffers.texi    "Luc Teirlinck"  Chong Yidong
 man/building.texi   "Ted Zlatanov" <tzz@lifelogs.com>
-man/calendar.texi
+man/calendar.texi    Joakim Verona <joakim@verona.se>
 man/cmdargs.texi
 man/commands.texi   "Luc Teirlinck"
 man/custom.texi
@@ -271,9 +191,9 @@
 man/display.texi    "Luc Teirlinck"
 man/emacs.texi      "Luc Teirlinck"
 man/entering.texi   "Luc Teirlinck"
-man/files.texi      "Luc Teirlinck"
+man/files.texi      "Luc Teirlinck"  Chong Yidong
 man/fixit.texi      "Luc Teirlinck"
-man/frames.texi     "Luc Teirlinck"
+man/frames.texi     "Luc Teirlinck"  Chong Yidong
 man/glossary.texi
 man/help.texi       "Luc Teirlinck"
 man/indent.texi     "Luc Teirlinck"
@@ -288,23 +208,24 @@
 man/msdog.texi
 man/mule.texi       "Luc Teirlinck"
 man/m-x.texi        "Luc Teirlinck"
-man/picture.texi
-man/programs.texi
+man/picture.texi    Joakim Verona <joakim@verona.se>
+man/programs.texi   "Stephen Eglen"
 man/regs.texi       "Luc Teirlinck"
 man/rmail.texi
 man/screen.texi     "Luc Teirlinck"
 man/search.texi     "Luc Teirlinck"
 man/sending.texi
-man/text.texi       "Luc Teirlinck"
+man/text.texi       "Luc Teirlinck"   Chong Yidong
 man/trouble.texi
-man/windows.texi    "Luc Teirlinck"
+man/windows.texi    "Luc Teirlinck"   Chong Yidong
 man/xresources.texi
 
 ** 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
 ----------------------------------
@@ -312,7 +233,7 @@
 lispref/advice.texi	 Joakim Verona <joakim@verona.se>
 lispref/anti.texi
 lispref/backups.texi     "Luc Teirlinck"
-lispref/buffers.texi     "Luc Teirlinck"
+lispref/buffers.texi     "Luc Teirlinck"   Chong Yidong
 lispref/calendar.texi    Joakim Verona <joakim@verona.se>
 lispref/commands.texi    "Luc Teirlinck"
 lispref/compile.texi     "Luc Teirlinck"
@@ -324,8 +245,8 @@
 lispref/elisp.texi       "Luc Teirlinck"
 lispref/errors.texi      "Luc Teirlinck"
 lispref/eval.texi        "Luc Teirlinck"
-lispref/files.texi       "Luc Teirlinck"
-lispref/frames.texi      "Luc Teirlinck"
+lispref/files.texi       "Luc Teirlinck"   Chong Yidong
+lispref/frames.texi      "Luc Teirlinck"   Chong Yidong
 lispref/functions.texi	 "Luc Teirlinck"
 lispref/hash.texi	 "Luc Teirlinck"
 lispref/help.texi	 "Luc Teirlinck"
@@ -353,10 +274,10 @@
 lispref/strings.texi	 "Luc Teirlinck"
 lispref/symbols.texi	 "Luc Teirlinck"
 lispref/syntax.texi	 "Luc Teirlinck"
-lispref/text.texi
+lispref/text.texi        Chong Yidong
 lispref/tips.texi	 "Luc Teirlinck"
 lispref/variables.texi	 "Luc Teirlinck"
-lispref/windows.texi     "Luc Teirlinck"
+lispref/windows.texi     "Luc Teirlinck"   Chong Yidong
 
 
 Local variables:
--- a/configure	Thu Feb 03 22:58:27 2005 +0000
+++ b/configure	Thu Feb 03 23:28:36 2005 +0000
@@ -984,7 +984,7 @@
     else
       echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
     fi
-    cd "$ac_popdir"
+    cd $ac_popdir
   done
 fi
 
@@ -3250,7 +3250,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3308,7 +3309,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3424,7 +3426,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3478,7 +3481,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3523,7 +3527,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3567,7 +3572,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4200,7 +4206,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4476,7 +4483,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4505,7 +4513,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4575,7 +4584,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4627,7 +4637,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4698,7 +4709,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4750,7 +4762,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4820,7 +4833,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4990,7 +5004,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5059,7 +5074,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5213,7 +5229,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5270,10 +5287,12 @@
 
 
 
+
 for ac_header in sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
   linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
   termcap.h stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
-  sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h
+  sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
+  sys/utsname.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -5306,7 +5325,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5448,7 +5468,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5567,7 +5588,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5732,7 +5754,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5795,7 +5818,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5868,7 +5892,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5954,7 +5979,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6027,7 +6053,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6097,7 +6124,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6156,7 +6184,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6225,7 +6254,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6286,7 +6316,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6352,7 +6383,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6498,7 +6530,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6562,7 +6595,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6627,7 +6661,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6673,7 +6708,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6747,7 +6783,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6812,7 +6849,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6856,7 +6894,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6927,7 +6966,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6977,7 +7017,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7048,7 +7089,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7098,7 +7140,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7169,7 +7212,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7219,7 +7263,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7290,7 +7335,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7340,7 +7386,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7411,7 +7458,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7461,7 +7509,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7548,7 +7597,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7654,7 +7704,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7714,7 +7765,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7838,7 +7890,6 @@
 echo "$as_me:$LINENO: checking for X" >&5
 echo $ECHO_N "checking for X... $ECHO_C" >&6
 
-ac_path_x_has_been_run=yes
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -7931,7 +7982,7 @@
 /usr/openwin/share/include'
 
 if test "$ac_x_includes" = no; then
-  # Guess where to find include files, by looking for a specified header file.
+  # Guess where to find include files, by looking for Intrinsic.h.
   # First, try using that file with no special directory specified.
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -8005,7 +8056,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8065,12 +8117,8 @@
   # Update the cache value to reflect the command line values.
   ac_cv_have_x="have_x=yes \
 		ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
-  # It might be that x_includes is empty (headers are found in the
-  # standard search path. Then output the corresponding message
-  ac_out_x_includes=$x_includes
-  test "x$x_includes" = x && ac_out_x_includes="in standard search path"
-  echo "$as_me:$LINENO: result: libraries $x_libraries, headers $ac_out_x_includes" >&5
-echo "${ECHO_T}libraries $x_libraries, headers $ac_out_x_includes" >&6
+  echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
+echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
 fi
 
 if test "$no_x" = yes; then
@@ -8234,7 +8282,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8329,7 +8378,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8388,7 +8438,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8472,7 +8523,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8656,7 +8708,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8908,7 +8961,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8975,7 +9029,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9044,7 +9099,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9129,7 +9185,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9206,7 +9263,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9260,7 +9318,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9329,7 +9388,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9433,7 +9493,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9500,7 +9561,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9570,7 +9632,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9810,7 +9873,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10332,7 +10396,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10404,7 +10469,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10486,7 +10552,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10565,7 +10632,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10639,7 +10707,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10707,7 +10776,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10776,7 +10846,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10900,7 +10971,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10996,7 +11068,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11076,7 +11149,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11144,7 +11218,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11289,7 +11364,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11398,7 +11474,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11543,7 +11620,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11650,7 +11728,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11804,7 +11883,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11879,7 +11959,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12027,7 +12108,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12104,7 +12186,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12251,7 +12334,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12327,7 +12411,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12470,7 +12555,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12638,7 +12724,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12783,7 +12870,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12859,7 +12947,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12922,7 +13011,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13003,7 +13093,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13144,7 +13235,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13289,7 +13381,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13365,7 +13458,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13438,7 +13532,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13593,7 +13688,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13659,7 +13755,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13918,7 +14015,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13985,7 +14083,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14137,7 +14236,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14321,7 +14421,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14648,7 +14749,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14749,7 +14851,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14822,7 +14925,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14901,7 +15005,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14970,7 +15075,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15038,7 +15144,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15112,7 +15219,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15216,7 +15324,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15291,7 +15400,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15443,7 +15553,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15511,7 +15622,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15688,7 +15800,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15764,7 +15877,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15918,7 +16032,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16069,7 +16184,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16220,7 +16336,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16362,7 +16479,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16406,7 +16524,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16552,7 +16671,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16596,7 +16716,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16661,7 +16782,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16724,7 +16846,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16826,7 +16949,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16895,7 +17019,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17002,7 +17127,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17105,7 +17231,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17181,7 +17308,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17285,7 +17413,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17377,7 +17506,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17442,7 +17572,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17508,7 +17639,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17618,7 +17750,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17683,7 +17816,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17763,7 +17897,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17836,7 +17971,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17909,7 +18045,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17982,7 +18119,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18056,7 +18194,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18128,7 +18267,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18203,7 +18343,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18275,7 +18416,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18348,7 +18490,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18498,7 +18641,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18644,7 +18788,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18790,7 +18935,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18947,7 +19093,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19093,7 +19240,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19239,7 +19387,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19397,7 +19546,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19555,7 +19705,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19744,7 +19895,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19817,7 +19969,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19885,7 +20038,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19931,7 +20085,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20005,7 +20160,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20069,7 +20225,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20207,7 +20364,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20268,7 +20426,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20413,7 +20572,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20569,7 +20729,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20740,7 +20901,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20808,7 +20970,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20993,7 +21156,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -21286,7 +21450,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -21351,7 +21516,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -21414,7 +21580,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -21480,7 +21647,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -21521,7 +21689,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -21588,7 +21757,8 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -22717,6 +22887,11 @@
   *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
   esac
 
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
   # Let's still pretend it is `configure' which instantiates (i.e., don't
   # use $as_me), people would be surprised to read:
   #    /* config.h.  Generated by config.status.  */
@@ -22755,12 +22930,6 @@
 	 fi;;
       esac
     done` || { (exit 1); exit 1; }
-
-  if test x"$ac_file" != x-; then
-    { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-    rm -f "$ac_file"
-  fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
   sed "$ac_vpsub
--- a/configure.in	Thu Feb 03 22:58:27 2005 +0000
+++ b/configure.in	Thu Feb 03 23:28:36 2005 +0000
@@ -1449,7 +1449,8 @@
 AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
   linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
   termcap.h stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
-  sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h)
+  sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
+  sys/utsname.h)
 
 AC_MSG_CHECKING(if personality LINUX32 can be set)
 AC_TRY_COMPILE([#include <sys/personality.h>], [personality (PER_LINUX32)],
--- a/etc/ChangeLog	Thu Feb 03 22:58:27 2005 +0000
+++ b/etc/ChangeLog	Thu Feb 03 23:28:36 2005 +0000
@@ -1,3 +1,28 @@
+2005-01-22  David Kastrup  <dak@gnu.org>
+
+	* NEWS: Mention alias `find-grep' for `grep-find'.
+
+2005-01-22  Nick Roberts  <nickrob@snap.net.nz>
+
+	* TODO: Add entry for toolbar on ttys.
+
+2005-01-18  Nick Roberts  <nickrob@snap.net.nz>
+
+	* DEBUG: Suggest separate terminal for debug session.
+
+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/DEBUG	Thu Feb 03 22:58:27 2005 +0000
+++ b/etc/DEBUG	Thu Feb 03 23:28:36 2005 +0000
@@ -62,6 +62,11 @@
 Put a breakpoint early in `main', or suspend the Emacs,
 to get an opportunity to do the set command.
 
+When Emacs is running in a terminal, it is useful to use a separate terminal
+for the debug session.  This can be done by starting Emacs as usual, then
+attaching to it from gdb with the `attach' command which is explained in the
+node "Attach" of the GDB manual.
+
 ** Examining Lisp object values.
 
 When you have a live process to debug, and it has not encountered a
@@ -115,7 +120,7 @@
     b set_frame_buffer_list
     r -q
 
-Then when Emacs it hits the breakpoint:
+Then Emacs hits the breakpoint:
 
     (gdb) p frame
     $1 = 139854428
--- a/etc/MORE.STUFF	Thu Feb 03 22:58:27 2005 +0000
+++ b/etc/MORE.STUFF	Thu Feb 03 23:28:36 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,7 +204,7 @@
    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.
 
  * Mule-UCS: Universal enCoding System:
@@ -195,10 +215,25 @@
    `utf-translate-cjk' turned on.
 
  * 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>
 
@@ -208,6 +243,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.
@@ -216,6 +263,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>
 
@@ -224,6 +273,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	Thu Feb 03 22:58:27 2005 +0000
+++ b/etc/NEWS	Thu Feb 03 23:28:36 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.
@@ -98,28 +99,50 @@
 
 * Changes in Emacs 21.4
 
+** Emacs now responds to mouse-clicks on the mode-line, header-line and
+display margin, when run in an xterm.
+
+** M-SPC (just-one-space) when given a numeric argument N
+converts whitespace around point to N spaces.
+
+** 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
 boundries etc.  For more info, see the documentation of the variable
 `calculator-radix-grouping-mode'.
 
++++
 ** You can now follow links by clicking Mouse-1 on the link.
 
 Traditionally, Emacs uses a Mouse-1 click to set point and a Mouse-2
 click to follow a link, whereas most other applications use a Mouse-1
 click for both purposes, depending on whether you click outside or
-inside a link.  With release 21.4, the behaviour of a Mouse-1 click
-has been changed to match this context-sentitive dual behaviour.
+inside a link.  Now the behavior of a Mouse-1 click has been changed
+to match this context-sentitive dual behavior.
 
 Depending on the current mode, a Mouse-2 click in Emacs may do much
-more than just follow a link, so the new Mouse-1 behaviour is only
+more than just follow a link, so the new Mouse-1 behavior is only
 activated for modes which explicitly mark a clickable text as a "link"
-(see the new function `mouse-on-link-p' for details).  The lisp
+(see the new function `mouse-on-link-p' for details).  The Lisp
 packages that are included in release 21.4 have been adapted to do
 this, but external packages may not yet support this.  However, there
 is no risk in using such packages, as the worst thing that could
-happen is that you get the original Mouse-1 behaviour when you click
+happen is that you get the original Mouse-1 behavior when you click
 on a link, which typically means that you set point where you click.
 
 If you want to get the original Mouse-1 action also inside a link, you
@@ -130,7 +153,7 @@
 Dragging the Mouse-1 inside a link still performs the original
 drag-mouse-1 action, typically copy the text.
 
-You can customize the new Mouse-1 behaviour via the new user option
+You can customize the new Mouse-1 behavior via the new user option
 `mouse-1-click-follows-link'.
 
 +++
@@ -153,8 +176,8 @@
 
 +++
 ** When the undo information of the current command gets really large
-(beyond the value of `undo-outer-limit'), Emacs asks you whether to
-discard it or keep it.
+(beyond the value of `undo-outer-limit'), Emacs discards it and warns
+you about it.
 
 ** line-move-ignore-invisible now defaults to t.
 
@@ -191,6 +214,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
 
 +++
@@ -333,6 +359,10 @@
 
 *** Grep commands now have their own submenu and customization group.
 
++++
+*** `grep-find' is now also available under the name `find-grep' where
+people knowing `find-grep-dired' would probably expect it.
+
 *** The new variables `grep-window-height', `grep-auto-highlight', and
 `grep-scroll-output' can be used to override the corresponding
 compilation mode settings for grep commands.
@@ -392,20 +422,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
 
@@ -437,7 +477,7 @@
 cursor will be displayed in the fringe when positioned on that newline.
 
 The new user option 'overflow-newline-into-fringe' may be set to nil to
-revert to the old behaviour of continuing such lines.
+revert to the old behavior of continuing such lines.
 
 +++
 ** The buffer boundaries (i.e. first and last line in the buffer) may
@@ -622,11 +662,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.
 
@@ -662,7 +697,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.
@@ -671,6 +706,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
@@ -1500,7 +1539,7 @@
 
 ** Unexpected yanking of text due to accidental clicking on the mouse
 wheel button (typically mouse-2) during wheel scrolling is now avoided.
-This behaviour can be customized via the mouse-wheel-click-event and
+This behavior can be customized via the mouse-wheel-click-event and
 mouse-wheel-inhibit-click-time variables.
 
 +++
@@ -1830,7 +1869,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.
@@ -2093,6 +2132,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
@@ -2324,7 +2371,7 @@
 
 In addition, when ending or calling a macro with C-x e, the macro can
 be repeated immediately by typing just the `e'.  You can customize
-this behaviour via the variable kmacro-call-repeat-key and
+this behavior via the variable kmacro-call-repeat-key and
 kmacro-call-repeat-with-arg.
 
 Keyboard macros can now be debugged and edited interactively.
@@ -2426,8 +2473,33 @@
 ** `cfengine-mode' is a major mode for editing GNU Cfengine
 configuration files.
 
+* Incompatible Lisp Changes in Emacs 21.4
+
++++
+** `suppress-keymap' now works by remapping `self-insert-command' to
+the command `undefined'.  (In earlier Emacs versions, it used
+`substitute-key-definition' to rebind self inserting characters to
+`undefined'.)
+
++++
+** 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
 
+** An element of buffer-undo-list can now have the form (FUNNAME .
+ARGS), where FUNNAME is a symbol other than t or nil.  That stands for
+a high-level change that should be undone by evaluating (apply FUNNAME
+ARGS).
+
++++
+** The line-move, scroll-up, and scroll-down functions will now
+modify the window vscroll to scroll through display rows that are
+taller that the height of the window, for example in the presense of
+large images.  To disable this feature, Lisp code may bind the new
+variable `auto-window-vscroll' to nil.
+
 +++
 ** If a buffer sets buffer-save-without-query to non-nil,
 save-some-buffers will always save that buffer without asking
@@ -2460,9 +2532,9 @@
 
 +++
 ** New functions `make-progress-reporter', `progress-reporter-update',
-`progress-reporter-force-update' and `progress-reporter-done' provide
-a simple and efficient way for a command to present progress messages
-for the user.
+`progress-reporter-force-update', `progress-reporter-done', and
+`dotimes-with-progress-reporter' provide a simple and efficient way for
+a command to present progress messages for the user.
 
 ---
 ** To manipulate the File menu using easy-menu, you must specify the
@@ -2612,7 +2684,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
@@ -2626,10 +2698,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
@@ -2638,11 +2719,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.
 
@@ -3077,7 +3153,7 @@
 buffer is multibyte, the output of the process is at first converted
 to multibyte by `string-to-multibyte' then inserted in the buffer.
 Previously, it was converted to multibyte by `string-as-multibyte',
-which was not compatible with the behaviour of file reading.
+which was not compatible with the behavior of file reading.
 
 +++
 ** New function `string-to-multibyte' converts a unibyte string to a
@@ -3565,7 +3641,7 @@
 The `insert-for-yank' function looks for a yank-handler property on
 the first character on its string argument (typically the first
 element on the kill-ring).  If a yank-handler property is found,
-the normal behaviour of `insert-for-yank' is modified in various ways:
+the normal behavior of `insert-for-yank' is modified in various ways:
 
   When FUNCTION is present and non-nil, it is called instead of `insert'
 to insert the string.  FUNCTION takes one argument--the object to insert.
@@ -3653,7 +3729,7 @@
 
 On some systems, when emacs reads the output from a subprocess, the
 output data is read in very small blocks, potentially resulting in
-very poor performance.  This behaviour can be remedied to some extent
+very poor performance.  This behavior can be remedied to some extent
 by setting the new variable process-adaptive-read-buffering to a
 non-nil value (the default), as it will automatically delay reading
 from such processes, to allowing them to produce more output before
@@ -3850,11 +3926,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.
@@ -4172,7 +4243,7 @@
 If you want the old behavior, set selection-coding-system to
 compound-text, which may be significantly more efficient.  Using
 compound-text-with-extensions seems to be necessary only for decoding
-text from applications under XFree86 4.2, whose behaviour is actually
+text from applications under XFree86 4.2, whose behavior is actually
 contrary to the compound text specification.
 
 
--- a/etc/TODO	Thu Feb 03 22:58:27 2005 +0000
+++ b/etc/TODO	Thu Feb 03 23:28:36 2005 +0000
@@ -20,6 +20,13 @@
 ** Redefine define-generic-mode as a macro, so the compiler
   sees the definitions it generates.
 
+** Change the way define-minor-mode handles autoloading.
+  It should not generate :require.  Or :require in defcustom
+  should not be recorded in the user's custom-set-variables call.
+
+** The buttons at the top of a custom buffer should not omit
+  variables whose values are currently hidden.
+
 * Important features:
 
 ** Provide user-friendly ways to list all available font families,
@@ -71,6 +78,12 @@
 
 * Other features we would like:
 
+** A function to check for customizable options that have been
+  set but not saved, and ask the user whether to save them.
+  This could go in kill-emacs-query-functions, to remind people
+  to save their changes. If the user says yes, show them
+  in a Custom buffer using customize-customized.
+
 ** ange-ftp
 *** understand sftp
 *** Use MLS for ange-ftp-insert-directory if a list of files is specified.
@@ -321,6 +334,9 @@
   "japanese".  Currently, most Japanese users are using external
   packages (e.g. tamago, anthy) or an input method via XIM.
 
+** Provide the toolbar on ttys. This could map a bit like tmm-menubar
+   for the menubar and buttons could look a bit like those used by customize.
+
 * Internal changes
 
 ** Replace gmalloc.c with the modified Doug Lea code from the current
--- a/etc/TUTORIAL.nl	Thu Feb 03 22:58:27 2005 +0000
+++ b/etc/TUTORIAL.nl	Thu Feb 03 23:28:36 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/lib-src/ChangeLog	Thu Feb 03 22:58:27 2005 +0000
+++ b/lib-src/ChangeLog	Thu Feb 03 23:28:36 2005 +0000
@@ -1,3 +1,7 @@
+2005-01-29  Richard M. Stallman  <rms@gnu.org>
+
+	* movemail.c (popmail): Don't use Errmsg as format string.
+
 2004-12-26  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* make-docfile.c: Include stdlib.h even if WINDOWSNT is not
--- a/lib-src/movemail.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/lib-src/movemail.c	Thu Feb 03 23:28:36 2005 +0000
@@ -789,7 +789,7 @@
       mbx_delimit_begin (mbf);
       if (pop_retr (server, i, mbf) != OK)
 	{
-	  error (Errmsg, 0, 0);
+	  error ("%s", Errmsg, 0);
 	  close (mbfi);
 	  return EXIT_FAILURE;
 	}
--- a/lisp/ChangeLog	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/ChangeLog	Thu Feb 03 23:28:36 2005 +0000
@@ -1,3 +1,1100 @@
+2005-02-03  Richard M. Stallman  <rms@gnu.org>
+
+	* hi-lock.el (hi-lock-mode): Turning on Hi-Lock turns on Font-Lock.
+
+2005-02-03  Matt Hodges  <MPHodges@member.fsf.org>
+
+	* faces.el (list-faces-display): Add optional argument.
+
+2005-02-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* font-core.el (font-lock-default-function): Handle the rare case where
+	only font-lock-keywords is set.
+
+2005-02-02  Kenichi Handa  <handa@m17n.org>
+
+	* international/characters.el: Cancel previous change for
+	I-WITH-DOT-ABOVE and DOTLESS-i.
+
+	* international/latin-5.el: Cancel previous change.
+
+2005-02-02  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gud.el: Correction to syntax in gud-menu-map.
+
+2005-02-02  Kenichi Handa  <handa@m17n.org>
+
+	* international/latin-5.el (tbl): Setup cases of I-WITH-DOT-ABOVE,
+	DOTLESS-i.
+
+	* international/characters.el: Setup cases of GREEK-FINAL-SIGMA,
+	Y-WITH-DIAERESIS, I-WITH-DOT-ABOVE, DOTLESS-i.
+
+	* case-table.el (get-upcase-table): New function.
+	(copy-case-table): Copy upcaes table too if non-nil.
+	(set-case-syntax-delims): Maintain upcase table too.
+	(set-case-syntax-pair): Likewise.
+	(set-upcase-syntax, set-downcase-syntax): New functions.
+	(set-case-syntax): Maintain upcase table too.
+
+2005-02-02  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el: (gdb-goto-info): Delete.
+
+	* progmodes/gud.el (gud-goto-info): New function.
+	(gud-tool-bar-map): Use correct icon.
+
+2005-02-01  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* emacs-lisp/lisp-mode.el (lisp-indent-function): Fix bug:
+	When delegating, order args in the funcall correctly.
+
+2005-02-01  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* emacs-lisp/lisp-mode.el (lisp-indent-function): Doc fix.
+
+2005-02-01  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/reftex.el (reftex-access-scan-info): Error out in a
+	buffer not visiting a file.
+
+2005-01-31  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-embed.el (calc-embedded-find-bounds): Set the formula
+	bound on the line with the formula.
+
+2005-01-31  Kim F. Storm  <storm@cua.dk>
+
+	* ses.el (ses-create-cell-variable-range)
+	(ses-destroy-cell-variable-range, ses-reset-header-string)
+	(ses-set-with-undo, ses-unset-with-undo, ses-aset-with-undo)
+	(ses-insert-row): Fix format of apply undo entries.
+
+2005-01-31  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-aent.el (math-read-token): Separate the TeX and LaTeX
+	parts.
+
+	* calc/calc-embed.el (calc-embedded-open-formula)
+	(calc-embedded-close-formula): Ignore matrix environments.
+
+	* calc/calc-ext.el (math-read-big-expr): Make LaTeX the default
+	TeX mode.
+
+	* calc/calc-lang.el (math-function-table, math-oper-table)
+	(math-variable-table): Adjust the LaTeX portions.
+
+	* calc/calc.el (math-tex-ignore-words): Remove LaTeX portion.
+	(math-latex-ignore-words): New constant.
+
+2005-01-31  Richard M. Stallman  <rms@gnu.org>
+
+	* textmodes/ispell.el (ispell-local-dictionary-overridden): New var.
+	(ispell-local-dictionary): Doc fix.
+	(ispell-dictionary-alist): Don't include ispell-local-dictionary-alist.
+	Don't reinitialize at run time.  Don't defcustom.
+	All uses changed to append ispell-local-dictionary-alist,
+	or check it first.
+	(ispell-current-dictionary): New variable for dictionary in use.
+	(ispell-dictionary): Now used only for global default.
+	(ispell-start-process): Set ispell-current-dictionary,
+	not ispell-dictionary.
+	(ispell-change-dictionary): Use this only for setting
+	user preferences.
+	(ispell-internal-change-dictionary): New function
+	to change the current dictionary in use.
+	(ispell-region, ispell-process-line, ispell-buffer-local-dict):
+	Use ispell-current-dictionary.
+	Handle ispell-local-dictionary-overridden.
+	(ispell-buffer-local-dict): Call ispell-internal-change-dictionary.
+
+2005-01-31  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-aent.el (math-read-token): Add support for LaTeX.
+
+	* calc/calc-ext.el: Add calc-latex-language to autoloads.
+	(calc-mode-map): Add calc-latex-language.
+
+	* calc/calc-lang.el (calc-latex-language, math-latex-parse-frac)
+	(math-latex-print-frac): New functions.
+	(math-oper-table, math-function-table, math-variable-table)
+	(math-complex-format, math-input-filter): Add latex properties.
+	(calc-set-language): Set math-expr-special-function-mapping.
+
+	* calc/calc-prog.el (calc-edit-user-syntax, calc-fix-token-name)
+	(calc-write-parse-table-part):  Add LaTeX support.
+
+	* calc/calc.el (calc-language): Adjust docstring.
+	(calc-set-mode-line): Add LaTeX support.
+	(math-expr-special-function-mapping): New variable.
+	(math-tex-ignore-words): Add to list.
+
+	* calc/calccomp.el (math-compose-expr, math-compose-rows):
+	Add LaTeX support.
+	(math-compose-expr): Add support for special functions.
+
+	* calc/calc-help.el (calc-d-prefix-help): Add LaTeX.
+
+2005-01-31  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-memory-address)
+	(gdb-memory-repeat-count, gdb-memory-format, gdb-memory-unit)
+	(gdb-memory-mode-map, gdb-memory-format-keymap)
+	(gdb-memory-format-menu, gdb-memory-unit-keymap)
+	(gdb-memory-unit-menu): New variables for a buffer
+	that lets the user examine program memory.
+	(gdb-memory-set-address, gdb-memory-set-repeat-count)
+	(gdb-memory-format-binary, gdb-memory-format-octal)
+	(gdb-memory-format-unsigned, gdb-memory-format-signed)
+	(gdb-memory-format-hexadecimal, gdb-memory-format-menu)
+	(gdb-memory-format-menu-1, gdb-memory-unit-giant)
+	(gdb-memory-unit-word, gdb-memory-unit-halfword)
+	(gdb-memory-unit-byte, gdb-memory-unit-menu)
+	(gdb-memory-unit-menu-1, gdb-make-header-line-mouse-map)
+	(gdb-memory-mode, gdb-memory-buffer-name)
+	(gdb-display-memory-buffer, gdb-frame-memory-buffer):
+	New functions for above buffer.
+
+2005-01-30  Richard M. Stallman  <rms@gnu.org>
+
+	* cus-edit.el (custom-bury-buffer): Function deleted.
+	(custom-buffer-done-function): Option deleted.
+	(custom-buffer-done-kill): New (replacement option.
+	(Custom-buffer-done): Call quit-window.
+	(custom-buffer-create-internal): Update for above changes.
+
+2005-01-29  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* simple.el (undo-ask-before-discard): New var.
+	(undo-outer-limit-truncate): Implement it.
+	(undo-extra-outer-limit): Doc update.
+
+2005-01-29  Richard M. Stallman  <rms@gnu.org>
+
+	* ses.el (undo-more): Delete defadvice.
+	(ses-begin-change): Doc fix.
+
+	* dired.el (dired-mode-map): Remap `undo' and `advertised-undo'
+	instead of rebinding C-x u and C-_.
+
+	* files.el (normal-backup-enable-predicate): Return nil for files
+	in /tmp, regardless of temporary-file-directory.
+
+	* man.el (Man-getpage-in-background): Disable undo in Man buffer.
+
+	* rect.el (delete-rectangle-line, delete-extract-rectangle-line)
+	(open-rectangle, delete-whitespace-rectangle-line)
+	(clear-rectangle-line): If FILL, pass t instead of FILL
+	for move-to-column's 2nd arg.
+
+	* simple.el (undo): Fix the test for continuing a series of undos.
+	(undo-more): Set pending-undo-list to t when we reach end.
+	(pending-undo-list): Move up defvar.
+
+	* wid-edit.el (widget-button-click):
+	Shorten the range of the track-mouse binding.
+
+	* comint.el (comint-insert-input): Undo previous changes;
+	use last-input-event in interactive spec.
+
+2005-01-29  Eli Zaretskii  <eliz@gnu.org>
+
+	* progmodes/compile.el (compilation-start): Bind buffer-read-only
+	to nil before invoking call-process.  Reset buffer's modified flag
+	after fontifying it in the no-async branch.
+
+	* wid-edit.el (widget-specify-button): If mouse pointer shape
+	cannot be changed, use mouse face instead.
+
+2005-01-29  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-info-breakpoints-custom)
+	(gdb-goto-breakpoint): Make breakpoint handling work on template
+	functions in C++.  Reported by Martin Reed <mjreed@essex.ac.uk>
+	(gdb-assembler-custom): Update to recognise breakpoint information
+	added on 2005-01-19.
+
+2005-01-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/scheme.el (scheme-mode-variables): Set comment-add.
+	(dsssl-mode): Use define-derived-mode.
+	(scheme-mode-initialize): Remove.
+	(scheme-mode): Use run-mode-hooks.
+
+	* cus-edit.el (customize-group-other-window)
+	(custom-buffer-create-other-window): Don't override special-display-*.
+	(custom-mode-map): Make it dense.
+
+	* emacs-lisp/lisp-mode.el (eval-defun-1): Make sure `defvar' always
+	sets the default value.
+
+2005-01-28  Eli Zaretskii  <eliz@gnu.org>
+
+	* descr-text.el: Add more keywords.
+
+2005-01-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* speedbar.el: Avoid unnecessary use of locate-library.
+
+	* international/mule-cmds.el (standard-display-european-internal):
+	Don't fiddle with latin-1 non-break space any more since it's now
+	special cased in the C code.
+	Don't "do&undo" setting for 160 (especially, don't undo incorrectly).
+
+2005-01-26  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* cus-start.el (all): Add `undo-outer-limit'.
+
+2005-01-25  Roland Winkler  <Roland.Winkler@physik.uni-erlangen.de>
+
+	* textmodes/bibtex.el (bibtex-format-entry):
+	Use `bibtex-empty-field-re' only on the text of fields, not on entire
+	field lines.
+	(bibtex-autofill-entry): Use `bibtex-empty-field-re' on a string,
+	not on part of a buffer.
+
+2005-01-25  Lute Kamstra  <lute@gnu.org>
+
+	* textmodes/bibtex.el (bibtex-empty-field-re): Don't match
+	nonempty field text strings like "{letters\\macro{}more letters}".
+	Clarify docstring.
+	(bibtex-sort-entry-class, bibtex-autokey-titleword-ignore)
+	(bibtex-entry-offset, bibtex-parse-association)
+	(bibtex-parse-field-name): Fix typos in docstrings.
+	(bibtex-field-list, bibtex-find-crossref): Fix typos in error messages.
+
+2005-01-24  Carsten Dominik <dominik@science.uva.nl>
+
+	* textmodes/reftex-global.el (reftex-isearch-push-state-function)
+	(reftex-isearch-pop-state-function, reftex-isearch-isearch-search)
+	(reftex-isearch-switch-to-next-file, reftex-isearch-turn-off)
+	(reftex-isearch-turn-on, reftex-isearch-minor-mode): New functions.
+
+	* textmodes/reftex.el (reftex-mode-menu): Add entry for reftex
+	isearch minor mode.
+
+2005-01-24  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* help-at-pt.el (help-at-pt-display-when-idle): Add autoload cookie.
+
+2005-01-24  Lute Kamstra  <lute@gnu.org>
+
+	* textmodes/ispell.el (ispell-dictionary-alist-4): Rewrite the
+	CASECHARS and NOT-CASECHARS regular expressions of the
+	"nederlands" and "nederlands8" dictionaries to prevent a "Range
+	striding over charsets" error.
+
+2005-01-24  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-store.el (calc-declare-variable): Use calc-var-name to
+	display variable name.
+
+2005-01-24  Kenichi Handa  <handa@m17n.org>
+
+	* international/encoded-kb.el (encoded-kbd-iso2022-single-shift):
+	Fix setting of the element of encoded-kbd-iso2022-invocations.
+
+2005-01-24  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-goto-breakpoint, gdb-frames-select)
+	(gdb-threads-select): Change to also accept mouse events.
+	(gdb-mouse-goto-breakpoint, gdb-frames-mouse-select)
+	(gdb-threads-mouse-select): Delete.
+
+2005-01-23  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* files.el (insert-directory): Take care of empty directory,
+	listed without -a switch.
+
+2005-01-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* textmodes/refill.el (refill-post-command-function):
+	Add `indent-new-comment-line' and `reindent-then-newline-and-indent'
+	to the list of functions that we should be careful not to undo.
+	(refill-late-fill-paragraph-function): Remove.
+	(refill-saved-state): New var.
+	(refill-mode): Use it to save fill-paragraph-function.
+	Save also the value of auto-fill-function.
+
+	* term/w32-win.el: Simplify code.
+
+2005-01-23  Kim F. Storm  <storm@cua.dk>
+
+	* simple.el (line-move): Adapt to new return value from
+	pos-visible-in-window-p.
+
+	* simple.el (line-move): Fix last change.  Check partial
+	visibility at point rather than at window-start.
+
+2005-01-22  Jason Rumney  <jasonr@gnu.org>
+
+	* term/w32-win.el (xw-defined-colors): Remove debug-message.
+
+2005-01-22  David Kastrup  <dak@gnu.org>
+
+	* progmodes/grep.el: Add alias `find-grep' for `grep-find'.
+
+2005-01-22  Eli Zaretskii  <eliz@gnu.org>
+
+	* type-break.el (type-break-mode): Add a test for
+	type-break-file-name being non-nil.
+
+2005-01-22  Toby Allsopp  <Toby.Allsopp@navman.com>  (tiny change)
+
+	* net/eudc.el (top level): Call (message "") via progn, so that
+	eudc-options-file is loaded.
+
+2005-01-22  Kim F. Storm  <storm@cua.dk>
+
+	* simple.el (line-move-1): Rename from line-move.
+	(line-move): New function that adjusts vscroll for partially
+	visible rows, and calls line-move-1 otherwise.
+
+2005-01-21  Ren,Ai(B Kyllingstad  <listmailxemacs@kyllingstad.com>
+
+	* pcomplete.el: define pcomplete-read-event instead of read-event,
+	since it's not a complete read-event implementation
+
+2005-01-20  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-ext.el (calc-fancy-prefix-other-key): Set prefix arg
+	for called function.
+
+2005-01-20  Steven Tamm  <steventamm@mac.com>
+
+	* term/mac-win.el (process-connection-type): Remove.
+	Controlled now by s/darwin.h:PTY_ITERATION.
+
+2005-01-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* window.el (handle-select-window): Don't switch window when we're
+	in the minibuffer.
+
+2005-01-10  Paul Pogonyshev  <pogonyshev@gmx.net>
+
+	* subr.el (dotimes-with-progress-reporter): New macro.
+
+	* ses.el (ses-dotimes-msg): Remove macro.
+	Use `dotimes-with-progress-reporter' instead.
+
+2005-01-19  Steven Tamm  <steventamm@mac.com>
+
+	* term/mac-win.el (process-connection-type): Use new
+	operating-system-release variable to use ptys on Darwin 7 (OSX
+	10.3) when using carbon build.
+
+2005-01-19  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-ext.el (calc-fancy-prefix-other-key): Don't clear
+	flags if the last command was a tab or M-tab.
+
+	* calc/calc-prog.el (calc-user-define-edit): Put original formula
+	in formula editing buffer.
+
+2005-01-19  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-put-breakpoint-icon): Add help-echo for
+	breakpoint image symbol in margin.
+
+2005-01-19  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-prog.el (calc-execute-kbd-macro):
+	Ignore calc-keep-arg-flag.
+
+2005-01-19  Kenichi Handa  <handa@m17n.org>
+
+	* textmodes/ispell.el (ispell-looking-at): New function.
+	(ispell-process-line): Use ispell-looking-at to compare the ispell
+	output and the buffer contents.
+
+2005-01-18  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc.el (calc-display-raw): Fix docstring.
+
+2005-01-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* simple.el (blink-matching-open): Strip extra info from syntax.
+
+	* progmodes/sh-script.el (sh-here-doc-open-re): Don't allow | or other
+	funny chars in the end-of-here-doc marker.
+
+2005-01-19  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-put-string): Copy/create strings so
+	that enable/disabled state of breakpoints is shown correctly in
+	fringe and on ttys.
+	(gdb-put-breakpoint-icon, gdb-info-breakpoints-custom):
+	Add breakpoint information as text properties.
+	(gdb-mouse-toggle-breakpoint):
+	Rename to gdb-mouse-set-clear-breakpoint.
+	(gdb-mouse-toggle-breakpoint): New function.  Enable/disable
+	breakpoints in the margin.
+	(gdb-remove-strings): Simplify.
+
+2005-01-17  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-yank.el (calc-edit-mode): Inhibit read-only when
+	erasing buffer.
+
+2005-01-17  Richard M. Stallman  <rms@gnu.org>
+
+	* progmodes/grep.el (grep-find): Copy from `grep' the condition
+	for calling grep-compute-defaults.
+
+	* play/decipher.el (decipher-mode): Don't call decipher-read-alphabet
+	if buffer is empty.
+
+	* emacs-lisp/lisp.el (backward-kill-sexp, kill-sexp): Doc fixes.
+
+2005-01-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* hilit-chg.el (highlight-changes-mode): Don't autoload.
+
+	* bindings.el (mode-line-mode-menu): Use bound-and-true-p for all the
+	non-preloaded variables.
+
+2005-01-17  Steven Tamm  <steventamm@mac.com>
+
+	* textmodes/tex-mode.el (tex-start-shell): Adding -i to the
+	tex-shell cause to force interactivity when using pipes.
+
+2005-01-17  Kim F. Storm  <storm@cua.dk>
+
+	* simple.el (just-one-space): Make arg optional.
+
+2005-01-17  Nick Roberts  <nickrob@snap.net.nz>
+
+	* xt-mouse.el (xterm-mouse-event): Set new optional fourth arg in
+	posn-at-x-y to t to access left-margin.
+
+2005-01-16  Michael Albinus  <michael.albinus@gmx.de>
+
+	Sync with Tramp 2.0.47.
+
+	* tramp.el (tramp-operation-not-permitted-regexp) New defcustom,
+	catching keep-date problems in cp/scp operations.
+	(tramp-handle-copy-file): Don't call `set-file-modes'
+	unconditionally.  Specialized functions should know better what is
+	necessary.  This improves performance a little bit, and the
+	functions could catch errors with `cp -p' and `scp -p'.
+	(tramp-do-copy-or-rename-file-via-buffer)
+	(tramp-do-copy-or-rename-file-out-of-band): Call `set-file-modes'
+	when appropriate.
+	(tramp-do-copy-or-rename-file-directly): Mask `cp -p' error.
+	Call `set-file-modes' when appropriate.
+	(tramp-action-out-of-band): Mask `scp -p' error.  Reported by Isak
+	Johnsson <isak@hypergene.com>
+	(tramp-get-buffer, tramp-get-debug-buffer): Discard the undo list
+	of both Tramp buffer and debug buffer.  Reported by Joakim Verona
+	<joakim@verona.se>
+	(tramp-file-name-for-operation): Mark `shell-command' as magic for
+	Emacs only.
+
+	* tramp-util.el (tramp-minor-mode): New minor mode.  Add it to
+	`find-file-hooks' and `dired-mode-hook'.
+	(tramp-minor-mode-map): Respective map.  Add remapping for
+	`compile' and `recompile'.
+	(tramp-remap-command, tramp-recompile): New defuns.
+	(tramp-compile): Enable `tramp-minor-mode' and `compilation-mode'
+	in buffer "*Compilation*".  Call the commands asynchronously.
+
+	* tramp-vc.el (tramp-vc-do-command, tramp-vc-do-command-new)
+	(tramp-vc-simple-command): Call `tramp-handle-shell-command' but
+	`shell-command', because it isn't magic in XEmacs.  Reported by
+	Adrian Aichner <adrian@xemacs.org>.
+
+	* tramp-smb.el (tramp-smb-file-name-handler-alist): Add entry for
+	`substitute-in-file-name.
+	(tramp-smb-handle-substitute-in-file-name): New defun.
+	(tramp-smb-advice-PC-do-completion): Delete advice.
+
+2005-01-16  Kai Grossjohann  <kgrossjo@eu.uu.net>
+
+	* tramp.el (tramp-wait-for-output): Fix typo in echo processing.
+	Fix error in deleting region.
+
+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): Move to
+	rmail-obsolete group.
+	(rmail-set-pop-password): Rename to rmail-set-remote-password.
+	All callers updated.
+	(rmail-get-pop-password): Rename 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): Rename 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 funs.
+	(rmail-parse-url): New function.
+	(rmail-get-new-mail, rmail-insert-inbox-text): Update 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): Rename from
+	`org-set-regexps'.  Added checking for STARTUP keyword.
+	(org-get-current-options): Add 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):
+	Add new escapes %m and %M, fixed bug with %F by adding
+	save-match-data.
+	(reftex-reference): Remove ?. from list of spaces.
+	(reftex-label-info): Add automatic label prefix recognition.
+
+	* textmodes/reftex-index.el (reftex-index-next-phrase):
+	Add slave parameter to call of `reftex-index-this-phrase'.
+	(reftex-index-this-phrase): New optional argument.
+	(reftex-index-region-phrases): Add slave parameter to call of
+	`reftex-index-this-phrase'.
+	(reftex-display-index): New argument redo.
+	(reftex-index-rescan): Add 'redo to arguments of
+	`reftex-display-index'.
+	(reftex-index-Rescan, reftex-index-revert)
+	(reftex-index-switch-index-tag): Add 'redo to arguments of
+	`reftex-display-index'.
+	(reftex-index-make-phrase-regexp): Fix bug with case-sensitive
+	indexing.  Fix 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):
+	Add 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):
+	Add 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/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 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)
+	(calc-edit-macro-combine-alg-ent, calc-edit-macro-combine-ext-command)
+	(calc-edit-macro-combine-var-name, calc-edit-macro-combine-digits)
+	(calc-edit-format-macro-buffer, calc-edit-macro-pre-finish-edit)
+	(calc-edit-macro-finish-edit): New functions.
+	(calc-user-define-edit): Use new functions to edit named calc macros.
+
+2005-01-01  Stefan  <monnier@iro.umontreal.ca>
+
+	* files.el (hack-local-variables): Cleanup prefix/suffix matching.
+
+	* ses.el (copy-region-as-kill): Deactivate mark.
+
+2005-01-01  Richard M. Stallman  <rms@gnu.org>
+
+	* replace.el (occur-1): If the output buffer is also an input,
+	don't kill it, rename it.
+
+	* faces.el (set-face-background, set-face-foreground): Doc fix.
+
+	* cus-face.el (custom-face-attributes): Fix :help-echo strings
+	for :foreground and :background.
+
+	* dired.el (dired-view-command-alist): Variable deleted.
+	(dired-view-file, dired-mouse-find-file-other-window):
+	Delete the code to use it.
+
+2005-01-01  Kim F. Storm  <storm@cua.dk>
+
+	* image.el (insert-sliced-image): Use t for line-height property.
+
 2004-12-31  Jay Belanger  <belanger@truman.edu>
 
 	* calc/calc-store.el (calcVar-digit, calcVar-oper):  Remove the need
@@ -27,7 +1124,7 @@
 	* progmodes/antlr-mode.el (antlr-mode): Use mode-require-final-newline.
 	Delete old-Emacs compatibility code.
 	(antlr-c-common-init): Function deleted.
-	
+
 	* net/snmp-mode.el (snmp-common-mode): Use mode-require-final-newline.
 	* progmodes/vhdl-mode.el (vhdl-mode): Use mode-require-final-newline.
 	* progmodes/simula.el (simula-mode): Use mode-require-final-newline.
@@ -64,12 +1161,11 @@
 2004-12-31  Kenichi Handa  <handa@m17n.org>
 
 	* international/mule.el	(buffer-file-coding-system-explicit):
-	Renamed for explicit-buffer-file-coding-system.
-	(after-insert-file-set-coding): Adjusted for the above change.
-
-	* files.el (revert-buffer): Change
-	explicit-buffer-file-coding-system to
-	buffer-file-coding-system-explicit.
+	Rename for explicit-buffer-file-coding-system.
+	(after-insert-file-set-coding): Adjust for the above change.
+
+	* files.el (revert-buffer): Change explicit-buffer-file-coding-system
+	to buffer-file-coding-system-explicit.
 	(basic-save-buffer-1): Likewise.
 
 2004-12-30  Richard M. Stallman  <rms@gnu.org>
@@ -93,9 +1189,9 @@
 	(artist-get-first-non-nil-op): New function.
 	(artist-get-last-non-nil-op): New function.
 	(artist-mode-init): Call artist-get-last-non-nil-op to initialize
- 	artist-prev-next-op-alist.
+	artist-prev-next-op-alist.
 	(artist-mode-map): Add binding for C-mouse-4 and C-mouse-5 to
- 	change drawing operation.
+	change drawing operation.
 
 2004-12-30  Luc Teirlinck  <teirllm@auburn.edu>
 
@@ -107,8 +1203,8 @@
 
 2004-12-30  Jay Belanger  <belanger@truman.edu>
 
-	* calc/calc-store.el (calc-copy-variable):  Fix mistyped variable
-	name.  Change the way a variable is displayed in a message.
+	* calc/calc-store.el (calc-copy-variable): Fix mistyped variable name.
+	Change the way a variable is displayed in a message.
 
 	* calc/calc-prog.el (calc-user-define-edit, calc-finish-macro-edit)
 	(calc-user-define-permanent, calc-execute-kbd-macro):
@@ -116,14 +1212,14 @@
 
 2004-12-30  Kenichi Handa  <handa@m17n.org>
 
-	* files.el (basic-save-buffer-1): Set
-	explicit-buffer-file-coding-system to last-coding-system-used.
+	* files.el (basic-save-buffer-1):
+	Set explicit-buffer-file-coding-system to last-coding-system-used.
 	(revert-buffer): Pay attention to
 	explicit-buffer-file-coding-system (not buffer-file-coding-system)
 	on bind coding-system-for-read.
 
-	* international/mule.el (explicit-buffer-file-coding-system): New
-	buffer local variable.
+	* international/mule.el (explicit-buffer-file-coding-system):
+	New buffer local variable.
 	(after-insert-file-set-coding): Set it to coding-system-for-read.
 
 2004-12-29  Luc Teirlinck  <teirllm@auburn.edu>
@@ -148,13 +1244,12 @@
 2004-12-29  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* term/mac-win.el: Require x-dnd.
-	(mac-drag-n-drop): Sync with W32 version.  Use x-dnd.el
-	functions.
+	(mac-drag-n-drop): Sync with W32 version.  Use x-dnd.el functions.
 
 2004-12-29  David Kastrup  <dak@gnu.org>
 
-	* international/mule.el (decode-coding-inserted-region): Don't
-	barf if `buffer-undo-list' is already set to `t'.
+	* international/mule.el (decode-coding-inserted-region):
+	Don't barf if `buffer-undo-list' is already set to `t'.
 
 2004-12-29  Jay Belanger  <belanger@truman.edu>
 
@@ -207,8 +1302,8 @@
 2004-12-27  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* term/mac-win.el: Sync with x-win.el.  Rearrange the contents.
-	Call mac-clear-font-name-table if invoked on Mac OS 8/9.  Call
-	x-open-connection on Mac OS X.
+	Call mac-clear-font-name-table if invoked on Mac OS 8/9.
+	Call x-open-connection on Mac OS X.
 
 2004-12-27  Richard M. Stallman  <rms@gnu.org>
 
@@ -275,7 +1370,7 @@
 
 	* simple.el (undo-list-saved): New variable (buffer-local).
 	(undo): Set and test it.
-	(buffer-disable-undo): Moved here from buffer.c.
+	(buffer-disable-undo): Move here from buffer.c.
 	Clear out undo-list-saved.
 
 	* international/mule.el (decode-coding-inserted-region):
@@ -298,7 +1393,7 @@
 	`interactive' form as previous-matching-history-element.
 
 	* ffap.el (ffap-string-at-point-mode-alist): Add "*" to url chars,
-        it can appear unencoded and has been seen from yahoo.
+	it can appear unencoded and has been seen from yahoo.
 
 2004-12-27  Sergey Poznyakoff <gray@Mirddin.farlep.net>  (tiny change)
 
@@ -307,8 +1402,8 @@
 
 2004-12-27  Kenichi Handa  <handa@m17n.org>
 
-	* international/utf-8.el (utf-translate-cjk-load-tables): Bind
-	coding-system-for-read to nil while loading subst-*.
+	* international/utf-8.el (utf-translate-cjk-load-tables):
+	Bind coding-system-for-read to nil while loading subst-*.
 
 2004-12-26  Jay Belanger  <belanger@truman.edu>
 
@@ -365,8 +1460,8 @@
 
 2004-12-21  Markus Rost  <rost@ias.edu>
 
-	* calendar/diary-lib.el (mark-diary-entries): Set
-	mark-diary-entries-in-calendar only after checking for diary-file.
+	* calendar/diary-lib.el (mark-diary-entries):
+	Set mark-diary-entries-in-calendar only after checking for diary-file.
 
 2004-12-21  Richard M. Stallman  <rms@gnu.org>
 
@@ -389,32 +1484,29 @@
 	(calculator-string-to-number): New function, mostly moved and
 	updated code from calculator-curnum-value.
 	(calculator-curnum-value): Use it.
-	(calculator-paste): Use it, and update grabbing the
-	current-kill.
+	(calculator-paste): Use it, and update grabbing the current-kill.
 	(calculator-rotate-displayer)
 	(calculator-rotate-displayer-back): Toggle digit grouping when
 	in radix mode, use calculator-message.
-	(calculator-displayer-prev, calculator-displayer-next): Change
-	digit group size when in radix mode.
-	(calculator-number-to-string): Renamed from
+	(calculator-displayer-prev, calculator-displayer-next):
+	Change digit group size when in radix mode.
+	(calculator-number-to-string): Rename from
 	calculator-num-to-string.  Now deals with digit grouping in
 	radix mode.
-	(calculator-update-display, calculator-put-value): Use the new
-	name.
+	(calculator-update-display, calculator-put-value): Use the new name.
 	(calculator-fact): Return a floating point number.
 	(calculator-mode): Doc fix.
 
 2004-12-20  Glenn Morris  <gmorris@ast.cam.ac.uk>
 
 	* calendar/calendar.el (view-other-diary-entries): Add autoload.
-	* calendar/diary-lib.el (view-other-diary-entries): Use
-	current-prefix-arg in interactive spec.
+	* calendar/diary-lib.el (view-other-diary-entries):
+	Use current-prefix-arg in interactive spec.
 
 2004-12-19  Jay Belanger  <belanger@truman.edu>
 
 	* calc/calc-aent.el (calcAlg-blank-matching-open):
-	Temporarily adjust the syntax of both delimiters of half-open
-	intervals.
+	Temporarily adjust the syntax of both delimiters of half-open intervals.
 
 2004-12-19  Kim F. Storm  <storm@cua.dk>
 
@@ -524,7 +1616,7 @@
 2004-12-16  Juri Linkov  <juri@jurta.org>
 
 	* help.el (function-called-at-point):
-	* help-fns.el (variable-at-point): As a last resort try striping
+	* help-fns.el (variable-at-point): As a last resort try stripping
 	non-word prefixes and suffixes.
 
 	* descr-text.el (describe-property-list): Don't treat syntax-table
@@ -615,13 +1707,13 @@
 	* simple.el (inhibit-mark-movement): Remove defvar.
 	(beginning-of-buffer, end-of-buffer): Don't use it.
 
-	* emacs-lisp/lisp.el (beginning-of-defun, end-of-defun): Don't
-	use inhibit-mark-movement.
+	* emacs-lisp/lisp.el (beginning-of-defun, end-of-defun):
+	Don't use inhibit-mark-movement.
 
 	* emulation/cua-base.el (cua--preserve-mark-commands): Remove.
 	(cua--undo-push-mark): Remove.
-	(cua--pre-command-handler, cua--post-command-handler): Don't
-	fiddle with inhibit-mark-movement.
+	(cua--pre-command-handler, cua--post-command-handler):
+	Don't fiddle with inhibit-mark-movement.
 
 2004-12-14  Juri Linkov  <juri@jurta.org>
 
@@ -633,8 +1725,7 @@
 
 2004-12-13  Juri Linkov  <juri@jurta.org>
 
-	* simple.el (next-error-buffer-p, next-error-find-buffer):
-	Doc fix.
+	* simple.el (next-error-buffer-p, next-error-find-buffer): Doc fix.
 
 	* mail/supercite.el (sc-cite-frame-alist): Doc fix.
 	(sc-cite-region, sc-uncite-region, sc-recite-region):
@@ -2907,7 +3998,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.
@@ -4012,7 +5103,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
@@ -5652,8 +6743,7 @@
 	* progmodes/cperl-mode.el (cperl-mode): Adapt defun-prompt-regexp
 	so that it is more understanding of whitespace.
 
-	* xml.el (xml-maybe-do-ns, xml-parse-tag): Produce elements in the
-	form
+	* xml.el (xml-maybe-do-ns, xml-parse-tag): Produce elements in the form
 	(("ns" . "element") (attr-list) children) instead of
 	((:ns . "element") (attr-list) children) in order to reduce the
 	number of symbols used.
--- a/lisp/add-log.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/add-log.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/battery.el	Thu Feb 03 23:28:36 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/bindings.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/bindings.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,7 +1,7 @@
 ;;; bindings.el --- define standard key bindings and some variables
 
-;; Copyright (C) 1985,86,87,92,93,94,95,96,99,2000, 2001
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996, 1999, 2000,
+;;   2001, 2005  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: internal
@@ -403,7 +403,7 @@
 	      :button (:toggle . line-number-mode)))
 (define-key mode-line-mode-menu [highlight-changes-mode]
   `(menu-item ,(purecopy "Highlight changes (Chg)") highlight-changes-mode
-	      :button (:toggle . highlight-changes-mode)))
+	      :button (:toggle . (bound-and-true-p highlight-changes-mode))))
 (define-key mode-line-mode-menu [hide-ifdef-mode]
   `(menu-item ,(purecopy "Hide ifdef (Ifdef)") hide-ifdef-mode
 	      :button (:toggle . (bound-and-true-p hide-ifdef-mode))))
@@ -421,10 +421,10 @@
 	      :button (:toggle . column-number-mode)))
 (define-key mode-line-mode-menu [auto-revert-tail-mode]
   `(menu-item ,(purecopy "Auto revert tail (Tail)") auto-revert-tail-mode
-	      :button (:toggle . auto-revert-tail-mode)))
+	      :button (:toggle . (bound-and-true-p auto-revert-tail-mode))))
 (define-key mode-line-mode-menu [auto-revert-mode]
   `(menu-item ,(purecopy "Auto revert (ARev)") auto-revert-mode
-	      :button (:toggle . auto-revert-mode)))
+	      :button (:toggle . (bound-and-true-p auto-revert-mode))))
 (define-key mode-line-mode-menu [auto-fill-mode]
   `(menu-item ,(purecopy "Auto fill (Fill)") auto-fill-mode
 	      :button (:toggle . auto-fill-function)))
@@ -1018,5 +1018,5 @@
 ;; no-update-autoloads: t
 ;; End:
 
-;;; arch-tag: 23b5c7e6-e47b-49ed-8c6c-ed213c5fffe0
+;; arch-tag: 23b5c7e6-e47b-49ed-8c6c-ed213c5fffe0
 ;;; bindings.el ends here
--- a/lisp/calc/calc-aent.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calc-aent.el	Thu Feb 03 23:28:36 2005 +0000
@@ -690,7 +690,7 @@
                           math-exp-pos)
 		      (or (eq math-exp-pos 0)
 			  (and (memq calc-language '(nil flat big unform
-							 tex eqn))
+							 tex latex eqn))
 			       (eq (string-match "[^])}\"a-zA-Z0-9'$]_"
 						 math-exp-str (1- math-exp-pos))
 				   (1- math-exp-pos))))))
@@ -756,6 +756,34 @@
 		   math-exp-pos (match-end 0)
 		   math-expr-data (math-restore-dashes
 			     (math-match-substring math-exp-str 1)))
+	     (let ((code (assoc math-expr-data math-latex-ignore-words)))
+	       (cond ((null code))
+		     ((null (cdr code))
+		      (math-read-token))
+		     ((eq (nth 1 code) 'punc)
+		      (setq math-exp-token 'punc
+			    math-expr-data (nth 2 code)))
+                      ((and (eq (nth 1 code) 'mat)
+                            (string-match " *{" math-exp-str math-exp-pos))
+		      (setq math-exp-pos (match-end 0)
+			    math-exp-token 'punc
+			    math-expr-data "[")
+		      (let ((right (string-match "}" math-exp-str math-exp-pos)))
+			(and right
+			     (setq math-exp-str (copy-sequence math-exp-str))
+			     (aset math-exp-str right ?\])))))))
+	    ((and (= ch ?\\) (eq calc-language 'latex)
+		  (< math-exp-pos (1- (length math-exp-str))))
+	     (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}" 
+                               math-exp-str math-exp-pos)
+                 (string-match "\\\\text *{\\([a-zA-Z0-9]+\\)}" 
+                               math-exp-str math-exp-pos)
+		 (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)" 
+                               math-exp-str math-exp-pos))
+	     (setq math-exp-token 'symbol
+		   math-exp-pos (match-end 0)
+		   math-expr-data (math-restore-dashes
+			     (math-match-substring math-exp-str 1)))
 	     (let ((code (assoc math-expr-data math-tex-ignore-words)))
 	       (cond ((null code))
 		     ((null (cdr code))
@@ -763,8 +791,23 @@
 		     ((eq (nth 1 code) 'punc)
 		      (setq math-exp-token 'punc
 			    math-expr-data (nth 2 code)))
-		     ((and (eq (nth 1 code) 'mat)
-			   (string-match " *{" math-exp-str math-exp-pos))
+                     ((and (eq (nth 1 code) 'begenv)
+                           (string-match " *{\\([^}]*\\)}" math-exp-str math-exp-pos))
+                      (setq math-exp-pos (match-end 0)
+                            envname (match-string 1 math-exp-str)
+                            math-exp-token 'punc
+                            math-expr-data "[")
+                      (cond ((or (string= envname "matrix")
+                                 (string= envname "bmatrix")
+                                 (string= envname "smallmatrix")
+                                 (string= envname "pmatrix"))
+                             (if (setq j (string-match (concat "\\\\end{" envname "}")
+                                               math-exp-str math-exp-pos))
+                                 (setq math-exp-str 
+                                       (replace-match "]" t t math-exp-str))
+                               (error "%s" (concat "No closing \\end{" envname "}"))))))
+                      ((and (eq (nth 1 code) 'mat)
+                            (string-match " *{" math-exp-str math-exp-pos))
 		      (setq math-exp-pos (match-end 0)
 			    math-exp-token 'punc
 			    math-expr-data "[")
@@ -800,11 +843,11 @@
 	     (setq math-exp-pos (match-end 0))
 	     (math-read-token))
 	    (t
-	     (if (and (eq ch ?\{) (memq calc-language '(tex eqn)))
+	     (if (and (eq ch ?\{) (memq calc-language '(tex latex eqn)))
 		 (setq ch ?\())
-	     (if (and (eq ch ?\}) (memq calc-language '(tex eqn)))
+	     (if (and (eq ch ?\}) (memq calc-language '(tex latex eqn)))
 		 (setq ch ?\)))
-	     (if (and (eq ch ?\&) (eq calc-language 'tex))
+	     (if (and (eq ch ?\&) (memq calc-language '(tex latex)))
 		 (setq ch ?\,))
 	     (setq math-exp-token 'punc
 		   math-expr-data (char-to-string ch)
--- a/lisp/calc/calc-embed.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calc-embed.el	Thu Feb 03 23:28:36 2005 +0000
@@ -48,11 +48,11 @@
 (defvar calc-embedded-some-active nil)
 (make-variable-buffer-local 'calc-embedded-some-active)
 
-(defvar calc-embedded-open-formula "\\`\\|^\n\\|\\$\\$?\\|\\\\\\[\\|^\\\\begin.*\n\\|^@.*\n\\|^\\.EQ.*\n\\|\\\\(\\|^%\n\\|^\\.\\\\\"\n"
+(defvar calc-embedded-open-formula "\\`\\|^\n\\|\\$\\$?\\|\\\\\\[\\|^\\\\begin[^{].*\n\\|^\\\\begin{.*[^x]}.*\n\\|^@.*\n\\|^\\.EQ.*\n\\|\\\\(\\|^%\n\\|^\\.\\\\\"\n"
   "*A regular expression for the opening delimiter of a formula used by
 calc-embedded.")
 
-(defvar calc-embedded-close-formula "\\'\\|\n$\\|\\$\\$?\\|\\\\]\\|^\\\\end.*\n\\|^@.*\n\\|^\\.EN.*\n\\|\\\\)\\|\n%\n\\|^\\.\\\\\"\n"
+(defvar calc-embedded-close-formula "\\'\\|\n$\\|\\$\\$?\\|\\\\]\\|^\\\\end[^{].*\n\\|^\\\\end{.*[^x]}.*\n\\|^@.*\n\\|^\\.EN.*\n\\|\\\\)\\|\n%\n\\|^\\.\\\\\"\n"
   "*A regular expression for the closing delimiter of a formula used by
 calc-embedded.")
 
@@ -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)
@@ -417,6 +417,8 @@
 	 (forward-char -1))
     (setq calc-embed-outer-top (point))
     (goto-char (match-end 0))
+    (if (looking-at "[ \t]*$")
+        (end-of-line))
     (if (eq (following-char) ?\n)
 	(forward-char 1))
     (or (bolp)
@@ -885,7 +887,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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calc-ext.el	Thu Feb 03 23:28:36 2005 +0000
@@ -217,6 +217,7 @@
   (define-key calc-mode-map "dO" 'calc-flat-language)
   (define-key calc-mode-map "dP" 'calc-pascal-language)
   (define-key calc-mode-map "dT" 'calc-tex-language)
+  (define-key calc-mode-map "dL" 'calc-latex-language)
   (define-key calc-mode-map "dU" 'calc-unformatted-language)
   (define-key calc-mode-map "dW" 'calc-maple-language)
   (define-key calc-mode-map "d[" 'calc-truncate-up)
@@ -998,7 +999,7 @@
  ("calc-lang" calc-big-language calc-c-language calc-eqn-language
 calc-flat-language calc-fortran-language calc-maple-language
 calc-mathematica-language calc-normal-language calc-pascal-language
-calc-tex-language calc-unformatted-language)
+calc-tex-language calc-latex-language calc-unformatted-language)
 
  ("calc-map" calc-accumulate calc-apply calc-inner-product calc-map
 calc-map-equation calc-map-stack calc-outer-product calc-reduce)
@@ -1240,36 +1241,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)
@@ -1376,10 +1395,14 @@
 
 (defun calc-fancy-prefix-other-key (arg)
   (interactive "P")
-  (if (or (not (integerp last-command-char))
-	  (and (>= last-command-char 0) (< last-command-char ? )
-	       (not (eq last-command-char meta-prefix-char))))
+  (if (and
+       (not (eq last-command-char 'tab))
+       (not (eq last-command-char 'M-tab))
+       (or (not (integerp last-command-char))
+           (and (>= last-command-char 0) (< last-command-char ? )
+                (not (eq last-command-char meta-prefix-char)))))
      (calc-wrapper))  ; clear flags if not a Calc command.
+  (setq prefix-arg arg)
   (calc-unread-command)
   (setq overriding-terminal-local-map nil))
 
@@ -2924,13 +2947,13 @@
        (setq str (concat (substring str 0 (match-beginning 0))
 			 (substring str (match-end 0)))))
   (if (string-match "\\\\[^ \n|]" str)
-      (if (eq calc-language 'tex)
+      (if (eq calc-language 'latex)
 	  (math-read-expr str)
-	(let ((calc-language 'tex)
+	(let ((calc-language 'latex)
 	      (calc-language-option nil)
-	      (math-expr-opers (get 'tex 'math-oper-table))
-	      (math-expr-function-mapping (get 'tex 'math-function-table))
-	      (math-expr-variable-mapping (get 'tex 'math-variable-table)))
+	      (math-expr-opers (get 'latex 'math-oper-table))
+	      (math-expr-function-mapping (get 'latex 'math-function-table))
+	      (math-expr-variable-mapping (get 'latex 'math-variable-table)))
 	  (math-read-expr str)))
     (let ((math-read-big-lines nil)
 	  (pos 0)
--- a/lisp/calc/calc-help.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calc-help.el	Thu Feb 03 23:28:36 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")
@@ -593,7 +593,7 @@
      "Why; Line-nums, line-Breaks; <, =, > (justify); Plain"
      "\" (strings); Truncate, [, ]; SPC (refresh), RET, @"
      "SHIFT + language: Normal, One-line, Big, Unformatted"
-     "SHIFT + language: C, Pascal, Fortran; TeX, Eqn"
+     "SHIFT + language: C, Pascal, Fortran; TeX, LaTeX, Eqn"
      "SHIFT + language: Mathematica, W=Maple")
    "display" ?d))
 
--- a/lisp/calc/calc-lang.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calc-lang.el	Thu Feb 03 23:28:36 2005 +0000
@@ -36,6 +36,7 @@
 (defun calc-set-language (lang &optional option no-refresh)
   (setq math-expr-opers (or (get lang 'math-oper-table) math-standard-opers)
 	math-expr-function-mapping (get lang 'math-function-table)
+	math-expr-special-function-mapping (get lang 'math-special-function-table)
 	math-expr-variable-mapping (get lang 'math-variable-table)
 	calc-language-input-filter (get lang 'math-input-filter)
 	calc-language-output-filter (get lang 'math-output-filter)
@@ -296,6 +297,26 @@
 		  "TeX language mode with \\func{\\hbox{var}}")
 	      "TeX language mode"))))
 
+(defun calc-latex-language (n)
+  (interactive "P")
+  (calc-wrapper
+   (and n (setq n (prefix-numeric-value n)))
+   (calc-set-language 'latex n)
+   (cond ((not n)
+          (message "LaTeX language mode"))
+         ((= n 0)
+          (message "LaTeX language mode with multiline matrices"))
+         ((= n 1)
+          (message "LaTeX language mode with \\text{func}(\\text{var})"))
+         ((> n 1)
+          (message 
+           "LaTeX language mode with \\text{func}(\\text{var}) and multiline matrices"))
+         ((= n -1)
+          (message "LaTeX language mode with \\func(\\text{var})"))
+         ((< n -1)
+          (message 
+           "LaTeX language mode with \\func(\\text{var}) and multiline matrices")))))
+
 (put 'tex 'math-oper-table
   '( ( "u+"       ident		   -1 1000 )
      ( "u-"       neg		   -1 1000 )
@@ -406,6 +427,80 @@
   str)
 (put 'tex 'math-input-filter 'math-tex-input-filter)
 
+(put 'latex 'math-oper-table
+     (append (get 'tex 'math-oper-table)
+             '(( "\\Hat"    calcFunc-Hat     -1  950 )
+               ( "\\Check"  calcFunc-Check   -1  950 )
+               ( "\\Tilde"  calcFunc-Tilde   -1  950 )
+               ( "\\Acute"  calcFunc-Acute   -1  950 )
+               ( "\\Grave"  calcFunc-Grave   -1  950 )
+               ( "\\Dot"    calcFunc-Dot     -1  950 )
+               ( "\\Ddot"   calcFunc-Dotdot  -1  950 )
+               ( "\\Breve"  calcFunc-Breve   -1  950 )
+               ( "\\Bar"    calcFunc-Bar     -1  950 )
+               ( "\\Vec"    calcFunc-VEC     -1  950 )
+               ( "\\dddot"  calcFunc-dddot   -1  950 )
+               ( "\\ddddot" calcFunc-ddddot  -1  950 )
+               ( "\div"     /                170 171 )
+               ( "\\le"     calcFunc-leq     160 161 )
+               ( "\\leqq"   calcFunc-leq     160 161 )
+               ( "\\leqsland" calcFunc-leq   160 161 )
+               ( "\\ge"	    calcFunc-geq     160 161 )
+               ( "\\geqq"   calcFunc-geq     160 161 )
+               ( "\\geqslant" calcFunc-geq   160 161 )
+               ( "="	    calcFunc-eq	     160 161 )
+               ( "\\neq"    calcFunc-neq     160 161 )
+               ( "\\ne"	    calcFunc-neq     160 161 )
+               ( "\\lnot"   calcFunc-lnot     -1 121 )
+               ( "\\land"   calcFunc-land    110 111 )
+               ( "\\lor"    calcFunc-lor     100 101 )
+               ( "?"	    (math-read-if)    91  90 )
+               ( "!!!"	    calcFunc-pnot     -1  85 )
+               ( "&&&"	    calcFunc-pand     80  81 )
+               ( "|||"	    calcFunc-por      75  76 )
+               ( "\\gets"   calcFunc-assign   51  50 )
+               ( ":="	    calcFunc-assign   51  50 )
+               ( "::"       calcFunc-condition 45 46 )
+               ( "\\to"	    calcFunc-evalto   40  41 )
+               ( "\\to"	    calcFunc-evalto   40  -1 )
+               ( "=>" 	    calcFunc-evalto   40  41 )
+               ( "=>" 	    calcFunc-evalto   40  -1 ))))
+
+(put 'latex 'math-function-table
+     (append
+      (get 'tex 'math-function-table)
+      '(( \\frac      . (math-latex-parse-frac /))
+        ( \\tfrac     . (math-latex-parse-frac /))
+        ( \\dfrac     . (math-latex-parse-frac /))
+        ( \\binom     . (math-latex-parse-frac calcFunc-choose))
+        ( \\tbinom    . (math-latex-parse-frac calcFunc-choose))
+        ( \\dbinom    . (math-latex-parse-frac calcFunc-choose))
+        ( \\phi	      . calcFunc-totient )
+        ( \\mu	      . calcFunc-moebius ))))
+
+(put 'latex 'math-special-function-table
+     '((/               . (math-latex-print-frac "\\frac"))
+       (calcFunc-choose . (math-latex-print-frac "\\binom"))))
+
+(put 'latex 'math-variable-table
+     (get 'tex 'math-variable-table))
+
+(put 'latex 'math-complex-format 'i)
+
+(defun math-latex-parse-frac (f val)
+  (let (numer denom)
+    (setq args (math-read-expr-list))
+    (math-read-token)
+    (setq margs (math-read-factor))
+    (list (nth 2 f) (car args) margs)))
+
+(defun math-latex-print-frac (a fn)
+  (list 'horiz (nth 1 fn) "{" (math-compose-expr (nth 1 a) -1)
+               "}{"
+               (math-compose-expr (nth 2 a) -1)
+               "}"))
+
+(put 'latex 'math-input-filter 'math-tex-input-filter)
 
 (defun calc-eqn-language (n)
   (interactive "P")
--- a/lisp/calc/calc-mode.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calc-mode.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calc-prog.el	Thu Feb 03 23:28:36 2005 +0000
@@ -474,9 +474,10 @@
    (let ((lang calc-language))
      (calc-edit-mode (list 'calc-finish-user-syntax-edit (list 'quote lang))
 		     t
-		     (format "Editing %s-Mode Syntax Table"
+		     (format "Editing %s-Mode Syntax Table. "
 			     (cond ((null lang) "Normal")
 				   ((eq lang 'tex) "TeX")
+                                   ((eq lang 'latex) "LaTeX")
 				   (t (capitalize (symbol-name lang))))))
      (calc-write-parse-table (cdr (assq lang calc-user-parse-tables))
 			     lang)))
@@ -519,7 +520,7 @@
     (cond ((stringp (car p))
 	   (let ((s (car p)))
 	     (if (and (string-match "\\`\\\\dots\\>" s)
-		      (not (eq calc-lang 'tex)))
+		      (not (eq calc-lang '(tex latex))))
 		 (setq s (concat ".." (substring s 5))))
 	     (if (or (and (string-match
 			   "[a-zA-Z0-9\"{}]\\|\\`:=\\'\\|\\`#\\|\\`%%" s)
@@ -582,11 +583,11 @@
 (defun calc-fix-token-name (name &optional unquoted)
   (cond ((string-match "\\`\\.\\." name)
 	 (concat "\\dots" (substring name 2)))
-	((and (equal name "{") (memq calc-lang '(tex eqn)))
+	((and (equal name "{") (memq calc-lang '(tex latex eqn)))
 	 "(")
-	((and (equal name "}") (memq calc-lang '(tex eqn)))
+	((and (equal name "}") (memq calc-lang '(tex latex eqn)))
 	 ")")
-	((and (equal name "&") (eq calc-lang 'tex))
+	((and (equal name "&") (eq calc-lang '(tex latex)))
 	 ",")
 	((equal name "#")
 	 (search-backward "#")
@@ -660,7 +661,6 @@
 				 (list '\? (list (car last)) '("$$"))))))))
     part))
 
-
 (defun calc-user-define-invocation ()
   (interactive)
   (or last-kbd-macro
@@ -668,9 +668,8 @@
   (setq calc-invocation-macro last-kbd-macro)
   (message "Use `M-# Z' to invoke this macro"))
 
-
-(defun calc-user-define-edit (prefix)
-  (interactive "P")  ; but no calc-wrapper!
+(defun calc-user-define-edit ()
+  (interactive)  ; but no calc-wrapper!
   (message "Edit definition of command: z-")
   (let* ((key (read-char))
 	 (def (or (assq key (calc-user-key-map))
@@ -678,118 +677,267 @@
 		  (assq (downcase key) (calc-user-key-map))
 		  (error "No command defined for that key")))
 	 (cmd (cdr def)))
-    (if (symbolp cmd)
-	(setq cmd (symbol-function cmd)))
+    (when (symbolp cmd)
+      (setq cmdname (symbol-name cmd))
+      (setq cmd (symbol-function cmd)))
     (cond ((or (stringp cmd)
 	       (and (consp cmd)
 		    (eq (car-safe (nth 3 cmd)) 'calc-execute-kbd-macro)))
-	   (if (and (>= (prefix-numeric-value prefix) 0)
-		    (fboundp 'edit-kbd-macro)
-		    (symbolp (cdr def))
-		    (eq major-mode 'calc-mode))
-	       (progn
-		 (if (and (< (window-width) (frame-width))
-			  calc-display-trail)
-		     (let ((win (get-buffer-window (calc-trail-buffer))))
-		       (if win
-			   (delete-window win))))
-		 (edit-kbd-macro (cdr def) prefix nil
-				 (function
-				  (lambda (x)
-				    (and calc-display-trail
-					 (calc-wrapper
-					  (calc-trail-display 1 t)))))
-				 (function
-				  (lambda (cmd)
-				    (if (stringp (symbol-function cmd))
-					(symbol-function cmd)
-				      (let ((mac (nth 1 (nth 3 (symbol-function
-								cmd)))))
-					(if (vectorp mac)
-					    (aref mac 1)
-					  mac)))))
-				 (function
-				  (lambda (new cmd)
-				    (if (stringp (symbol-function cmd))
-					(fset cmd new)
-				      (let ((mac (cdr (nth 3 (symbol-function
-							      cmd)))))
-					(if (vectorp (car mac))
-					    (progn
-					      (aset (car mac) 0
-						    (key-description new))
-					      (aset (car mac) 1 new))
-					  (setcar mac new))))))))
-	     (let ((keys (progn (and (fboundp 'edit-kbd-macro)
-				     (edit-kbd-macro nil))
-				(fboundp 'edmacro-parse-keys))))
-	       (calc-wrapper
-		(calc-edit-mode (list 'calc-finish-macro-edit
-				      (list 'quote def)
-				      keys)
-				t)
-		(if keys
-		    (let (top
-			  (fill-column 70)
-			  (fill-prefix nil))
-		      (insert "Notations: RET, SPC, TAB, DEL, LFD, NUL"
-			      ", C-xxx, M-xxx.\n\n")
-		      (setq top (point))
-		      (insert (if (stringp cmd)
-				  (key-description cmd)
-				(if (vectorp (nth 1 (nth 3 cmd)))
-				    (aref (nth 1 (nth 3 cmd)) 0)
-				  (key-description (nth 1 (nth 3 cmd)))))
-			      "\n")
-		      (if (>= (prog2 (forward-char -1)
-				     (current-column)
-				     (forward-char 1))
-			      (frame-width))
-			  (fill-region top (point))))
-		  (insert "Press C-q to quote control characters like RET"
-			  " and TAB.\n"
-			  (if (stringp cmd)
-			      cmd
-			    (if (vectorp (nth 1 (nth 3 cmd)))
-				(aref (nth 1 (nth 3 cmd)) 1)
-			      (nth 1 (nth 3 cmd)))))))
-	       (calc-show-edit-buffer)
-	       (forward-line (if keys 2 1)))))
+           (let* ((mac (elt (nth 1 (nth 3 cmd)) 1))
+                  (str (edmacro-format-keys mac t))
+                  (kys (nth 3 (nth 3 cmd))))
+             (calc-edit-mode 
+              (list 'calc-edit-macro-finish-edit cmdname kys)
+              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)))
 	  (t (let* ((func (calc-stack-command-p cmd))
 		    (defn (and func
 			       (symbolp func)
-			       (get func 'calc-user-defn))))
+			       (get func 'calc-user-defn)))
+                    (kys (concat "z" (char-to-string (car def))))
+                    (intcmd (symbol-name (cdr def)))
+                    (algcmd (substring (symbol-name func) 9)))
 	       (if (and defn (calc-valid-formula-func func))
-		   (progn
+		   (let ((niceexpr (math-format-nice-expr defn (frame-width))))
 		     (calc-wrapper
-		      (calc-edit-mode (list 'calc-finish-formula-edit
-					    (list 'quote func)))
-		      (insert (math-showing-full-precision
-			       (math-format-nice-expr defn (frame-width)))
-			      "\n"))
+		      (calc-edit-mode 
+                       (list 'calc-finish-formula-edit (list 'quote func))
+                       nil
+                       (format (concat
+                                "Editing formula (%s, %s, bound to %s).\n"
+                                "Original formula: %s\n")
+                               intcmd algcmd kys niceexpr))
+		      (insert  (math-showing-full-precision
+                                niceexpr)
+                               "\n"))
 		     (calc-show-edit-buffer))
 		 (error "That command's definition cannot be edited")))))))
 
-(defun calc-finish-macro-edit (def keys)
-  (forward-line 1)
-  (if (and keys (looking-at "\n")) (forward-line 1))
-  (let* ((true-str (buffer-substring (point) (point-max)))
-	 (str true-str))
-    (if keys (setq str (edmacro-parse-keys str)))
-    (if (symbolp (cdr def))
-	(if (stringp (symbol-function (cdr def)))
-	    (fset (cdr def) str)
-	  (let ((mac (cdr (nth 3 (symbol-function (cdr def))))))
-	    (if (vectorp (car mac))
-		(progn
-		  (aset (car mac) 0 (if keys true-str (key-description str)))
-		  (aset (car mac) 1 str))
-	      (setcar mac str))))
-      (setcdr def str))))
+;; Formatting the macro buffer
+
+(defun calc-edit-macro-repeats ()
+  (goto-char calc-edit-top)
+  (while
+      (re-search-forward "^\\([0-9]+\\)\\*" nil t)
+    (setq num (string-to-int (match-string 1)))
+    (setq line (buffer-substring (point) (line-end-position)))
+    (goto-char (line-beginning-position))
+    (kill-line 1)
+    (while (> num 0)
+      (insert line "\n")
+      (setq num (1- num)))))
+
+(defun calc-edit-macro-adjust-buffer ()
+  (calc-edit-macro-repeats)
+  (goto-char calc-edit-top)
+  (while (re-search-forward "^RET$" nil t)
+    (delete-char 1))
+  (goto-char calc-edit-top)
+  (while (and (re-search-forward "^$" nil t)
+              (not (= (point) (point-max))))
+    (delete-char 1)))
+
+(defun calc-edit-macro-command ()
+  "Return the command on the current line in a Calc macro editing buffer."
+  (let ((beg (line-beginning-position))
+        (end (save-excursion
+               (if (search-forward ";;" (line-end-position) 1)
+                   (forward-char -2))
+               (skip-chars-backward " \t")
+               (point))))
+    (buffer-substring beg end)))
+
+(defun calc-edit-macro-command-type ()
+  "Return the type of command on the current line in a Calc macro editing buffer."
+  (let ((beg (save-excursion
+               (if (search-forward ";;" (line-end-position) t)
+                   (progn
+                     (skip-chars-forward " \t")
+                     (point)))))
+        (end (save-excursion
+               (goto-char (line-end-position))
+               (skip-chars-backward " \t")
+               (point))))
+    (if beg
+        (buffer-substring beg end)
+      "")))
+
+(defun calc-edit-macro-combine-alg-ent ()
+  "Put an entire algebraic entry on a single line."
+  (let ((line (calc-edit-macro-command))
+        (type (calc-edit-macro-command-type))
+        curline
+        match)
+    (goto-char (line-beginning-position))
+    (kill-line 1)
+    (setq curline (calc-edit-macro-command))
+    (while (and curline
+                (not (string-equal "RET" curline))
+                (not (setq match (string-match "<return>" curline))))
+      (setq line (concat line curline))
+      (kill-line 1)
+      (setq curline (calc-edit-macro-command)))
+    (when match
+      (kill-line 1)
+      (setq line (concat line (substring curline 0 match))))
+    (setq line (replace-regexp-in-string "SPC" " SPC " 
+                  (replace-regexp-in-string " " "" line)))
+    (insert line "\t\t\t")
+    (if (> (current-column) 24)
+        (delete-char -1))
+    (insert ";; " type "\n")
+    (if match
+        (insert "RET\t\t\t;; calc-enter\n"))))
+
+(defun calc-edit-macro-combine-ext-command ()
+  "Put an entire extended command on a single line."
+  (let ((cmdbeg (calc-edit-macro-command))
+        (line "")
+        (type (calc-edit-macro-command-type))
+        curline
+        match)
+    (goto-char (line-beginning-position))
+    (kill-line 1)
+    (setq curline (calc-edit-macro-command))
+    (while (and curline
+                (not (string-equal "RET" curline))
+                (not (setq match (string-match "<return>" curline))))
+      (setq line (concat line curline))
+      (kill-line 1)
+      (setq curline (calc-edit-macro-command)))
+    (when match 
+      (kill-line 1)
+      (setq line (concat line (substring curline 0 match))))
+    (setq line (replace-regexp-in-string " " "" line))
+    (insert cmdbeg " " line "\t\t\t")
+    (if (> (current-column) 24)
+        (delete-char -1))
+    (insert ";; " type "\n")
+    (if match
+        (insert "RET\t\t\t;; calc-enter\n"))))
+
+(defun calc-edit-macro-combine-var-name ()
+  "Put an entire variable name on a single line."
+  (let ((line (calc-edit-macro-command))
+        curline
+        match)
+    (goto-char (line-beginning-position))
+    (kill-line 1)
+    (if (member line '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9"))
+          (insert line "\t\t\t;; calc quick variable\n")
+      (setq curline (calc-edit-macro-command))
+      (while (and curline
+                  (not (string-equal "RET" curline))
+                  (not (setq match (string-match "<return>" curline))))
+        (setq line (concat line curline))
+        (kill-line 1)
+        (setq curline (calc-edit-macro-command)))
+      (when match 
+        (kill-line 1)
+        (setq line (concat line (substring curline 0 match))))
+      (setq line (replace-regexp-in-string " " "" line))
+      (insert line "\t\t\t")
+      (if (> (current-column) 24)
+          (delete-char -1))
+      (insert ";; calc variable\n")
+      (if match
+          (insert "RET\t\t\t;; calc-enter\n")))))
+
+(defun calc-edit-macro-combine-digits ()
+  "Put an entire sequence of digits on a single line."
+  (let ((line (calc-edit-macro-command))
+        curline)
+    (goto-char (line-beginning-position))
+    (kill-line 1)
+    (while (string-equal (calc-edit-macro-command-type) "calcDigit-start")
+      (setq line (concat line (calc-edit-macro-command)))
+      (kill-line 1))
+    (insert line "\t\t\t")
+    (if (> (current-column) 24)
+        (delete-char -1))
+    (insert ";; calc digits\n")))
+
+(defun calc-edit-format-macro-buffer ()
+  "Rewrite the Calc macro editing buffer."
+  (calc-edit-macro-adjust-buffer)
+  (goto-char calc-edit-top)
+  (let ((type (calc-edit-macro-command-type)))
+    (while (not (string-equal type ""))
+      (cond
+       ((or
+         (string-equal type "calc-algebraic-entry")
+         (string-equal type "calc-auto-algebraic-entry"))
+        (calc-edit-macro-combine-alg-ent))
+       ((string-equal type "calc-execute-extended-command")
+        (calc-edit-macro-combine-ext-command))
+       ((string-equal type "calcDigit-start")
+        (calc-edit-macro-combine-digits))
+       ((or
+         (string-equal type "calc-store")
+         (string-equal type "calc-store-into")
+         (string-equal type "calc-store-neg")
+         (string-equal type "calc-store-plus")
+         (string-equal type "calc-store-minus")
+         (string-equal type "calc-store-div")
+         (string-equal type "calc-store-times")
+         (string-equal type "calc-store-power")
+         (string-equal type "calc-store-concat")
+         (string-equal type "calc-store-inv")
+         (string-equal type "calc-store-dec")
+         (string-equal type "calc-store-incr")
+         (string-equal type "calc-store-exchange")
+         (string-equal type "calc-unstore")
+         (string-equal type "calc-recall")
+         (string-equal type "calc-let")
+         (string-equal type "calc-permanent-variable"))
+        (forward-line 1)
+        (calc-edit-macro-combine-var-name))
+       ((or
+         (string-equal type "calc-copy-variable")
+         (string-equal type "calc-declare-variable"))
+        (forward-line 1)
+        (calc-edit-macro-combine-var-name)
+        (calc-edit-macro-combine-var-name))
+       (t (forward-line 1)))
+      (setq type (calc-edit-macro-command-type))))
+  (goto-char calc-edit-top))
+
+;; Finish editing the macro
+
+(defun calc-edit-macro-pre-finish-edit ()
+  (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)
+    (let* ((str (buffer-substring calc-edit-top (point-max)))
+           (mac (edmacro-parse-keys str t)))
+      (if (= (length mac) 0)
+          (fmakunbound cmd)
+        (fset cmd
+              (list 'lambda '(arg)
+                    '(interactive "P")
+                    (list 'calc-execute-kbd-macro
+                          (vector (key-description mac)
+                                  mac)
+                          'arg key)))))))
 
 (defun calc-finish-formula-edit (func)
   (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)
@@ -979,6 +1127,8 @@
   (calc-execute-kbd-macro last-kbd-macro arg))
 
 (defun calc-execute-kbd-macro (mac arg &rest prefix)
+  (if calc-keep-args-flag
+      (calc-keep-args))
   (if (and (vectorp mac) (> (length mac) 0) (stringp (aref mac 0)))
       (setq mac (or (aref mac 1)
 		    (aset mac 1 (progn (and (fboundp 'edit-kbd-macro)
--- a/lisp/calc/calc-sel.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calc-sel.el	Thu Feb 03 23:28:36 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-store.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calc-store.el	Thu Feb 03 23:28:36 2005 +0000
@@ -397,7 +397,7 @@
 	 (setq calc-last-edited-variable var)
 	 (calc-edit-mode (list 'calc-finish-stack-edit (list 'quote var))
 			 t
-			 (concat "Editing " (calc-var-name var)))
+			 (concat "Editing variable `" (calc-var-name var) "'. "))
 	 (and value
 	      (insert (math-format-nice-expr value (frame-width)) "\n")))))
   (calc-show-edit-buffer))
@@ -482,7 +482,7 @@
 			     (setq rp nil)))
 		       (not rp)))))
      (calc-unread-command ?\C-a)
-     (setq decl (read-string (format "Declare: %s  to be: " var)
+     (setq decl (read-string (format "Declare: %s  to be: " (calc-var-name var))
 			     (and rp
 				  (math-format-flat-expr (nth 2 (car dp)) 0))))
      (setq decl (and (string-match "[^ \t]" decl)
--- a/lisp/calc/calc-units.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calc-units.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calc-yank.el	Thu Feb 03 23:28:36 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.
@@ -459,15 +460,21 @@
     (setq calc-restore-trail (get-buffer-window (calc-trail-buffer)))
     (make-local-variable 'calc-allow-ret)
     (setq calc-allow-ret allow-ret)
-    (erase-buffer)
+    (let ((inhibit-read-only t))
+      (erase-buffer))
     (add-hook 'kill-buffer-hook (lambda () 
                                   (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 +491,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 +525,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 +550,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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calc.el	Thu Feb 03 23:28:36 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).
@@ -431,27 +405,28 @@
   pascal	Use Pascal language notation.
   fortran	Use Fortran language notation.
   tex		Use TeX notation.
+  latex         Use LaTeX notation.
   eqn		Use eqn notation.
   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 +435,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. (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 +508,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
@@ -738,6 +705,7 @@
 (defvar math-eval-rules-cache-tag t)
 (defvar math-radix-explicit-format t)
 (defvar math-expr-function-mapping nil)
+(defvar math-expr-special-function-mapping nil)
 (defvar math-expr-variable-mapping nil)
 (defvar math-read-expr-quotes nil)
 (defvar math-working-step nil)
@@ -1028,7 +996,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")
@@ -1402,6 +1370,7 @@
 		     (if calc-leading-zeros "Zero " "")
 		     (cond ((null calc-language) "")
 			   ((eq calc-language 'tex) "TeX ")
+			   ((eq calc-language 'latex) "LaTeX ")
 			   (t (concat
 			       (capitalize (symbol-name calc-language))
 			       " ")))
@@ -3252,9 +3221,13 @@
      ("\\cal") ("\\mit") ("\\Cal") ("\\Bbb") ("\\frak") ("\\goth")
      ("\\evalto")
      ("\\matrix" mat) ("\\bmatrix" mat) ("\\pmatrix" mat)
+     ("\\begin" begenv)
      ("\\cr" punc ";") ("\\\\" punc ";") ("\\*" punc "*")
-     ("\\{" punc "[") ("\\}" punc "]")
-))
+     ("\\{" punc "[") ("\\}" punc "]")))
+
+(defconst math-latex-ignore-words
+  (append math-tex-ignore-words
+          '(("\\begin" begenv))))
 
 (defconst math-eqn-ignore-words
   '( ("roman") ("bold") ("italic") ("mark") ("lineup") ("evalto")
@@ -3262,8 +3235,7 @@
      ("right" ("floor") ("ceil"))
      ("arc" ("sin") ("cos") ("tan") ("sinh") ("cosh") ("tanh"))
      ("size" n) ("font" n) ("fwd" n) ("back" n) ("up" n) ("down" n)
-     ("above" punc ",")
-))
+     ("above" punc ",")))
 
 (defconst math-standard-opers
   '( ( "_"     calcFunc-subscr 1200 1201 )
--- a/lisp/calc/calccomp.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/calc/calccomp.el	Thu Feb 03 23:28:36 2005 +0000
@@ -79,7 +79,8 @@
 
 
 (defun math-compose-expr (a prec)
-  (let ((math-compose-level (1+ math-compose-level)))
+  (let ((math-compose-level (1+ math-compose-level))
+        spfn)
     (cond
      ((or (and (eq a math-comp-selected) a)
 	  (and math-comp-tagged
@@ -89,10 +90,13 @@
 	(list 'tag a (math-compose-expr a prec))))
      ((and (not (consp a)) (not (integerp a)))
       (concat "'" (prin1-to-string a)))
+     ((setq spfn (assq (car-safe a) math-expr-special-function-mapping))
+      (setq spfn (cdr spfn))
+      (funcall (car spfn) a spfn))
      ((math-scalarp a)
       (if (or (eq (car-safe a) 'frac)
 	      (and (nth 1 calc-frac-format) (Math-integerp a)))
-	  (if (memq calc-language '(tex eqn math maple c fortran pascal))
+	  (if (memq calc-language '(tex latex eqn math maple c fortran pascal))
 	      (let ((aa (math-adjust-fraction a))
 		    (calc-frac-format nil))
 		(math-compose-expr (list '/
@@ -265,34 +269,44 @@
 		      (append '(horiz "\\matrix{ ")
 			      (math-compose-tex-matrix (cdr a))
 			      '(" }"))
-		    (if (and (eq calc-language 'eqn)
-			     (math-matrixp a))
-			(append '(horiz "matrix { ")
-				(math-compose-eqn-matrix
-				 (cdr (math-transpose a)))
-				'("}"))
-		      (if (and (eq calc-language 'maple)
-			       (math-matrixp a))
-			  (list 'horiz
-				"matrix("
-				math-comp-left-bracket
-				(math-compose-vector (cdr a) 
+                    (if (and (eq calc-language 'latex)
+                             (math-matrixp a))
+                        (if (memq calc-language-option '(-2 0 2))
+                            (append '(vleft 0 "\\begin{pmatrix}")
+                                    (math-compose-tex-matrix (cdr a))
+                                    '("\\end{pmatrix}"))
+                          (append '(horiz "\\begin{pmatrix} ")
+                                  (math-compose-tex-matrix (cdr a))
+                                  '(" \\end{pmatrix}")))
+                      (if (and (eq calc-language 'eqn)
+                               (math-matrixp a))
+                          (append '(horiz "matrix { ")
+                                  (math-compose-eqn-matrix
+                                   (cdr (math-transpose a)))
+                                  '("}"))
+                        (if (and (eq calc-language 'maple)
+                                 (math-matrixp a))
+                            (list 'horiz
+                                  "matrix("
+                                  math-comp-left-bracket
+                                  (math-compose-vector (cdr a) 
+                                                       (concat math-comp-comma " ")
+                                                       math-comp-vector-prec)
+                                  math-comp-right-bracket
+                                  ")")
+                          (list 'horiz
+                                math-comp-left-bracket
+                                (math-compose-vector (cdr a) 
                                                      (concat math-comp-comma " ")
-						     math-comp-vector-prec)
-				math-comp-right-bracket
-				")")
-			(list 'horiz
-			      math-comp-left-bracket
-			      (math-compose-vector (cdr a) 
-                                                   (concat math-comp-comma " ")
-						   math-comp-vector-prec)
-			      math-comp-right-bracket))))
+                                                     math-comp-vector-prec)
+                                math-comp-right-bracket)))))
 		(list 'horiz
 		      math-comp-left-bracket
 		      (math-compose-vector (list (nth 1 a) (nth 2 a) (nth 3 a))
 					   (concat math-comp-comma " ") 
                                            math-comp-vector-prec)
-		      math-comp-comma (if (eq calc-language 'tex) " \\ldots" " ...")
+		      math-comp-comma (if (memq calc-language '(tex latex)) 
+                                          " \\ldots" " ...")
 		      math-comp-comma " "
 		      (list 'break math-compose-level)
 		      (math-compose-expr (nth (1- (length a)) a)
@@ -326,12 +340,14 @@
       (let ((v (rassq (nth 2 a) math-expr-variable-mapping)))
 	(if v
 	    (symbol-name (car v))
-	  (if (and (eq calc-language 'tex)
+	  (if (and (memq calc-language '(tex latex))
 		   calc-language-option
 		   (not (= calc-language-option 0))
 		   (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'"
 				 (symbol-name (nth 1 a))))
-	      (format "\\hbox{%s}" (symbol-name (nth 1 a)))
+              (if (eq calc-language 'latex)
+                  (format "\\text{%s}" (symbol-name (nth 1 a)))
+                (format "\\hbox{%s}" (symbol-name (nth 1 a))))
 	    (if (and math-compose-hash-args
 		     (let ((p calc-arg-values))
 		       (setq v 1)
@@ -359,7 +375,7 @@
 	    (if (eq calc-language 'maple) ""
 	      (if (memq (nth 1 a) '(0 1)) "(" "["))
 	    (math-compose-expr (nth 2 a) 0)
-	    (if (eq calc-language 'tex) " \\ldots "
+	    (if (memq calc-language '(tex latex)) " \\ldots "
 	      (if (eq calc-language 'eqn) " ... " " .. "))
 	    (math-compose-expr (nth 3 a) 0)
 	    (if (eq calc-language 'maple) ""
@@ -404,7 +420,7 @@
 	    (math-compose-expr (nth 2 a) 0)
 	    "]]"))
      ((and (eq (car a) 'calcFunc-sqrt)
-	   (eq calc-language 'tex))
+	   (memq calc-language '(tex latex)))
       (list 'horiz
 	    "\\sqrt{"
 	    (math-compose-expr (nth 1 a) 0)
@@ -440,7 +456,7 @@
 	      (math-comp-height a1)
 	      a1 '(rule ?-) a2)))
      ((and (memq (car a) '(calcFunc-sum calcFunc-prod))
-	   (eq calc-language 'tex)
+	   (memq calc-language '(tex latex))
 	   (= (length a) 5))
       (list 'horiz (if (eq (car a) 'calcFunc-sum) "\\sum" "\\prod")
 	    "_{" (math-compose-expr (nth 2 a) 0)
@@ -495,7 +511,7 @@
 	   (integerp (nth 2 a)))
       (let ((c (math-compose-expr (nth 1 a) -1)))
 	(if (> prec (nth 2 a))
-	    (if (eq calc-language 'tex)
+	    (if (memq calc-language '(tex latex))
 		(list 'horiz "\\left( " c " \\right)")
 	      (if (eq calc-language 'eqn)
 		  (list 'horiz "{left ( " c " right )}")
@@ -633,13 +649,13 @@
 		      (make-list (nth 1 a) c))))))
      ((and (eq (car a) 'calcFunc-evalto)
 	   (setq calc-any-evaltos t)
-	   (memq calc-language '(tex eqn))
+	   (memq calc-language '(tex latex eqn))
 	   (= math-compose-level (if math-comp-tagged 2 1))
 	   (= (length a) 3))
       (list 'horiz
-	    (if (eq calc-language 'tex) "\\evalto " "evalto ")
+	    (if (memq calc-language '(tex latex)) "\\evalto " "evalto ")
 	    (math-compose-expr (nth 1 a) 0)
-	    (if (eq calc-language 'tex) " \\to " " -> ")
+	    (if (memq calc-language '(tex latex)) " \\to " " -> ")
 	    (math-compose-expr (nth 2 a) 0)))
      (t
       (let ((op (and (not (eq calc-language 'unform))
@@ -651,7 +667,7 @@
 		    (/= (nth 3 op) -1))
 	       (cond
 		((> prec (or (nth 4 op) (min (nth 2 op) (nth 3 op))))
-		 (if (and (eq calc-language 'tex)
+		 (if (and (memq calc-language '(tex latex))
 			  (not (math-tex-expr-is-flat a)))
 		     (if (eq (car-safe a) '/)
 			 (list 'horiz "{" (math-compose-expr a -1) "}")
@@ -668,7 +684,7 @@
 				 (math-compose-expr a -1)
 				 " right )}")))
 		     (list 'horiz "(" (math-compose-expr a 0) ")"))))
-		((and (eq calc-language 'tex)
+		((and (memq calc-language '(tex latex))
 		      (memq (car a) '(/ calcFunc-choose calcFunc-evalto))
 		      (>= prec 0))
 		 (list 'horiz "{" (math-compose-expr a -1) "}"))
@@ -694,7 +710,7 @@
 		   (and (equal (car op) "^")
 			(eq (math-comp-first-char lhs) ?-)
 			(setq lhs (list 'horiz "(" lhs ")")))
-		   (and (eq calc-language 'tex)
+		   (and (memq calc-language '(tex latex))
 			(or (equal (car op) "^") (equal (car op) "_"))
 			(not (and (stringp rhs) (= (length rhs) 1)))
 			(setq rhs (list 'horiz "{" rhs "}")))
@@ -761,7 +777,7 @@
 		((or (> prec (or (nth 4 op) (nth 2 op)))
 		     (and (not (eq (assoc (car op) math-expr-opers) op))
 			  (> prec 0)))   ; don't write x% + y
-		 (if (and (eq calc-language 'tex)
+		 (if (and (memq calc-language '(tex latex))
 			  (not (math-tex-expr-is-flat a)))
 		     (list 'horiz "\\left( "
 			   (math-compose-expr a -1)
@@ -786,7 +802,7 @@
 	      ((and op (= (length a) 2) (= (nth 2 op) -1))
 	       (cond
 		((eq (nth 3 op) 0)
-		 (let ((lr (and (eq calc-language 'tex)
+		 (let ((lr (and (memq calc-language '(tex latex))
 				(not (math-tex-expr-is-flat (nth 1 a))))))
 		   (list 'horiz
 			 (if lr "\\left" "")
@@ -799,7 +815,7 @@
 			 (if lr "\\right" "")
 			 (car (nth 1 (memq op math-expr-opers))))))
 		((> prec (or (nth 4 op) (nth 3 op)))
-		 (if (and (eq calc-language 'tex)
+		 (if (and (memq calc-language '(tex latex))
 			  (not (math-tex-expr-is-flat a)))
 		     (list 'horiz "\\left( "
 			   (math-compose-expr a -1)
@@ -836,6 +852,7 @@
 				      ( pascal . math-compose-pascal )
 				      ( fortran . math-compose-fortran )
 				      ( tex . math-compose-tex )
+				      ( latex . math-compose-latex )
 				      ( eqn . math-compose-eqn )
 				      ( math . math-compose-math )
 				      ( maple . math-compose-maple ))))
@@ -866,20 +883,22 @@
 			       (symbol-name func))))
 		 (if (memq calc-language '(c fortran pascal maple))
 		     (setq func (math-to-underscores func)))
-		 (if (and (eq calc-language 'tex)
+		 (if (and (memq calc-language '(tex latex))
 			  calc-language-option
 			  (not (= calc-language-option 0))
 			  (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'" func))
 		     (if (< (prefix-numeric-value calc-language-option) 0)
 			 (setq func (format "\\%s" func))
-		       (setq func (format "\\hbox{%s}" func))))
+		       (setq func (if (eq calc-language 'latex)
+                                      (format "\\text{%s}" func)
+                                    (format "\\hbox{%s}" func)))))
 		 (if (and (eq calc-language 'eqn)
 			  (string-match "[^']'+\\'" func))
 		     (let ((n (- (length func) (match-beginning 0) 1)))
 		       (setq func (substring func 0 (- n)))
 		       (while (>= (setq n (1- n)) 0)
 			 (setq func (concat func " prime")))))
-		 (cond ((and (eq calc-language 'tex)
+		 (cond ((and (eq calc-language '(tex latex))
 			     (or (> (length a) 2)
 				 (not (math-tex-expr-is-flat (nth 1 a)))))
 			(setq left "\\left( "
@@ -889,11 +908,13 @@
 				 (not (math-tex-expr-is-flat (nth 1 a)))))
 			(setq left "{left ( "
 			      right " right )}"))
-		       ((and (or (and (eq calc-language 'tex)
+		       ((and (or (and (memq calc-language '(tex latex))
 				      (eq (aref func 0) ?\\))
 				 (and (eq calc-language 'eqn)
 				      (memq (car a) math-eqn-special-funcs)))
-			     (not (string-match "\\hbox{" func))
+			     (not (or
+                                   (string-match "\\hbox{" func)
+                                   (string-match "\\text{" func)))
 			     (= (length a) 2)
 			     (or (Math-realp (nth 1 a))
 				 (memq (car (nth 1 a)) '(var *))))
@@ -968,7 +989,7 @@
       (if (<= count 0)
 	  (if (< count 0)
 	      (math-compose-rows (cdr a) -1 nil)
-	    (cons (concat (if (eq calc-language 'tex) "  \\ldots" "  ...")
+	    (cons (concat (if (memq calc-language '(tex latex)) "  \\ldots" "  ...")
 			  math-comp-comma)
 		  (math-compose-rows (cdr a) -1 nil)))
 	(cons (list 'horiz
@@ -983,9 +1004,8 @@
 
 (defun math-compose-tex-matrix (a)
   (if (cdr a)
-      (cons (math-compose-vector (cdr (car a)) " & " 0)
-	    (cons " \\\\ "
-		  (math-compose-tex-matrix (cdr a))))
+      (cons (append (math-compose-vector (cdr (car a)) " & " 0) '(" \\\\ "))
+            (math-compose-tex-matrix (cdr a)))
     (list (math-compose-vector (cdr (car a)) " & " 0))))
 
 (defun math-compose-eqn-matrix (a)
--- a/lisp/case-table.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/case-table.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 ;;; case-table.el --- code to extend the character set and support case tables
 
-;; Copyright (C) 1988, 1994 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1994, 2005 Free Software Foundation, Inc.
 
 ;; Author: Howard Gayle
 ;; Maintainer: FSF
@@ -62,11 +62,26 @@
        (describe-vector description)
        (help-mode)))))
 
+(defun get-upcase-table (case-table)
+  "Return the upcase table of CASE-TABLE."
+  (or (char-table-extra-slot case-table 0)
+      ;; Setup all extra slots of CASE-TABLE by temporarily selecting
+      ;; it as the standard case table.
+      (let ((old (standard-case-table)))
+	(unwind-protect
+	    (progn
+	      (set-standard-case-table case-table)
+	      (char-table-extra-slot case-table 0))
+	  (or (eq case-table old)
+	      (set-standard-case-table old))))))
+
 (defun copy-case-table (case-table)
-  (let ((copy (copy-sequence case-table)))
-    ;; Clear out the extra slots so that they will be
-    ;; recomputed from the main (downcase) table.
-    (set-char-table-extra-slot copy 0 nil)
+  (let ((copy (copy-sequence case-table))
+	(up (char-table-extra-slot case-table 0)))
+    ;; Clear out the extra slots (except for upcase table) so that
+    ;; they will be recomputed from the main (downcase) table.
+    (if up
+	(set-char-table-extra-slot copy 0 (copy-sequence up)))
     (set-char-table-extra-slot copy 1 nil)
     (set-char-table-extra-slot copy 2 nil)
     copy))
@@ -87,9 +102,11 @@
   (setq r (set-case-syntax-1 r))
   (aset table l l)
   (aset table r r)
+  (let ((up (get-upcase-table table)))
+    (aset up l l)
+    (aset up r r))
   ;; Clear out the extra slots so that they will be
-  ;; recomputed from the main (downcase) table.
-  (set-char-table-extra-slot table 0 nil)
+  ;; recomputed from the main (downcase) table and upcase table.
   (set-char-table-extra-slot table 1 nil)
   (set-char-table-extra-slot table 2 nil)
   (modify-syntax-entry l (concat "(" (char-to-string r) "  ")
@@ -103,14 +120,49 @@
 that will be used as the downcase part of a case table.
 It also modifies `standard-syntax-table' to give them the syntax of
 word constituents."
-  (unless (= (charset-bytes (char-charset uc))
-	     (charset-bytes (char-charset lc)))
-    (error "Can't casify chars with different `charset-bytes' values"))
   (setq uc (set-case-syntax-1 uc))
   (setq lc (set-case-syntax-1 lc))
   (aset table uc lc)
   (aset table lc lc)
-  (set-char-table-extra-slot table 0 nil)
+  (let ((up (get-upcase-table table)))
+    (aset up uc uc)
+    (aset up lc uc))
+  ;; Clear out the extra slots so that they will be
+  ;; recomputed from the main (downcase) table and upcase table.
+  (set-char-table-extra-slot table 1 nil)
+  (set-char-table-extra-slot table 2 nil)
+  (modify-syntax-entry lc "w   " (standard-syntax-table))
+  (modify-syntax-entry uc "w   " (standard-syntax-table)))
+
+(defun set-upcase-syntax (uc lc table)
+  "Make character UC an upcase of character LC.
+It also modifies `standard-syntax-table' to give them the syntax of
+word constituents."
+  (setq uc (set-case-syntax-1 uc))
+  (setq lc (set-case-syntax-1 lc))
+  (aset table lc lc)
+  (let ((up (get-upcase-table table)))
+    (aset up uc uc)
+    (aset up lc uc))
+  ;; Clear out the extra slots so that they will be
+  ;; recomputed from the main (downcase) table and upcase table.
+  (set-char-table-extra-slot table 1 nil)
+  (set-char-table-extra-slot table 2 nil)
+  (modify-syntax-entry lc "w   " (standard-syntax-table))
+  (modify-syntax-entry uc "w   " (standard-syntax-table)))
+
+(defun set-downcase-syntax (uc lc table)
+  "Make character LC a downcase of character UC.
+It also modifies `standard-syntax-table' to give them the syntax of
+word constituents."
+  (setq uc (set-case-syntax-1 uc))
+  (setq lc (set-case-syntax-1 lc))
+  (aset table uc lc)
+  (aset table lc lc)
+  (let ((up (get-upcase-table table)))
+    (aset up uc uc))
+  ;; Clear out the extra slots so that they will be
+  ;; recomputed from the main (downcase) table and upcase table.
   (set-char-table-extra-slot table 1 nil)
   (set-char-table-extra-slot table 2 nil)
   (modify-syntax-entry lc "w   " (standard-syntax-table))
@@ -124,7 +176,10 @@
 SYNTAX should be \" \", \"w\", \".\" or \"_\"."
   (setq c (set-case-syntax-1 c))
   (aset table c c)
-  (set-char-table-extra-slot table 0 nil)
+  (let ((up (get-upcase-table table)))
+    (aset up c c))
+  ;; Clear out the extra slots so that they will be
+  ;; recomputed from the main (downcase) table and upcase table.
   (set-char-table-extra-slot table 1 nil)
   (set-char-table-extra-slot table 2 nil)
   (modify-syntax-entry c syntax (standard-syntax-table)))
--- a/lisp/comint.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/comint.el	Thu Feb 03 23:28:36 2005 +0000
@@ -788,7 +788,9 @@
 
 (defun comint-insert-input (&optional event)
   "In a Comint buffer, set the current input to the previous input at point."
-  (interactive "e")
+  ;; This doesn't use "e" because it is supposed to work
+  ;; for events without parameters.
+  (interactive (list last-input-event))
   (if event (mouse-set-point event))
   (let ((pos (point)))
     (if (not (eq (get-char-property pos 'field) 'input))
--- a/lisp/cus-edit.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/cus-edit.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,7 @@
 ;;; cus-edit.el --- tools for customizing Emacs and Lisp packages
 ;;
-;; Copyright (C) 1996,97,1999,2000,01,02,03,2004  Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+;;           Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Maintainer: FSF
@@ -243,7 +244,6 @@
 
 (defgroup customize '((widgets custom-group))
   "Customization of the Customization support."
-  :link '(custom-manual "(elisp)Customization")
   :prefix "custom-"
   :group 'help)
 
@@ -899,8 +899,6 @@
 	(let (
 	      ;; Copied from `custom-buffer-create-other-window'.
 	      (pop-up-windows t)
-	      (special-display-buffer-names nil)
-	      (special-display-regexps nil)
 	      (same-window-buffer-names nil)
 	      (same-window-regexps nil))
 	  (pop-to-buffer name))
@@ -1182,19 +1180,10 @@
 		(const links))
   :group 'custom-buffer)
 
-;; If we pass BUFFER to `bury-buffer', the buffer isn't removed from
-;; the window.
-(defun custom-bury-buffer (buffer)
-  (with-current-buffer buffer
-    (bury-buffer)))
-
-(defcustom custom-buffer-done-function 'custom-bury-buffer
-  "*Function called to remove a Custom buffer when the user is done with it.
-Called with one argument, the buffer to remove."
-  :type '(choice (function-item :tag "Bury buffer" custom-bury-buffer)
-		 (function-item :tag "Kill buffer" kill-buffer)
-		 (function :tag "Other"))
-  :version "21.1"
+(defcustom custom-buffer-done-kill nil
+  "*Non-nil means exiting a Custom buffer should kill it."
+  :type 'boolean
+  :version "21.4"
   :group 'custom-buffer)
 
 (defcustom custom-buffer-indent 3
@@ -1247,8 +1236,6 @@
 that option."
   (unless name (setq name "*Customization*"))
   (let ((pop-up-windows t)
-	(special-display-buffer-names nil)
-	(special-display-regexps nil)
 	(same-window-buffer-names nil)
 	(same-window-regexps nil))
     (pop-to-buffer (custom-get-fresh-buffer name))
@@ -1266,9 +1253,9 @@
   :group 'custom-buffer)
 
 (defun Custom-buffer-done (&rest ignore)
-  "Remove current buffer by calling `custom-buffer-done-function'."
+  "Exit current Custom buffer according to `custom-buffer-done-kill'."
   (interactive)
-  (funcall custom-buffer-done-function (current-buffer)))
+  (quit-window custom-buffer-done-kill))
 
 (defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box)
 					     '(("unspecified" . unspecified))))
@@ -1354,13 +1341,9 @@
 		 :tag "Finish"
 		 :help-echo
 		 (lambda (&rest ignore)
-		   (cond
-		    ((eq custom-buffer-done-function
-			 'custom-bury-buffer)
-		     "Bury this buffer")
-		    ((eq custom-buffer-done-function 'kill-buffer)
-		     "Kill this buffer")
-		    (t "Finish with this buffer")))
+		   (if custom-buffer-done-kill
+		       "Kill this buffer"
+		     "Bury this buffer"))
 		 :action #'Custom-buffer-done)
   (widget-insert "\n\n")
   (message "Creating customization items...")
@@ -3699,35 +3682,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.
@@ -4051,23 +4056,23 @@
 
 ;;; The Custom Mode.
 
-(defvar custom-mode-map nil
-  "Keymap for `custom-mode'.")
-
-(unless custom-mode-map
+(defvar custom-mode-map
   ;; This keymap should be dense, but a dense keymap would prevent inheriting
   ;; "\r" bindings from the parent map.
-  (setq custom-mode-map (make-sparse-keymap))
-  (set-keymap-parent custom-mode-map widget-keymap)
-  (suppress-keymap custom-mode-map)
-  (define-key custom-mode-map " " 'scroll-up)
-  (define-key custom-mode-map "\177" 'scroll-down)
-  (define-key custom-mode-map "\C-x\C-s" 'Custom-save)
-  (define-key custom-mode-map "q" 'Custom-buffer-done)
-  (define-key custom-mode-map "u" 'Custom-goto-parent)
-  (define-key custom-mode-map "n" 'widget-forward)
-  (define-key custom-mode-map "p" 'widget-backward)
-  (define-key custom-mode-map [mouse-1] 'Custom-move-and-invoke))
+  ;; Actually, this misfeature of dense keymaps was fixed on 2001-11-26.
+  (let ((map (make-keymap)))
+    (set-keymap-parent map widget-keymap)
+    (suppress-keymap map)
+    (define-key map " " 'scroll-up)
+    (define-key map "\177" 'scroll-down)
+    (define-key map "\C-x\C-s" 'Custom-save)
+    (define-key map "q" 'Custom-buffer-done)
+    (define-key map "u" 'Custom-goto-parent)
+    (define-key map "n" 'widget-forward)
+    (define-key map "p" 'widget-backward)
+    (define-key map [mouse-1] 'Custom-move-and-invoke)
+    map)
+  "Keymap for `custom-mode'.")
 
 (defun Custom-move-and-invoke (event)
   "Move to where you click, and if it is an active field, invoke it."
@@ -4166,5 +4171,5 @@
 
 (provide 'cus-edit)
 
-;;; arch-tag: 64533aa4-1b1a-48c3-8812-f9dc718e8a6f
+;; arch-tag: 64533aa4-1b1a-48c3-8812-f9dc718e8a6f
 ;;; cus-edit.el ends here
--- a/lisp/cus-face.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/cus-face.el	Thu Feb 03 23:28:36 2005 +0000
@@ -53,6 +53,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)
@@ -198,11 +199,11 @@
 
     (:foreground
      (color :tag "Foreground"
-	    :help-echo "Set foreground color."))
+	    :help-echo "Set foreground color (name or #RRGGBB hex spec)."))
 
     (:background
      (color :tag "Background"
-	    :help-echo "Set background color."))
+	    :help-echo "Set background color (name or #RRGGBB hex spec)."))
 
     (:stipple
      (choice :tag "Stipple"
--- a/lisp/cus-start.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/cus-start.el	Thu Feb 03 23:28:36 2005 +0000
@@ -41,6 +41,17 @@
 	     (gc-cons-threshold alloc integer)
 	     (undo-limit undo integer)
 	     (undo-strong-limit undo integer)
+	     (undo-outer-limit undo
+			       (choice integer
+				       (const :tag "No limit"
+					      :format "%t\n%d"
+					      :doc
+					      "With this choice, \
+the undo info for the current command never gets discarded.
+This should only be chosen under exceptional circumstances,
+since it could result in memory overflow and make Emacs crash."
+					      nil))
+			       "21.4")
 	     (garbage-collection-messages alloc boolean)
 	     ;; buffer.c
 	     (mode-line-format modeline sexp) ;Hard to do right.
--- a/lisp/custom.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/custom.el	Thu Feb 03 23:28:36 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/descr-text.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/descr-text.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,10 +1,10 @@
 ;;; descr-text.el --- describe text mode
 
-;; Copyright (c) 1994, 1995, 1996, 2001, 2002, 2003, 2004
+;; Copyright (c) 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005
 ;;           Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
-;; Keywords: faces
+;; Keywords: faces, i18n, Unicode, multilingual
 
 ;; This file is part of GNU Emacs.
 
@@ -217,7 +217,7 @@
 (defcustom describe-char-unicodedata-file nil
   "Location of Unicode data file.
 This is the UnicodeData.txt file from the Unicode consortium, used for
-diagnostics.  If it is non-nil `describe-char-after' will print data
+diagnostics.  If it is non-nil `describe-char' will print data
 looked up from it.  This facility is mostly of use to people doing
 multilingual development.
 
--- a/lisp/desktop.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/desktop.el	Thu Feb 03 23:28:36 2005 +0000
@@ -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: emacs-mule; -*-\n"
+        ";; -*- mode: emacs-lisp; coding: emacs-mule; -*-\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 'emacs-mule))
@@ -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/dired.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/dired.el	Thu Feb 03 23:28:36 2005 +0000
@@ -200,22 +200,6 @@
 ;; Note this can't simply be run inside function `dired-ls' as the hook
 ;; functions probably depend on the dired-subdir-alist to be OK.
 
-;; Fixme: This should use mailcap.
-(defcustom dired-view-command-alist
-  '(("\\.\\(ps\\|ps_pages\\|eps\\)\\'" . "gv %s")
-    ("\\.pdf\\'" . "xpdf %s")
-    ;; ("\\.pod\\'" . "perldoc %s")
-    ("\\.\\(jpe?g\\|gif\\|png\\)\\'" . "eog %s")
-    ("\\.dvi\\'" . "xdvi %s"))
-  "Alist specifying how to view special types of files.
-Each element has the form (REGEXP . SHELL-COMMAND).
-When the file name matches REGEXP, `dired-view-file'
-invokes SHELL-COMMAND to view the file, processing it through `format'.
-Use `%s' in SHELL-COMMAND to specify where to put the file name."
-  :group 'dired
-  :type '(alist :key-type regexp :value-type string)
-  :version "21.4")
-
 ;; Internal variables
 
 (defvar dired-marker-char ?*		; the answer is 42
@@ -1213,8 +1197,8 @@
     ;; misc
     (define-key map "?" 'dired-summary)
     (define-key map "\177" 'dired-unmark-backward)
-    (define-key map "\C-_" 'dired-undo)
-    (define-key map "\C-xu" 'dired-undo)
+    (define-key map [remap undo] 'dired-undo)
+    (define-key map [remap advertised-undo] 'dired-undo)
 
     ;; Make menu bar items.
 
@@ -1666,41 +1650,20 @@
 	    (progn
 	      (select-window window)
 	      (dired-other-window file)))
-      (let (cmd)
-	;; Look for some other way to view a certain file.
-	(dolist (elt dired-view-command-alist)
-	  (if (string-match (car elt) file)
-	      (setq cmd (cdr elt))))
-	(if cmd
-	    (call-process shell-file-name nil 0 nil
-			  "-c"
-			  (concat (format cmd (shell-quote-argument file))
-				  " &"))
-	  (select-window window)
-	  (find-file-other-window (file-name-sans-versions file t)))))))
+      (select-window window)
+      (find-file-other-window (file-name-sans-versions file t)))))
 
 (defun dired-view-file ()
   "In Dired, examine a file in view mode, returning to dired when done.
 When file is a directory, show it in this buffer if it is inserted.
-Some kinds of files are displayed using external viewer programs;
-see `dired-view-command-alist'.  Otherwise, display it in another buffer."
+Otherwise, display it in another buffer."
   (interactive)
   (let ((file (dired-get-file-for-visit)))
     (if (file-directory-p file)
 	(or (and (cdr dired-subdir-alist)
 		 (dired-goto-subdir file))
 	    (dired file))
-      (let (cmd)
-	;; Look for some other way to view a certain file.
-	(dolist (elt dired-view-command-alist)
-	  (if (string-match (car elt) file)
-	      (setq cmd (cdr elt))))
-	(if cmd
-	    (call-process shell-file-name nil 0 nil
-			  "-c"
-			  (concat (format cmd (shell-quote-argument file))
-				  " &"))
-	  (view-file file))))))
+      (view-file file))))
 
 (defun dired-find-file-other-window ()
   "In Dired, visit this file or directory in another window."
--- a/lisp/ebuff-menu.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/ebuff-menu.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/electric.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/emacs-lisp/autoload.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/emacs-lisp/elint.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/emacs-lisp/find-func.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/emacs-lisp/lisp-mnt.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/emacs-lisp/lisp-mode.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 ;;; lisp-mode.el --- Lisp mode, and its idiosyncratic commands
 
-;; Copyright (C) 1985, 1986, 1999, 2000, 2001, 2003, 2004
+;; Copyright (C) 1985, 1986, 1999, 2000, 2001, 2003, 2004, 2005
 ;;           Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -602,7 +602,7 @@
 	      (boundp (cadr form)))
 	 ;; Force variable to be re-set.
 	 `(progn (defvar ,(nth 1 form) nil ,@(nthcdr 3 form))
-		 (setq ,(nth 1 form) ,(nth 2 form))))
+		 (setq-default ,(nth 1 form) ,(nth 2 form))))
 	;; `defcustom' is now macroexpanded to
 	;; `custom-declare-variable' with a quoted value arg.
 	((and (eq (car form) 'custom-declare-variable)
@@ -881,11 +881,11 @@
 that specifies how to do the indentation.  The property value can be
 * `defun', meaning indent `defun'-style;
 * an integer N, meaning indent the first N arguments specially
-like ordinary function arguments and then indent any further
-aruments like a body;
+  like ordinary function arguments and then indent any further
+  arguments like a body;
 * a function to call just as this function was called.
-If that function returns nil, that means it doesn't specify
-the indentation.
+  If that function returns nil, that means it doesn't specify
+  the indentation.
 
 This function also returns nil meaning don't specify the indentation."
   (let ((normal-indent (current-column)))
@@ -921,7 +921,7 @@
 	       (lisp-indent-specform method state
 				     indent-point normal-indent))
 	      (method
-		(funcall method state indent-point)))))))
+		(funcall method indent-point state)))))))
 
 (defvar lisp-body-indent 2
   "Number of columns to indent the second line of a `(def...)' form.")
@@ -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/lisp.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/emacs-lisp/lisp.el	Thu Feb 03 23:28:36 2005 +0000
@@ -140,18 +140,18 @@
       (setq arg (- arg inc)))))
 
 (defun kill-sexp (&optional arg)
-  "Kill the sexp (balanced expression) following the cursor.
-With ARG, kill that many sexps after the cursor.
-Negative arg -N means kill N sexps before the cursor."
+  "Kill the sexp (balanced expression) following point.
+With ARG, kill that many sexps after point.
+Negative arg -N means kill N sexps before point."
   (interactive "p")
   (let ((opoint (point)))
     (forward-sexp (or arg 1))
     (kill-region opoint (point))))
 
 (defun backward-kill-sexp (&optional arg)
-  "Kill the sexp (balanced expression) preceding the cursor.
-With ARG, kill that many sexps before the cursor.
-Negative arg -N means kill N sexps after the cursor."
+  "Kill the sexp (balanced expression) preceding point.
+With ARG, kill that many sexps before point.
+Negative arg -N means kill N sexps after point."
   (interactive "p")
   (kill-sexp (- (or arg 1))))
 
--- a/lisp/emacs-lisp/re-builder.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/emacs-lisp/re-builder.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/facemenu.el	Thu Feb 03 23:28:36 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/faces.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/faces.el	Thu Feb 03 23:28:36 2005 +0000
@@ -730,7 +730,9 @@
 (defun set-face-background (face color &optional frame)
   "Change the background color of face FACE to COLOR (a string).
 FRAME nil or not specified means change face on all frames.
-When called interactively, prompt for the face and color."
+COLOR can be a system-defined color name (see `list-colors-display')
+or a hex spec of the form #RRGGBB.
+When called interactively, prompts for the face and color."
   (interactive (read-face-and-attribute :background))
   (set-face-attribute face frame :background (or color 'unspecified)))
 
@@ -738,7 +740,9 @@
 (defun set-face-foreground (face color &optional frame)
   "Change the foreground color of face FACE to COLOR (a string).
 FRAME nil or not specified means change face on all frames.
-When called interactively, prompt for the face and color."
+COLOR can be a system-defined color name (see `list-colors-display')
+or a hex spec of the form #RRGGBB.
+When called interactively, prompts for the face and color."
   (interactive (read-face-and-attribute :foreground))
   (set-face-attribute face frame :foreground (or color 'unspecified)))
 
@@ -1139,15 +1143,26 @@
 ;; conflict with Lucid, which uses that name differently.
 
 (defvar help-xref-stack)
-(defun list-faces-display ()
+(defun list-faces-display (&optional regexp)
   "List all faces, using the same sample text in each.
 The sample text is a string that comes from the variable
-`list-faces-sample-text'."
-  (interactive)
+`list-faces-sample-text'.
+
+If REGEXP is non-nil, list only those faces with names matching
+this regular expression.  When called interactively with a prefix
+arg, prompt for a regular expression."
+  (interactive (list (and current-prefix-arg
+                          (read-string "List faces matching regexp: "))))
   (let ((faces (sort (face-list) #'string-lessp))
-	(face nil)
 	(frame (selected-frame))
 	disp-frame window face-name)
+    (when (> (length regexp) 0)
+      (setq faces
+            (delq nil
+                  (mapcar (lambda (f)
+                            (when (string-match regexp (symbol-name f))
+                              f))
+                          faces))))
     (with-output-to-temp-buffer "*Faces*"
       (save-excursion
 	(set-buffer standard-output)
@@ -1160,9 +1175,7 @@
 	   "\\[help-follow] on a face name to customize it\n"
 	   "or on its sample text for a description of the face.\n\n")))
 	(setq help-xref-stack nil)
-	(while faces
-	  (setq face (car faces))
-	  (setq faces (cdr faces))
+	(dolist (face faces)
 	  (setq face-name (symbol-name face))
 	  (insert (format "%25s " face-name))
 	  ;; Hyperlink to a customization buffer for the face.  Using
@@ -1204,6 +1217,7 @@
 	    (copy-face (car faces) (car faces) frame disp-frame)
 	    (setq faces (cdr faces)))))))
 
+
 (defun describe-face (face &optional frame)
   "Display the properties of face FACE on FRAME.
 Interactively, FACE defaults to the faces of the character after point
--- a/lisp/files.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/files.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,7 +1,7 @@
 ;;; files.el --- file input and output commands for Emacs
 
-;; Copyright (C) 1985,86,87,92,93,94,95,96,97,98,99,2000,01,02,03,2004
-;;;   Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+;;   1999, 2000, 2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 
@@ -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,93 +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))))))))))
-	  (let (prefix suffix beg
-		(enable-local-eval enable-local-eval))
-	    ;; The prefix is what comes before "local variables:" in its line.
-	    ;; The suffix is what comes after "local variables:" in its line.
-	    (skip-chars-forward " \t")
-	    (or (eolp)
-		(setq suffix (buffer-substring (point)
-					       (progn (end-of-line) (point)))))
-	    (goto-char (match-beginning 0))
-	    (or (bolp)
-		(setq prefix
-		      (buffer-substring (point)
-					(progn (beginning-of-line) (point)))))
-
-	    (setq prefix (if prefix (regexp-quote prefix) "^"))
-	    (if suffix (setq suffix (concat (regexp-quote suffix) "$")))
-	    (forward-line 1)
-	    (let ((startpos (point))
-		  endpos
-		  (thisbuf (current-buffer)))
-	      (save-excursion
-		(if (not (re-search-forward
-			  (concat (or prefix "")
-				  "[ \t]*End:[ \t]*"
-				  (or 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 any.
-		  (if 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 any.
-		  (if 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))
@@ -2841,13 +2844,18 @@
 
 (defun normal-backup-enable-predicate (name)
   "Default `backup-enable-predicate' function.
-Checks for files in `temporary-file-directory' or
-`small-temporary-file-directory'."
+Checks for files in `temporary-file-directory',
+`small-temporary-file-directory', and /tmp."
   (not (or (let ((comp (compare-strings temporary-file-directory 0 nil
 					name 0 nil)))
 	     ;; Directory is under temporary-file-directory.
 	     (and (not (eq comp t))
 		  (< comp (- (length temporary-file-directory)))))
+	   (let ((comp (compare-strings "/tmp" 0 nil
+					name 0 nil)))
+	     ;; Directory is under /tmp.
+	     (and (not (eq comp t))
+		  (< comp (- (length "/tmp")))))
 	   (if small-temporary-file-directory
 	       (let ((comp (compare-strings small-temporary-file-directory
 					    0 nil
@@ -3271,11 +3279,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 ()
@@ -4546,47 +4555,54 @@
 	  (when (if (stringp switches)
 		    (string-match "--dired\\>" switches)
 		  (member "--dired" switches))
+	    ;; The following overshoots by one line for an empty
+	    ;; directory listed with "--dired", but without "-a"
+	    ;; switch, where the ls output contains a
+	    ;; "//DIRED-OPTIONS//" line, but no "//DIRED//" line.
+	    ;; We take care of that case later.
 	    (forward-line -2)
             (when (looking-at "//SUBDIRED//")
               (delete-region (point) (progn (forward-line 1) (point)))
               (forward-line -1))
-	    (when (looking-at "//DIRED//")
-	      (let ((end (line-end-position))
-		    (linebeg (point))
-		    error-lines)
-		;; Find all the lines that are error messages,
-		;; and record the bounds of each one.
-		(goto-char (point-min))
-		(while (< (point) linebeg)
-		  (or (eql (following-char) ?\s)
-		      (push (list (point) (line-end-position)) error-lines))
-		  (forward-line 1))
-		(setq error-lines (nreverse error-lines))
-		;; Now read the numeric positions of file names.
-		(goto-char linebeg)
-		(forward-word 1)
-		(forward-char 3)
-		(while (< (point) end)
-		  (let ((start (insert-directory-adj-pos
+	    (if (looking-at "//DIRED//")
+		(let ((end (line-end-position))
+		      (linebeg (point))
+		      error-lines)
+		  ;; Find all the lines that are error messages,
+		  ;; and record the bounds of each one.
+		  (goto-char beg)
+		  (while (< (point) linebeg)
+		    (or (eql (following-char) ?\s)
+			(push (list (point) (line-end-position)) error-lines))
+		    (forward-line 1))
+		  (setq error-lines (nreverse error-lines))
+		  ;; Now read the numeric positions of file names.
+		  (goto-char linebeg)
+		  (forward-word 1)
+		  (forward-char 3)
+		  (while (< (point) end)
+		    (let ((start (insert-directory-adj-pos
+				  (+ beg (read (current-buffer)))
+				  error-lines))
+			  (end (insert-directory-adj-pos
 				(+ beg (read (current-buffer)))
-				error-lines))
-			(end (insert-directory-adj-pos
-			      (+ beg (read (current-buffer)))
-			      error-lines)))
-		    (if (memq (char-after end) '(?\n ?\ ))
-			;; End is followed by \n or by " -> ".
-			(put-text-property start end 'dired-filename t)
-		      ;; It seems that we can't trust ls's output as to
-		      ;; byte positions of filenames.
-		      (put-text-property beg (point) 'dired-filename nil)
-		      (end-of-line))))
-		(goto-char end)
-		(beginning-of-line)
-		(delete-region (point) (progn (forward-line 2) (point))))
-	      (forward-line 1)
-	      (if (looking-at "//DIRED-OPTIONS//")
-		  (delete-region (point) (progn (forward-line 1) (point)))
-		(forward-line 1))))
+				error-lines)))
+		      (if (memq (char-after end) '(?\n ?\ ))
+			  ;; End is followed by \n or by " -> ".
+			  (put-text-property start end 'dired-filename t)
+			;; It seems that we can't trust ls's output as to
+			;; byte positions of filenames.
+			(put-text-property beg (point) 'dired-filename nil)
+			(end-of-line))))
+		  (goto-char end)
+		  (beginning-of-line)
+		  (delete-region (point) (progn (forward-line 1) (point))))
+	      ;; Take care of the case where the ls output contains a
+	      ;; "//DIRED-OPTIONS//"-line, but no "//DIRED//"-line
+	      ;; and we went one line too far back (see above).
+	      (forward-line 1))
+	    (if (looking-at "//DIRED-OPTIONS//")
+		(delete-region (point) (progn (forward-line 1) (point)))))
 
 	  ;; Now decode what read if necessary.
 	  (let ((coding (or coding-system-for-read
--- a/lisp/font-core.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/font-core.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,7 +1,7 @@
 ;;; font-core.el --- Core interface to font-lock
 
-;; Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999, 2000, 2001, 02, 2003
-;;  Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+;;   2002, 2003, 2005  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: languages, faces
@@ -202,6 +202,7 @@
   ;; Only do hard work if the mode has specified stuff in
   ;; `font-lock-defaults'.
   (when (or font-lock-defaults
+	    (and (boundp 'font-lock-keywords) font-lock-keywords)
 	    (cdr (assq major-mode font-lock-defaults-alist)))
     (font-lock-mode-internal mode)))
 
@@ -295,6 +296,5 @@
 
 (provide 'font-core)
 
+;; arch-tag: f8c286e1-02f7-41d9-b89b-1b67780aed71
 ;;; font-core.el ends here
-
-;;; arch-tag: f8c286e1-02f7-41d9-b89b-1b67780aed71
--- a/lisp/gnus/ChangeLog	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/gnus/ChangeLog	Thu Feb 03 23:28:36 2005 +0000
@@ -1,9 +1,45 @@
+2005-01-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* gnus-art.el (gnus-article-mode): Turn off the "\ " non-break space.
+
+2005-01-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* message.el (message-beginning-of-line): Change the behavior when
+	invoked between BOL and : so that it first moves backward.
+
+2005-01-28  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-art.el (gnus-article-setup-buffer): Kill and re-create the
+	article buffer when editing of the article is discarded.
+	(gnus-article-prepare): Revert.
+
+2005-01-28  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-art.el (gnus-article-prepare):
+	Remove message-strip-forbidden-properties from the local hook.
+
+2005-01-24  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* mml.el (mml-generate-mime-1): Convert string into unibyte when
+	inserting " *mml*" buffer's contents into a unibyte temp buffer.
+
+2005-01-20  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* mm-decode.el (mm-insert-part): Switch the multibyteness of data
+	which will be inserted according to the multibyteness of a buffer
+	rather than the type of contents.  Suggested by ARISAWA Akihiro
+	<ari@mbf.ocn.ne.jp>.
+
+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
-	when mm-use-ultra-safe-encoding is enabled (e.g., for PGP/MIME)
-	and we have trailing white space.  Reported by Werner Koch
-	<wk@gnupg.org>.
+	* mm-bodies.el (mm-body-encoding): Don't permit 7-bit to be used when
+	mm-use-ultra-safe-encoding is enabled (e.g., for PGP/MIME) and we have
+	trailing white space.  Reported by Werner Koch <wk@gnupg.org>.
 
 2004-12-17  Kim F. Storm  <storm@cua.dk>
 
@@ -46,8 +82,8 @@
 
 2004-12-13  Katsumi Yamaoka  <yamaoka@jpl.org>
 
-	* gnus-group.el (gnus-group-make-rss-group): Use
-	gnus-group-make-group instead of gnus-group-unsubscribe-group.
+	* gnus-group.el (gnus-group-make-rss-group):
+	Use gnus-group-make-group instead of gnus-group-unsubscribe-group.
 
 	* gnus-start.el (gnus-setup-news): Honor user's setting to
 	gnus-message-archive-method.  Suggested by Lute Kamstra
@@ -376,11 +412,10 @@
 
 2004-10-18  Kevin Greiner  <kevin.greiner@compsol.cc>
 
-	* gnus-agent.el (gnus-agent-possibly-synchronize-flags): Ignore
-	servers that are offline.  Avoids having gnus-agent-toggle-plugged
-	first ask if you want to open a server and then, even when you
-	responded with no, asking if you want to synchronize the server's
-	flags.
+	* gnus-agent.el (gnus-agent-possibly-synchronize-flags): Ignore servers
+	that are offline.  Avoids having gnus-agent-toggle-plugged first ask if
+	you want to open a server and then, even when you responded with no,
+	asking if you want to synchronize the server's flags.
 	(gnus-agent-synchronize-flags-server): Rewrite read loop to handle
 	multi-line expressions.
 	(gnus-agent-synchronize-group-flags): New internal function.
@@ -528,9 +563,8 @@
 
 2004-10-18  Kevin Greiner <kevin.greiner@compsol.cc>
 
-	* gnus-start.el (gnus-convert-old-newsrc): Only write the
-	conversion message to newsrc-dribble when an actual conversion is
-	performed.
+	* gnus-start.el (gnus-convert-old-newsrc): Only write the conversion
+	message to newsrc-dribble when an actual conversion is performed.
 
 2004-10-18  Kevin Greiner <kevin.greiner@compsol.cc>
 
--- a/lisp/gnus/gnus-art.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/gnus/gnus-art.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,5 +1,5 @@
 ;;; gnus-art.el --- article mode commands for Gnus
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -3711,6 +3711,8 @@
   (make-local-variable 'gnus-article-image-alist)
   (make-local-variable 'gnus-article-charset)
   (make-local-variable 'gnus-article-ignored-charsets)
+  ;; Prevent recent Emacsen from displaying non-break space as "\ ".
+  (set (make-local-variable 'show-nonbreak-escape) nil)
   (gnus-set-default-directory)
   (buffer-disable-undo)
   (setq buffer-read-only t)
@@ -3743,14 +3745,19 @@
       (mm-enable-multibyte)
       (setq major-mode 'gnus-original-article-mode)
       (make-local-variable 'gnus-original-article))
-    (if (get-buffer name)
+    (if (and (get-buffer name)
+	     (with-current-buffer name
+	       (if gnus-article-edit-mode
+		   (if (y-or-n-p "Article mode edit in progress; discard? ")
+		       (progn
+			 (set-buffer-modified-p nil)
+			 (gnus-kill-buffer name)
+			 (message "")
+			 nil)
+		     (error "Action aborted"))
+		 t)))
 	(save-excursion
 	  (set-buffer name)
-	  (when (and gnus-article-edit-mode
-		     (buffer-modified-p)
-		     (not
-		      (y-or-n-p "Article mode edit in progress; discard? ")))
-	    (error "Action aborted"))
 	  (set (make-local-variable 'gnus-article-edit-mode) nil)
 	  (when gnus-article-mime-handles
 	    (mm-destroy-parts gnus-article-mime-handles)
--- a/lisp/gnus/imap.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/gnus/imap.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,5 +1,5 @@
 ;;; imap.el --- imap library
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <jas@pdc.kth.se>
@@ -69,7 +69,7 @@
 ;; imap-message-append,               imap-envelope-from
 ;; imap-body-lines
 ;;
-;; It is my hope that theese commands should be pretty self
+;; It is my hope that these commands should be pretty self
 ;; explanatory for someone that know IMAP.  All functions have
 ;; additional documentation on how to invoke them.
 ;;
@@ -325,7 +325,7 @@
 (defvar imap-error nil
   "Error codes from the last command.")
 
-;; Internal constants.  Change theese and die.
+;; Internal constants.  Change these and die.
 
 (defconst imap-default-port 143)
 (defconst imap-default-ssl-port 993)
@@ -1456,7 +1456,7 @@
 (defun imap-fetch (uids props &optional receive nouidfetch buffer)
   "Fetch properties PROPS from message set UIDS from server in BUFFER.
 UIDS can be a string, number or a list of numbers.  If RECEIVE
-is non-nil return theese properties."
+is non-nil return these properties."
   (with-current-buffer (or buffer (current-buffer))
     (when (imap-ok-p (imap-send-command-wait
 		      (format "%sFETCH %s %s" (if nouidfetch "" "UID ")
--- a/lisp/gnus/message.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/gnus/message.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,5 +1,5 @@
 ;;; message.el --- composing mail and news messages
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -800,7 +800,7 @@
 ;; is nil.  See: http://article.gmane.org/gmane.emacs.gnus.general/51138
 (defcustom message-generate-headers-first '(references)
   "Which headers should be generated before starting to compose a message.
-If `t', generate all required headers.  This can also be a list of headers to
+If t, generate all required headers.  This can also be a list of headers to
 generate.  The variables `message-required-news-headers' and
 `message-required-mail-headers' specify which headers to generate.
 
@@ -5295,10 +5295,10 @@
 is nil.
 
 If point is in the message header and on a (non-continued) header
-line, move point to the beginning of the header value.  If point
-is already there, move point to beginning of line.  Therefore,
-repeated calls will toggle point between beginning of field and
-beginning of line."
+line, move point to the beginning of the header value or the beginning of line,
+whichever is closer.  If point is already at beginning of line, move point to
+beginning of header value.  Therefore, repeated calls will toggle point
+between beginning of field and beginning of line."
   (interactive "p")
   (let ((zrs 'zmacs-region-stays))
     (when (and (interactive-p) (boundp zrs))
@@ -5309,9 +5309,9 @@
 	     (bol (progn (beginning-of-line n) (point)))
 	     (eol (gnus-point-at-eol))
 	     (eoh (re-search-forward ": *" eol t)))
-	(if (or (not eoh) (equal here eoh))
-	    (goto-char bol)
-	  (goto-char eoh)))
+	(goto-char
+	 (if (and eoh (or (< eoh here) (= bol here)))
+	     eoh bol)))
     (beginning-of-line n)))
 
 (defun message-buffer-name (type &optional to group)
@@ -6880,5 +6880,5 @@
 ;; coding: iso-8859-1
 ;; End:
 
-;;; arch-tag: 94b32cac-4504-4b6c-8181-030ebf380ee0
+;; arch-tag: 94b32cac-4504-4b6c-8181-030ebf380ee0
 ;;; message.el ends here
--- a/lisp/gnus/mm-decode.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/gnus/mm-decode.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,5 +1,5 @@
 ;;; mm-decode.el --- Functions for decoding MIME things
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -1032,27 +1032,10 @@
 
 (defun mm-insert-part (handle)
   "Insert the contents of HANDLE in the current buffer."
-  (let ((cur (current-buffer)))
-    (save-excursion
-      (if (member (mm-handle-media-supertype handle) '("text" "message"))
-	  (with-temp-buffer
-	    (insert-buffer-substring (mm-handle-buffer handle))
-	    (prog1
-		(mm-decode-content-transfer-encoding
-		 (mm-handle-encoding handle)
-		 (mm-handle-media-type handle))
-	      (let ((temp (current-buffer)))
-		(set-buffer cur)
-		(insert-buffer-substring temp))))
-	(mm-with-unibyte-buffer
-	  (insert-buffer-substring (mm-handle-buffer handle))
-	  (prog1
-	      (mm-decode-content-transfer-encoding
-	       (mm-handle-encoding handle)
-	       (mm-handle-media-type handle))
-	    (let ((temp (current-buffer)))
-	      (set-buffer cur)
-	      (insert-buffer-substring temp))))))))
+  (save-excursion
+    (insert (if (mm-multibyte-p)
+		(mm-string-as-multibyte (mm-get-part handle))
+	      (mm-get-part handle)))))
 
 (defun mm-file-name-delete-whitespace (file-name)
   "Remove all whitespace characters from FILE-NAME."
--- a/lisp/gnus/mml.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/gnus/mml.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,5 +1,5 @@
 ;;; mml.el --- A package for parsing and validating MML documents
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -472,7 +472,9 @@
 	    (mm-with-unibyte-buffer
 	      (cond
 	       ((cdr (assq 'buffer cont))
-		(insert-buffer-substring (cdr (assq 'buffer cont))))
+		(insert (with-current-buffer (cdr (assq 'buffer cont))
+			  (mm-with-unibyte-current-buffer
+			    (buffer-string)))))
 	       ((and (setq filename (cdr (assq 'filename cont)))
 		     (not (equal (cdr (assq 'nofile cont)) "yes")))
 		(let ((coding-system-for-read mm-binary-coding-system))
--- a/lisp/gnus/spam.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/gnus/spam.el	Thu Feb 03 23:28:36 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-at-pt.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/help-at-pt.el	Thu Feb 03 23:28:36 2005 +0000
@@ -146,6 +146,7 @@
 	  (run-with-idle-timer
 	   help-at-pt-timer-delay t #'help-at-pt-maybe-display))))
 
+;;;###autoload
 (defcustom help-at-pt-display-when-idle 'never
   "*Automatically show local help on point-over.
 If the value is t, the string obtained from any `kbd-help' or
--- a/lisp/help-fns.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/help-fns.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/help-macro.el	Thu Feb 03 23:28:36 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/hi-lock.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/hi-lock.el	Thu Feb 03 23:28:36 2005 +0000
@@ -294,6 +294,10 @@
     (when (and (not hi-lock-mode-prev) hi-lock-mode)
       (add-hook 'find-file-hooks 'hi-lock-find-file-hook)
       (add-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook)
+      (when (eq nil font-lock-defaults)
+	(setq font-lock-defaults '(nil)))
+      (unless font-lock-mode
+	(font-lock-mode 1))
       (define-key-after menu-bar-edit-menu [hi-lock]
         (cons "Regexp Highlighting" hi-lock-menu))
       (dolist (buffer (buffer-list))
--- a/lisp/hilit-chg.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/hilit-chg.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 ;;; hilit-chg.el --- minor mode displaying buffer changes with special face
 
-;; Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000, 2005  Free Software Foundation, Inc.
 
 ;; Author: Richard Sharman <rsharman@pobox.com>
 ;; Keywords: faces
@@ -392,8 +392,6 @@
 
 ;; These shouldn't be changed!
 
-;; Autoload for the benefit of `make-mode-line-mouse-sensitive'.
-;;;###autoload
 (defvar highlight-changes-mode nil)
 (defvar hilit-chg-list nil)
 (defvar hilit-chg-string " ??")
@@ -1163,5 +1161,5 @@
 
 (provide 'hilit-chg)
 
-;;; arch-tag: de00301d-5bad-44da-aa82-e0e010b0c463
+;; arch-tag: de00301d-5bad-44da-aa82-e0e010b0c463
 ;;; hilit-chg.el ends here
--- a/lisp/image.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/image.el	Thu Feb 03 23:28:36 2005 +0000
@@ -263,7 +263,7 @@
 	  (setq x (+ x dx))))
       (setq x 0.0
 	    y (+ y dy))
-      (insert (propertize "\n" 'line-height 0)))))
+      (insert (propertize "\n" 'line-height t)))))
 
 
 
--- a/lisp/imenu.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/imenu.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/info-look.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/info.el	Thu Feb 03 23:28:36 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/international/characters.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/international/characters.el	Thu Feb 03 23:28:36 2005 +0000
@@ -447,6 +447,7 @@
   (set-case-syntax-pair ?,FO(B ?,Fo(B tbl)
   (set-case-syntax-pair ?,FP(B ?,Fp(B tbl)
   (set-case-syntax-pair ?,FQ(B ?,Fq(B tbl)
+  (set-upcase-syntax    ?,FS(B ?,Fr(B tbl)
   (set-case-syntax-pair ?,FS(B ?,Fs(B tbl)
   (set-case-syntax-pair ?,FT(B ?,Ft(B tbl)
   (set-case-syntax-pair ?,FU(B ?,Fu(B tbl)
@@ -481,6 +482,7 @@
   (set-case-syntax-pair ?$,1&(B ?$,1'?(B tbl)
   (set-case-syntax-pair ?$,1' (B ?$,1'@(B tbl)
   (set-case-syntax-pair ?$,1'!(B ?$,1'A(B tbl)
+  (set-upcase-syntax    ?$,1'#(B ?$,1'B(B tbl)
   (set-case-syntax-pair ?$,1'#(B ?$,1'C(B tbl)
   (set-case-syntax-pair ?$,1'$(B ?$,1'D(B tbl)
   (set-case-syntax-pair ?$,1'%(B ?$,1'E(B tbl)
@@ -882,10 +884,12 @@
 	 (set-case-syntax-pair
 	  (decode-char 'ucs (1- c)) (decode-char 'ucs c) tbl))
     (setq c (1+ c)))
+  ;;(set-downcase-syntax  ?$,1 P(B ?i tbl)
+  ;;(set-upcase-syntax    ?I ?$,1 Q(B tbl)
   (set-case-syntax-pair ?$,1 R(B ?$,1 S(B tbl)
   (set-case-syntax-pair ?$,1 T(B ?$,1 U(B tbl)
   (set-case-syntax-pair ?$,1 V(B ?$,1 W(B tbl)
-;;;  (set-case-syntax-pair ?$,1!8(B ?,A(B tbl)	; these two have different length!
+  (set-case-syntax-pair ?$,1!8(B ?,A(B tbl)
   (set-case-syntax-pair ?$,1!9(B ?$,1!:(B tbl)
   (set-case-syntax-pair ?$,1!;(B ?$,1!<(B tbl)
   (set-case-syntax-pair ?$,1!=(B ?$,1!>(B tbl)
--- a/lisp/international/encoded-kb.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/international/encoded-kb.el	Thu Feb 03 23:28:36 2005 +0000
@@ -126,9 +126,7 @@
 
 (defun encoded-kbd-iso2022-single-shift (ignore)
   (let ((char (encoded-kbd-last-key)))
-    (aset encoded-kbd-iso2022-invocations 2
-	  (aref encoded-kbd-iso2022-designations
-		(if (= char ?\216) 2 3))))
+    (aset encoded-kbd-iso2022-invocations 2 (if (= char ?\216) 2 3)))
   "")
 
 (defun encoded-kbd-self-insert-iso2022-7bit (ignore)
--- a/lisp/international/mule-cmds.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/international/mule-cmds.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 ;;; mule-cmds.el --- commands for mulitilingual environment -*-coding: iso-2022-7bit -*-
 
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004  Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 2003 Electrotechnical Laboratory, JAPAN.
 ;; Licensed to the Free Software Foundation.
 
@@ -1865,12 +1865,14 @@
   ;; different there.
   (or (and (eq window-system 'pc) (not default-enable-multibyte-characters))
       (progn
-	;; Make non-line-break space display as a plain space.
-	;; Most X fonts do the wrong thing for code 160.
-	(aset standard-display-table 160 [32])
-	;; With luck, non-Latin-1 fonts are more recent and so don't
-	;; have this bug.
-	(aset standard-display-table (make-char 'latin-iso8859-1 160) [32])
+	;; Most X fonts used to do the wrong thing for latin-1 code 160.
+	(unless (and (eq window-system 'x)
+		     ;; XFree86 4 has fixed the fonts.
+		     (string= "The XFree86 Project, Inc" (x-server-vendor))
+		     (> (aref (number-to-string (nth 2 (x-server-version))) 0)
+			?3))
+	  ;; Make non-line-break space display as a plain space.
+	  (aset standard-display-table 160 [32]))
 	;; Most Windows programs send out apostrophes as \222.  Most X fonts
 	;; don't contain a character at that position.  Map it to the ASCII
 	;; apostrophe.  [This is actually RIGHT SINGLE QUOTATION MARK,
@@ -1878,23 +1880,7 @@
 	;; fonts probably have the appropriate glyph at this position,
 	;; so they could use standard-display-8bit.  It's better to use a
 	;; proper windows-1252 coding system.  --fx]
-	(aset standard-display-table 146 [39])
-	;; XFree86 4 has changed most of the fonts from their designed
-	;; versions such that `' no longer appears as balanced quotes.
-	;; Assume it has iso10646 fonts installed, so we can display
-	;; balanced quotes.
-	(when (and (eq window-system 'x)
-		   (string= "The XFree86 Project, Inc" (x-server-vendor))
-		   (> (aref (number-to-string (nth 2 (x-server-version))) 0)
-		      ?3))
-	  ;; We suppress these setting for the moment because the
-	  ;; above assumption is wrong.
-	  ;; (aset standard-display-table ?' [?$,1ry(B])
-	  ;; (aset standard-display-table ?` [?$,1rx(B])
-	  ;; The fonts don't have the relevant bug.
-	  (aset standard-display-table 160 nil)
-	  (aset standard-display-table (make-char 'latin-iso8859-1 160)
-		nil)))))
+	(aset standard-display-table 146 [39]))))
 
 (defun set-language-environment-coding-systems (language-name
 						&optional eol-type)
@@ -1955,8 +1941,7 @@
       (setq language-name (symbol-name language-name)))
   (dolist (feature (get-language-info language-name 'features))
     (require feature))
-  (let ((doc (get-language-info language-name 'documentation))
-	pos)
+  (let ((doc (get-language-info language-name 'documentation)))
     (help-setup-xref (list #'describe-language-environment language-name)
 		     (interactive-p))
     (with-output-to-temp-buffer (help-buffer)
--- a/lisp/isearch.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/isearch.el	Thu Feb 03 23:28:36 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
@@ -648,7 +735,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
@@ -676,8 +763,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
@@ -2146,31 +2233,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 `\\\\')
@@ -2202,12 +2266,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
@@ -2227,81 +2312,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)
@@ -2316,11 +2326,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
@@ -2330,7 +2340,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)
@@ -2361,7 +2371,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 ()
@@ -2382,7 +2392,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
@@ -2441,7 +2451,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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/loadhist.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/mail/mailabbrev.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/mail/rmail.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/man.el	Thu Feb 03 23:28:36 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")
 
 
@@ -694,6 +697,7 @@
       (setq buffer (generate-new-buffer bufname))
       (save-excursion
 	(set-buffer buffer)
+	(setq buffer-undo-list t)
 	(setq Man-original-frame (selected-frame))
 	(setq Man-arguments man-args))
       (let ((process-environment (copy-sequence process-environment))
@@ -822,6 +826,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 +858,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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/mouse.el	Thu Feb 03 23:28:36 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/net/eudc.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/net/eudc.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1214,7 +1214,7 @@
 ;;; Load the options file
 (if (and (not noninteractive)
 	 (and (locate-library eudc-options-file)
-	      (message ""))		; Remove modeline message
+	      (progn (message "") t))   ; Remove modeline message
 	 (not (featurep 'eudc-options-file)))
     (load eudc-options-file))
 
--- a/lisp/net/tramp-smb.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/net/tramp-smb.el	Thu Feb 03 23:28:36 2005 +0000
@@ -172,7 +172,7 @@
     (set-file-modes . tramp-smb-not-handled)
     (set-visited-file-modtime . tramp-smb-not-handled)
     (shell-command . tramp-smb-not-handled)
-    ;; `substitute-in-file-name' performed by default handler
+    (substitute-in-file-name . tramp-smb-handle-substitute-in-file-name)
     (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
     (vc-registered . tramp-smb-not-handled)
     (verify-visited-file-modtime . tramp-smb-not-handled)
@@ -617,6 +617,13 @@
 
   (delete-file filename))
 
+(defun tramp-smb-handle-substitute-in-file-name (filename)
+  "Like `handle-substitute-in-file-name' for tramp files.
+Catches errors for shares like \"C$/\", which are common in Microsoft Windows."
+  (condition-case nil
+      (tramp-run-real-handler 'substitute-in-file-name (list filename))
+    (error filename)))
+
 (defun tramp-smb-handle-write-region
   (start end filename &optional append visit lockname confirm)
   "Like `write-region' for tramp files."
@@ -1084,54 +1091,6 @@
 	  (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2)))))
 
 
-;; `PC-do-completion' touches the returning "$$" by `substitute-in-file-name'.
-;; Must be corrected.
-
-(defadvice PC-do-completion (around tramp-smb-advice-PC-do-completion)
-  "Changes \"$\" back to \"$$\" in minibuffer."
-  (if (funcall PC-completion-as-file-name-predicate)
-
-      (progn
-	;; Substitute file names
-	(let* ((beg (or (and (functionp 'minibuffer-prompt-end) ; Emacs 21
-			     (funcall 'minibuffer-prompt-end))
-			(point-min)))
-	       (end (point-max))
-	       (str (substitute-in-file-name (buffer-substring beg end))))
-	  (delete-region beg end)
-	  (insert str)
-	  (ad-set-arg 2 (point)))
-
-	;; Do `PC-do-completion' without substitution
-	(let* (save)
-	  (fset 'save (symbol-function 'substitute-in-file-name))
- 	  (unwind-protect
- 	      (progn
- 		(fset 'substitute-in-file-name (symbol-function 'identity))
- 		ad-do-it)
- 	    (fset 'substitute-in-file-name (symbol-function 'save))))
-
-	;; Expand "$"
-	(let* ((beg (or (and (functionp 'minibuffer-prompt-end) ; Emacs 21
-			     (funcall 'minibuffer-prompt-end))
-			(point-min)))
-	       (end (point-max))
-	       (str (buffer-substring beg end)))
-	  (delete-region beg end)
-	  (insert (if (string-match "\\(\\$\\)\\(/\\|$\\)" str)
-		      (replace-match "$$" nil nil str 1)
-		    str))))
-
-    ;; No file names. Behave unchanged.
-    ad-do-it))
-
-;; Activate advice.  Recent Emacsen don't need that.
-(when (functionp 'PC-do-completion)
-  (condition-case nil
-      (substitute-in-file-name "C$/")
-    (error
-     (ad-activate 'PC-do-completion))))
-
 (provide 'tramp-smb)
 
 ;;; TODO:
--- a/lisp/net/tramp-util.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/net/tramp-util.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,9 +1,9 @@
 ;;; -*- coding: iso-2022-7bit; -*-
 ;;; tramp-util.el --- Misc utility functions to use with Tramp
 
-;; Copyright (C) 2001  Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
-;; Author: Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+;; Author: kai.grossjohann@gmx.net
 ;; Keywords: comm, extensions, processes
 
 ;; This file is free software; you can redistribute it and/or modify
@@ -32,6 +32,60 @@
 (require 'compile)
 (require 'tramp)
 
+;; Define a Tramp minor mode. It's intention is to redefine some keys for Tramp
+;; specific functions, like compilation.
+;; The key remapping works since Emacs 21.4 only. Unknown for XEmacs.
+
+(when (fboundp 'define-minor-mode)
+
+  (defvar tramp-minor-mode-map (make-sparse-keymap)
+    "Keymap for Tramp minor mode.")
+
+  (define-minor-mode tramp-minor-mode "Tramp minor mode for utility functions."
+    :group 'tramp
+    :global nil
+    :init-value nil
+    :lighter " Tramp"
+    :keymap tramp-minor-mode-map
+    (setq tramp-minor-mode
+	  (and tramp-minor-mode (tramp-tramp-file-p default-directory))))
+
+  (add-hook 'find-file-hooks 'tramp-minor-mode t)
+  (add-hook 'dired-mode-hook 'tramp-minor-mode t)
+
+  (defun tramp-remap-command (old-command new-command)
+    "Replaces bindings of OLD-COMMAND by NEW-COMMAND.
+If remapping functionality for keymaps is defined, this happens for all
+bindings.  Otherwise, only bindings active during invocation are taken
+into account.  XEmacs menubar bindings are not changed by this."
+    (if (functionp 'command-remapping)
+	;; Emacs 21.4
+	(eval
+	 `(define-key tramp-minor-mode-map [remap ,old-command] new-command))
+      ;; previous Emacs 21 versions.
+      (mapcar
+       '(lambda (x)
+	  (define-key tramp-minor-mode-map x new-command))
+       (where-is-internal old-command))))
+
+  (tramp-remap-command 'compile 'tramp-compile)
+  (tramp-remap-command 'recompile 'tramp-recompile)
+
+  ;; XEmacs has an own mimic for menu entries
+  (when (fboundp 'add-menu-button)
+    (funcall 'add-menu-button
+     '("Tools" "Compile")
+     ["Compile..."
+      (command-execute (if tramp-minor-mode 'tramp-compile 'compile))
+      :active (fboundp 'compile)])
+    (funcall 'add-menu-button
+     '("Tools" "Compile")
+     ["Repeat Compilation"
+      (command-execute (if tramp-minor-mode 'tramp-recompile 'recompile))
+      :active (fboundp 'compile)])))
+
+;; Utility functions.
+
 (defun tramp-compile (command)
   "Compile on remote host."
   (interactive
@@ -49,6 +103,16 @@
       (setq default-directory d)))
   (tramp-handle-shell-command command (get-buffer "*Compilation*"))
   (pop-to-buffer (get-buffer "*Compilation*"))
+  (tramp-minor-mode 1)
+  (compilation-minor-mode 1))
+
+(defun tramp-recompile ()
+  "Re-compile on remote host."
+  (interactive)
+  (save-some-buffers (not compilation-ask-about-save) nil)
+  (tramp-handle-shell-command compile-command (get-buffer "*Compilation*"))
+  (pop-to-buffer (get-buffer "*Compilation*"))
+  (tramp-minor-mode 1)
   (compilation-minor-mode 1))
 
 (provide 'tramp-util)
--- a/lisp/net/tramp-vc.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/net/tramp-vc.el	Thu Feb 03 23:28:36 2005 +0000
@@ -130,7 +130,8 @@
 	(save-excursion
 	  (save-window-excursion
 	    ;; Actually execute remote command
-	    (shell-command
+	    ;; `shell-command' cannot be used; it isn't magic in XEmacs.
+	    (tramp-handle-shell-command
 	     (mapconcat 'tramp-shell-quote-argument
 			(cons command squeezed) " ") t)
 	    ;;(tramp-wait-for-output)
@@ -190,7 +191,8 @@
       (let ((w32-quote-process-args t))
         (when (eq okstatus 'async)
           (message "Tramp doesn't do async commands, running synchronously."))
-        (setq status (shell-command
+	;; `shell-command' cannot be used; it isn't magic in XEmacs.
+        (setq status (tramp-handle-shell-command
                       (mapconcat 'tramp-shell-quote-argument
                                  (cons command squeezed) " ") t))
         (when (or (not (integerp status))
@@ -285,7 +287,8 @@
 	(save-excursion
 	  (save-window-excursion
 	    ;; Actually execute remote command
-	    (shell-command
+	    ;; `shell-command' cannot be used; it isn't magic in XEmacs.
+	    (tramp-handle-shell-command
 	     (mapconcat 'tramp-shell-quote-argument
 			(append (list command) args (list localname)) " ")
 	     (get-buffer-create"*vc-info*"))
--- a/lisp/net/tramp.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/net/tramp.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,7 +1,7 @@
 ;;; -*- mode: Emacs-Lisp; coding: iso-2022-7bit; -*-
 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol
 
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 ;; Author: kai.grossjohann@gmx.net
 ;; Keywords: comm, processes
@@ -912,6 +912,15 @@
   :group 'tramp
   :type 'regexp)
 
+(defcustom tramp-operation-not-permitted-regexp
+  (concat "\\(" "preserving times.*" "\\|" "set mode" "\\)" ":\\s-*"
+	  (regexp-opt '("Operation not permitted") t))
+  "Regular expression matching keep-date problems in (s)cp operations.
+Copying has been performed successfully already, so this message can
+be ignored safely."
+  :group 'tramp
+  :type 'regexp)
+
 (defcustom tramp-process-alive-regexp
   ""
   "Regular expression indicating a process has finished.
@@ -2500,7 +2509,7 @@
 		 (fa2 (file-attributes file2)))
 	     (if (and (not (equal (nth 5 fa1) '(0 0)))
 		      (not (equal (nth 5 fa2) '(0 0))))
-		 (< 0 (tramp-time-diff (nth 5 fa1) (nth 5 fa2)))
+		 (> 0 (tramp-time-diff (nth 5 fa2) (nth 5 fa1)))
 	       ;; If one of them is the dont-know value, then we can
 	       ;; still try to run a shell command on the remote host.
 	       ;; However, this only works if both files are Tramp
@@ -2822,10 +2831,8 @@
   ;; At least one file a tramp file?
   (if (or (tramp-tramp-file-p filename)
           (tramp-tramp-file-p newname))
-      (let ((modes (file-modes filename)))
-	(tramp-do-copy-or-rename-file
-	 'copy filename newname ok-if-already-exists keep-date)
-	(set-file-modes newname modes))
+      (tramp-do-copy-or-rename-file
+       'copy filename newname ok-if-already-exists keep-date)
     (tramp-run-real-handler
      'copy-file
      (list filename newname ok-if-already-exists keep-date))))
@@ -2973,8 +2980,9 @@
       (when keep-date
 	(when (and (not (null modtime))
 		   (not (equal modtime '(0 0))))
-	  (tramp-touch newname modtime))
-	(set-file-modes newname (file-modes filename))))
+	  (tramp-touch newname modtime)))
+      ;; Set the mode.
+      (set-file-modes newname (file-modes filename)))
     ;; If the operation was `rename', delete the original file.
     (unless (eq op 'copy)
       (delete-file filename))))
@@ -2994,15 +3002,34 @@
                        "Unknown operation `%s', must be `copy' or `rename'"
                        op)))))
     (save-excursion
-      (tramp-barf-unless-okay
+      (tramp-send-command
        multi-method method user host
        (format "%s %s %s"
                cmd
                (tramp-shell-quote-argument localname1)
-               (tramp-shell-quote-argument localname2))
-       nil 'file-error
-       "Copying directly failed, see buffer `%s' for details."
-       (buffer-name)))))
+               (tramp-shell-quote-argument localname2)))
+      (tramp-wait-for-output)
+      (goto-char (point-min))
+      (unless
+	  (or
+	   (and (eq op 'copy) keep-date
+		;; Mask cp -f error.
+		(re-search-forward tramp-operation-not-permitted-regexp nil t))
+	   (zerop (tramp-send-command-and-check
+		   multi-method method user host nil nil)))
+	(pop-to-buffer (current-buffer))
+	(signal 'file-error
+		(format "Copying directly failed, see buffer `%s' for details."
+			(buffer-name)))))
+    ;; Set the mode.
+    ;; CCC: Maybe `chmod --reference=localname1 localname2' could be used
+    ;;      where available?
+    (unless (or (eq op 'rename) keep-date)
+      (set-file-modes
+       (tramp-make-tramp-file-name multi-method method user host localname2)
+       (file-modes
+	(tramp-make-tramp-file-name
+	 multi-method method user host localname1))))))
 
 (defun tramp-do-copy-or-rename-file-out-of-band (op filename newname keep-date)
   "Invoke rcp program to copy.
@@ -3122,7 +3149,11 @@
 			       tramp-actions-copy-out-of-band))
       (kill-buffer trampbuf)
       (tramp-message
-       5 "Transferring %s to file %s...done" filename newname))
+       5 "Transferring %s to file %s...done" filename newname)
+
+      ;; Set the mode.
+      (unless keep-date
+	(set-file-modes newname (file-modes filename))))
 
     ;; If the operation was `rename', delete the original file.
     (unless (eq op 'copy)
@@ -4074,7 +4105,9 @@
      (if (bufferp (nth 0 args)) (nth 0 args) (current-buffer))))
    ; COMMAND
    ((member operation
-	    (list 'dired-call-process 'shell-command
+	    (list 'dired-call-process-command
+                  ; Emacs only
+		  'shell
                   ; Post Emacs 21.3 only
                   'process-file
 	          ; XEmacs only
@@ -4908,7 +4941,10 @@
 
 (defun tramp-get-buffer (multi-method method user host)
   "Get the connection buffer to be used for USER at HOST using METHOD."
-  (get-buffer-create (tramp-buffer-name multi-method method user host)))
+  (with-current-buffer
+      (get-buffer-create (tramp-buffer-name multi-method method user host))
+    (setq buffer-undo-list t)
+    (current-buffer)))
 
 (defun tramp-debug-buffer-name (multi-method method user host)
   "A name for the debug buffer for USER at HOST using METHOD."
@@ -4922,7 +4958,11 @@
 
 (defun tramp-get-debug-buffer (multi-method method user host)
   "Get the debug buffer for USER at HOST using METHOD."
-  (get-buffer-create (tramp-debug-buffer-name multi-method method user host)))
+  (with-current-buffer
+      (get-buffer-create
+       (tramp-debug-buffer-name multi-method method user host))
+    (setq buffer-undo-list t)
+    (current-buffer)))
 
 (defun tramp-find-executable (multi-method method user host
                                          progname dirlist ignore-tilde)
@@ -5214,8 +5254,16 @@
 	((or (and (memq (process-status p) '(stop exit))
 		  (not (zerop (process-exit-status p))))
 	     (memq (process-status p) '(signal)))
-	 (tramp-message 9 "Process has died.")
-	 (throw 'tramp-action 'process-died))
+	 ;; `scp' could have copied correctly, but set modes could have failed.
+	 ;; This can be ignored.
+	 (goto-char (point-min))
+	 (if (re-search-forward tramp-operation-not-permitted-regexp nil t)
+	     (progn
+	       (tramp-message 10 "'set mode' error ignored.")
+	       (tramp-message 9 "Process has finished.")
+	       (throw 'tramp-action 'ok))
+	   (tramp-message 9 "Process has died.")
+	   (throw 'tramp-action 'process-died)))
 	(t nil)))
 
 ;; The following functions are specifically for multi connections.
@@ -6336,7 +6384,7 @@
       (save-excursion
 	(goto-char start-point)
 	(when (looking-at (regexp-quote tramp-last-cmd))
-	  (delete-region (point) (forward-line 1)))))
+	  (delete-region (point) (progn (forward-line 1) (point))))))
     ;; Add output to debug buffer if appropriate.
     (when tramp-debug-buffer
       (append-to-buffer
--- a/lisp/net/trampver.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/net/trampver.el	Thu Feb 03 23:28:36 2005 +0000
@@ -30,7 +30,7 @@
 ;; are auto-frobbed from configure.ac, so you should edit that file and run
 ;; "autoconf && ./configure" to change them.
 
-(defconst tramp-version "2.0.46"
+(defconst tramp-version "2.0.47"
   "This version of Tramp.")
 
 (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org"
--- a/lisp/pcomplete.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/pcomplete.el	Thu Feb 03 23:28:36 2005 +0000
@@ -946,8 +946,10 @@
 (unless (fboundp 'event-matches-key-specifier-p)
   (defalias 'event-matches-key-specifier-p 'eq))
 
-(unless (fboundp 'read-event)
-  (defsubst read-event (&optional prompt)
+(if (fboundp 'read-event)
+    (defsubst pcomplete-read-event (&optional prompt)
+      (read-event prompt))
+  (defsubst pcomplete-read-event (&optional prompt)
     (aref (read-key-sequence prompt) 0)))
 
 (unless (fboundp 'event-basic-type)
@@ -969,7 +971,7 @@
       (prog1
 	  (catch 'done
 	    (while (with-current-buffer (get-buffer "*Completions*")
-		     (setq event (read-event)))
+		     (setq event (pcomplete-read-event)))
 	      (cond
 	       ((event-matches-key-specifier-p event ? )
 		(set-window-configuration pcomplete-last-window-config)
--- a/lisp/play/decipher.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/play/decipher.el	Thu Feb 03 23:28:36 2005 +0000
@@ -305,7 +305,8 @@
       (setq case-fold-search nil))      ;Case is significant when searching
   (use-local-map decipher-mode-map)
   (set-syntax-table decipher-mode-syntax-table)
-  (decipher-read-alphabet)
+  (unless (= (point-min) (point-max))
+    (decipher-read-alphabet))
   (set (make-local-variable 'font-lock-defaults)
        '(decipher-font-lock-keywords t))
   ;; Make the buffer writable when we exit Decipher mode:
--- a/lisp/progmodes/compile.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/progmodes/compile.el	Thu Feb 03 23:28:36 2005 +0000
@@ -985,8 +985,9 @@
 	  (setq mode-line-process ":run")
 	  (force-mode-line-update)
 	  (sit-for 0)			; Force redisplay
-	  (let ((status (call-process shell-file-name nil outbuf nil "-c"
-				      command)))
+	  (let* ((buffer-read-only nil)	; call-process needs to modify outbuf
+		 (status (call-process shell-file-name nil outbuf nil "-c"
+				       command)))
 	    (cond ((numberp status)
 		   (compilation-handle-exit 'exit status
 					    (if (zerop status)
@@ -1003,6 +1004,7 @@
 	  ;; fontified, so fontify it now.
 	  (let ((font-lock-verbose nil)) ; shut up font-lock messages
 	    (font-lock-fontify-buffer))
+	  (set-buffer-modified-p nil)
 	  (message "Executing `%s'...done" command)))
       ;; Now finally cd to where the shell started make/grep/...
       (setq default-directory thisdir))
--- a/lisp/progmodes/ebrowse.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/progmodes/ebrowse.el	Thu Feb 03 23:28:36 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/gdb-ui.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/progmodes/gdb-ui.el	Thu Feb 03 23:28:36 2005 +0000
@@ -33,24 +33,34 @@
 ;; Emacs 21 such as the fringe/display margin for breakpoints, and the toolbar
 ;; (see the GDB Graphical Interface section in the Emacs info manual).
 
-;; Start the debugger with M-x gdba.
+;; By default, M-x gdb will start the debugger. However, if you have customised
+;; gud-gdb-command-name, then start it with M-x gdba.
 
-;; This file has evolved from gdba.el from GDB 5.0 written by Tom Lord and Jim
-;; Kingdon and uses GDB's annotation interface.  You don't need to know about
-;; annotations to use this mode as a debugger, but if you are interested
-;; developing the mode itself, then see the Annotations section in the GDB
-;; info manual.
+;; This file has evolved from gdba.el that was included with GDB 5.0 and
+;; written by Tom Lord and Jim Kingdon.  It uses GDB's annotation interface.
+;; You don't need to know about annotations to use this mode as a debugger,
+;; but if you are interested developing the mode itself, then see the
+;; Annotations section in the GDB info manual.
 ;;
 ;; GDB developers plan to make the annotation interface obsolete.  A new
 ;; interface called GDB/MI (machine interface) has been designed to replace
 ;; it.  Some GDB/MI commands are used in this file through the CLI command
-;; 'interpreter mi <mi-command>'.  A file called gdb-mi.el is included in the
-;; GDB repository for future releases (6.2 onwards) that uses GDB/MI as the
-;; primary interface to GDB.  It is still under development and is part of a
-;; process to migrate Emacs from annotations to GDB/MI.
+;; 'interpreter mi <mi-command>'.  A file called gdb-mi.el is included with
+;; GDB (6.2 onwards) that uses GDB/MI as the primary interface to GDB.  It is
+;; still under development and is part of a process to migrate Emacs from
+;; annotations to GDB/MI.
 ;;
 ;; Known Bugs:
 ;;
+;; TODO:
+;; 1) Use MI command -data-read-memory for memory window.
+;; 2) Highlight changed register values (use MI commands
+;;    -data-list-register-values and -data-list-changed-registers instead
+;;    of 'info registers'.
+;; 3) Use tree-widget.el instead of the speedbar for watch-expressions?
+;; 4) Mark breakpoint locations on scroll-bar of source buffer?
+;; 5) After release of 21.4 use '-var-list-children --all-values'
+;;    and '-stack-list-locals 2' which need GDB 6.1 onwards.
 
 ;;; Code:
 
@@ -58,6 +68,7 @@
 
 (defvar gdb-current-address "main" "Initialisation for Assembler buffer.")
 (defvar gdb-previous-address nil)
+(defvar gdb-memory-address "main")
 (defvar gdb-previous-frame nil)
 (defvar gdb-current-frame nil)
 (defvar gdb-current-stack-level nil)
@@ -169,13 +180,13 @@
 (defvar gdb-debug-log nil)
 
 (defcustom gdb-enable-debug-log nil
- "Non-nil means record the process input and output in `gdb-debug-log'."
+  "Non-nil means record the process input and output in `gdb-debug-log'."
   :type 'boolean
   :group 'gud
   :version "21.4")
 
 (defcustom gdb-use-inferior-io-buffer nil
- "Non-nil means display output from the inferior in a separate buffer."
+  "Non-nil means display output from the inferior in a separate buffer."
   :type 'boolean
   :group 'gud
   :version "21.4")
@@ -210,15 +221,20 @@
 	   "\C-u" "Continue to current line or address.")
 
   (define-key gud-minor-mode-map [left-margin mouse-1]
-    'gdb-mouse-toggle-breakpoint)
+    'gdb-mouse-set-clear-breakpoint)
   (define-key gud-minor-mode-map [left-fringe mouse-1]
+    'gdb-mouse-set-clear-breakpoint)
+  (define-key gud-minor-mode-map [left-margin mouse-3]
     'gdb-mouse-toggle-breakpoint)
+;  (define-key gud-minor-mode-map [left-fringe mouse-3]
+;    'gdb-mouse-toggle-breakpoint)
 
   (setq comint-input-sender 'gdb-send)
   ;;
   ;; (re-)initialize
   (setq gdb-current-address "main")
   (setq gdb-previous-address nil)
+  (setq gdb-memory-address "main")
   (setq gdb-previous-frame nil)
   (setq gdb-current-frame nil)
   (setq gdb-current-stack-level nil)
@@ -273,15 +289,8 @@
 	     `(lambda () (gdb-var-create-handler ,expr))))))
   (select-window (get-buffer-window gud-comint-buffer 0)))
 
-(defun gdb-goto-info ()
-  "Go to Emacs info node: GDB Graphical Interface."
-  (interactive)
-  (select-frame (make-frame))
-  (require 'info)
-  (Info-goto-node "(emacs)GDB Graphical Interface"))
-
 (defconst gdb-var-create-regexp
-"name=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\",type=\"\\(.*?\\)\"")
+  "name=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\",type=\"\\(.*?\\)\"")
 
 (defun gdb-var-create-handler (expr)
   (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
@@ -328,7 +337,7 @@
 	     `(lambda () (gdb-var-list-children-handler ,varnum)))))
 
 (defconst gdb-var-list-children-regexp
-"name=\"\\(.*?\\)\",exp=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\"")
+  "name=\"\\(.*?\\)\",exp=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\"")
 
 (defun gdb-var-list-children-handler (varnum)
   (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
@@ -832,6 +841,7 @@
 	(gdb-invalidate-breakpoints)
 	(gdb-invalidate-assembler)
 	(gdb-invalidate-registers)
+	(gdb-invalidate-memory)
 	(gdb-invalidate-locals)
 	(gdb-invalidate-threads)
 	(unless (eq system-type 'darwin) ;Breaks on Darwin's GDB-5.3.
@@ -1038,7 +1048,8 @@
 
 (defvar gdb-cdir nil "Compilation directory.")
 
-(defconst breakpoint-xpm-data "/* XPM */
+(defconst breakpoint-xpm-data
+  "/* XPM */
 static char *magick[] = {
 /* columns rows colors chars-per-pixel */
 \"10 10 2 1\",
@@ -1059,7 +1070,7 @@
   "XPM data used for breakpoint icon.")
 
 (defconst breakpoint-enabled-pbm-data
-"P1
+  "P1
 10 10\",
 0 0 0 0 1 1 1 1 0 0 0 0
 0 0 0 1 1 1 1 1 1 0 0 0
@@ -1074,7 +1085,7 @@
   "PBM data used for enabled breakpoint icon.")
 
 (defconst breakpoint-disabled-pbm-data
-"P1
+  "P1
 10 10\",
 0 0 1 0 1 0 1 0 0 0
 0 1 0 1 0 1 0 1 0 0
@@ -1116,8 +1127,7 @@
 
 ;;-put breakpoint icons in relevant margins (even those set in the GUD buffer)
 (defun gdb-info-breakpoints-custom ()
-  (let ((flag))
-    ;;
+  (let ((flag) (bptno))
     ;; remove all breakpoint-icons in source buffers but not assembler buffer
     (dolist (buffer (buffer-list))
       (with-current-buffer buffer
@@ -1131,12 +1141,13 @@
 	  (forward-line 1)
 	  (if (looking-at "[^\t].*breakpoint")
 	      (progn
-		(looking-at "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)")
-		(setq flag (char-after (match-beginning 1)))
+		(looking-at "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)")
+		(setq bptno (match-string 1))
+		(setq flag (char-after (match-beginning 2)))
 		(beginning-of-line)
-		(if (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t)
+		(if (re-search-forward "in.*at\\s-+" nil t)
 		    (progn
-		      (looking-at "\\(\\S-*\\):\\([0-9]+\\)")
+		      (looking-at "\\(\\S-+\\):\\([0-9]+\\)")
 		      (let ((line (match-string 2)) (buffer-read-only nil)
 			    (file (match-string 1)))
 			(add-text-properties (point-at-bol) (point-at-eol)
@@ -1153,12 +1164,12 @@
 			  ;; only want one breakpoint icon at each location
 			  (save-excursion
 			    (goto-line (string-to-number line))
-			    (gdb-put-breakpoint-icon (eq flag ?y)))))))))
+			    (gdb-put-breakpoint-icon (eq flag ?y) bptno))))))))
 	  (end-of-line)))))
   (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom)))
 
-(defun gdb-mouse-toggle-breakpoint (event)
-  "Toggle breakpoint in left fringe/margin with mouse click."
+(defun gdb-mouse-set-clear-breakpoint (event)
+  "Set/clear breakpoint in left fringe/margin with mouse click."
   (interactive "e")
   (mouse-minibuffer-check event)
   (let ((posn (event-end event)))
@@ -1172,6 +1183,31 @@
 		(gud-remove nil)
 	      (gud-break nil)))))))
 
+(defun gdb-mouse-toggle-breakpoint (event)
+  "Enable/disable breakpoint in left fringe/margin with mouse click."
+  (interactive "e")
+  (mouse-minibuffer-check event)
+  (let ((posn (event-end event)))
+    (if (numberp (posn-point posn))
+	(with-selected-window (posn-window posn)
+	  (save-excursion
+	    (goto-char (posn-point posn))
+	    (if 
+;		(or
+		 (posn-object posn)
+;		 (eq (car (fringe-bitmaps-at-pos (posn-point posn)))
+;		     'breakpoint))
+		(gdb-enqueue-input
+		 (list
+		  (let ((bptno (get-text-property
+				0 'gdb-bptno (car (posn-string posn)))))
+		    (concat
+			    (if (get-text-property
+				 0 'gdb-enabled (car (posn-string posn)))
+				"disable "
+			      "enable ")
+			    bptno "\n")) 'ignore))))))))
+
 (defun gdb-breakpoints-buffer-name ()
   (with-current-buffer gud-comint-buffer
     (concat "*breakpoints of " (gdb-get-target-string) "*")))
@@ -1209,7 +1245,7 @@
     (define-key map "d" 'gdb-delete-breakpoint)
     (define-key map "q" 'kill-this-buffer)
     (define-key map "\r" 'gdb-goto-breakpoint)
-    (define-key map [mouse-2] 'gdb-mouse-goto-breakpoint)
+    (define-key map [mouse-2] 'gdb-goto-breakpoint)
     map))
 
 (defun gdb-breakpoints-mode ()
@@ -1227,7 +1263,7 @@
     'gdbmi-invalidate-breakpoints))
 
 (defun gdb-toggle-breakpoint ()
-  "Enable/disable the breakpoint at current line."
+  "Enable/disable breakpoint at current line."
   (interactive)
   (save-excursion
     (beginning-of-line 1)
@@ -1257,13 +1293,14 @@
 	(concat gdb-server-prefix "delete " (match-string 1) "\n") 'ignore))
     (error "Not recognized as break/watchpoint line")))
 
-(defun gdb-goto-breakpoint ()
+(defun gdb-goto-breakpoint (&optional event)
   "Display the breakpoint location specified at current line."
-  (interactive)
+  (interactive (list last-input-event))
+  (if event (mouse-set-point event))
   (save-excursion
     (beginning-of-line 1)
     (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
-	    (looking-at ".*in\\s-+\\S-+\\s-+at\\s-+\\(\\S-*\\):\\([0-9]+\\)")
+	    (looking-at ".*in.*at\\s-+\\(\\S-*\\):\\([0-9]+\\)")
 	  (looking-at
      "[0-9]+\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)"))
 	(let ((line (match-string 2))
@@ -1277,14 +1314,8 @@
 		(goto-line (string-to-number line))
 		(set-window-point window (point))))))
       (error "Not recognized as break/watchpoint line"))))
+
 
-(defun gdb-mouse-goto-breakpoint (event)
-  "Display the breakpoint location that you click on."
-  (interactive "e")
-  (mouse-set-point event)
-  (gdb-goto-breakpoint))
-
-;;
 ;; Frames buffer.  This displays a perpetually correct bactracktrace
 ;; (from the command `where').
 ;;
@@ -1338,7 +1369,7 @@
     (suppress-keymap map)
     (define-key map "q" 'kill-this-buffer)
     (define-key map "\r" 'gdb-frames-select)
-    (define-key map [mouse-2] 'gdb-frames-mouse-select)
+    (define-key map [mouse-2] 'gdb-frames-select)
     map))
 
 (defun gdb-frames-mode ()
@@ -1362,20 +1393,15 @@
 	   (n (or (and pos (match-string-no-properties 1)) "0")))
       n)))
 
-(defun gdb-frames-select ()
+(defun gdb-frames-select (&optional event)
   "Select the frame and display the relevant source."
-  (interactive)
+  (interactive (list last-input-event))
+  (if event (mouse-set-point event))
   (gdb-enqueue-input
    (list (concat gdb-server-prefix "frame " (gdb-get-frame-number) "\n") 'ignore))
   (gud-display-frame))
+
 
-(defun gdb-frames-mouse-select (event)
-  "Select the frame you click on and display the relevant source."
-  (interactive "e")
-  (mouse-set-point event)
-  (gdb-frames-select))
-
-;;
 ;; Threads buffer.  This displays a selectable thread list.
 ;;
 (gdb-set-buffer-rules 'gdb-threads-buffer
@@ -1420,7 +1446,7 @@
     (suppress-keymap map)
     (define-key map "q" 'kill-this-buffer)
     (define-key map "\r" 'gdb-threads-select)
-    (define-key map [mouse-2] 'gdb-threads-mouse-select)
+    (define-key map [mouse-2] 'gdb-threads-select)
     map))
 
 (defun gdb-threads-mode ()
@@ -1440,20 +1466,15 @@
     (re-search-backward "^\\s-*\\([0-9]*\\)" nil t)
     (match-string-no-properties 1)))
 
-(defun gdb-threads-select ()
+(defun gdb-threads-select (&optional event)
   "Select the thread and display the relevant source."
-  (interactive)
+  (interactive (list last-input-event))
+  (if event (mouse-set-point event))
   (gdb-enqueue-input
    (list (concat "thread " (gdb-get-thread-number) "\n") 'ignore))
   (gud-display-frame))
+
 
-(defun gdb-threads-mouse-select (event)
-  "Select the thread you click on and display the relevant source."
-  (interactive "e")
-  (mouse-set-point event)
-  (gdb-threads-select))
-
-;;
 ;; Registers buffer.
 ;;
 (gdb-set-buffer-rules 'gdb-registers-buffer
@@ -1502,8 +1523,268 @@
   (let ((special-display-regexps (append special-display-regexps '(".*")))
 	(special-display-frame-alist gdb-frame-parameters))
     (display-buffer (gdb-get-create-buffer 'gdb-registers-buffer))))
+
+;; Memory buffer.
+;;
+(defcustom gdb-memory-repeat-count 32
+  "Number of data items in memory window."
+  :type 'integer
+  :group 'gud
+  :version "21.4")
+
+(defcustom gdb-memory-format "x"
+  "Display format of data items in memory window."
+  :type '(choice (const :tag "Hexadecimal" "x")
+	 	 (const :tag "Signed decimal" "d")
+	 	 (const :tag "Unsigned decimal" "u")
+		 (const :tag "Octal" "o")
+		 (const :tag "Binary" "t"))
+  :group 'gud
+  :version "21.4")
+
+(defcustom gdb-memory-unit "w"
+  "Unit size of data items in memory window."
+  :type '(choice (const :tag "Byte" "b")
+		 (const :tag "Halfword" "h")
+		 (const :tag "Word" "w")
+		 (const :tag "Giant word" "g"))
+  :group 'gud
+  :version "21.4")
+
+(gdb-set-buffer-rules 'gdb-memory-buffer
+		      'gdb-memory-buffer-name
+		      'gdb-memory-mode)
+
+(def-gdb-auto-updated-buffer gdb-memory-buffer
+  gdb-invalidate-memory
+  (concat gdb-server-prefix "x/" (number-to-string gdb-memory-repeat-count)
+	  gdb-memory-format gdb-memory-unit " " gdb-memory-address "\n")
+  gdb-read-memory-handler
+  gdb-read-memory-custom)
+
+(defun gdb-read-memory-custom ())
+
+(defvar gdb-memory-mode-map
+  (let ((map (make-sparse-keymap)))
+    (suppress-keymap map)
+    (define-key map "q" 'kill-this-buffer)
+     map))
+
+(defun gdb-memory-set-address (event)
+  "Set the start memory address."
+  (interactive "e")
+  (save-selected-window
+    (select-window (posn-window (event-start event)))
+    (let ((arg (read-from-minibuffer "Memory address: ")))
+      (setq gdb-memory-address arg))
+    (gdb-invalidate-memory)))
+
+(defun gdb-memory-set-repeat-count (event)
+  "Set the number of data items in memory window."
+  (interactive "e")
+  (save-selected-window
+    (select-window (posn-window (event-start event)))
+    (let* ((arg (read-from-minibuffer "Repeat count: "))
+	  (count (string-to-int arg)))
+      (if (< count 0)
+	  (error "Non-negative numbers only")
+	(customize-set-variable 'gdb-memory-repeat-count count)
+	(gdb-invalidate-memory)))))
+
+(defun gdb-memory-format-binary ()
+  "Set the display format to binary."
+  (interactive)
+  (customize-set-variable 'gdb-memory-format "t")
+  (gdb-invalidate-memory))
+
+(defun gdb-memory-format-octal ()
+  "Set the display format to octal."
+  (interactive)
+  (customize-set-variable 'gdb-memory-format "o")
+  (gdb-invalidate-memory))
+
+(defun gdb-memory-format-unsigned ()
+  "Set the display format to unsigned decimal."
+  (interactive)
+  (customize-set-variable 'gdb-memory-format "u")
+  (gdb-invalidate-memory))
+
+(defun gdb-memory-format-signed ()
+  "Set the display format to decimal."
+  (interactive)
+  (customize-set-variable 'gdb-memory-format "d")
+  (gdb-invalidate-memory))
+
+(defun gdb-memory-format-hexadecimal ()
+  "Set the display format to hexadecimal."
+  (interactive)
+  (customize-set-variable 'gdb-memory-format "x")
+  (gdb-invalidate-memory))
+
+(defvar gdb-memory-format-keymap
+  (let ((map (make-sparse-keymap)))
+    (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1)
+    map)
+ "Keymap to select format in the header line.")
+
+(defvar gdb-memory-format-menu (make-sparse-keymap "Format")
+ "Menu of display formats in the header line.")
+
+(define-key gdb-memory-format-menu [binary]
+  '(menu-item "Binary" gdb-memory-format-binary
+	      :button (:radio . (equal gdb-memory-format "t"))))
+(define-key gdb-memory-format-menu [octal]
+  '(menu-item "Octal" gdb-memory-format-octal
+	      :button (:radio . (equal gdb-memory-format "o"))))
+(define-key gdb-memory-format-menu [unsigned]
+  '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned
+	      :button (:radio . (equal gdb-memory-format "u"))))
+(define-key gdb-memory-format-menu [signed]
+  '(menu-item "Signed Decimal" gdb-memory-format-signed
+	      :button (:radio . (equal gdb-memory-format "d"))))
+(define-key gdb-memory-format-menu [hexadecimal]
+  '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal
+	      :button (:radio . (equal gdb-memory-format "x"))))
+
+(defun gdb-memory-format-menu (event)
+  (interactive "@e")
+  (x-popup-menu event gdb-memory-format-menu))
+
+(defun gdb-memory-format-menu-1 (event)
+  (interactive "e")
+  (save-selected-window
+    (select-window (posn-window (event-start event)))
+    (let* ((selection (gdb-memory-format-menu event))
+	   (binding (and selection (lookup-key gdb-memory-format-menu
+					       (vector (car selection))))))
+      (if binding (call-interactively binding)))))
+
+(defun gdb-memory-unit-giant ()
+  "Set the unit size to giant words (eight bytes)."
+  (interactive)
+  (customize-set-variable 'gdb-memory-unit "g")
+  (gdb-invalidate-memory))
+
+(defun gdb-memory-unit-word ()
+  "Set the unit size to words (four bytes)."
+  (interactive)
+  (customize-set-variable 'gdb-memory-unit "w")
+  (gdb-invalidate-memory))
+
+(defun gdb-memory-unit-halfword ()
+  "Set the unit size to halfwords (two bytes)."
+  (interactive)
+  (customize-set-variable 'gdb-memory-unit "h")
+  (gdb-invalidate-memory))
+
+(defun gdb-memory-unit-byte ()
+  "Set the unit size to bytes."
+  (interactive)
+  (customize-set-variable 'gdb-memory-unit "b")
+  (gdb-invalidate-memory))
+
+(defvar gdb-memory-unit-keymap
+  (let ((map (make-sparse-keymap)))
+    (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1)
+    map)
+ "Keymap to select units in the header line.")
+
+(defvar gdb-memory-unit-menu (make-sparse-keymap "Unit")
+ "Menu of units in the header line.")
+
+(define-key gdb-memory-unit-menu [giantwords]
+  '(menu-item "Giant words" gdb-memory-unit-giant
+	      :button (:radio . (equal gdb-memory-unit "g"))))
+(define-key gdb-memory-unit-menu [words]
+  '(menu-item "Words" gdb-memory-unit-word
+	      :button (:radio . (equal gdb-memory-unit "w"))))
+(define-key gdb-memory-unit-menu [halfwords]
+  '(menu-item "Halfwords" gdb-memory-unit-halfword
+	      :button (:radio . (equal gdb-memory-unit "h"))))
+(define-key gdb-memory-unit-menu [bytes]
+  '(menu-item "Bytes" gdb-memory-unit-byte
+	      :button (:radio . (equal gdb-memory-unit "b"))))
+
+(defun gdb-memory-unit-menu (event)
+  (interactive "@e")
+  (x-popup-menu event gdb-memory-unit-menu))
+
+(defun gdb-memory-unit-menu-1 (event)
+  (interactive "e")
+  (save-selected-window
+    (select-window (posn-window (event-start event)))
+    (let* ((selection (gdb-memory-unit-menu event))
+	   (binding (and selection (lookup-key gdb-memory-unit-menu
+					       (vector (car selection))))))
+      (if binding (call-interactively binding)))))
+
+;;from make-mode-line-mouse-map
+(defun gdb-make-header-line-mouse-map (mouse function) "\
+Return a keymap with single entry for mouse key MOUSE on the header line.
+MOUSE is defined to run function FUNCTION with no args in the buffer
+corresponding to the mode line clicked."
+  (let ((map (make-sparse-keymap)))
+    (define-key map (vector 'header-line mouse) function)
+    (define-key map (vector 'header-line 'down-mouse-1) 'ignore)
+    map))
+
+(defun gdb-memory-mode ()
+  "Major mode for examining memory.
+
+\\{gdb-memory-mode-map}"
+  (kill-all-local-variables)
+  (setq major-mode 'gdb-memory-mode)
+  (setq mode-name "Memory")
+  (setq buffer-read-only t)
+  (use-local-map gdb-memory-mode-map)
+  (setq header-line-format
+	'(:eval
+	  (concat 
+	   "Read address: "
+	   (propertize gdb-memory-address
+		       'face font-lock-warning-face
+		       'help-echo (purecopy "mouse-1: Set memory address")
+		       'local-map (purecopy (gdb-make-header-line-mouse-map
+					     'mouse-1
+					     #'gdb-memory-set-address)))
+	   "  Repeat Count: "
+	   (propertize (number-to-string gdb-memory-repeat-count)
+		       'face font-lock-warning-face
+		       'help-echo (purecopy "mouse-1: Set repeat count")
+		       'local-map (purecopy (gdb-make-header-line-mouse-map
+					     'mouse-1
+					     #'gdb-memory-set-repeat-count)))
+	   "  Display Format: "
+	   (propertize gdb-memory-format
+		       'face font-lock-warning-face
+		       'help-echo (purecopy "mouse-3: Select display format")
+		       'local-map gdb-memory-format-keymap)
+	   "  Unit Size: "
+	   (propertize gdb-memory-unit
+		       'face font-lock-warning-face
+		       'help-echo (purecopy "mouse-3: Select unit size")
+		       'local-map gdb-memory-unit-keymap))))
+  (run-mode-hooks 'gdb-memory-mode-hook)
+  'gdb-invalidate-memory)
+
+(defun gdb-memory-buffer-name ()
+  (with-current-buffer gud-comint-buffer
+    (concat "*memory of " (gdb-get-target-string) "*")))
+
+(defun gdb-display-memory-buffer ()
+  "Display memory contents."
+  (interactive)
+  (gdb-display-buffer
+   (gdb-get-create-buffer 'gdb-memory-buffer)))
+
+(defun gdb-frame-memory-buffer ()
+  "Display memory contents in a new frame."
+  (interactive)
+  (let ((special-display-regexps (append special-display-regexps '(".*")))
+	(special-display-frame-alist gdb-frame-parameters))
+    (display-buffer (gdb-get-create-buffer 'gdb-memory-buffer))))
 
-;;
+
 ;; Locals buffer.
 ;;
 (gdb-set-buffer-rules 'gdb-locals-buffer
@@ -1614,6 +1895,7 @@
     `(menu-item "GDB-Frames" ,menu :visible (eq gud-minor-mode 'gdba)))
   (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer))
   (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer))
+  (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer))
   (define-key menu [assembler] '("Machine" . gdb-frame-assembler-buffer))
   (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer))
   (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer))
@@ -1624,8 +1906,9 @@
   (define-key gud-menu-map [displays]
     `(menu-item "GDB-Windows" ,menu :visible (eq gud-minor-mode 'gdba)))
   (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer))
+  (define-key menu [threads] '("Threads" . gdb-display-threads-buffer))
+  (define-key menu [memory] '("Memory" . gdb-display-memory-buffer))
   (define-key menu [assembler] '("Machine" . gdb-display-assembler-buffer))
-  (define-key menu [threads] '("Threads" . gdb-display-threads-buffer))
   (define-key menu [registers] '("Registers" . gdb-display-registers-buffer))
   (define-key menu [locals] '("Locals" . gdb-display-locals-buffer))
   (define-key menu [frames] '("Stack" . gdb-display-stack-buffer))
@@ -1707,7 +1990,7 @@
   :version "21.4")
 
 (defun gdb-many-windows (arg)
-"Toggle the number of windows in the basic arrangement."
+  "Toggle the number of windows in the basic arrangement."
   (interactive "P")
   (setq gdb-many-windows
 	(if (null arg)
@@ -1777,14 +2060,15 @@
 PUTSTRING is displayed by putting an overlay into the current buffer with a
 `before-string' STRING that has a `display' property whose value is
 PUTSTRING."
-  (let ((gdb-string "x")
+  (let ((string (make-string 1 ?x))
 	(buffer (current-buffer)))
+    (setq putstring (copy-sequence putstring))
     (let ((overlay (make-overlay pos pos buffer))
 	  (prop (or dprop
 		    (list (list 'margin 'left-margin) putstring))))
-      (put-text-property 0 (length gdb-string) 'display prop gdb-string)
+      (put-text-property 0 (length string) 'display prop string)
       (overlay-put overlay 'put-break t)
-      (overlay-put overlay 'before-string gdb-string))))
+      (overlay-put overlay 'before-string string))))
 
 ;;from remove-images
 (defun gdb-remove-strings (start end &optional buffer)
@@ -1793,25 +2077,30 @@
 BUFFER nil or omitted means use the current buffer."
   (unless buffer
     (setq buffer (current-buffer)))
-  (let ((overlays (overlays-in start end)))
-    (while overlays
-      (let ((overlay (car overlays)))
+  (dolist (overlay (overlays-in start end))
 	(when (overlay-get overlay 'put-break)
-	  (delete-overlay overlay)))
-      (setq overlays (cdr overlays)))))
+	  (delete-overlay overlay))))
 
-(defun gdb-put-breakpoint-icon (enabled)
+(defun gdb-put-breakpoint-icon (enabled bptno)
   (let ((start (progn (beginning-of-line) (- (point) 1)))
-	(end (progn (end-of-line) (+ (point) 1))))
+	(end (progn (end-of-line) (+ (point) 1)))
+	(putstring (if enabled "B" "b")))
+    (add-text-properties
+     0 1 '(help-echo "mouse-1: set/clear bkpt, mouse-3: enable/disable bkpt")
+     putstring)
+    (if enabled (add-text-properties
+		 0 1 `(gdb-bptno ,bptno gdb-enabled t) putstring)
+      (add-text-properties
+       0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring))
     (gdb-remove-breakpoint-icons start end)
     (if (display-images-p)
 	(if (>= (car (window-fringes)) 8)
 	    (gdb-put-string
 	     nil (1+ start)
 	     `(left-fringe breakpoint
-	       ,(if enabled
-		    'breakpoint-enabled-bitmap-face
-		  'breakpoint-disabled-bitmap-face)))
+			   ,(if enabled
+				'breakpoint-enabled-bitmap-face
+			      'breakpoint-disabled-bitmap-face)))
 	  (when (< left-margin-width 2)
 	    (save-current-buffer
 	      (setq left-margin-width 2)
@@ -1838,7 +2127,9 @@
 				     (:type pbm :data
 					    ,breakpoint-disabled-pbm-data
 					    :ascent 100))))))
-	   (+ start 1) nil 'left-margin))
+	   (+ start 1)
+	   putstring
+	   'left-margin))
       (when (< left-margin-width 2)
 	(save-current-buffer
 	  (setq left-margin-width 2)
@@ -1846,7 +2137,7 @@
 	      (set-window-margins
 	       (get-buffer-window (current-buffer) 0)
 	       left-margin-width right-margin-width))))
-      (gdb-put-string (if enabled "B" "b") (1+ start)))))
+      (gdb-put-string putstring (1+ start)))))
 
 (defun gdb-remove-breakpoint-icons (start end &optional remove-margin)
   (gdb-remove-strings start end)
@@ -1875,7 +2166,7 @@
 
 (defun gdb-assembler-custom ()
   (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer))
-	(pos 1) (address) (flag))
+	(pos 1) (address) (flag) (bptno))
     (with-current-buffer buffer
       (if (not (equal gdb-current-address "main"))
 	  (progn
@@ -1897,16 +2188,17 @@
 	(if (looking-at "[^\t].*breakpoint")
 	    (progn
 	      (looking-at
-	       "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*0x\\(\\S-*\\)")
-	      (setq flag (char-after (match-beginning 1)))
-	      (setq address (match-string 2))
+	       "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)\\s-+0x\\(\\S-+\\)")
+	      (setq bptno (match-string 1))
+	      (setq flag (char-after (match-beginning 2)))
+	      (setq address (match-string 3))
 	      ;; remove leading 0s from output of info break.
 	      (if (string-match "^0+\\(.*\\)" address)
 		  (setq address (match-string 1 address)))
 	      (with-current-buffer buffer
 		  (goto-char (point-min))
 		  (if (re-search-forward address nil t)
-		      (gdb-put-breakpoint-icon (eq flag ?y))))))))
+		      (gdb-put-breakpoint-icon (eq flag ?y) bptno)))))))
     (if (not (equal gdb-current-address "main"))
 	(set-window-point (get-buffer-window buffer 0) pos))))
 
--- a/lisp/progmodes/grep.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/progmodes/grep.el	Thu Feb 03 23:28:36 2005 +0000
@@ -527,7 +527,8 @@
 easily repeat a find command."
   (interactive
    (progn
-     (unless grep-find-command
+     (unless (and grep-command
+		  (or (not grep-use-null-device) (eq grep-use-null-device t)))
        (grep-compute-defaults))
      (if grep-find-command
 	 (list (read-from-minibuffer "Run find (like this): "
@@ -541,6 +542,9 @@
     (let ((null-device nil))		; see grep
       (grep command-args))))
 
+;;;###autoload
+(defalias 'find-grep 'grep-find)
+
 (defun grep-expand-command-macros (command &optional regexp files dir excl case-fold)
   "Patch grep COMMAND replacing <D>, etc."
   (setq command
--- a/lisp/progmodes/gud.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/progmodes/gud.el	Thu Feb 03 23:28:36 2005 +0000
@@ -91,9 +91,17 @@
   "Non-nil if debuggee is running.
 Used to grey out relevant toolbar icons.")
 
+(defun gud-goto-info ()
+  "Go to relevant Emacs info node."
+  (interactive)
+  (select-frame (make-frame))
+  (require 'info)
+  (if (memq gud-minor-mode '(gdbmi gdba))
+      (Info-goto-node "(emacs)GDB Graphical Interface")
+    (Info-goto-node "(emacs)Debuggers")))
+
 (easy-mmode-defmap gud-menu-map
-  '(([help]     menu-item "Help" gdb-goto-info
-                  :enable (memq gud-minor-mode '(gdbmi gdba)))
+  '(([help]     "Info" . gud-goto-info)
     ([refresh]	"Refresh" . gud-refresh)
     ([run]	menu-item "Run" gud-run
                   :enable (and (not gud-running)
@@ -172,7 +180,7 @@
 		     (gud-nexti . "gud-ni")
 		     (gud-up . "gud-up")
 		     (gud-down . "gud-down")
-		     (gdb-goto-info . "help"))
+		     (gud-goto-info . "info"))
 		   map)
 	  (tool-bar-local-item-from-menu
 	   (car x) (cdr x) map gud-minor-mode-map)))))
--- a/lisp/progmodes/hideshow.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/progmodes/hideshow.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/progmodes/perl-mode.el	Thu Feb 03 23:28:36 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/scheme.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/progmodes/scheme.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,7 @@
 ;;; scheme.el --- Scheme (and DSSSL) editing mode
 
-;; Copyright (C) 1986, 87, 88, 97, 1998 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1987, 1988, 1997, 1998, 2005
+;;           Free Software Foundation, Inc.
 
 ;; Author: Bill Rozas <jinx@martigny.ai.mit.edu>
 ;; Adapted-by: Dave Love <d.love@dl.ac.uk>
@@ -144,6 +145,7 @@
   (setq outline-regexp ";;; \\|(....")
   (make-local-variable 'comment-start)
   (setq comment-start ";")
+  (set (make-local-variable 'comment-add) 1)
   (make-local-variable 'comment-start-skip)
   ;; Look within the line for a ; following an even number of backslashes
   ;; after either a non-backslash or the line beginning.
@@ -171,17 +173,11 @@
 
 (defvar scheme-mode-line-process "")
 
-(defvar scheme-mode-map nil
-  "Keymap for Scheme mode.
-All commands in `lisp-mode-shared-map' are inherited by this map.")
-
-(unless scheme-mode-map
-  (let ((map (make-sparse-keymap "Scheme")))
-    (setq scheme-mode-map (make-sparse-keymap))
-    (set-keymap-parent scheme-mode-map lisp-mode-shared-map)
-    (define-key scheme-mode-map [menu-bar] (make-sparse-keymap))
-    (define-key scheme-mode-map [menu-bar scheme]
-      (cons "Scheme" map))
+(defvar scheme-mode-map
+  (let ((smap (make-sparse-keymap))
+	(map (make-sparse-keymap "Scheme")))
+    (set-keymap-parent smap lisp-mode-shared-map)
+    (define-key smap [menu-bar scheme] (cons "Scheme" map))
     (define-key map [run-scheme] '("Run Inferior Scheme" . run-scheme))
     (define-key map [uncomment-region]
       '("Uncomment Out Region" . (lambda (beg end)
@@ -192,7 +188,10 @@
     (define-key map [indent-line] '("Indent Line" . lisp-indent-line))
     (put 'comment-region 'menu-enable 'mark-active)
     (put 'uncomment-region 'menu-enable 'mark-active)
-    (put 'indent-region 'menu-enable 'mark-active)))
+    (put 'indent-region 'menu-enable 'mark-active)
+    smap)
+  "Keymap for Scheme mode.
+All commands in `lisp-mode-shared-map' are inherited by this map.")
 
 ;; Used by cmuscheme
 (defun scheme-mode-commands (map)
@@ -222,14 +221,11 @@
 if that value is non-nil."
   (interactive)
   (kill-all-local-variables)
-  (scheme-mode-initialize)
-  (scheme-mode-variables)
-  (run-hooks 'scheme-mode-hook))
-
-(defun scheme-mode-initialize ()
   (use-local-map scheme-mode-map)
   (setq major-mode 'scheme-mode)
-  (setq mode-name "Scheme"))
+  (setq mode-name "Scheme")
+  (scheme-mode-variables)
+  (run-mode-hooks 'scheme-mode-hook))
 
 (defgroup scheme nil
   "Editing Scheme code"
@@ -346,7 +342,7 @@
   "Default expressions to highlight in Scheme modes.")
 
 ;;;###autoload
-(defun dsssl-mode ()
+(define-derived-mode dsssl-mode scheme-mode "DSSSL"
   "Major mode for editing DSSSL code.
 Editing commands are similar to those of `lisp-mode'.
 
@@ -357,20 +353,16 @@
 Entering this mode runs the hooks `scheme-mode-hook' and then
 `dsssl-mode-hook' and inserts the value of `dsssl-sgml-declaration' if
 that variable's value is a string."
-  (interactive)
-  (kill-all-local-variables)
-  (use-local-map scheme-mode-map)
-  (scheme-mode-initialize)
   (make-local-variable 'page-delimiter)
   (setq page-delimiter "^;;;" ; ^L not valid SGML char
 	major-mode 'dsssl-mode
 	mode-name "DSSSL")
   ;; Insert a suitable SGML declaration into an empty buffer.
+  ;; FIXME: This should use `auto-insert-alist' instead.
   (and (zerop (buffer-size))
        (stringp dsssl-sgml-declaration)
        (not buffer-read-only)
        (insert dsssl-sgml-declaration))
-  (scheme-mode-variables)
   (setq font-lock-defaults '(dsssl-font-lock-keywords
 			     nil t (("+-*/.<>=?$%_&~^:" . "w"))
 			     beginning-of-defun
@@ -378,9 +370,7 @@
   (set (make-local-variable 'imenu-case-fold-search) nil)
   (setq imenu-generic-expression dsssl-imenu-generic-expression)
   (set (make-local-variable 'imenu-syntax-alist)
-       '(("+-*/.<>=?$%_&~^:" . "w")))
-  (run-hooks 'scheme-mode-hook)
-  (run-hooks 'dsssl-mode-hook))
+       '(("+-*/.<>=?$%_&~^:" . "w"))))
 
 ;; Extra syntax for DSSSL.  This isn't separated from Scheme, but
 ;; shouldn't cause much trouble in scheme-mode.
@@ -558,5 +548,5 @@
 
 (provide 'scheme)
 
-;;; arch-tag: a8f06bc1-ad11-42d2-9e36-ce651df37a90
+;; arch-tag: a8f06bc1-ad11-42d2-9e36-ce651df37a90
 ;;; scheme.el ends here
--- a/lisp/progmodes/sh-script.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/progmodes/sh-script.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 ;;; sh-script.el --- shell-script editing commands for Emacs
 
-;; Copyright (C) 1993, 94, 95, 96, 97, 1999, 2001, 03, 2004
+;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2001, 2003, 2004, 2005
 ;;  Free Software Foundation, Inc.
 
 ;; Author: Daniel Pfeiffer <occitan@esperanto.org>
@@ -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)
@@ -837,7 +838,7 @@
 (defconst sh-st-symbol (string-to-syntax "_"))
 (defconst sh-here-doc-syntax (string-to-syntax "|")) ;; generic string
 
-(defconst sh-here-doc-open-re "<<-?\\s-*\\\\?\\(\\(?:['\"][^'\"]+['\"]\\|\\sw\\|\\s_\\)+\\).*\\(\n\\)")
+(defconst sh-here-doc-open-re "<<-?\\s-*\\\\?\\(\\(?:['\"][^'\"]+['\"]\\|\\sw\\)+\\).*\\(\n\\)")
 
 (defvar sh-here-doc-markers nil)
 (make-variable-buffer-local 'sh-here-doc-markers)
@@ -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,7 +3558,78 @@
   (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
+;; arch-tag: eccd8b72-f337-4fc2-ae86-18155a69d937
 ;;; sh-script.el ends here
--- a/lisp/rect.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/rect.el	Thu Feb 03 23:28:36 2005 +0000
@@ -127,14 +127,14 @@
     ))
 
 (defun delete-rectangle-line (startcol endcol fill)
-  (when (= (move-to-column startcol (or fill 'coerce)) startcol)
+  (when (= (move-to-column startcol (if fill t 'coerce)) startcol)
     (delete-region (point)
 		   (progn (move-to-column endcol 'coerce)
 			  (point)))))
 
 (defun delete-extract-rectangle-line (startcol endcol lines fill)
   (let ((pt (point-at-eol)))
-    (if (< (move-to-column startcol (or fill 'coerce)) startcol)
+    (if (< (move-to-column startcol (if fill t 'coerce)) startcol)
 	(setcdr lines (cons (spaces-string (- endcol startcol))
 			    (cdr lines)))
       ;; else
@@ -284,13 +284,13 @@
   (goto-char start))
 
 (defun open-rectangle-line (startcol endcol fill)
-  (when (= (move-to-column startcol (or fill 'coerce)) startcol)
+  (when (= (move-to-column startcol (if fill t 'coerce)) startcol)
     (unless (and (not fill)
 		 (= (point) (point-at-eol)))
       (indent-to endcol))))
 
 (defun delete-whitespace-rectangle-line (startcol endcol fill)
-  (when (= (move-to-column startcol (or fill 'coerce)) startcol)
+  (when (= (move-to-column startcol (if fill t 'coerce)) startcol)
     (unless (= (point) (point-at-eol))
       (delete-region (point) (progn (skip-syntax-forward " ") (point))))))
 
@@ -371,7 +371,7 @@
 
 (defun clear-rectangle-line (startcol endcol fill)
   (let ((pt (point-at-eol)))
-    (when (= (move-to-column startcol (or fill 'coerce)) startcol)
+    (when (= (move-to-column startcol (if fill t 'coerce)) startcol)
       (if (and (not fill)
 	       (<= (save-excursion (goto-char pt) (current-column)) endcol))
 	  (delete-region (point) pt)
--- a/lisp/replace.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/replace.el	Thu Feb 03 23:28:36 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 ""))
 
@@ -736,9 +757,12 @@
   (interactive "p")
   ;; we need to run occur-find-match from within the Occur buffer
   (with-current-buffer
+      ;; Choose the buffer and make it current.
       (if (next-error-buffer-p (current-buffer))
 	  (current-buffer)
-	(next-error-find-buffer nil nil (lambda() (eq major-mode 'occur-mode))))
+	(next-error-find-buffer nil nil
+				(lambda ()
+				  (eq major-mode 'occur-mode))))
 
     (goto-char (cond (reset (point-min))
 		     ((< argp 0) (line-beginning-position))
@@ -799,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
@@ -918,17 +943,20 @@
 (defun occur-1 (regexp nlines bufs &optional buf-name)
   (unless buf-name
     (setq buf-name "*Occur*"))
-  (let ((occur-buf (get-buffer-create buf-name))
-	(made-temp-buf nil)
+  (let (occur-buf
 	(active-bufs (delq nil (mapcar #'(lambda (buf)
 					   (when (buffer-live-p buf) buf))
 				       bufs))))
     ;; Handle the case where one of the buffers we're searching is the
-    ;; *Occur* buffer itself.
-    (when (memq occur-buf bufs)
-      (setq occur-buf (with-current-buffer occur-buf
-			(clone-buffer "*Occur-temp*"))
-	    made-temp-buf t))
+    ;; output buffer.  Just rename it.
+    (when (member buf-name (mapcar 'buffer-name active-bufs))
+      (with-current-buffer (get-buffer buf-name)
+	(rename-uniquely)))
+
+    ;; Now find or create the output buffer.
+    ;; If we just renamed that buffer, we will make a new one here.
+    (setq occur-buf (get-buffer-create buf-name))
+
     (with-current-buffer occur-buf
       (setq buffer-read-only nil)
       (occur-mode)
@@ -948,12 +976,6 @@
 		   (if (zerop count) "no" (format "%d" count))
 		   (if (= count 1) "" "es")
 		   regexp))
-	;; If we had to make a temporary buffer, make it the *Occur*
-	;; buffer now.
-	(when made-temp-buf
-	  (with-current-buffer (get-buffer buf-name)
-	    (kill-buffer (current-buffer)))
-	  (rename-buffer buf-name))
 	(setq occur-revert-arguments (list regexp nlines bufs)
 	      buffer-read-only t)
 	(if (> count 0)
@@ -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
@@ -1601,27 +1625,6 @@
 		 (if (= replace-count 1) "" "s")))
     (and keep-going stack)))
 
-(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")
-
 (defvar replace-overlay nil)
 
 (defun replace-highlight (beg end)
@@ -1638,7 +1641,7 @@
   (when replace-overlay
     (delete-overlay replace-overlay))
   (when query-replace-lazy-highlight
-    (isearch-lazy-highlight-cleanup isearch-lazy-highlight-cleanup)
+    (isearch-lazy-highlight-cleanup lazy-highlight-cleanup)
     (setq isearch-lazy-highlight-last-string nil)))
 
 ;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4
--- a/lisp/ses.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/ses.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 ;;; ses.el -- Simple Emacs Spreadsheet  -*- coding: utf-8 -*-
 
-;; Copyright (C) 2002,03,04  Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 ;; Author: Jonathan Yavner <jyavner@member.fsf.org>
 ;; Maintainer: Jonathan Yavner <jyavner@member.fsf.org>
@@ -405,26 +405,6 @@
   (setq ses--header-row row)
   t)
 
-(defmacro ses-dotimes-msg (spec msg &rest body)
-  "(ses-dotimes-msg (VAR LIMIT) MSG BODY...): Like `dotimes', but
-a message is emitted using MSG every second or so during the loop."
-  (let ((msgvar   (make-symbol "msg"))
-	(limitvar (make-symbol "limit"))
-	(var      (car spec))
-	(limit    (cadr spec)))
-    `(let ((,limitvar ,limit)
-	   (,msgvar   ,msg))
-       (setq ses-start-time (float-time))
-       (message ,msgvar)
-       (setq ,msgvar (concat ,msgvar " (%d%%)"))
-       (dotimes (,var ,limitvar)
-	 (ses-time-check ,msgvar '(/ (* ,var 100) ,limitvar))
-	 ,@body)
-       (message nil))))
-
-(put 'ses-dotimes-msg 'lisp-indent-function 2)
-(def-edebug-spec ses-dotimes-msg ((symbolp form) form body))
-
 (defmacro ses-dorange (curcell &rest body)
   "Execute BODY repeatedly, with the variables `row' and `col' set to each
 cell in the range specified by CURCELL.  The range is available in the
@@ -535,7 +515,7 @@
 
 (defun ses-create-cell-variable-range (minrow maxrow mincol maxcol)
   "Create buffer-local variables for cells.  This is undoable."
-  (push `(ses-destroy-cell-variable-range ,minrow ,maxrow ,mincol ,maxcol)
+  (push `(apply ses-destroy-cell-variable-range ,minrow ,maxrow ,mincol ,maxcol)
 	buffer-undo-list)
   (let (sym xrow xcol)
     (dotimes (row (1+ (- maxrow minrow)))
@@ -556,16 +536,16 @@
       (dotimes (col (1+ (- maxcol mincol)))
 	(setq sym (ses-create-cell-symbol (+ row minrow) (+ col mincol)))
 	(if (boundp sym)
-	    (push `(ses-set-with-undo ,sym ,(symbol-value sym))
+	    (push `(apply ses-set-with-undo ,sym ,(symbol-value sym))
 		  buffer-undo-list))
 	(kill-local-variable sym))))
-  (push `(ses-create-cell-variable-range ,minrow ,maxrow ,mincol ,maxcol)
+  (push `(apply ses-create-cell-variable-range ,minrow ,maxrow ,mincol ,maxcol)
 	buffer-undo-list))
 
 (defun ses-reset-header-string ()
   "Flags the header string for update.  Upon undo, the header string will be
 updated again."
-  (push '(ses-reset-header-string) buffer-undo-list)
+  (push '(apply ses-reset-header-string) buffer-undo-list)
   (setq ses--header-hscroll -1))
 
 ;;Split this code off into a function to avoid coverage-testing difficulties
@@ -1218,7 +1198,8 @@
 to each symbol."
   (let (reform)
     (let (mycell newval)
-      (ses-dotimes-msg (row ses--numrows) "Relocating formulas..."
+      (dotimes-with-progress-reporter
+          (row ses--numrows) "Relocating formulas..."
 	(dotimes (col ses--numcols)
 	  (setq ses-relocate-return nil
 		mycell (ses-get-cell row col)
@@ -1246,7 +1227,8 @@
       (cond
        ((and (<= rowincr 0) (<= colincr 0))
 	;;Deletion of rows and/or columns
-	(ses-dotimes-msg (row (- ses--numrows minrow)) "Relocating variables..."
+	(dotimes-with-progress-reporter
+           (row (- ses--numrows minrow)) "Relocating variables..."
 	  (setq myrow  (+ row minrow))
 	  (dotimes (col (- ses--numcols mincol))
 	    (setq mycol  (+ col mincol)
@@ -1262,7 +1244,8 @@
 	(let ((disty (1- ses--numrows))
 	      (distx (1- ses--numcols))
 	      myrow mycol)
-	  (ses-dotimes-msg (row (- ses--numrows minrow)) "Relocating variables..."
+	  (dotimes-with-progress-reporter
+	      (row (- ses--numrows minrow)) "Relocating variables..."
 	    (setq myrow (- disty row))
 	    (dotimes (col (- ses--numcols mincol))
 	      (setq mycol (- distx col)
@@ -1296,38 +1279,39 @@
 ;; Undo control
 ;;----------------------------------------------------------------------------
 
-(defadvice undo-more (around ses-undo-more activate preactivate)
-  "Define a meaning for conses in buffer-undo-list whose car is a symbol
-other than t or nil.  To undo these, apply the car--a function--to the
-cdr--its arglist."
-  (let ((ses-count (ad-get-arg 0)))
-    (catch 'undo
-      (dolist (ses-x pending-undo-list)
-	(unless ses-x
-	  ;;End of undo boundary
-	  (setq ses-count (1- ses-count))
-	  (if (<= ses-count 0)
-	      ;;We've seen enough boundaries - stop undoing
-	      (throw 'undo nil)))
-	(and (consp ses-x) (symbolp (car ses-x)) (fboundp (car ses-x))
-	     ;;Undo using apply
-	     (apply (car ses-x) (cdr ses-x)))))
-    (if (not (eq major-mode 'ses-mode))
-	ad-do-it
-      ;;Here is some extra code for SES mode.
-      (setq ses--deferred-narrow
-	    (or ses--deferred-narrow (ses-narrowed-p)))
-      (widen)
-      (condition-case x
-	  ad-do-it
-	(error
-	 ;;Restore narrow if appropriate
-	 (ses-command-hook)
-	 (signal (car x) (cdr x)))))))
+;; This should be unnecessary, because the feature is now built in.
+
+;;; (defadvice undo-more (around ses-undo-more activate preactivate)
+;;;   "Define a meaning for conses in buffer-undo-list whose car is a symbol
+;;; other than t or nil.  To undo these, apply the car--a function--to the
+;;; cdr--its arglist."
+;;;   (let ((ses-count (ad-get-arg 0)))
+;;;     (catch 'undo
+;;;       (dolist (ses-x pending-undo-list)
+;;; 	(unless ses-x
+;;; 	  ;;End of undo boundary
+;;; 	  (setq ses-count (1- ses-count))
+;;; 	  (if (<= ses-count 0)
+;;; 	      ;;We've seen enough boundaries - stop undoing
+;;; 	      (throw 'undo nil)))
+;;; 	(and (consp ses-x) (symbolp (car ses-x)) (fboundp (car ses-x))
+;;; 	     ;;Undo using apply
+;;; 	     (apply (car ses-x) (cdr ses-x)))))
+;;;     (if (not (eq major-mode 'ses-mode))
+;;; 	ad-do-it
+;;;       ;;Here is some extra code for SES mode.
+;;;       (setq ses--deferred-narrow
+;;; 	    (or ses--deferred-narrow (ses-narrowed-p)))
+;;;       (widen)
+;;;       (condition-case x
+;;; 	  ad-do-it
+;;; 	(error
+;;; 	 ;;Restore narrow if appropriate
+;;; 	 (ses-command-hook)
+;;; 	 (signal (car x) (cdr x)))))))
 
 (defun ses-begin-change ()
-  "For undo, remember current buffer-position before we start changing hidden
-stuff."
+  "For undo, remember point before we start changing hidden stuff."
   (let ((inhibit-read-only t))
     (insert-and-inherit "X")
     (delete-region (1- (point)) (point))))
@@ -1341,8 +1325,8 @@
 	       (equal (symbol-value sym) newval)
 	       (not (stringp newval)))
     (push (if (boundp sym)
-	      `(ses-set-with-undo ,sym ,(symbol-value sym))
-	    `(ses-unset-with-undo ,sym))
+	      `(apply ses-set-with-undo ,sym ,(symbol-value sym))
+	    `(apply ses-unset-with-undo ,sym))
 	  buffer-undo-list)
     (set sym newval)
     t))
@@ -1350,13 +1334,13 @@
 (defun ses-unset-with-undo (sym)
   "Set SYM to be unbound.  This is undoable."
   (when (1value (boundp sym)) ;;Always bound, except after a programming error
-    (push `(ses-set-with-undo ,sym ,(symbol-value sym)) buffer-undo-list)
+    (push `(apply ses-set-with-undo ,sym ,(symbol-value sym)) buffer-undo-list)
     (makunbound sym)))
 
 (defun ses-aset-with-undo (array idx newval)
   "Like aset, but undoable.  Result is t if element has changed"
   (unless (equal (aref array idx) newval)
-    (push `(ses-aset-with-undo ,array ,idx ,(aref array idx)) buffer-undo-list)
+    (push `(apply ses-aset-with-undo ,array ,idx ,(aref array idx)) buffer-undo-list)
     (aset array idx newval)
     t))
 
@@ -1475,7 +1459,7 @@
     (put-text-property (point-min) (1+ (point-min)) 'front-sticky t)
     ;;Create intangible properties, which also indicate which cell the text
     ;;came from.
-    (ses-dotimes-msg (row ses--numrows) "Finding cells..."
+    (dotimes-with-progress-reporter (row ses--numrows) "Finding cells..."
       (dotimes (col ses--numcols)
 	(setq pos  end
 	      sym  (ses-cell-symbol row col))
@@ -1724,7 +1708,7 @@
     ;;find the data area when inserting or deleting *skip* values for cells
     (dotimes (row ses--numrows)
       (insert-and-inherit ses--blank-line))
-    (ses-dotimes-msg (row ses--numrows) "Reprinting..."
+    (dotimes-with-progress-reporter (row ses--numrows) "Reprinting..."
       (if (eq (ses-cell-value row 0) '*skip*)
 	  ;;Column deletion left a dangling skip
 	  (ses-set-cell row 0 'value nil))
@@ -1809,11 +1793,13 @@
   ;;Reconstruct reference lists.
   (let (x yrow ycol)
     ;;Delete old reference lists
-    (ses-dotimes-msg (row ses--numrows) "Deleting references..."
+    (dotimes-with-progress-reporter
+        (row ses--numrows) "Deleting references..."
       (dotimes (col ses--numcols)
 	(ses-set-cell row col 'references nil)))
     ;;Create new reference lists
-    (ses-dotimes-msg (row ses--numrows) "Computing references..."
+    (dotimes-with-progress-reporter
+        (row ses--numrows) "Computing references..."
       (dotimes (col ses--numcols)
 	(dolist (ref (ses-formula-references (ses-cell-formula row col)))
 	  (setq x    (ses-sym-rowcol ref)
@@ -2073,14 +2059,14 @@
     (ses-set-parameter 'ses--numrows (+ ses--numrows count))
     ;;Insert each row
     (ses-goto-print row 0)
-    (ses-dotimes-msg (x count) "Inserting row..."
+    (dotimes-with-progress-reporter (x count) "Inserting row..."
       ;;Create a row of empty cells.  The `symbol' fields will be set by
       ;;the call to ses-relocate-all.
       (setq newrow (make-vector ses--numcols nil))
       (dotimes (col ses--numcols)
 	(aset newrow col (ses-make-cell)))
       (setq ses--cells (ses-vector-insert ses--cells row newrow))
-      (push `(ses-vector-delete ses--cells ,row 1) buffer-undo-list)
+      (push `(apply ses-vector-delete ses--cells ,row 1) buffer-undo-list)
       (insert ses--blank-line))
     ;;Insert empty lines in cell data area (will be replaced by
     ;;ses-relocate-all)
@@ -2162,7 +2148,7 @@
     (ses-create-cell-variable-range 0            (1- ses--numrows)
 				    ses--numcols (+ ses--numcols count -1))
     ;;Insert each column.
-    (ses-dotimes-msg (x count) "Inserting column..."
+    (dotimes-with-progress-reporter (x count) "Inserting column..."
       ;;Create a column of empty cells.  The `symbol' fields will be set by
       ;;the call to ses-relocate-all.
       (ses-adjust-print-width col (1+ width))
@@ -2220,7 +2206,7 @@
     (ses-begin-change)
     (ses-set-parameter 'ses--numcols (- ses--numcols count))
     (ses-adjust-print-width col (- width))
-    (ses-dotimes-msg (row ses--numrows) "Deleting column..."
+    (dotimes-with-progress-reporter (row ses--numrows) "Deleting column..."
       ;;Delete lines from cell data area
       (ses-goto-data row col)
       (ses-delete-line count)
@@ -2331,7 +2317,10 @@
 		(eq (get-text-property beg 'read-only) 'ses)
 		(eq (get-text-property (1- end) 'read-only) 'ses)))
       ad-do-it ;Normal copy-region-as-kill
-    (kill-new (ses-copy-region beg end))))
+    (kill-new (ses-copy-region beg end))
+    (if transient-mark-mode
+	(setq deactivate-mark t))
+    nil))
 
 (defun ses-copy-region (beg end)
   "Treat the region as rectangular.  Convert the intangible attributes to
@@ -2466,7 +2455,7 @@
 	     (colincr  (- (cdr rowcol) (cdr first)))
 	     (pos      0)
 	     myrow mycol x)
-	(ses-dotimes-msg (row needrows) "Yanking..."
+	(dotimes-with-progress-reporter (row needrows) "Yanking..."
 	  (setq myrow (+ row (car rowcol)))
 	  (dotimes (col needcols)
 	    (setq mycol (+ col (cdr rowcol))
--- a/lisp/simple.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/simple.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,7 +1,7 @@
 ;;; simple.el --- basic editing commands for Emacs
 
 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-;;               2000, 2001, 2002, 2003, 2004
+;;               2000, 2001, 2002, 2003, 2004, 2005
 ;;        Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -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 (&optional 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 (or n 1))
+      (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)))
@@ -1234,6 +1235,10 @@
 (defvar undo-no-redo nil
   "If t, `undo' doesn't go through redo entries.")
 
+(defvar pending-undo-list nil
+  "Within a run of consecutive undo commands, list remaining to be undone.
+t if we undid all the way to the end of it.")
+
 (defun undo (&optional arg)
   "Undo some previous changes.
 Repeat this command to undo more changes.
@@ -1257,14 +1262,15 @@
     (setq this-command 'undo-start)
 
     (unless (and (eq last-command 'undo)
-		 ;; If something (a timer or filter?) changed the buffer
-		 ;; since the previous command, don't continue the undo seq.
-		 (let ((list buffer-undo-list))
-		   (while (eq (car list) nil)
-		     (setq list (cdr list)))
-		   ;; If the last undo record made was made by undo
-		   ;; it shows nothing else happened in between.
-		   (gethash list undo-equiv-table)))
+		 (or (eq pending-undo-list t)
+		     ;; If something (a timer or filter?) changed the buffer
+		     ;; since the previous command, don't continue the undo seq.
+		     (let ((list buffer-undo-list))
+		       (while (eq (car list) nil)
+			 (setq list (cdr list)))
+		       ;; If the last undo record made was made by undo
+		       ;; it shows nothing else happened in between.
+		       (gethash list undo-equiv-table))))
       (setq undo-in-region
 	    (if transient-mark-mode mark-active (and arg (not (numberp arg)))))
       (if undo-in-region
@@ -1339,9 +1345,6 @@
 ;; no idea whereas to bind it.  Any suggestion welcome.  -stef
 ;; (define-key ctl-x-map "U" 'undo-only)
 
-(defvar pending-undo-list nil
-  "Within a run of consecutive undo commands, list remaining to be undone.")
-
 (defvar undo-in-progress nil
   "Non-nil while performing an undo.
 Some change-hooks test this variable to do something different.")
@@ -1350,12 +1353,14 @@
   "Undo back N undo-boundaries beyond what was already undone recently.
 Call `undo-start' to get ready to undo recent changes,
 then call `undo-more' one or more times to undo them."
-  (or pending-undo-list
+  (or (listp pending-undo-list)
       (error (format "No further undo information%s"
 		     (if (and transient-mark-mode mark-active)
 			 " for region" ""))))
   (let ((undo-in-progress t))
-    (setq pending-undo-list (primitive-undo count pending-undo-list))))
+    (setq pending-undo-list (primitive-undo count pending-undo-list))
+    (if (null pending-undo-list)
+	(setq pending-undo-list t))))
 
 ;; Deep copy of a list
 (defun undo-copy-list (list)
@@ -1520,33 +1525,76 @@
 	     '(0 . 0)))
     '(0 . 0)))
 
+(defcustom undo-ask-before-discard t
+  "If non-nil ask about discarding undo info for the current command.
+Normally, Emacs discards the undo info for the current command if
+it exceeds `undo-outer-limit'.  But if you set this option
+non-nil, it asks in the echo area whether to discard the info.
+If you answer no, there a slight risk that Emacs might crash, so
+only do it if you really want to undo the command.
+
+This option is mainly intended for debugging.  You have to be
+careful if you use it for other purposes.  Garbage collection is
+inhibited while the question is asked, meaning that Emacs might
+leak memory.  So you should make sure that you do not wait
+excessively long before answering the question."
+  :type 'boolean
+  :group 'undo
+  :version "21.4")
+
 (defvar undo-extra-outer-limit nil
   "If non-nil, an extra level of size that's ok in an undo item.
 We don't ask the user about truncating the undo list until the
-current item gets bigger than this amount.")
+current item gets bigger than this amount.
+
+This variable only matters if `undo-ask-before-discard' is non-nil.")
 (make-variable-buffer-local 'undo-extra-outer-limit)
 
-;; When the first undo batch in an undo list is longer than undo-outer-limit,
-;; this function gets called to ask the user what to do.
-;; Garbage collection is inhibited around the call,
-;; so it had better not do a lot of consing.
+;; When the first undo batch in an undo list is longer than
+;; undo-outer-limit, this function gets called to warn the user that
+;; the undo info for the current command was discarded.  Garbage
+;; collection is inhibited around the call, so it had better not do a
+;; lot of consing.
 (setq undo-outer-limit-function 'undo-outer-limit-truncate)
 (defun undo-outer-limit-truncate (size)
-  (when (or (null undo-extra-outer-limit)
-	    (> size undo-extra-outer-limit))
-    ;; Don't ask the question again unless it gets even bigger.
-    ;; This applies, in particular, if the user quits from the question.
-    ;; Such a quit quits out of GC, but something else will call GC
-    ;; again momentarily.  It will call this function again,
-    ;; but we don't want to ask the question again.
-    (setq undo-extra-outer-limit (+ size 50000))
-    (if (let (use-dialog-box)
-	  (yes-or-no-p (format "Buffer %s undo info is %d bytes long; discard it? "
-			       (buffer-name) size)))
-	(progn (setq buffer-undo-list nil)
-	       (setq undo-extra-outer-limit nil)
-	       t)
-      nil)))
+  (if undo-ask-before-discard
+      (when (or (null undo-extra-outer-limit)
+		(> size undo-extra-outer-limit))
+	;; Don't ask the question again unless it gets even bigger.
+	;; This applies, in particular, if the user quits from the question.
+	;; Such a quit quits out of GC, but something else will call GC
+	;; again momentarily.  It will call this function again,
+	;; but we don't want to ask the question again.
+	(setq undo-extra-outer-limit (+ size 50000))
+	(if (let (use-dialog-box track-mouse executing-kbd-macro )
+	      (yes-or-no-p (format "Buffer %s undo info is %d bytes long; discard it? "
+				   (buffer-name) size)))
+	    (progn (setq buffer-undo-list nil)
+		   (setq undo-extra-outer-limit nil)
+		   t)
+	  nil))
+    (display-warning '(undo discard-info)
+		     (concat
+		      (format "Buffer %s undo info was %d bytes long.\n"
+			      (buffer-name) size)
+		      "The undo info was discarded because it exceeded \
+`undo-outer-limit'.
+
+This is normal if you executed a command that made a huge change
+to the buffer.  In that case, to prevent similar problems in the
+future, set `undo-outer-limit' to a value that is large enough to
+cover the maximum size of normal changes you expect a single
+command to make, but not so large that it might exceed the
+maximum memory allotted to Emacs.
+
+If you did not execute any such command, the situation is
+probably due to a bug and you should report it.
+
+You can disable the popping up of this buffer by adding the entry
+\(undo discard-info) to the user option `warning-suppress-types'.\n")
+		     :warning)
+    (setq buffer-undo-list nil)
+    t))
 
 (defvar shell-command-history nil
   "History list for some commands that read shell commands.")
@@ -3012,10 +3060,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)
@@ -3182,10 +3230,31 @@
       (or (memq prop buffer-invisibility-spec)
 	  (assq prop buffer-invisibility-spec)))))
 
+;; Perform vertical scrolling of tall images if necessary.
+(defun line-move (arg &optional noerror to-end)
+  (if auto-window-vscroll
+      (let ((forward (> arg 0))
+	    (part (nth 2 (pos-visible-in-window-p (point) nil t))))
+	(if (and (consp part)
+		 (> (setq part (if forward (cdr part) (car part))) 0))
+	    (set-window-vscroll nil
+				(if forward
+				    (+ (window-vscroll nil t)
+				       (min part
+					    (* (frame-char-height) arg)))
+				  (max 0
+				       (- (window-vscroll nil t)
+					  (min part
+					       (* (frame-char-height) (- arg))))))
+				t)
+	  (set-window-vscroll nil 0)
+	  (line-move-1 arg noerror to-end)))
+    (line-move-1 arg noerror to-end)))
+
 ;; This is the guts of next-line and previous-line.
 ;; Arg says how many lines to move.
 ;; The value is t if we can move the specified number of lines.
-(defun line-move (arg &optional noerror to-end)
+(defun line-move-1 (arg &optional noerror to-end)
   ;; Don't run any point-motion hooks, and disregard intangibility,
   ;; for intermediate positions.
   (let ((inhibit-point-motion-hooks t)
@@ -3594,7 +3663,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
@@ -4004,7 +4073,7 @@
 		(setq matching-paren
 		      (let ((syntax (syntax-after blinkpos)))
 			(and (consp syntax)
-			     (eq (car syntax) 4)
+			     (eq (logand (car syntax) 255) 4)
 			     (cdr syntax)))
 		      mismatch
 		      (or (null matching-paren)
@@ -4119,7 +4188,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.
@@ -4261,7 +4330,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'.")
 
@@ -4324,7 +4393,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
@@ -4332,6 +4401,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/speedbar.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/speedbar.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,7 @@
 ;;; speedbar.el --- quick access to files and tags in a frame
 
-;;; Copyright (C) 1996, 97, 98, 99, 2000, 01 Free Software Foundation
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2005
+;;           Free Software Foundation
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Version: 0.11a
@@ -170,6 +171,8 @@
 ;; - More functions to create buttons and options
 ;; - Timeout directories we haven't visited in a while.
 
+;;; Code:
+
 (require 'assoc)
 (require 'easymenu)
 
@@ -201,7 +204,6 @@
   :prefix "speedbar-"
   :group 'speedbar)
 
-;;; Code:
 (defvar speedbar-initial-expansion-mode-alist
   '(("buffers" speedbar-buffer-easymenu-definition speedbar-buffers-key-map
      speedbar-buffer-buttons)
@@ -373,7 +375,7 @@
 			(symbol :tag "Property")
 			(sexp :tag "Value"))))
 
-(defcustom speedbar-use-imenu-flag (stringp (locate-library "imenu"))
+(defcustom speedbar-use-imenu-flag (fboundp 'imenu)
   "*Non-nil means use imenu for file parsing.  nil to use etags.
 XEmacs prior to 20.4 doesn't support imenu, therefore the default is to
 use etags instead.  Etags support is not as robust as imenu support."
@@ -3749,7 +3751,7 @@
 
     nil
 
-(eval-when-compile (if (locate-library "imenu") (require 'imenu)))
+(eval-when-compile (condition-case nil (require 'imenu) (error nil)))
 
 (defun speedbar-fetch-dynamic-imenu (file)
   "Load FILE into a buffer, and generate tags using Imenu.
@@ -4359,5 +4361,5 @@
 ;; run load-time hooks
 (run-hooks 'speedbar-load-hook)
 
-;;; arch-tag: 4477e6d1-f78c-48b9-a503-387d3c9767d5
+;; arch-tag: 4477e6d1-f78c-48b9-a503-387d3c9767d5
 ;;; speedbar.el ends here
--- a/lisp/startup.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/startup.el	Thu Feb 03 23:28:36 2005 +0000
@@ -877,12 +877,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/subr.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/subr.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,7 +1,7 @@
 ;;; subr.el --- basic lisp subroutines for Emacs
 
 ;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1999, 2000, 2001, 2002, 2003,
-;;   2004  Free Software Foundation, Inc.
+;;   2004, 2005  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: internal
@@ -2723,7 +2723,7 @@
 (defun make-progress-reporter (message min-value max-value
 				       &optional current-value
 				       min-change min-time)
-  "Return progress reporter object usage with `progress-reporter-update'.
+  "Return progress reporter object to be used with `progress-reporter-update'.
 
 MESSAGE is shown in the echo area.  When at least 1% of operation
 is complete, the exact percentage will be appended to the
@@ -2812,5 +2812,32 @@
   "Print reporter's message followed by word \"done\" in echo area."
   (message "%sdone" (aref (cdr reporter) 3)))
 
+(defmacro dotimes-with-progress-reporter (spec message &rest body)
+  "Loop a certain number of times and report progress in the echo area.
+Evaluate BODY with VAR bound to successive integers running from
+0, inclusive, to COUNT, exclusive.  Then evaluate RESULT to get
+the return value (nil if RESULT is omitted).
+
+At each iteration MESSAGE followed by progress percentage is
+printed in the echo area.  After the loop is finished, MESSAGE
+followed by word \"done\" is printed.  This macro is a
+convenience wrapper around `make-progress-reporter' and friends.
+
+\(fn (VAR COUNT [RESULT]) MESSAGE BODY...)"
+  (declare (indent 2) (debug ((symbolp form &optional form) form body)))
+  (let ((temp (make-symbol "--dotimes-temp--"))
+	(temp2 (make-symbol "--dotimes-temp2--"))
+	(start 0)
+	(end (nth 1 spec)))
+    `(let ((,temp ,end)
+	   (,(car spec) ,start)
+	   (,temp2 (make-progress-reporter ,message ,start ,end)))
+       (while (< ,(car spec) ,temp)
+	 ,@body
+	 (progress-reporter-update ,temp2
+				   (setq ,(car spec) (1+ ,(car spec)))))
+       (progress-reporter-done ,temp2)
+       nil ,@(cdr (cdr spec)))))
+
 ;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc
 ;;; subr.el ends here
--- a/lisp/tar-mode.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/tar-mode.el	Thu Feb 03 23:28:36 2005 +0000
@@ -715,66 +715,67 @@
 	      (set-buffer-multibyte nil)
 	      (save-excursion
 		(set-buffer buffer)
-		(if enable-multibyte-characters
-		    (progn
-		      ;; We must avoid unibyte->multibyte conversion.
-		      (set-buffer-multibyte nil)
-		      (insert-buffer-substring tar-buffer start end)
-		      (set-buffer-multibyte t))
-		  (insert-buffer-substring tar-buffer start end))
-		(goto-char (point-min))
-		(setq buffer-file-name new-buffer-file-name)
-		(setq buffer-file-truename
-		      (abbreviate-file-name buffer-file-name))
-		;; We need to mimic the parts of insert-file-contents
-		;; which determine the coding-system and decode the text.
-		(let ((coding
-		       (or coding-system-for-read
-			   (and set-auto-coding-function
-				(save-excursion
-				  (funcall set-auto-coding-function
-					   name (- (point-max) (point)))))))
-		      (multibyte enable-multibyte-characters)
-		      (detected (detect-coding-region
-				 (point-min)
-				 (min (+ (point-min) 16384) (point-max)) t)))
-		  (if coding
-		      (or (numberp (coding-system-eol-type coding))
-			  (vectorp (coding-system-eol-type detected))
-			  (setq coding (coding-system-change-eol-conversion
-					coding
-					(coding-system-eol-type detected))))
-		    (setq coding
-			  (or (find-new-buffer-file-coding-system detected)
-			      (let ((file-coding
-				     (find-operation-coding-system
-				      'insert-file-contents buffer-file-name)))
-				(if (consp file-coding)
-				    (setq file-coding (car file-coding))
-				  file-coding)))))
-		  (if (or (eq coding 'no-conversion)
-			  (eq (coding-system-type coding) 5))
-		      (setq multibyte (set-buffer-multibyte nil)))
-		  (or multibyte
+		(let ((buffer-undo-list t))
+		  (if enable-multibyte-characters
+		      (progn
+			;; We must avoid unibyte->multibyte conversion.
+			(set-buffer-multibyte nil)
+			(insert-buffer-substring tar-buffer start end)
+			(set-buffer-multibyte t))
+		    (insert-buffer-substring tar-buffer start end))
+		  (goto-char (point-min))
+		  (setq buffer-file-name new-buffer-file-name)
+		  (setq buffer-file-truename
+			(abbreviate-file-name buffer-file-name))
+		  ;; We need to mimic the parts of insert-file-contents
+		  ;; which determine the coding-system and decode the text.
+		  (let ((coding
+			 (or coding-system-for-read
+			     (and set-auto-coding-function
+				  (save-excursion
+				    (funcall set-auto-coding-function
+					     name (- (point-max) (point)))))))
+			(multibyte enable-multibyte-characters)
+			(detected (detect-coding-region
+				   (point-min)
+				   (min (+ (point-min) 16384) (point-max)) t)))
+		    (if coding
+			(or (numberp (coding-system-eol-type coding))
+			    (vectorp (coding-system-eol-type detected))
+			    (setq coding (coding-system-change-eol-conversion
+					  coding
+					  (coding-system-eol-type detected))))
 		      (setq coding
-			    (coding-system-change-text-conversion
-			     coding 'raw-text)))
-		  (decode-coding-region (point-min) (point-max) coding)
-		  (set-buffer-file-coding-system coding))
-		;; Set the default-directory to the dir of the
-		;; superior buffer.
-		(setq default-directory
-		      (save-excursion
-			(set-buffer tar-buffer)
-			default-directory))
-		(normal-mode)  ; pick a mode.
-		(rename-buffer bufname)
-		(make-local-variable 'tar-superior-buffer)
-		(make-local-variable 'tar-superior-descriptor)
-		(setq tar-superior-buffer tar-buffer)
-		(setq tar-superior-descriptor descriptor)
-		(setq buffer-read-only read-only-p)
-		(set-buffer-modified-p nil)
+			    (or (find-new-buffer-file-coding-system detected)
+				(let ((file-coding
+				       (find-operation-coding-system
+					'insert-file-contents buffer-file-name)))
+				  (if (consp file-coding)
+				      (setq file-coding (car file-coding))
+				    file-coding)))))
+		    (if (or (eq coding 'no-conversion)
+			    (eq (coding-system-type coding) 5))
+			(setq multibyte (set-buffer-multibyte nil)))
+		    (or multibyte
+			(setq coding
+			      (coding-system-change-text-conversion
+			       coding 'raw-text)))
+		    (decode-coding-region (point-min) (point-max) coding)
+		    (set-buffer-file-coding-system coding))
+		  ;; Set the default-directory to the dir of the
+		  ;; superior buffer.
+		  (setq default-directory
+			(save-excursion
+			  (set-buffer tar-buffer)
+			  default-directory))
+		  (normal-mode)  ; pick a mode.
+		  (rename-buffer bufname)
+		  (make-local-variable 'tar-superior-buffer)
+		  (make-local-variable 'tar-superior-descriptor)
+		  (setq tar-superior-buffer tar-buffer)
+		  (setq tar-superior-descriptor descriptor)
+		  (setq buffer-read-only read-only-p)
+		  (set-buffer-modified-p nil))
 		(tar-subfile-mode 1))
 	      (set-buffer tar-buffer))
 	  (narrow-to-region (point-min) tar-header-offset)
--- a/lisp/term/mac-win.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/term/mac-win.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1694,10 +1694,9 @@
 (if (string= default-directory "/")
     (cd "~"))
 
-;; Tell Emacs to use pipes instead of pty's for processes because the
-;; latter sometimes lose characters.  Pty support is compiled in since
-;; ange-ftp will not work without it.
-(setq process-connection-type nil)
+;; Darwin 6- pty breakage is now controlled from the C code so that
+;; it applies to all builds on darwin.  See s/darwin.h PTY_ITERATION.
+;; (setq process-connection-type t)
 
 ;; Assume that fonts are always scalable on the Mac.  This sometimes
 ;; results in characters with jagged edges.  However, without it,
--- a/lisp/term/w32-win.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/term/w32-win.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 ;;; w32-win.el --- parse switches controlling interface with W32 window system
 
-;; Copyright (C) 1993, 1994, 2003, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 ;; Author: Kevin Gallo
 ;; Keywords: terminals
@@ -139,50 +139,26 @@
   "Handle SWITCH of the form \"-switch value\" or \"-switch\"."
   (let ((aelt (assoc switch command-line-x-option-alist)))
     (if aelt
-	(let ((param (nth 3 aelt))
-	      (value (nth 4 aelt)))
-	  (if value
-	      (setq default-frame-alist
-		    (cons (cons param value)
-			  default-frame-alist))
-	    (setq default-frame-alist
-		  (cons (cons param
-			      (car x-invocation-args))
-			default-frame-alist)
- 	          x-invocation-args (cdr x-invocation-args)))))))
+	(push (cons (nth 3 aelt) (or (nth 4 aelt) (pop x-invocation-args)))
+	      default-frame-alist))))
 
 (defun x-handle-numeric-switch (switch)
   "Handle SWITCH of the form \"-switch n\"."
   (let ((aelt (assoc switch command-line-x-option-alist)))
     (if aelt
-	(let ((param (nth 3 aelt)))
-	(setq default-frame-alist
-	      (cons (cons param
-			  (string-to-int (car x-invocation-args)))
-		    default-frame-alist)
-	      x-invocation-args
-	      (cdr x-invocation-args))))))
+	(push (cons (nth 3 aelt) (string-to-int (pop x-invocation-args)))
+	      default-frame-alist))))
 
 ;; Handle options that apply to initial frame only
 (defun x-handle-initial-switch (switch)
   (let ((aelt (assoc switch command-line-x-option-alist)))
     (if aelt
-	(let ((param (nth 3 aelt))
-	      (value (nth 4 aelt)))
-	  (if value
-	      (setq initial-frame-alist
-		    (cons (cons param value)
-			  initial-frame-alist))
-	    (setq initial-frame-alist
-		  (cons (cons param
-			      (car x-invocation-args))
-			initial-frame-alist)
-		  x-invocation-args (cdr x-invocation-args)))))))
+	(push (cons (nth 3 aelt) (or (nth 4 aelt) (pop x-invocation-args)))
+	      initial-frame-alist))))
 
 (defun x-handle-iconic (switch)
   "Make \"-iconic\" SWITCH apply only to the initial frame."
-  (setq initial-frame-alist
-	(cons '(visibility . icon) initial-frame-alist)))
+  (push '(visibility . icon) initial-frame-alist))
 
 (defun x-handle-xrm-switch (switch)
   "Handle the \"-xrm\" SWITCH."
@@ -226,18 +202,15 @@
 ;; to the option's operand; set the name of the initial frame, too.
   (or (consp x-invocation-args)
       (error "%s: missing argument to `%s' option" (invocation-name) switch))
-  (setq x-resource-name (car x-invocation-args)
-	x-invocation-args (cdr x-invocation-args))
-  (setq initial-frame-alist (cons (cons 'name x-resource-name)
-				  initial-frame-alist)))
+  (setq x-resource-name (pop x-invocation-args))
+  (push (cons 'name x-resource-name) initial-frame-alist))
 
 (defvar x-display-name nil
   "The display name specifying server and frame.")
 
 (defun x-handle-display (switch)
   "Handle the \"-display\" SWITCH."
-  (setq x-display-name (car x-invocation-args)
-	x-invocation-args (cdr x-invocation-args)))
+  (setq x-display-name (pop x-invocation-args)))
 
 (defun x-handle-args (args)
   "Process the X-related command line options in ARGS.
@@ -281,7 +254,7 @@
 		     (cons argval x-invocation-args)))
 		(funcall handler this-switch))
 	    (funcall handler this-switch))
-	(setq args (cons orig-this-switch args)))))
+	(push orig-this-switch args))))
   (nconc (nreverse args) x-invocation-args))
 
 ;;
@@ -1046,16 +1019,10 @@
 (defun xw-defined-colors (&optional frame)
   "Internal function called by `defined-colors', which see."
   (or frame (setq frame (selected-frame)))
-  (let* ((color-map-colors (mapcar (lambda (clr) (car clr)) w32-color-map))
-	 (all-colors (or color-map-colors x-colors))
-	 (this-color nil)
-	 (defined-colors nil))
-    (message "Defining colors...")
-    (while all-colors
-      (setq this-color (car all-colors)
-	    all-colors (cdr all-colors))
+  (let ((defined-colors nil))
+    (dolist (this-color (or (mapcar 'car w32-color-map) x-colors))
       (and (color-supported-p this-color frame t)
-	   (setq defined-colors (cons this-color defined-colors))))
+	   (push this-color defined-colors)))
     defined-colors))
 
 
@@ -1077,13 +1044,10 @@
 
 ;;; Make sure we have a valid resource name.
 (or (stringp x-resource-name)
-    (let (i)
-      (setq x-resource-name (invocation-name))
-
-      ;; Change any . or * characters in x-resource-name to hyphens,
-      ;; so as not to choke when we use it in X resource queries.
-      (while (setq i (string-match "[.*]" x-resource-name))
-	(aset x-resource-name i ?-))))
+    (setq x-resource-name
+	  ;; Change any . or * characters in x-resource-name to hyphens,
+	  ;; so as not to choke when we use it in X resource queries.
+	  (replace-regexp-in-string "[.*]" "-" (invocation-name))))
 
 ;; For the benefit of older Emacses (19.27 and earlier) that are sharing
 ;; the same lisp directory, don't pass the third argument unless we seem
@@ -1167,21 +1131,17 @@
 	(setq initial-frame-alist (append initial-frame-alist parsed))
 	;; The size parms apply to all frames.
 	(if (assq 'height parsed)
-	    (setq default-frame-alist
-		  (cons (cons 'height (cdr (assq 'height parsed)))
-			default-frame-alist)))
+	    (push (cons 'height (cdr (assq 'height parsed)))
+		  default-frame-alist))
 	(if (assq 'width parsed)
-	    (setq default-frame-alist
-		  (cons (cons 'width (cdr (assq 'width parsed)))
-			default-frame-alist))))))
+	    (push (cons 'width (cdr (assq 'width parsed)))
+		  default-frame-alist)))))
 
 ;; Check the reverseVideo resource.
 (let ((case-fold-search t))
   (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
-    (if (and rv
-	     (string-match "^\\(true\\|yes\\|on\\)$" rv))
-	(setq default-frame-alist
-	      (cons '(reverse . t) default-frame-alist)))))
+    (if (and rv (string-match "^\\(true\\|yes\\|on\\)$" rv))
+	(push '(reverse . t) default-frame-alist))))
 
 (defun x-win-suspend-error ()
   "Report an error when a suspend is attempted."
@@ -1245,7 +1205,7 @@
 	 (and chosen-font (list chosen-font)))
      (x-popup-menu
       last-nonmenu-event
-    ;; Append list of fontsets currently defined.
+      ;; Append list of fontsets currently defined.
       ;; Conditional on new-fontset so bootstrapping works on non-GUI compiles
       (if (fboundp 'new-fontset)
       (append w32-fixed-font-alist (list (generate-fontset-menu)))))))
@@ -1269,5 +1229,5 @@
         (tiff "libtiff3.dll" "libtiff.dll")
         (gif "libungif.dll")))
 
-;;; arch-tag: 69fb1701-28c2-4890-b351-3d1fe4b4f166
+;; arch-tag: 69fb1701-28c2-4890-b351-3d1fe4b4f166
 ;;; w32-win.el ends here
--- a/lisp/textmodes/bibtex.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/bibtex.el	Thu Feb 03 23:28:36 2005 +0000
@@ -173,7 +173,7 @@
 If value of `bibtex-maintain-sorted-entries' is `entry-class'
 entries are ordered according to the classes they belong to.  Each
 class contains a list of entry names.  An entry `catch-all' applies
-to all entries not explicitely mentioned."
+to all entries not explicitly mentioned."
   :group 'BibTeX
   :type '(repeat (choice :tag "Class"
                          (const :tag "catch-all" (catch-all))
@@ -654,7 +654,7 @@
   '("A" "An" "On" "The" "Eine?" "Der" "Die" "Das"
     "[^A-Z].*" ".*[^A-Z0-9].*")
   "Determines words from the title that are not to be used in the key.
-Each item of the list is a regexp.  If a word of the title matchs a
+Each item of the list is a regexp.  If a word of the title matches a
 regexp from that list, it is not included in the title part of the key.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
@@ -730,7 +730,7 @@
 
 (defcustom bibtex-entry-offset 0
   "Offset for BibTeX entries.
-Added to the value of all other variables which determine colums."
+Added to the value of all other variables which determine columns."
   :group 'bibtex
   :type 'integer)
 
@@ -1115,9 +1115,8 @@
                       t))
   "Regexp matching the name of any valid BibTeX entry (including string).")
 
-
-(defconst bibtex-empty-field-re "\"\"\\|{}"
-  "Regexp matching an empty field.")
+(defconst bibtex-empty-field-re "\\`\\(\"\"\\|{}\\)\\'"
+  "Regexp matching the text part (as a string) of an empty field.")
 
 (defconst bibtex-font-lock-syntactic-keywords
   `((,(concat "^[ \t]*\\(" (substring bibtex-comment-start 0 1) "\\)"
@@ -1179,7 +1178,7 @@
   "Parse a string of the format <left-hand-side = right-hand-side>.
 The functions PARSE-LHS and PARSE-RHS are used to parse the corresponding
 substrings.  These functions are expected to return nil if parsing is not
-successfull.  If both functions return non-nil, a pair containing the returned
+successful.  If both functions return non-nil, a pair containing the returned
 values of the functions PARSE-LHS and PARSE-RHS is returned."
   (save-match-data
     (save-excursion
@@ -1196,7 +1195,7 @@
 If the field name is found, return a triple consisting of the position of the
 very first character of the match, the actual starting position of the name
 part and end position of the match.  Move point to end of field name.
-If `bibtex-autoadd-commas' is non-nil add missing comma at end of preceeding
+If `bibtex-autoadd-commas' is non-nil add missing comma at end of preceding
 BibTeX field as necessary."
   (cond ((looking-at ",[ \t\n]*")
          (let ((start (point)))
@@ -1875,7 +1874,7 @@
                               (if opt-alt (+ beg-name 3) beg-name) end-name))
                  (empty-field (string-match bibtex-empty-field-re
                                             (buffer-substring-no-properties
-                                             beg-field end-field)))
+                                             beg-text end-text)))
                  deleted)
 
             ;; We have more elegant high-level functions for several
@@ -2824,7 +2823,7 @@
   (let ((e (assoc-string entry-type bibtex-entry-field-alist t))
         required optional)
     (unless e
-      (error "Bibtex entry type %s not defined" entry-type))
+      (error "BibTeX entry type %s not defined" entry-type))
     (if (and (member-ignore-case entry-type bibtex-include-OPTcrossref)
              (nth 2 e))
         (setq required (nth 0 (nth 2 e))
@@ -2960,9 +2959,13 @@
 	(while (setq bounds (bibtex-parse-field bibtex-field-name))
 	  (let ((text (assoc-string (bibtex-name-in-field bounds t)
                                     other t)))
-	    (goto-char (bibtex-start-of-text-in-field bounds))
-	    (if (not (and (looking-at bibtex-empty-field-re) text))
+	    (if (not (and text
+                          (string-match bibtex-empty-field-re
+                                        (buffer-substring-no-properties
+                                         (bibtex-start-of-text-in-field bounds)
+                                         (bibtex-end-of-text-in-field bounds)))))
 		(goto-char (bibtex-end-of-field bounds))
+              (goto-char (bibtex-start-of-text-in-field bounds))
 	      (delete-region (point) (bibtex-end-of-text-in-field bounds))
 	      (insert (cdr text)))))
 	;; Finally try to update the text based on the difference between
@@ -3269,7 +3272,7 @@
            (bibtex-reposition-window)
            (beginning-of-line)
            (if (and eqb (> pnt pos))
-               (error "The referencing entry must preceed the crossrefed entry!")))
+               (error "The referencing entry must precede the crossrefed entry!")))
           ;; `bibtex-find-crossref' is called noninteractively during
           ;; clean-up of an entry.  Then it is not possible to check
           ;; whether the current entry and the crossrefed entry have
--- a/lisp/textmodes/ispell.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/ispell.el	Thu Feb 03 23:28:36 2005 +0000
@@ -44,8 +44,8 @@
 ;; country and language.
 ;;   Most dictionary changes should be made in this file so all users can
 ;; enjoy them.  Local or modified dictionaries are supported in your .emacs
-;; file.  Modify the variable `ispell-local-dictionary-alist' to include
-;; these dictionaries, and they will be installed when ispell.el is loaded.
+;; file.  Use the variable `ispell-local-dictionary-alist' to specify
+;; your own dictionaries.
 
 ;;  Depending on the mail system you use, you may want to include these:
 ;;  (add-hook 'news-inews-hook 'ispell-message)
@@ -428,29 +428,27 @@
   :type 'boolean
   :group 'ispell)
 
-;;; This is the local dictionary to use.  When nil the default dictionary will
-;;; be used.  Change set-default call to use a new default dictionary.
+(defvar ispell-local-dictionary-overridden nil
+  "Non-nil means the user has explicitly set this buffer's Ispell dictionary.")
+(make-variable-buffer-local 'ispell-local-dictionary)
+
 (defcustom ispell-local-dictionary nil
-  "If non-nil, the dictionary to be used for Ispell commands.
-The value must be a string dictionary name in `ispell-dictionary-alist'.
+  "If non-nil, the dictionary to be used for Ispell commands in this buffer.
+The value must be a string dictionary name,
+or nil, which means use the global setting in `ispell-dictionary'.
+Dictionary names are defined in `ispell-local-dictionary-alist'
+and `ispell-dictionary-alist',
 
 Setting `ispell-local-dictionary' to a value has the same effect as
 calling \\[ispell-change-dictionary] with that value.  This variable
 is automatically set when defined in the file with either
-`ispell-dictionary-keyword' or the Local Variable syntax.
-
-To create a non-standard default dictionary (not from `ispell-dictionary-alist')
-call function `set-default' with the new dictionary name."
+`ispell-dictionary-keyword' or the Local Variable syntax."
   :type '(choice string
 		 (const :tag "default" nil))
   :group 'ispell)
 
 (make-variable-buffer-local 'ispell-local-dictionary)
 
-;; Call this function set up the default dictionary if not English.
-;;(set-default 'ispell-local-dictionary nil)
-
-
 (defcustom ispell-extra-args nil
   "*If non-nil, a list of extra switches to pass to the Ispell program.
 For example, (\"-W\" \"3\") to cause it to accept all 1-3 character
@@ -473,17 +471,14 @@
 (make-variable-buffer-local 'ispell-skip-html)
 
 
-;;; Define definitions here only for personal dictionaries.
 ;;;###autoload
 (defcustom ispell-local-dictionary-alist nil
-  "*Contains local or customized dictionary definitions.
-
-These will override the values in `ispell-dictionary-alist'.
-
-Customization changes made to `ispell-dictionary-alist' will not operate
-over emacs sessions.  To make permanent changes to your dictionary
-definitions, you will need to make your changes in this variable, save,
-and then re-start emacs."
+  "*List of local or customized dictionary definitions.
+These can override the values in `ispell-dictionary-alist'.
+
+To make permanent changes to your dictionary definitions, you
+will need to make your changes in this variable, save, and then
+re-start emacs."
   :type '(repeat (list (choice :tag "Dictionary"
 			       (string :tag "Dictionary name")
 			       (const :tag "default" nil))
@@ -591,12 +586,12 @@
     "[^A-Z\300\301\310\311\314\315\322\323\331\332a-z\340\341\350\351\354\355\363\371\372]"
     "[-]" nil ("-B" "-d" "italian") "~tex" iso-8859-1)
    ("nederlands"			; Nederlands.aff
-    "[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]"
-    "[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]"
+    "[A-Za-z\300\301\302\303\304\305\307\310\311\312\313\314\315\316\317\322\323\324\325\326\331\332\333\334\340\341\342\343\344\345\347\350\351\352\353\354\355\356\357\361\362\363\364\365\366\371\372\373\374]"
+    "[^A-Za-z\300\301\302\303\304\305\307\310\311\312\313\314\315\316\317\322\323\324\325\326\331\332\333\334\340\341\342\343\344\345\347\350\351\352\353\354\355\356\357\361\362\363\364\365\366\371\372\373\374]"
     "[']" t ("-C") nil iso-8859-1)
    ("nederlands8"			; Dutch8.aff
-    "[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]"
-    "[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]"
+    "[A-Za-z\300\301\302\303\304\305\307\310\311\312\313\314\315\316\317\322\323\324\325\326\331\332\333\334\340\341\342\343\344\345\347\350\351\352\353\354\355\356\357\361\362\363\364\365\366\371\372\373\374]"
+    "[^A-Za-z\300\301\302\303\304\305\307\310\311\312\313\314\315\316\317\322\323\324\325\326\331\332\333\334\340\341\342\343\344\345\347\350\351\352\353\354\355\356\357\361\362\363\364\365\366\371\372\373\374]"
     "[']" t ("-C") nil iso-8859-1)))
 
 
@@ -646,9 +641,8 @@
 
 
 ;;;###autoload
-(defcustom ispell-dictionary-alist
-  (append ispell-local-dictionary-alist	; dictionary customizations
-	  ispell-dictionary-alist-1 ispell-dictionary-alist-2
+(defvar ispell-dictionary-alist
+  (append ispell-dictionary-alist-1 ispell-dictionary-alist-2
 	  ispell-dictionary-alist-3 ispell-dictionary-alist-4
 	  ispell-dictionary-alist-5 ispell-dictionary-alist-6)
   "An alist of dictionaries and their associated parameters.
@@ -696,33 +690,7 @@
 
 Note that the CASECHARS and OTHERCHARS slots of the alist should
 contain the same character set as casechars and otherchars in the
-LANGUAGE.aff file \(e.g., english.aff\)."
-  :type '(repeat (list (choice :tag "Dictionary"
-			       (string :tag "Dictionary name")
-			       (const :tag "default" nil))
-		       (regexp :tag "Case characters")
-		       (regexp :tag "Non case characters")
-		       (regexp :tag "Other characters")
-		       (boolean :tag "Many other characters")
-		       (repeat :tag "Ispell command line args"
-			       (string :tag "Arg"))
-		       (choice :tag "Extended character mode"
-			       (const "~tex") (const "~plaintex")
-			       (const "~nroff") (const "~list")
-			       (const "~latin1") (const "~latin3")
- 			       (const :tag "default" nil))
-		       (choice :tag "Coding System"
-			       (const iso-8859-1)
-			       (const iso-8859-2)
-			       (const koi8-r))))
-  :group 'ispell)
-
-;;; update the dictionaries at load time
-(setq ispell-dictionary-alist
-      (append ispell-local-dictionary-alist	; dictionary customizations
-	      ispell-dictionary-alist-1 ispell-dictionary-alist-2
-	      ispell-dictionary-alist-3 ispell-dictionary-alist-4
-	      ispell-dictionary-alist-5 ispell-dictionary-alist-6))
+LANGUAGE.aff file \(e.g., english.aff\).")
 
 (defvar ispell-really-aspell nil) ; Non-nil if aspell extensions should be used
 
@@ -877,7 +845,7 @@
 (defun ispell-valid-dictionary-list ()
   "Returns a list of valid dictionaries.
 The variable `ispell-library-directory' defines the library location."
-  (let ((dicts ispell-dictionary-alist)
+  (let ((dicts (append ispell-local-dictionary-alist ispell-dictionary-alist))
 	(dict-list (cons "default" nil))
 	name load-dict)
     (dolist (dict dicts)
@@ -899,11 +867,12 @@
 	  (setq dict-list (cons name dict-list))))
     dict-list))
 
-
 ;;;###autoload
 (if ispell-menu-map-needed
     (let ((dicts (if (fboundp 'ispell-valid-dictionary-list)
 		     (ispell-valid-dictionary-list)
+		   ;; This case is used in loaddefs.el
+		   ;; since ispell-valid-dictionary-list isn't defined then.
 		   (mapcar (lambda (x) (or (car x) "default"))
 			   ispell-dictionary-alist)))
 	  (dict-map (make-sparse-keymap "Dictionaries")))
@@ -1054,14 +1023,14 @@
 
 
 ;;; This variable contains the current dictionary being used if the ispell
-;;; process is running.  Otherwise it contains the global default.
-(defvar ispell-dictionary nil
+;;; process is running.
+(defvar ispell-current-dictionary nil
   "The name of the current dictionary, or nil for the default.
-When `ispell-local-dictionary' is nil, `ispell-dictionary' is used to select
-the dictionary for new buffers.
-
 This is passed to the ispell process using the `-d' switch and is
-used as key in `ispell-dictionary-alist' (which see).")
+used as key in `ispell-local-dictionary-alist' and `ispell-dictionary-alist'.")
+
+(defvar ispell-dictionary nil
+  "Default dictionary to use if `ispell-local-dictionary' is nil.")
 
 (defun ispell-decode-string (str)
   "Decodes multibyte character strings.
@@ -1074,23 +1043,68 @@
       (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 splicing 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 (or
+		(assoc ispell-current-dictionary ispell-local-dictionary-alist)
+		(assoc ispell-current-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)))
+  (nth 4 (or (assoc ispell-current-dictionary ispell-local-dictionary-alist)
+	     (assoc ispell-current-dictionary ispell-dictionary-alist))))
 (defun ispell-get-ispell-args ()
-  (nth 5 (assoc ispell-dictionary ispell-dictionary-alist)))
+  (nth 5 (or (assoc ispell-current-dictionary ispell-local-dictionary-alist)
+	     (assoc ispell-current-dictionary ispell-dictionary-alist))))
 (defun ispell-get-extended-character-mode ()
-  (nth 6 (assoc ispell-dictionary ispell-dictionary-alist)))
+  (nth 6 (or (assoc ispell-current-dictionary ispell-local-dictionary-alist)
+	     (assoc ispell-current-dictionary ispell-dictionary-alist))))
 (defun ispell-get-coding-system ()
-  (nth 7 (assoc ispell-dictionary ispell-dictionary-alist)))
+  (nth 7 (or (assoc ispell-current-dictionary ispell-local-dictionary-alist)
+	     (assoc ispell-current-dictionary ispell-dictionary-alist))))
 
 
 (defvar ispell-pdict-modified-p nil
@@ -1142,8 +1156,9 @@
 
 (defconst ispell-dictionary-keyword "Local IspellDict: "
   "The keyword for a local dictionary to use.
-The keyword must be followed by a correct dictionary name in
-`ispell-dictionary-alist'.  When multiple occurrences exist, the last keyword
+The keyword must be followed by a valid dictionary name, defined in
+`ispell-local-dictionary-alist' or `ispell-dictionary-alist'.
+When multiple occurrences exist, the last keyword
 definition is used.")
 
 (defconst ispell-pdict-keyword "Local IspellPersDict: "
@@ -1400,7 +1415,8 @@
 With a prefix argument (or if CONTINUE is non-nil),
 resume interrupted spell-checking of a buffer or region.
 
-Word syntax described by `ispell-dictionary-alist' (which see).
+Word syntax is controlled by the definition of the chosen dictionary,
+which is in `ispell-local-dictionary-alist' or `ispell-dictionary-alist'.
 
 This will check or reload the dictionary.  Use \\[ispell-change-dictionary]
 or \\[ispell-region] to update the Ispell process.
@@ -1510,7 +1526,8 @@
 Optional second argument contains otherchars that can be included in word
 many times.
 
-Word syntax described by `ispell-dictionary-alist' (which see)."
+Word syntax is controlled by the definition of the chosen dictionary,
+which is in `ispell-local-dictionary-alist' or `ispell-dictionary-alist'."
   (let* ((ispell-casechars (ispell-get-casechars))
 	 (ispell-not-casechars (ispell-get-not-casechars))
 	 (ispell-otherchars (ispell-get-otherchars))
@@ -2270,13 +2287,13 @@
 Keeps argument list for future ispell invocations for no async support."
   (let (args)
     ;; Local dictionary becomes the global dictionary in use.
-    (if ispell-local-dictionary
-	(setq ispell-dictionary ispell-local-dictionary))
+    (setq ispell-current-dictionary
+	  (or ispell-local-dictionary ispell-dictionary))
     (setq args (ispell-get-ispell-args))
-    (if (and ispell-dictionary		; use specified dictionary
+    (if (and ispell-current-dictionary	; use specified dictionary
 	     (not (member "-d" args)))	; only define if not overridden
 	(setq args
-	      (append (list "-d" ispell-dictionary) args)))
+	      (append (list "-d" ispell-current-dictionary) args)))
     (if ispell-personal-dictionary	; use specified pers dict
 	(setq args
 	      (append args
@@ -2392,9 +2409,7 @@
 
 ;;;###autoload
 (defun ispell-change-dictionary (dict &optional arg)
-  "Change `ispell-dictionary' (q.v.) to DICT and kill old Ispell process.
-A new one will be started as soon as necessary.
-
+  "Change to dictionary DICT for Ispell.
 By just answering RET you can find out what the current dictionary is.
 
 With prefix argument, set the default dictionary."
@@ -2402,39 +2417,42 @@
    (list (completing-read
 	  "Use new dictionary (RET for current, SPC to complete): "
 	  (and (fboundp 'ispell-valid-dictionary-list)
-	       (mapcar (lambda (x)(cons x nil)) (ispell-valid-dictionary-list)))
+	       (mapcar 'list (ispell-valid-dictionary-list)))
 	  nil t)
 	 current-prefix-arg))
+  (unless arg (ispell-accept-buffer-local-defs))
   (if (equal dict "default") (setq dict nil))
   ;; This relies on completing-read's bug of returning "" for no match
   (cond ((equal dict "")
 	 (message "Using %s dictionary"
 		  (or ispell-local-dictionary ispell-dictionary "default")))
-	((and (equal dict ispell-dictionary)
-	      (or (null ispell-local-dictionary)
-		  (equal dict ispell-local-dictionary)))
+	((equal dict (or ispell-local-dictionary
+			 ispell-dictionary "default"))
 	 ;; Specified dictionary is the default already.  No-op
 	 (and (interactive-p)
-	      (message "No change, using %s dictionary" (or dict "default"))))
+	      (message "No change, using %s dictionary" dict)))
 	(t				; reset dictionary!
-	 (if (assoc dict ispell-dictionary-alist)
-	     (progn
-	       (if (or arg (null dict))	; set default dictionary
-		   (setq ispell-dictionary dict))
-	       (if (null arg)		; set local dictionary
-		   (setq ispell-local-dictionary dict)))
+	 (if (or (assoc dict ispell-local-dictionary-alist)
+		 (assoc dict ispell-dictionary-alist))
+	     (if arg
+		 ;; set default dictionary
+		 (setq ispell-dictionary dict)
+	       ;; set local dictionary
+	       (setq ispell-local-dictionary dict)
+	       (setq ispell-local-dictionary-overridden t))
 	   (error "Undefined dictionary: %s" dict))
-	 (ispell-kill-ispell t)
-	 (message "(Next %sIspell command will use %s dictionary)"
-		  (cond ((equal ispell-local-dictionary ispell-dictionary)
-			 "")
-			(arg "global ")
-			(t "local "))
-		  (or (if (or (equal ispell-local-dictionary ispell-dictionary)
-			      (null arg))
-			  ispell-local-dictionary
-			ispell-dictionary)
-		      "default")))))
+	 (message "%s Ispell dictionary set to %s"
+		  (if arg "Global" "Local")
+		  dict))))
+
+(defun ispell-internal-change-dictionary ()
+  "Update the dictionary actually used by Ispell.
+This may kill the Ispell process; if so,
+a new one will be started when needed."
+  (let ((dict (or ispell-local-dictionary ispell-dictionary "default")))
+    (unless (equal ispell-current-dictionary dict)
+      (setq ispell-current-dictionary dict)
+      (ispell-kill-ispell t))))
 
 
 ;;; Spelling of comments are checked when ispell-check-comments is non-nil.
@@ -2454,7 +2472,7 @@
 	(message "Spell checking %s using %s dictionary..."
 		 (if (and (= reg-start (point-min)) (= reg-end (point-max)))
 		     (buffer-name) "region")
-		 (or ispell-dictionary "default"))
+		 (or ispell-current-dictionary "default"))
 	;; Returns cursor to original location.
 	(save-window-excursion
 	  (goto-char reg-start)
@@ -2472,7 +2490,7 @@
 		  (goto-char reg-start)))
 	    (let (message-log-max)
 	      (message "Continuing spelling check using %s dictionary..."
-		       (or ispell-dictionary "default")))
+		       (or ispell-current-dictionary "default")))
 	    (set-marker rstart reg-start)
 	    (set-marker ispell-region-end reg-end)
 	    (while (and (not ispell-quit)
@@ -2755,6 +2773,15 @@
     string))
 
 
+(defun ispell-looking-at (string)
+  (let ((coding (ispell-get-coding-system))
+	(len (length string)))
+    (and (<= (+ (point) len) (point-max))
+	 (equal (encode-coding-string string coding)
+		(encode-coding-string (buffer-substring-no-properties
+				       (point) (+ (point) len))
+				      coding)))))
+
 ;;; Avoid error messages when compiling for these dynamic variables.
 (eval-when-compile
   (defvar start)
@@ -2803,12 +2830,7 @@
 
 	    ;; Alignment cannot be tracked and this error will occur when
 	    ;; `query-replace' makes multiple corrections on the starting line.
-	    (if (/= (+ word-len (point))
-		    (progn
-		      ;; NB: Search can fail with Mule coding systems that don't
-		      ;;  display properly.  Ignore the error in this case?
-		      (search-forward (car poss) (+ word-len (point)) t)
-		      (point)))
+	    (or (ispell-looking-at (car poss))
 		;; This occurs due to filter pipe problems
 		(error (concat "Ispell misalignment: word "
 			       "`%s' point %d; probably incompatible versions")
@@ -2898,7 +2920,7 @@
 	    (if (not ispell-quit)
 		(let (message-log-max)
 		  (message "Continuing spelling check using %s dictionary..."
-			   (or ispell-dictionary "default"))))
+			   (or ispell-current-dictionary "default"))))
 	    (sit-for 0)
 	    (setq start (marker-position line-start)
 		  end (marker-position line-end))
@@ -3468,14 +3490,15 @@
       ;; Override the local variable definition.
       ;; Uses last occurrence of ispell-dictionary-keyword.
       (goto-char (point-max))
-      (if (search-backward ispell-dictionary-keyword nil t)
-	  (progn
-	    (search-forward ispell-dictionary-keyword)
-	    (setq end (save-excursion (end-of-line) (point)))
-	    (if (re-search-forward " *\\([^ \"]+\\)" end t)
-		(setq ispell-local-dictionary
-		      (buffer-substring-no-properties (match-beginning 1)
-						      (match-end 1))))))
+      (unless ispell-local-dictionary-overridden
+	(if (search-backward ispell-dictionary-keyword nil t)
+	    (progn
+	      (search-forward ispell-dictionary-keyword)
+	      (setq end (save-excursion (end-of-line) (point)))
+	      (if (re-search-forward " *\\([^ \"]+\\)" end t)
+		  (setq ispell-local-dictionary
+			(buffer-substring-no-properties (match-beginning 1)
+							(match-end 1)))))))
       (goto-char (point-max))
       (if (search-backward ispell-pdict-keyword nil t)
 	  (progn
@@ -3492,8 +3515,7 @@
 	(ispell-kill-ispell t)
 	(setq ispell-personal-dictionary ispell-local-pdict)))
   ;; Reload if new dictionary defined.
-  (if (not (equal ispell-local-dictionary ispell-dictionary))
-      (ispell-change-dictionary ispell-local-dictionary)))
+  (ispell-internal-change-dictionary))
 
 
 (defun ispell-buffer-local-words ()
--- a/lisp/textmodes/org.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/org.el	Thu Feb 03 23:28:36 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,10 +213,10 @@
 
 ;;; 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")
+(defun org-version ()
+  (interactive)
   (message "Org-mode version %s" org-version))
 
 ;; The following two constants are for compatibility with different 
@@ -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/refill.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/refill.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 ;;; refill.el --- `auto-fill' by refilling paragraphs on changes
 
-;; Copyright (C) 2000, 2003  Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2003, 2005  Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Maintainer: Miles Bader <miles@gnu.org>
@@ -85,6 +85,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 (defgroup refill nil
   "Refilling paragraphs on changes."
   :group 'fill)
@@ -169,40 +171,36 @@
   "Post-command function to do refilling (conditionally)."
   (when refill-doit ; there was a change
     ;; There's probably scope for more special cases here...
-    (if (eq this-command 'self-insert-command)
-	;; Treat self-insertion commands specially, since they don't
-	;; always reset `refill-doit' -- for self-insertion commands that
-	;; *don't* cause a refill, we want to leave it turned on so that
-	;; any subsequent non-modification command will cause a refill.
-	(when (aref auto-fill-chars (char-before))
-	  ;; Respond to the same characters as auto-fill (other than
-	  ;; newline, covered below).
-	  (refill-fill-paragraph-at refill-doit)
-	  (setq refill-doit nil))
-      (cond
-       ((or (eq this-command 'quoted-insert)
-	    (eq this-command 'fill-paragraph)
-	    (eq this-command 'fill-region))
-	nil)
-       ((or (eq this-command 'newline)
-	    (eq this-command 'newline-and-indent)
-	    (eq this-command 'open-line))
-	;; Don't zap what was just inserted.
-	(save-excursion
-	  (beginning-of-line)		; for newline-and-indent
-	  (skip-chars-backward "\n")
-	  (save-restriction
-	    (narrow-to-region (point-min) (point))
-	    (refill-fill-paragraph-at refill-doit)))
-	(widen)
-	(save-excursion
-	  (skip-chars-forward "\n")
-	  (save-restriction
-	    (narrow-to-region (line-beginning-position) (point-max))
-	    (refill-fill-paragraph-at refill-doit))))
-       (t
-	(refill-fill-paragraph-at refill-doit)))
-      (setq refill-doit nil))))
+    (case this-command
+      (self-insert-command
+       ;; Treat self-insertion commands specially, since they don't
+       ;; always reset `refill-doit' -- for self-insertion commands that
+       ;; *don't* cause a refill, we want to leave it turned on so that
+       ;; any subsequent non-modification command will cause a refill.
+       (when (aref auto-fill-chars (char-before))
+	 ;; Respond to the same characters as auto-fill (other than
+	 ;; newline, covered below).
+	 (refill-fill-paragraph-at refill-doit)
+	 (setq refill-doit nil)))
+      ((quoted-insert fill-paragraph fill-region) nil)
+      ((newline newline-and-indent open-line indent-new-comment-line
+	reindent-then-newline-and-indent)
+       ;; Don't zap what was just inserted.
+       (save-excursion
+	 (beginning-of-line)		; for newline-and-indent
+	 (skip-chars-backward "\n")
+	 (save-restriction
+	   (narrow-to-region (point-min) (point))
+	   (refill-fill-paragraph-at refill-doit)))
+       (widen)
+       (save-excursion
+	 (skip-chars-forward "\n")
+	 (save-restriction
+	   (narrow-to-region (line-beginning-position) (point-max))
+	   (refill-fill-paragraph-at refill-doit))))
+      (t
+       (refill-fill-paragraph-at refill-doit)))
+    (setq refill-doit nil)))
 
 (defun refill-pre-command-function ()
   "Pre-command function to do refilling (conditionally)."
@@ -213,7 +211,7 @@
     (refill-fill-paragraph-at refill-doit)
     (setq refill-doit nil)))
 
-(defvar refill-late-fill-paragraph-function nil)
+(defvar refill-saved-state nil)
 
 ;;;###autoload
 (define-minor-mode refill-mode
@@ -228,16 +226,18 @@
   (when refill-ignorable-overlay
     (delete-overlay refill-ignorable-overlay)
     (kill-local-variable 'refill-ignorable-overlay))
-  (when (local-variable-p 'refill-late-fill-paragraph-function)
-    (setq fill-paragraph-function refill-late-fill-paragraph-function)
-    (kill-local-variable 'refill-late-fill-paragraph-function))
+  (when (local-variable-p 'refill-saved-state)
+    (dolist (x refill-saved-state)
+      (set (make-local-variable (car x)) (cdr x)))
+    (kill-local-variable 'refill-saved-state))
   (if refill-mode
       (progn
 	(add-hook 'after-change-functions 'refill-after-change-function nil t)
 	(add-hook 'post-command-hook 'refill-post-command-function nil t)
 	(add-hook 'pre-command-hook 'refill-pre-command-function nil t)
-	(set (make-local-variable 'refill-late-fill-paragraph-function)
-	     fill-paragraph-function)
+	(set (make-local-variable 'refill-saved-state)
+	     (mapcar (lambda (s) (cons s (symbol-value s)))
+		     '(fill-paragraph-function auto-fill-function)))
 	;; This provides the test for recursive paragraph filling.
 	(set (make-local-variable 'fill-paragraph-function)
 	     'refill-fill-paragraph)
@@ -257,5 +257,5 @@
 
 (provide 'refill)
 
-;;; arch-tag: 2c4ce9e8-1daa-4a3b-b6f8-fd6ac5bf6138
+;; arch-tag: 2c4ce9e8-1daa-4a3b-b6f8-fd6ac5bf6138
 ;;; refill.el ends here
--- a/lisp/textmodes/reftex-auc.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/reftex-auc.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/reftex-cite.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/reftex-dcr.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/reftex-global.el	Thu Feb 03 23:28:36 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.
 
@@ -338,5 +338,131 @@
                               (buffer-name buf)))
             (error "Abort"))))))
 
+(defun reftex-isearch-wrap-function ()
+  (if (not isearch-word)
+      (switch-to-buffer 
+       (funcall isearch-next-buffer-function (current-buffer) t)))
+  (goto-char (if isearch-forward (point-min) (point-max))))
+
+(defun reftex-isearch-push-state-function ()
+  `(lambda (cmd)
+     (reftex-isearch-pop-state-function cmd ,(current-buffer))))
+
+(defun reftex-isearch-pop-state-function (cmd buffer)
+  (switch-to-buffer buffer))
+
+(defun reftex-isearch-isearch-search (string bound noerror)
+  (let ((nxt-buff nil)
+	(search-fun
+	 (cond
+	  (isearch-word
+	   (if isearch-forward 'word-search-forward 'word-search-backward))
+	  (isearch-regexp
+	   (if isearch-forward 're-search-forward 're-search-backward))
+	  (t
+	   (if isearch-forward 'search-forward 'search-backward)))))
+    (or
+     (funcall search-fun string bound noerror)
+     (unless bound
+       (condition-case nil
+	   (when isearch-next-buffer-function
+	     (while (not (funcall search-fun string bound noerror))
+	       (cond
+		(isearch-forward
+		 (setq nxt-buff
+		       (funcall isearch-next-buffer-function
+				(current-buffer)))
+		 (if (not nxt-buff)
+		     (progn
+		       (error "Wrap forward"))
+		   (switch-to-buffer nxt-buff)
+		   (goto-char (point-min))))
+		(t
+		 (setq nxt-buff
+		       (funcall isearch-next-buffer-function
+					 (current-buffer)))
+		 (if (not nxt-buff)
+		     (progn
+		       (error "Wrap backward"))
+		   (switch-to-buffer nxt-buff)
+		   (goto-char (point-max))))))
+	     (point))
+	 (error nil))))))
+
+;;; This function is called when isearch reaches the end of a
+;;; buffer. For reftex what we want to do is not wrap to the
+;;; beginning, but switch to the next buffer in the logical order of
+;;; the document.  This function looks through list of files in the
+;;; document (reftex-all-document-files), searches for the current
+;;; buffer and switches to the next/previous one in the logical order
+;;; of the document.  If WRAPP is true then wrap the search to the
+;;; beginning/end of the file list, depending of the search direction.
+(defun reftex-isearch-switch-to-next-file (crt-buf &optional wrapp)
+  (reftex-access-scan-info)
+  (let* ((cb (buffer-file-name crt-buf))
+	 (flist (reftex-all-document-files))
+	 (orig-flist flist))
+    (when flist
+      (if wrapp
+	  (unless isearch-forward
+	      (setq flist (last flist)))
+	(unless isearch-forward
+	  (setq flist (nreverse (copy-list flist)))
+	  (setq orig-flist flist))
+	(while (not (string= (car flist) cb))
+	  (setq flist (cdr flist)))
+	(setq flist (cdr flist)))
+      (when flist
+	(find-file  (car flist))))))
+
+;;;###autoload
+(defvar reftex-isearch-minor-mode nil)
+(make-variable-buffer-local 'reftex-isearch-minor-mode)
+
+;;;###autoload
+(defun reftex-isearch-minor-mode (&optional arg)
+  "When on, isearch searches the whole document, not only the current file.
+This minor mode allows isearch to search through all the files of
+the current TeX document.
+
+With no argument, this command toggles
+`reftex-isearch-minor-mode'.  With a prefix argument ARG, turn
+`reftex-isearch-minor-mode' on iff ARG is positive."
+  (interactive "P")
+  (let ((old-reftex-isearch-minor-mode reftex-isearch-minor-mode))
+    (setq reftex-isearch-minor-mode 
+	  (not (or (and (null arg) reftex-isearch-minor-mode)
+		   (<= (prefix-numeric-value arg) 0))))
+    (unless (eq reftex-isearch-minor-mode old-reftex-isearch-minor-mode)
+      (if reftex-isearch-minor-mode
+	  (progn
+	    (dolist (crt-buf (buffer-list))
+	      (with-current-buffer crt-buf
+		(when reftex-mode
+		  (set (make-local-variable 'isearch-wrap-function)
+		       'reftex-isearch-wrap-function)
+		  (set (make-local-variable 'isearch-search-fun-function)
+		       (lambda () 'reftex-isearch-isearch-search))
+		  (set (make-local-variable 'isearch-push-state-function)
+		       'reftex-isearch-push-state-function)
+		  (set (make-local-variable 'isearch-next-buffer-function)
+		       'reftex-isearch-switch-to-next-file)
+		  (setq reftex-isearch-minor-mode t))))
+	    (add-hook 'reftex-mode-hook 'reftex-isearch-minor-mode))
+	(dolist (crt-buf (buffer-list))
+	  (with-current-buffer crt-buf
+	    (when reftex-mode
+	      (kill-local-variable 'isearch-wrap-function)
+	      (kill-local-variable 'isearch-search-fun-function)
+	      (kill-local-variable 'isearch-push-state-function)
+	      (kill-local-variable 'isearch-next-buffer-function)
+	      (setq reftex-isearch-minor-mode nil))))
+	(remove-hook 'reftex-mode-hook 'reftex-isearch-minor-mode)))
+    ;; Force modeline redisplay.
+    (set-buffer-modified-p (buffer-modified-p))))
+
+(add-minor-mode 'reftex-isearch-minor-mode "/I" nil nil 
+		'reftex-isearch-minor-mode)
+
 ;;; arch-tag: 2dbf7633-92c8-4340-8656-7aa019d0f80d
 ;;; reftex-global.el ends here
--- a/lisp/textmodes/reftex-index.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/reftex-index.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/reftex-parse.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/reftex-ref.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/reftex-sel.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/reftex-toc.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/reftex-vars.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/reftex.el	Thu Feb 03 23:28:36 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)))
@@ -1219,6 +1228,11 @@
   ;; But, when RESCAN is -1, don't rescan even if docstruct is empty.
   ;; When FILE is non-nil, parse only from that file.
 
+  ;; Error out in a buffer without a file.
+  (if (and reftex-mode
+	   (not (buffer-file-name)))
+      (error "RefTeX works only in buffers visiting a file."))
+
   ;; Make sure we have the symbols tied
   (if (eq reftex-docstruct-symbol nil)
       ;; Symbols are not yet tied: Tie them.
@@ -1676,6 +1690,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 +2454,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 +2463,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])
@@ -2474,7 +2492,9 @@
     "--"
     "MISC"
     ["AUC TeX Interface" reftex-toggle-plug-into-AUCTeX
-     :style toggle :selected reftex-plug-into-AUCTeX])
+     :style toggle :selected reftex-plug-into-AUCTeX]
+    ["isearch whole document" reftex-isearch-minor-mode
+     :style toggle :selected reftex-isearch-minor-mode])
    ("Reference Style"
     ["Default" (setq reftex-vref-is-default nil
                      reftex-fref-is-default nil)
--- a/lisp/textmodes/sgml-mode.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/sgml-mode.el	Thu Feb 03 23:28:36 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>
@@ -394,6 +394,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.
@@ -424,6 +432,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) " -->")
@@ -1140,17 +1149,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
@@ -1174,24 +1185,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.
@@ -1202,13 +1214,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/textmodes/tex-mode.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/textmodes/tex-mode.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1495,7 +1495,9 @@
       (make-comint
        "tex-shell"
        (or tex-shell-file-name (getenv "ESHELL") shell-file-name)
-       nil)
+       nil
+       ;; Specify an interactive shell, to make sure it prompts.
+       "-i")
     (let ((proc (get-process "tex-shell")))
       (set-process-sentinel proc 'tex-shell-sentinel)
       (set-process-query-on-exit-flag proc nil)
--- a/lisp/toolbar/README	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/toolbar/README	Thu Feb 03 23:28:36 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	Thu Feb 03 23:28:36 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	Thu Feb 03 23:28:36 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	Thu Feb 03 23:28:36 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	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/type-break.el	Thu Feb 03 23:28:36 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,10 @@
       (and (interactive-p)
            (message "Type Break mode is already enabled")))
      (type-break-mode
+      (when type-break-file-name
+	(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 +404,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 +438,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 +503,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 +515,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 +543,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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/uniquify.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/url/ChangeLog	Thu Feb 03 23:28:36 2005 +0000
@@ -1,3 +1,18 @@
+2005-01-22  Klaus Straubinger  <KSNetz@Arcor.DE>  (tiny change)
+
+	* url-http.el (url-http-parse-headers) <302>: Reset url-http-data
+	to nil, like for the 303 response.
+
+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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/url/url-http.el	Thu Feb 03 23:28:36 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."
@@ -459,7 +459,7 @@
 	      (url-http-debug "Converting `%s' request to `GET' because of REDIRECT(%d)"
 			      url-http-method url-http-response-status)
 	      (setq url-http-method "GET"
-		    url-request-data nil)))
+		    url-http-data nil)))
 	   (303
 	    ;; The response to the request can be found under a different
 	    ;; URI and SHOULD be retrieved using a GET method on that
--- a/lisp/url/url.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/url/url.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/vc-arch.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/vc-cvs.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/vc-mcvs.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/vc-svn.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/vc.el	Thu Feb 03 23:28:36 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/wid-edit.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/wid-edit.el	Thu Feb 03 23:28:36 2005 +0000
@@ -391,7 +391,11 @@
     (overlay-put overlay 'evaporate t)
     ;; We want to avoid the face with image buttons.
     (unless (widget-get widget :suppress-face)
-      (overlay-put overlay 'face (widget-apply widget :button-face-get)))
+      (overlay-put overlay 'face (widget-apply widget :button-face-get))
+      ; Text terminals cannot change mouse pointer shape, so use mouse
+      ; face instead.
+      (or (display-graphic-p)
+	  (overlay-put overlay 'mouse-face widget-mouse-face)))
     (overlay-put overlay 'pointer 'hand)
     (overlay-put overlay 'follow-link follow-link)
     (overlay-put overlay 'help-echo help-echo)))
@@ -911,14 +915,14 @@
 		      ;; until we receive a release event.  Highlight/
 		      ;; unhighlight the button the mouse was initially
 		      ;; on when we move over it.
-		      (let ((track-mouse t))
-			(save-excursion
-			  (when face	; avoid changing around image
-			    (overlay-put overlay
-					 'face widget-button-pressed-face)
-			    (overlay-put overlay
-					 'mouse-face widget-button-pressed-face))
-			  (unless (widget-apply button :mouse-down-action event)
+		      (save-excursion
+			(when face	; avoid changing around image
+			  (overlay-put overlay
+				       'face widget-button-pressed-face)
+			  (overlay-put overlay
+				       'mouse-face widget-button-pressed-face))
+			(unless (widget-apply button :mouse-down-action event)
+			  (let ((track-mouse t))
 			    (while (not (widget-button-release-event-p event))
 			      (setq event (read-event)
 				    pos (widget-event-point event))
@@ -933,13 +937,13 @@
 						 'mouse-face
 						 widget-button-pressed-face))
 				(overlay-put overlay 'face face)
-				(overlay-put overlay 'mouse-face mouse-face))))
-
-			  ;; When mouse is released over the button, run
-			  ;; its action function.
-			  (when (and pos
-				     (eq (get-char-property pos 'button) button))
-			    (widget-apply-action button event))))
+				(overlay-put overlay 'mouse-face mouse-face)))))
+
+			;; When mouse is released over the button, run
+			;; its action function.
+			(when (and pos
+				   (eq (get-char-property pos 'button) button))
+			  (widget-apply-action button event)))
 		    (overlay-put overlay 'face face)
 		    (overlay-put overlay 'mouse-face mouse-face))))
 
--- a/lisp/window.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/window.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 ;;; window.el --- GNU Emacs window commands aside from those written in C
 
-;; Copyright (C) 1985, 1989, 1992, 1993, 1994, 2000, 2001, 2002, 2004
+;; Copyright (C) 1985, 1989, 1992, 1993, 1994, 2000, 2001, 2002, 2004, 2005
 ;;  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -631,6 +631,12 @@
   (interactive "e")
   (let ((window (posn-window (event-start event))))
     (if (and (window-live-p window)
+	     ;; Don't switch if we're currently in the minibuffer.
+	     ;; This tries to work around problems where the minibuffer gets
+	     ;; unselected unexpectedly, and where you then have to move
+	     ;; your mouse all the way down to the minibuffer to select it.
+	     (not (window-minibuffer-p (selected-window)))
+	     ;; Don't switch to a minibuffer window unless it's active.
 	     (or (not (window-minibuffer-p window))
 		 (minibuffer-window-active-p window)))
 	(select-window window))))
@@ -643,5 +649,5 @@
 (define-key ctl-x-map "+" 'balance-windows)
 (define-key ctl-x-4-map "0" 'kill-buffer-and-window)
 
-;;; arch-tag: b508dfcc-c353-4c37-89fa-e773fe10cea9
+;; arch-tag: b508dfcc-c353-4c37-89fa-e773fe10cea9
 ;;; window.el ends here
--- a/lisp/woman.el	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/woman.el	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lisp/xt-mouse.el	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 ;;; xt-mouse.el --- support the mouse when emacs run in an xterm
 
-;; Copyright (C) 1994, 2000, 2001 Free Software Foundation
+;; Copyright (C) 1994, 2000, 2001, 2005 Free Software Foundation
 
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: mouse, terminals
@@ -24,7 +24,7 @@
 
 ;;; Commentary:
 
-;; Enable mouse support when running inside an xterm or Linux console.
+;; Enable mouse support when running inside an xterm.
 
 ;; This is actually useful when you are running X11 locally, but is
 ;; working on remote machine over a modem line or through a gateway.
@@ -32,18 +32,16 @@
 ;; It works by translating xterm escape codes into generic emacs mouse
 ;; events so it should work with any package that uses the mouse.
 
-;; The xterm mouse escape codes are supposedly also supported by the
-;; Linux console, but I have not been able to verify this.
-
 ;; You don't have to turn off xterm mode to use the normal xterm mouse
 ;; functionality, it is still available by holding down the SHIFT key
 ;; when you press the mouse button.
 
 ;;; Todo:
 
-;; Support multi-click -- somehow.
+;; The xterm mouse escape codes are supposedly also supported by the
+;; Linux console, but I have not been able to verify this.
 
-;; Clicking on the mode-line does not work, although it should.
+;; Support multi-click -- somehow.
 
 ;;; Code:
 
@@ -51,6 +49,11 @@
 
 (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 t))
+      (list mouse
+	    (append (list nil 'menu-bar) (nthcdr 2 (posn-at-x-y x y w t)))))))
 
 ;;;###autoload
 (define-minor-mode xterm-mouse-mode
--- a/lispref/ChangeLog	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/ChangeLog	Thu Feb 03 23:28:36 2005 +0000
@@ -1,3 +1,151 @@
+2005-02-03  Richard M. Stallman  <rms@gnu.org>
+
+	* windows.texi (Basic Windows): Add cursor-in-non-selected-windows.
+	Clarify.
+	(Selecting Windows): Clarify save-selected-window.
+	(Cyclic Window Ordering): Clarify walk-windows.
+	(Window Point): Clarify.
+	(Window Start): Add comment to example.
+	(Resizing Windows): Add `interactive' specs in examples.
+	Document fit-window-to-buffer.
+
+	* text.texi (User-Level Deletion): just-one-space takes numeric arg.
+	(Undo, Maintaining Undo): Clarify last change.
+	(Sorting): In sort-numeric-fields, explain about octal and hex.
+	Mention sort-numeric-base.
+	(Format Properties): Add xref for hard newlines.
+
+	* frames.texi (Window Frame Parameters): Explain pixel=char on tty.
+	(Pop-Up Menus): Fix typo.
+	(Color Names): Explain all types of color names.
+	Explain color-values on B&W terminal.
+	(Text Terminal Colors): Explain "rgb values" are lists.  Fix arg names.
+
+	* files.texi (File Locks): Not supported on MS systems.
+	(Testing Accessibility): Clarify.
+
+	* edebug.texi (Printing in Edebug): Fix edebug-print-circle.
+	(Coverage Testing): Fix typo.
+
+	* commands.texi (Misc Events): Remove stray space.
+
+	* buffers.texi (Buffer Names): Clarify generate-new-buffer-name.
+	(Modification Time): Clarify when visited-file-modtime returns 0.
+	(The Buffer List): Clarify bury-buffer.
+	(Killing Buffers): Clarify.
+	(Indirect Buffers): Add clone-indirect-buffer.
+
+2005-02-02  Matt Hodges  <MPHodges@member.fsf.org>
+
+	* edebug.texi (Printing in Edebug): Fix default value of
+	edebug-print-circle.
+	(Coverage Testing): Fix displayed frequency count data.
+
+2005-02-02  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* text.texi (Maintaining Undo): Add `undo-outer-limit'.
+
+2005-02-02  Kim F. Storm  <storm@cua.dk>
+
+	* text.texi (Undo) <buffer-undo-list>: Describe `apply' elements.
+
+2005-01-29  Eli Zaretskii  <eliz@gnu.org>
+
+	* commands.texi (Misc Events): Describe the help-echo event.
+
+	* text.texi (Special Properties) <help-echo>: Use `pos'
+	consistently in description of the help-echo property.  Use
+	@code{nil} instead of @var{nil}.
+
+	* display.texi (Overlay Properties): Fix the index entry for
+	help-echo overlay property.
+
+	* customize.texi (Type Keywords): Uncomment the xref to the
+	help-echo property documentation.
+
+2005-01-23  Kim F. Storm  <storm@cua.dk>
+
+	* windows.texi (Window Start): Fix `pos-visible-in-window-p'
+	return value.  Third element FULLY replaced by PARTIAL which
+	specifies number of invisible pixels if row is only partially visible.
+	(Textual Scrolling): Mention auto-window-vscroll.
+	(Vertical Scrolling): New defvar auto-window-vscroll.
+
+2005-01-16  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* keymaps.texi (Changing Key Bindings): `suppress-keymap' now uses
+	command remapping.
+
+2005-01-15  Richard M. Stallman  <rms@gnu.org>
+
+	* display.texi (Defining Images): Mention DATA-P arg of create-image.
+
+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.
+
+2005-01-01  Richard M. Stallman  <rms@gnu.org>
+
+	* display.texi (Face Attributes): Describe hex color specs.
+
+2004-12-31  Richard M. Stallman  <rms@gnu.org>
+
+	* os.texi (Timers): Update previous change.
+
 2004-12-30  Kim F. Storm  <storm@cua.dk>
 
 	* display.texi (Line Height): Total line-height is now specified
--- a/lispref/buffers.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/buffers.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -344,11 +344,11 @@
 incrementing the number until it is not the name of an existing buffer.
 
 If the optional second argument @var{ignore} is non-@code{nil}, it
-should be a string; it makes a difference if it is a name in the
-sequence of names to be tried.  That name will be considered acceptable,
-if it is tried, even if a buffer with that name exists.  Thus, if
-buffers named @samp{foo}, @samp{foo<2>}, @samp{foo<3>} and @samp{foo<4>}
-exist,
+should be a string, a potential buffer name.  It means to consider
+that potential buffer acceptable, if it is tried, even it is the name
+of an existing buffer (which would normally be rejected).  Thus, if
+buffers named @samp{foo}, @samp{foo<2>}, @samp{foo<3>} and
+@samp{foo<4>} exist,
 
 @example
 (generate-new-buffer-name "foo")
@@ -629,16 +629,13 @@
 (This is the same format that @code{file-attributes} uses to return
 time values; see @ref{File Attributes}.)
 
-The function returns zero if the buffer has no recorded last
-modification time, which can happen, for instance, if the record has
-been explicitly cleared by @code{clear-visited-file-modtime} or if the
-buffer is not visiting a file.  Note, however, that
-@code{visited-file-modtime} can return a non-zero value for some
-buffers that are not visiting files, but are nevertheless closely
-associated with a file.  This happens, for instance, with dired
-buffers listing a directory.  For such buffers,
-@code{visited-file-modtime} returns the last modification time of that
-directory, as recorded by dired.
+If the buffer has no recorded last modification time, this function
+returns zero.  This case occurs, for instance, if the buffer is not
+visiting a file or if the time has been explicitly cleared by
+@code{clear-visited-file-modtime}.  Note, however, that
+@code{visited-file-modtime} returns a list for some non-file buffers
+too.  For instance, in a Dired buffer listing a directory, it returns
+the last modification time of that directory, as recorded by Dired.
 
 For a new buffer visiting a not yet existing file, @var{high} is
 @minus{}1 and @var{low} is 65535, that is,
@@ -857,7 +854,8 @@
 This function puts @var{buffer-or-name} at the end of the buffer list,
 without changing the order of any of the other buffers on the list.
 This buffer therefore becomes the least desirable candidate for
-@code{other-buffer} to return.
+@code{other-buffer} to return.  The argument can be either a buffer
+itself or the name of one.
 
 @code{bury-buffer} operates on each frame's @code{buffer-list} parameter
 as well as the frame-independent Emacs buffer list; therefore, the
@@ -949,8 +947,8 @@
 @cindex killing buffers
 @cindex buffers, killing
 
-  @dfn{Killing a buffer} makes its name unknown to Emacs and makes its
-text space available for other use.
+  @dfn{Killing a buffer} makes its name unknown to Emacs and makes the
+memory space it occupied available for other use.
 
   The buffer object for the buffer that has been killed remains in
 existence as long as anything refers to it, but it is specially marked
@@ -1101,6 +1099,18 @@
 buffer, not from @var{base-buffer}.
 @end deffn
 
+@defun clone-indirect-buffer newname display-flag &optional norecord
+This function creates and returns a new indirect buffer that shares
+the current buffer's base buffer and copies the rest of the current
+buffer's attributes.  (If the current buffer is not indirect, it is
+used as the base buffer.)
+
+If @var{display-flag} is non-@code{nil}, that means to display the new
+buffer by calling @code{pop-to-buffer}.  If @var{norecord} is
+non-@code{nil}, that means not to put the new buffer to the front of
+the buffer list.
+@end defun
+
 @defun buffer-base-buffer &optional buffer
 This function returns the base buffer of @var{buffer}, which defaults
 to the current buffer.  If @var{buffer} is not indirect, the value is
--- a/lispref/commands.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/commands.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -1547,6 +1547,21 @@
 This kind of event is generated, at present, only on some kinds of
 systems.
 
+@cindex @code{help-echo} event
+@item help-echo
+This kind of event is generated when a mouse pointer moves onto a
+portion of buffer text which has a @code{help-echo} text property.
+The generated event has this form:
+
+@example
+(help-echo @var{frame} @var{help} @var{window} @var{object} @var{pos})
+@end example
+
+@noindent
+The precise meaning of the event parameters and the way these
+parameters are used to display the help-echo text are described in
+@ref{Text help-echo}.
+
 @cindex @code{usr1-signal} event
 @cindex @code{usr2-signal} event
 @item usr1-signal
@@ -1843,12 +1858,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/customize.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/customize.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -983,7 +983,7 @@
 @code{help-echo} string and may actually be a function or form evaluated
 to yield a help string.  If it is a function, it is called with one
 argument, the widget.
-@c @xref{Text help-echo}.
+@xref{Text help-echo}.
 
 @item :match @var{function}
 Specify how to decide whether a value matches the type.  The
--- a/lispref/display.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/display.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -1,7 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002
-@c   Free Software Foundation, Inc.
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001,
+@c   2002, 2005  Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/display
 @node Display, Calendar, Processes, Top
@@ -633,6 +633,22 @@
 Secondly, ``done'' is more explicit.
 @end defun
 
+@defmac dotimes-with-progress-reporter (var count [result]) message body...
+This is a convenience macro that works the same way as @code{dotimes}
+does, but also reports loop progress using the functions described
+above.  It allows you to save some typing.
+
+You can rewrite the example in the beginning of this node using
+this macro this way:
+
+@example
+(dotimes-with-progress-reporter
+    (k 500)
+    "Collecting some mana for Emacs..."
+  (sit-for 0.01))
+@end example
+@end defmac
+
 @node Invisible Text
 @section Invisible Text
 
@@ -1193,7 +1209,7 @@
 @xref{Display Property}.
 
 @item help-echo
-@kindex help-echo @r{(text property)}
+@kindex help-echo @r{(overlay property)}
 If an overlay has a @code{help-echo} property, then when you move the
 mouse onto the text in the overlay, Emacs displays a help string in the
 echo area, or in the tooltip window.  For details see @ref{Text
@@ -1636,7 +1652,7 @@
 * Defining Faces::      How to define a face with @code{defface}.
 * Face Attributes::     What is in a face?
 * Attribute Functions::  Functions to examine and set face attributes.
-* Merging Faces::       How Emacs combines the faces specified for a character.
+* Displaying Faces::     How Emacs combines the faces specified for a character.
 * Font Selection::      Finding the best available font for a face.
 * Face Functions::      How to define and examine faces.
 * Auto Faces::          Hook for automatic face assignment.
@@ -1890,7 +1906,7 @@
 attributes}.  This table lists all the face attributes, and what they
 mean.  Note that in general, more than one face can be specified for a
 given piece of text; when that happens, the attributes of all the faces
-are merged to specify how to display the text.  @xref{Merging Faces}.
+are merged to specify how to display the text.  @xref{Displaying Faces}.
 
   In Emacs 21, any attribute in a face can have the value
 @code{unspecified}.  This means the face doesn't specify that attribute.
@@ -1941,10 +1957,14 @@
 the terminal supports the feature.
 
 @item :foreground
-Foreground color, a string.
+Foreground color, a string.  The value can be a system-defined color
+name, or a hexadecimal color specification of the form
+@samp{#@var{rr}@var{gg}@var{bb}}.  (@samp{#000000} is black,
+@samp{#ff0000} is red, @samp{#00ff00} is green, @samp{#0000ff} is
+blue, and @samp{#ffffff} is white.)
 
 @item :background
-Background color, a string.
+Background color, a string, like the foreground color.
 
 @item :inverse-video
 Whether or not characters should be displayed in inverse video.  The
@@ -2265,8 +2285,8 @@
 This function returns the @code{:inverse-video} attribute of face @var{face}.
 @end defun
 
-@node Merging Faces
-@subsection Merging Faces for Display
+@node Displaying Faces
+@subsection Displaying Faces
 
   Here are the ways to specify which faces to use for display of text:
 
@@ -3784,10 +3804,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
@@ -3798,7 +3820,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
@@ -4059,6 +4081,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
@@ -4238,6 +4265,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/edebug.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/edebug.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -801,7 +801,7 @@
 
 @defopt edebug-print-circle
 If non-@code{nil}, Edebug binds @code{print-circle} to this value while
-printing results.  The default value is @code{nil}.
+printing results.  The default value is @code{t}.
 @end defopt
 
   Other programs can also use custom printing; see @file{cust-print.el}
@@ -909,7 +909,7 @@
 @example
 (defun fac (n)
   (if (= n 0) (edebug))
-;#6           1      0 =5
+;#6           1      = =5
   (if (< 0 n)
 ;#5         =
       (* n (fac (1- n)))
--- a/lispref/files.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/files.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -646,9 +646,10 @@
 @section File Locks
 @cindex file locks
 
-  When two users edit the same file at the same time, they are likely to
-interfere with each other.  Emacs tries to prevent this situation from
-arising by recording a @dfn{file lock} when a file is being modified.
+  When two users edit the same file at the same time, they are likely
+to interfere with each other.  Emacs tries to prevent this situation
+from arising by recording a @dfn{file lock} when a file is being
+modified.  (File locks are not implemented on Microsoft systems.)
 Emacs can then detect the first attempt to modify a buffer visiting a
 file that is locked by another Emacs job, and ask the user what to do.
 The file lock is really a file, a symbolic link with a special name,
@@ -680,14 +681,15 @@
 This function locks the file @var{filename}, if the current buffer is
 modified.  The argument @var{filename} defaults to the current buffer's
 visited file.  Nothing is done if the current buffer is not visiting a
-file, or is not modified.
+file, or is not modified, or if the system does not support locking.
 @end defun
 
 @defun unlock-buffer
 This function unlocks the file being visited in the current buffer,
 if the buffer is modified.  If the buffer is not modified, then
 the file should not be locked, so this function does nothing.  It also
-does nothing if the current buffer is not visiting a file.
+does nothing if the current buffer is not visiting a file, or if the
+system does not support locking.
 @end defun
 
   File locking is not supported on some systems.  On systems that do not
@@ -834,10 +836,11 @@
 @c Emacs 19 feature
 @defun file-accessible-directory-p dirname
 This function returns @code{t} if you have permission to open existing
-files in the directory whose name as a file is @var{dirname}; otherwise
-(or if there is no such directory), it returns @code{nil}.  The value
-of @var{dirname} may be either a directory name or the file name of a
-file which is a directory.
+files in the directory whose name as a file is @var{dirname};
+otherwise (or if there is no such directory), it returns @code{nil}.
+The value of @var{dirname} may be either a directory name (such as
+@file{/foo/}) or the file name of a file which is a directory
+(such as @file{/foo}, without the final slash).
 
 Example: after the following,
 
--- a/lispref/frames.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/frames.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -310,12 +310,14 @@
 @node Window Frame Parameters
 @subsection Window Frame Parameters
 
-Just what parameters a frame has depends on what display mechanism it
+  Just what parameters a frame has depends on what display mechanism it
 uses.  Here is a table of the parameters that have special meanings in a
 window frame; of these, @code{name}, @code{title}, @code{height},
 @code{width}, @code{buffer-list} and @code{buffer-predicate} provide
 meaningful information in terminal frames, and @code{tty-color-mode}
-is meaningful @emph{only} in terminal frames.
+is meaningful @emph{only} in terminal frames.  Frame parameter whose
+values measured in pixels, when used on text-only terminals, count
+characters or lines instead.
 
 @table @code
 @item display
@@ -1407,7 +1409,7 @@
 submenu using @code{x-popup-menu}, it cannot work with the menu bar in
 an integrated fashion.  This is why all menu bar submenus are
 implemented with menu keymaps within the parent menu, and never with
-@code{x-popup-menu}.  @xref{Menu Bar},
+@code{x-popup-menu}.  @xref{Menu Bar}.
 
   If you want a menu bar submenu to have contents that vary, you should
 still use a menu keymap to implement it.  To make the contents vary, add
@@ -1586,6 +1588,17 @@
 @node Color Names
 @section Color Names
 
+  A color name is text (usually in a string) that specifies a color.
+Symbolic names such as @samp{black}, @samp{white}, @samp{red}, etc.,
+are allowed; use @kbd{M-x list-colors-display} to see a list of
+defined names.  You can also specify colors numerically in forms such
+as @samp{#@var{rgb}} and @samp{RGB:@var{r}/@var{g}/@var{b}}, where
+@var{r} specifies the red level, @var{g} specifies the green level,
+and @var{b} specifies the blue level.  You can use either one, two,
+three, or four hex digits for @var{r}; then you must use the same
+number of hex digits for all @var{g} and @var{b} as well, making
+either 3, 6, 9 or 12 hex digits in all.
+
   These functions provide a way to determine which color names are
 valid, and what they look like.  In some cases, the value depends on the
 @dfn{selected frame}, as described below; see @ref{Input Focus}, for the
@@ -1666,9 +1679,10 @@
      @result{} nil
 @end example
 
-The color values are returned for @var{frame}'s display.  If @var{frame}
-is omitted or @code{nil}, the information is returned for the selected
-frame's display.
+The color values are returned for @var{frame}'s display.  If
+@var{frame} is omitted or @code{nil}, the information is returned for
+the selected frame's display.  If the frame cannot display colors, the
+value is @code{nil}.
 
 @findex x-color-values
 This function used to be called @code{x-color-values},
@@ -1701,26 +1715,26 @@
 support more than one text-only terminal at one time; then this argument
 will specify which terminal to operate on (the default being the
 selected frame's terminal; @pxref{Input Focus}).  At present, though,
-the @var{display} argument has no effect.
+the @var{frame} argument has no effect.
 
-@defun tty-color-define name number &optional rgb display
+@defun tty-color-define name number &optional rgb frame
 @tindex tty-color-define
 This function associates the color name @var{name} with
 color number @var{number} on the terminal.
 
-The optional argument @var{rgb}, if specified, is an rgb value; it says
-what the color actually looks like.  If you do not specify @var{rgb},
-then this color cannot be used by @code{tty-color-approximate} to
-approximate other colors, because Emacs does not know what it looks
-like.
+The optional argument @var{rgb}, if specified, is an rgb value, a list
+of three numbers that specify what what the color actually looks like.
+If you do not specify @var{rgb}, then this color cannot be used by
+@code{tty-color-approximate} to approximate other colors, because
+Emacs will not know what it looks like.
 @end defun
 
-@defun tty-color-clear &optional display
+@defun tty-color-clear &optional frame
 @tindex tty-color-clear
 This function clears the table of defined colors for a text-only terminal.
 @end defun
 
-@defun tty-color-alist &optional display
+@defun tty-color-alist &optional frame
 @tindex tty-color-alist
 This function returns an alist recording the known colors supported by a
 text-only terminal.
@@ -1728,26 +1742,23 @@
 Each element has the form @code{(@var{name} @var{number} . @var{rgb})}
 or @code{(@var{name} @var{number})}.  Here, @var{name} is the color
 name, @var{number} is the number used to specify it to the terminal.
-If present, @var{rgb} is an rgb value that says what the color
-actually looks like.
+If present, @var{rgb} is a list of three color values (for red, green,
+and blue) that says what the color actually looks like.
 @end defun
 
-@defun tty-color-approximate rgb &optional display
+@defun tty-color-approximate rgb &optional frame
 @tindex tty-color-approximate
-This function finds the closest color, among the known colors supported
-for @var{display}, to that described by the rgb value @var{rgb}.
-The return value is an element of @code{tty-color-alist}.
+This function finds the closest color, among the known colors
+supported for @var{display}, to that described by the rgb value
+@var{rgb} (a list of color values).  The return value is an element of
+@code{tty-color-alist}.
 @end defun
 
-@defun tty-color-translate color &optional display
+@defun tty-color-translate color &optional frame
 @tindex tty-color-translate
 This function finds the closest color to @var{color} among the known
 colors supported for @var{display} and returns its index (an integer).
 If the name @var{color} is not defined, the value is @code{nil}.
-
-@var{color} can be an X-style @code{"#@var{xxxyyyzzz}"} specification
-instead of an actual name.  The format
-@code{"RGB:@var{xx}/@var{yy}/@var{zz}"} is also supported.
 @end defun
 
 @node Resources
--- a/lispref/keymaps.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/keymaps.texi	Thu Feb 03 23:28:36 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
@@ -1262,9 +1266,10 @@
 @defun suppress-keymap keymap &optional nodigits
 @cindex @code{self-insert-command} override
 This function changes the contents of the full keymap @var{keymap} by
-making all the printing characters undefined.  More precisely, it binds
-them to the command @code{undefined}.  This makes ordinary insertion of
-text impossible.  @code{suppress-keymap} returns @code{nil}.
+remapping @code{self-insert-command} to the command @code{undefined}
+(@pxref{Remapping Commands}).  This has the effect of undefining all
+printing characters, thus making ordinary insertion of text impossible.
+@code{suppress-keymap} returns @code{nil}.
 
 If @var{nodigits} is @code{nil}, then @code{suppress-keymap} defines
 digits to run @code{digit-argument}, and @kbd{-} to run
--- a/lispref/modes.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/modes.texi	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/os.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -1368,10 +1368,11 @@
 timer to call a function that takes substantial time to run is likely
 to be annoying.
 
-  Timer functions should normally not alter the current buffer
-contents, but it may be ok to alter some other buffer that exists for
-special purposes.  A general guideline is that if a buffer has undo
-enabled, timers should not write in it.
+  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 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
@@ -1486,11 +1487,6 @@
 input.  Then it becomes idle again, and all the idle timers that are
 set up to repeat will subsequently run another time, one by one.
 
-  It is legitimate for an idle timer to edit the current buffer.  If
-it does, it should explicitly call @code{undo-boundary} once at the
-beginning and once just before exiting, since Emacs won't do that
-automatically for an idle timer.
-
 @defun cancel-timer timer
 Cancel the requested action for @var{timer}, which should be a value
 previously returned by @code{run-at-time} or @code{run-with-idle-timer}.
--- a/lispref/text.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/text.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -720,10 +720,11 @@
 @end smallexample
 @end deffn
 
-@deffn Command just-one-space
+@deffn Command just-one-space &optional n
 @comment !!SourceFile simple.el
 This command replaces any spaces and tabs around point with a single
-space.  It returns @code{nil}.
+space, or @var{n} spaces if @var{n} is specified.  It returns
+@code{nil}.
 @end deffn
 
 @deffn Command delete-blank-lines
@@ -1208,6 +1209,19 @@
 (put-text-property @var{beg} @var{end} @var{property} @var{value})
 @end example
 
+@item (apply @var{funname} . @var{args})
+This kind of element records a change that can be undone by evaluating
+(@code{apply} @var{funname} @var{args}).
+
+@item (apply @var{delta} @var{beg} @var{end} @var{funname} . @var{args})
+This kind of element records a change that can be undone by evaluating
+(@code{apply} @var{funname} @var{args}).  The integer values @var{beg}
+and @var{end} is buffer positions of the range affected by this change
+and @var{delta} is an integer value which is the number of bytes added
+or deleted in that range by this change.  This kind of element
+enables undo limited to a region to determine whether the element
+pertains to that region.
+
 @item (@var{marker} . @var{adjustment})
 This kind of element records the fact that the marker @var{marker} was
 relocated due to deletion of surrounding text, and that it moved
@@ -1309,20 +1323,27 @@
 them from using up all available memory space, garbage collection trims
 them back to size limits you can set.  (For this purpose, the ``size''
 of an undo list measures the cons cells that make up the list, plus the
-strings of deleted text.)  Two variables control the range of acceptable
-sizes: @code{undo-limit} and @code{undo-strong-limit}.
-
-@defvar undo-limit
+strings of deleted text.)  Three variables control the range of acceptable
+sizes: @code{undo-limit}, @code{undo-strong-limit} and
+@code{undo-outer-limit}.
+
+@defopt undo-limit
 This is the soft limit for the acceptable size of an undo list.  The
 change group at which this size is exceeded is the last one kept.
-@end defvar
-
-@defvar undo-strong-limit
+@end defopt
+
+@defopt undo-strong-limit
 This is the upper limit for the acceptable size of an undo list.  The
 change group at which this size is exceeded is discarded itself (along
 with all older change groups).  There is one exception: the very latest
-change group is never discarded no matter how big it is.
-@end defvar
+change group is only discarded if it exceeds @code{undo-outer-limit}.
+@end defopt
+
+@defopt undo-outer-limit
+If at garbage collection time the undo info for the current command
+exceeds this limit, Emacs discards the info and displays a warning.
+This is a last ditch limit to prevent memory overflow.
+@end defopt
 
 @node Filling
 @comment  node-name,  next,  previous,  up
@@ -1896,19 +1917,27 @@
 
 @deffn Command sort-numeric-fields field start end
 This command sorts lines in the region between @var{start} and
-@var{end}, comparing them numerically by the @var{field}th field of each
-line.  The specified field must contain a number in each line of the
-region.  Fields are separated by whitespace and numbered starting from
-1.  If @var{field} is negative, sorting is by the
-@w{@minus{}@var{field}th} field from the end of the line.  This command
-is useful for sorting tables.
+@var{end}, comparing them numerically by the @var{field}th field of
+each line.  Fields are separated by whitespace and numbered starting
+from 1.  The specified field must contain a number in each line of the
+region.  Numbers starting with 0 are treated as octal, and numbers
+starting with @samp{0x} are treated as hexadecimal.
+
+If @var{field} is negative, sorting is by the
+@w{@minus{}@var{field}th} field from the end of the line.  This
+command is useful for sorting tables.
 @end deffn
 
+@defopt sort-numeric-base
+This variable specifies the default radix for
+@code{sort-numeric-fields} to parse numbers.
+@end defopt
+
 @deffn Command sort-columns reverse &optional beg end
 This command sorts the lines in the region between @var{beg} and
-@var{end}, comparing them alphabetically by a certain range of columns.
-The column positions of @var{beg} and @var{end} bound the range of
-columns to sort on.
+@var{end}, comparing them alphabetically by a certain range of
+columns.  The column positions of @var{beg} and @var{end} bound the
+range of columns to sort on.
 
 If @var{reverse} is non-@code{nil}, the sort is in reverse order.
 
@@ -2431,6 +2460,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 +2856,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
@@ -2891,10 +2921,10 @@
 
 If the value of the @code{help-echo} property is a function, that
 function is called with three arguments, @var{window}, @var{object} and
-@var{position} and should return a help string or @var{nil} for
+@var{pos} and should return a help string or @code{nil} for
 none.  The first argument, @var{window} is the window in which
 the help was found.  The second, @var{object}, is the buffer, overlay or
-string which had the @code{help-echo} property.  The @var{position}
+string which had the @code{help-echo} property.  The @var{pos}
 argument is as follows:
 
 @itemize @bullet{}
@@ -3099,8 +3129,9 @@
 @item hard
 If a newline character has this property, it is a ``hard'' newline.
 The fill commands do not alter hard newlines and do not move words
-across them.  However, this property takes effect only if the variable
-@code{use-hard-newlines} is non-@code{nil}.
+across them.  However, this property takes effect only if the
+@code{use-hard-newlines} minor mode is enabled.  @xref{Hard and Soft
+Newlines,, Hard and Soft Newlines, emacs, The GNU Emacs Manual}.
 
 @item right-margin
 This property specifies an extra right margin for filling this part of the
@@ -3388,6 +3419,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/lispref/windows.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/lispref/windows.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -53,11 +53,17 @@
 
   In each frame, at any time, one and only one window is designated as
 @dfn{selected within the frame}.  The frame's cursor appears in that
-window.  At any time, one frame is the selected frame; and the window
-selected within that frame is @dfn{the selected window}.  The selected
-window's buffer is usually the current buffer (except when
+window, but the other windows have ``non-selected'' cursors, normally
+less visible.  At any time, one frame is the selected frame; and the
+window selected within that frame is @dfn{the selected window}.  The
+selected window's buffer is usually the current buffer (except when
 @code{set-buffer} has been used).  @xref{Current Buffer}.
 
+@defvar cursor-in-non-selected-windows
+If this variable is @code{nil}, Emacs displays only one cursor,
+in the selected window.  Other windows have no cursor at all.
+@end defvar
+
   For practical purposes, a window exists only while it is displayed in
 a frame.  Once removed from the frame, the window is effectively deleted
 and should not be used, @emph{even though there may still be references
@@ -455,10 +461,10 @@
 @end defun
 
 @defmac save-selected-window forms@dots{}
-This macro records the selected window, as well as the selected window
+This macro records the selected frame, as well as the selected window
 of each frame, executes @var{forms} in sequence, then restores the
-earlier selected windows.  It returns the value of the last form in
-@var{forms}.
+earlier selected frame and windows It returns the value of the last
+form in @var{forms}.
 
 This macro does not save or restore anything about the sizes,
 arrangement or contents of windows; therefore, if the @var{forms}
@@ -648,8 +654,9 @@
 
 @c Emacs 19 feature
 @defun walk-windows proc &optional minibuf all-frames
-This function cycles through all windows, calling @code{proc}
-once for each window with the window as its sole argument.
+This function cycles through all windows.  It calls the function
+@code{proc} once for each window, with the window as its sole
+argument.
 
 The optional arguments @var{minibuf} and @var{all-frames} specify the
 set of windows to include in the scan.  See @code{next-window}, above,
@@ -1175,10 +1182,10 @@
 @item
 As long as the selected window displays the current buffer, the window's
 point and the buffer's point always move together; they remain equal.
+@end itemize
 
-@item
+@noindent
 @xref{Positions}, for more details on buffer positions.
-@end itemize
 
   As far as the user is concerned, point is where the cursor is, and
 when the user switches to another buffer, the cursor jumps to the
@@ -1345,15 +1352,18 @@
 If @var{position} is visible, @code{pos-visible-in-window-p} returns
 @code{t} if @var{partially} is @code{nil}; if @var{partially} is
 non-@code{nil}, it returns a list of the form @code{(@var{x} @var{y}
-@var{fully})}, where @var{x} and @var{y} are the pixel coordinates
-relative to the top left corner of the window, and @var{fully} is
-@code{t} if the character after @var{position} is fully visible and
-@code{nil} otherwise.
+@var{partial})}, where @var{x} and @var{y} are the pixel coordinates
+relative to the top left corner of the window, and @var{partial} is
+@code{nil} if the character after @var{position} is fully visible;
+otherwise it is a cons @code{(@var{rtop} . @var{rbot})} where the
+@var{rtop} and @var{rbot} specify the number of invisible pixels at
+the top and bottom of the row at @var{position}.
 
 Here is an example:
 
 @example
 @group
+;; @r{If point is off the screen now, recenter it now.}
 (or (pos-visible-in-window-p
      (point) (selected-window))
     (recenter 0))
@@ -1397,6 +1407,12 @@
 buffer is different from the buffer that is displayed in the selected
 window.  @xref{Current Buffer}.
 
+  If the window contains a row which is taller than the height of the
+window (for example in the presense of a large image), the scroll
+functions will adjust the window vscroll to scroll the partially
+visible row.  To disable this feature, Lisp code may bind the variable
+`auto-window-vscroll' to @code{nil} (@pxref{Vertical Scrolling}).
+
 @deffn Command scroll-up &optional count
 This function scrolls the text in the selected window upward
 @var{count} lines.  If @var{count} is negative, scrolling is actually
@@ -1622,6 +1638,13 @@
 pixels.  In this case, the return value is @var{lines}.
 @end defun
 
+@defvar auto-window-vscroll
+If this variable is non-@code{nil}, the line-move, scroll-up, and
+scroll-down functions will automatically modify the window vscroll to
+scroll through display rows that are taller that the height of the
+window, for example in the presense of large images.
+@end defvar
+
 @node Horizontal Scrolling
 @section Horizontal Scrolling
 @cindex horizontal scrolling
@@ -1969,6 +1992,7 @@
 @example
 @group
 (defun enlarge-window-horizontally (columns)
+  (interactive "p")
   (enlarge-window columns t))
 @end group
 @end example
@@ -1991,16 +2015,29 @@
 @example
 @group
 (defun shrink-window-horizontally (columns)
+  (interactive "p")
   (shrink-window columns t))
 @end group
 @end example
 @end deffn
 
+@defun fit-window-to-buffer &optional window max-height min-height
+This function makes @var{window} the right height to display its
+contents exactly.  If @var{window} is omitted or @code{nil}, it uses
+the selected window.
+
+The argument @var{max-height} specifies the maximum height the window
+is allowed to be; @code{nil} means use the frame height.  The argument
+@var{min-height} specifies the minimum height for the window;
+@code{nil} means use @code{window-min-height}.  All these height
+values include the mode-line and/or header-line.
+@end defun
+
 @deffn Command shrink-window-if-larger-than-buffer &optional window
-This command shrinks @var{window} to be as small as possible while still
-showing the full contents of its buffer---but not less than
-@code{window-min-height} lines.  If @var{window} is not given,
-it defaults to the selected window.
+This command shrinks @var{window} vertically to be as small as
+possible while still showing the full contents of its buffer---but not
+less than @code{window-min-height} lines.  If @var{window} is not
+given, it defaults to the selected window.
 
 However, the command does nothing if the window is already too small to
 display the whole text of the buffer, or if part of the contents are
--- a/mac/inc/config.h	Thu Feb 03 22:58:27 2005 +0000
+++ b/mac/inc/config.h	Thu Feb 03 23:28:36 2005 +0000
@@ -1,4 +1,4 @@
-/* Handcrafted Emacs site configuration file for Mac OS.  -*- C -*- */
+/* Handcrafted Emacs site configuration file for Mac OS 9.  -*- C -*- */
 
 /* GNU Emacs site configuration template file.  -*- C -*-
    Copyright (C) 1988, 1993, 1994, 1999, 2000 Free Software Foundation, Inc.
--- a/mac/inc/s-mac.h	Thu Feb 03 22:58:27 2005 +0000
+++ b/mac/inc/s-mac.h	Thu Feb 03 23:28:36 2005 +0000
@@ -1,4 +1,4 @@
-/* Handcrafted s-mac.h file for building GNU Emacs on the Macintosh.
+/* Handcrafted s-mac.h file for building GNU Emacs on Mac OS 9.
    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
--- a/man/ChangeLog	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/ChangeLog	Thu Feb 03 23:28:36 2005 +0000
@@ -1,3 +1,227 @@
+2005-02-03  Richard M. Stallman  <rms@gnu.org>
+
+	* windows.texi (Basic Window): Mention color-change in mode line.
+	(Change Window): Explain dragging vertical boundaries.
+
+	* text.texi (Sentences): Clarify.
+	(Paragraphs): Explain M-a and blank lines.
+	(Outline Mode): Clarify text and menu.
+	(Hard and Soft Newlines): Mention use-hard-newlines.
+
+	* frames.texi (Frames): Delete unnecessary mention of Windows.
+	(Mouse Commands): Likewise.  Mention xterm mouse support.
+	(Clipboard): Clarify.
+	(Mouse References): Mention use of Mouse-1 for following links.
+	(Menu Mouse Clicks): Clarify.
+	(Mode Line Mouse): Clarify.
+	(Drag and Drop): Rewrite.
+
+	* fixit.texi (Spelling): Fix typo.
+
+	* files.texi (File Names): Clarify.
+	(Visiting): Update conditions for use of file dialog.  Clarify.
+	(Saving): Doc d as answer in save-some-buffers.
+	(Remote Files): Clean up the text.
+
+	* dired.texi (Misc Dired Commands): Delete dired-marked-files.
+
+	* buffers.texi (Select Buffer): Doc next-buffer and prev-buffer.
+	(List Buffers): Clarify.
+	(Several Buffers): Doc T command.
+	(Buffer Convenience): Clarify menu.
+
+	* basic.texi (Undo): Clarify last change.
+
+2005-02-02  Matt Hodges  <MPHodges@member.fsf.org>
+
+	* fixit.texi (Spelling): Fix typo.
+
+2005-02-01  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* basic.texi (Undo): Update description of `undo-outer-limit'.
+
+2005-02-01  Nick Roberts  <nickrob@snap.net.nz>
+
+	* building.texi: Update documentation relating to GDB Graphical
+	Interface.
+
+2005-01-30  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* custom.texi (Easy Customization): Adapt menu to node name change.
+
+2005-01-30  Richard M. Stallman  <rms@gnu.org>
+
+	* custom.texi (Easy Customization): Defn of "User Option" now
+	includes faces.  Don't say just "option" when talking about variables.
+	Do say just "options" to mean "anything customizable".
+	(Specific Customization): Describe `customize-variable',
+	not `customize-option'.
+
+	* glossary.texi (Glossary) <Faces>: Add xref.
+	<User Option>: Change definition--include faces.  Change xref.
+
+	* picture.texi (Picture): Mention artist.el.
+
+	* sending.texi, screen.texi, programs.texi, misc.texi:
+	* mini.texi, major.texi, maintaining.texi, macos.texi:
+	* help.texi, frames.texi, files.texi:
+	Don't say just "option" when talking about variables.
+
+	* display.texi, mule.texi: Don't say just "option" when talking
+	about variables.  Other minor cleanups.
+
+2005-01-28  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus.texi: Some edits based on comments from David Abrahams.
+
+2005-01-24  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus.texi (RSS): Fix the keystroke.
+
+2005-01-26  Lute Kamstra  <lute@gnu.org>
+
+	* cmdargs.texi (Initial Options): Add a cross reference to `Init
+	File'.  Mention the `-Q' option at the `--no-site-file' option.
+
+2005-01-24  David Kastrup  <dak@gnu.org>
+
+	* faq.texi: Update AUCTeX version info.
+
+2005-01-16  Xavier Maillard <zedek@gnu-rox.org> (tiny change)
+
+	* gnus-faq.texi ([4.1]): Typo.
+
+2005-01-22  David Kastrup  <dak@gnu.org>
+
+	* building.texi (Grep Searching): Mention alias `find-grep' for
+	`grep-find'.
+
+2005-01-20  Richard M. Stallman  <rms@gnu.org>
+
+	* calendar.texi (Time Intervals): Delete special stuff for MS-DOS.
+
+2005-01-19  Jay Belanger  <belanger@truman.edu>
+
+	* calc.texi (Keep Arguments): Mention that keeping arguments
+	doesn't work with keyboard macros.
+
+2005-01-16  Richard M. Stallman  <rms@gnu.org>
+
+	* autotype.texi (Autoinserting): Fix small error.
+
+2005-01-16  Michael Albinus  <michael.albinus@gmx.de>
+
+	Sync with Tramp 2.0.47.
+
+	* tramp.texi (Compilation): New section, describing compilation of
+	remote files.
+
+2005-01-15  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
+ 
+ 	* man/rmail.texi (Movemail): Explain differences
+	between standard and mailutils versions of movemail.
+	Describe command line and configuration options introduced
+	with the latter.
+	Explain the notion of mailbox URL, provide examples and
+	cross-references to mailutils documentation.
+	Describe various methods of specifying mailbox names,
+	user names and user passwords for rmail.
+	(Remote Mailboxes): New section.  Describe
+	how movemail handles remote mailboxes.  Describe configuration
+	options used to control its behavior. 
+	(Other Mailbox Formats): Explain handling of various mailbox
+	formats.
+
+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
+	edit keyboard macros to match current behavior.
+
+2005-01-01  Andreas Schwab  <schwab@suse.de>
+
+	* killing.texi (Graphical Kill): Move up under node Killing,
+	change @section to @subsection.
+
+2005-01-01  Richard M. Stallman  <rms@gnu.org>
+
+	* custom.texi (Face Customization): Mention hex color specs.
+
+	* emacs.texi (Top): Update Killing submenu.
+
+	* killing.texi (Killing): Reorganize section.
+	No more TeX-only text; put the node command at start of chapter.
+	But the first section heading is used only in TeX.
+	Rewrite the text to read better in this mode.
+	(Graphical Kill): New subnode gets some of the text that
+	used to be in the first section.
+
 2004-12-31  Richard M. Stallman  <rms@gnu.org>
 
 	* dired.texi (Shell Commands in Dired): Delete the ? example.
@@ -27,10 +251,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
@@ -56,7 +276,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
@@ -73,7 +292,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,
@@ -87,7 +305,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/autotype.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/autotype.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -400,7 +400,7 @@
   In Lisp (@pxref{(emacs)Init File}) you can use the function
 @code{define-auto-insert} to add to or modify
 @code{auto-insert-alist}.  See its documentation with @kbd{C-h f
-auto-insert-alist}.
+define-auto-insert}.
 
 @vindex auto-insert
   The variable @code{auto-insert} says what to do when @code{auto-insert} is
--- a/man/basic.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/basic.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -399,13 +399,13 @@
 
   Regardless of the values of those variables, the most recent change
 is never discarded unless it gets bigger than @code{undo-outer-limit}
-(normally 300,000).  At that point, Emacs asks whether to discard the
-undo information even for the current command.  (You also have the
-option of quitting.)  So there is normally no danger that garbage
-collection occurring right after an unintentional large change might
-prevent you from undoing it.  But if you didn't expect the command
-to create such large undo data, you can get rid of it and prevent
-Emacs from running out of memory.
+(normally 3,000,000).  At that point, Emacs discards the undo data and
+warns you about it.  This is the only situation in which you cannot
+undo the last command.  If this happens, you can increase the value of
+@code{undo-outer-limit} to make it even less likely to happen in the
+future.  But if you didn't expect the command to create such large
+undo data, then it is probably a bug and you should report it.
+@xref{Bugs,, Reporting Bugs}.
 
   The reason the @code{undo} command has two keys, @kbd{C-x u} and
 @kbd{C-_}, set up to run it is that it is worthy of a single-character
--- a/man/buffers.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/buffers.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -67,6 +67,10 @@
 @table @kbd
 @item C-x b @var{buffer} @key{RET}
 Select or create a buffer named @var{buffer} (@code{switch-to-buffer}).
+@item C-x @key{LEFT}
+Select the previous buffer in the list of existing buffers.
+@item C-x @key{RIGHT}
+Select the next buffer in the list of existing buffers.
 @item C-x 4 b @var{buffer} @key{RET}
 Similar, but select @var{buffer} in another window
 (@code{switch-to-buffer-other-window}).
@@ -84,6 +88,16 @@
 specifies the buffer that was current most recently among those not
 now displayed in any window.
 
+@kindex C-x @key{LEFT}
+@kindex C-x @key{RIGHT}
+@findex next-buffer
+@findex prev-buffer
+  For conveniently switching between a few buffers, use the commands
+@kbd{C-x @key{LEFT}} and @kbd{C-x @key{RIGHT}}.  @kbd{C-x @key{RIGHT}}
+(@code{prev-buffer}) selects the previous buffer (following the order
+of most recent selection), while @kbd{C-x @key{LEFT}}
+(@code{next-buffer}) moves through buffers in the reverse direction.
+
 @kindex C-x 4 b
 @findex switch-to-buffer-other-window
 @vindex even-window-heights
@@ -141,9 +155,9 @@
 @cindex listing current buffers
 @kindex C-x C-b
 @findex list-buffers
-  To display a list of all the buffers that exist, type @kbd{C-x C-b}.
-Each line in the list shows one buffer's name, major mode and visited
-file.  The buffers are listed in the order that they were current; the
+  To display a list of existing buffers, type @kbd{C-x C-b}.  Each
+line in the list shows one buffer's name, major mode and visited file.
+The buffers are listed in the order that they were current; the
 buffers that were current most recently come first.
 
   @samp{*} in the first field of a line indicates the buffer is ``modified.''
@@ -171,7 +185,7 @@
 visiting files by giving the command a prefix; for instance, by typing
 @kbd{C-u C-x C-b}.
 
-@code{list-buffers} omits buffers whose name begins with a blank,
+  @code{list-buffers} omits buffers whose names begin with a space,
 unless they visit files: such buffers are used internally by Emacs.
 
 @need 2000
@@ -332,8 +346,9 @@
 buffers@footnote{Buffers which don't visit files and whose names begin
 with a space are omitted: these are used internally by Emacs.} into the
 buffer @samp{*Buffer List*}, and selects that buffer in Buffer Menu
-mode.  The list in the @samp{*Buffer List*} buffer looks exactly as
-described in @ref{List Buffers}.  The buffer is read-only, and can be
+mode.
+
+  The buffer is read-only, and can be
 changed only through the special commands described in this section.
 The usual Emacs cursor motion commands can be used in the @samp{*Buffer
 List*} buffer.  The following commands apply to the buffer described on
@@ -411,21 +426,32 @@
 marked any buffers, this command is equivalent to @kbd{1}.
 @end table
 
-  All that @code{buffer-menu} does directly is create and switch to a
-suitable buffer, and turn on Buffer Menu mode.  Everything else
+  There is also a command that affects the entire buffer list:
+
+@table @kbd
+@item T
+Delete, or reinsert, lines for non-file buffers.  This command toggles
+the inclusion of such buffers in the buffer list.
+@end table
+
+  What @code{buffer-menu} actually does is create and switch to a
+suitable buffer, and turn on Buffer Menu mode in it.  Everything else
 described above is implemented by the special commands provided in
 Buffer Menu mode.  One consequence of this is that you can switch from
-the @samp{*Buffer List*} buffer to another Emacs buffer, and edit there.
-You can reselect the @samp{*Buffer List*} buffer later, to perform the
-operations already requested, or you can kill it, or pay no further
-attention to it.
+the @samp{*Buffer List*} buffer to another Emacs buffer, and edit
+there.  You can reselect the @samp{*Buffer List*} buffer later, to
+perform the operations already requested, or you can kill it, or pay
+no further attention to it.
 
-  The only difference between @code{buffer-menu} and @code{list-buffers}
-is that @code{buffer-menu} switches to the @samp{*Buffer List*} buffer
-in the selected window; @code{list-buffers} displays it in another
-window.  If you run @code{list-buffers} (that is, type @kbd{C-x C-b})
-and select the buffer list manually, you can use all of the commands
-described here.
+  The list in the @samp{*Buffer List*} buffer looks exactly like the
+buffer list described in @ref{List Buffers}, because they really are
+the same.  The only difference between @code{buffer-menu} and
+@code{list-buffers} is that @code{buffer-menu} switches to the
+@samp{*Buffer List*} buffer in the selected window;
+@code{list-buffers} displays the same buffer in another window.  If
+you run @code{list-buffers} (that is, type @kbd{C-x C-b}) and select
+the buffer list manually, you can use all of the commands described
+here.
 
   Normally, the buffer @samp{*Buffer List*} is not updated automatically when
 buffers are created and killed; its contents are just text.  If you have
@@ -506,7 +532,7 @@
 convenient to switch between buffers.
 
 @menu
-* Uniquify::               Buffer names can contain directory parts.
+* Uniquify::               Making buffer names unique with directory parts.
 * Iswitchb::               Switching between buffers with substrings.
 * Buffer Menus::           Configurable buffer menu.
 @end menu
--- a/man/building.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/building.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -51,6 +51,7 @@
 Run @code{grep} asynchronously under Emacs, with matching lines
 listed in the buffer named @samp{*grep*}.
 @item M-x grep-find
+@item M-x find-grep
 Run @code{grep} via @code{find}, with user-specified arguments, and
 collect output in the buffer named @samp{*grep*}.
 @item M-x kill-compilation
@@ -166,11 +167,12 @@
 @code{grep} command.
 
 @findex grep-find
-  The command @kbd{M-x grep-find} is similar to @kbd{M-x grep}, but it
-supplies a different initial default for the command---one that runs
-both @code{find} and @code{grep}, so as to search every file in a
-directory tree.  See also the @code{find-grep-dired} command,
-in @ref{Dired and Find}.
+@findex find-grep
+  The command @kbd{M-x grep-find} (also available as @kbd{M-x
+find-grep}) is similar to @kbd{M-x grep}, but it supplies a different
+initial default for the command---one that runs both @code{find} and
+@code{grep}, so as to search every file in a directory tree.  See also
+the @code{find-grep-dired} command, in @ref{Dired and Find}.
 
 @node Compilation Mode
 @section Compilation Mode
@@ -307,12 +309,13 @@
 
 @c Do you believe in GUD?
 The GUD (Grand Unified Debugger) library provides an interface to
-various symbolic debuggers from within Emacs.  We recommend the debugger
-GDB, which is free software, but you can also run DBX, SDB or XDB if you
-have them.  GUD can also serve as an interface to Perl's debugging
-mode, the Python debugger PDB, and to JDB, the Java Debugger.
-@xref{Debugging,, The Lisp Debugger, elisp, the Emacs Lisp Reference Manual},
-for information on debugging Emacs Lisp programs.
+various symbolic debuggers from within Emacs.  We recommend the
+debugger GDB, which is free software, but you can also run DBX, SDB or
+XDB if you have them.  GUD can also serve as an interface to Perl's
+debugging mode, the Python debugger PDB, the bash debugger, and to
+JDB, the Java Debugger.  @xref{Debugging,, The Lisp Debugger, elisp,
+the Emacs Lisp Reference Manual}, for information on debugging Emacs
+Lisp programs.
 
 @menu
 * Starting GUD::	How to start a debugger subprocess.
@@ -334,15 +337,14 @@
 @table @kbd
 @item M-x gdb @key{RET} @var{file} @key{RET}
 @findex gdb
-Run GDB as a subprocess of Emacs.  If the variable
-@code{gud-gdb-command-name} is ``gdb --annotate=3'' (the default
-value) then GDB starts as for @kbd{M-x gdba} below.  If you want GDB
-to start as in Emacs 21.3 and earlier then edit the string in the
-minibuffer or set @code{gud-gdb-command-name} to ``gdb --fullname''.
-You need to do this if you want to run multiple debugging sessions
-within one Emacs session.  In this case, the command creates a buffer
-for input and output to GDB, and switches to it.  If a GDB buffer
-already exists, it just switches to that buffer.
+Run GDB as a subprocess of Emacs.  By default, GDB starts as for
+@kbd{M-x gdba} below.  If you want GDB to start as in Emacs 21.3 and
+earlier then edit the string in the minibuffer or set
+@code{gud-gdb-command-name} to ``gdb --fullname''.  You need to do
+this if you want to run multiple debugging sessions within one Emacs
+session.  In this case, the command creates a buffer for input and
+output to GDB, and switches to it.  If a GDB buffer already exists, it
+just switches to that buffer.
 
 @item M-x gdba @key{RET} @var{file} @key{RET}
 Run GDB as a subprocess of Emacs, providing a graphical interface
@@ -567,11 +569,13 @@
 details.
 @end table
 
-If you started GDB with the command @code{gdba}, you can click
-@kbd{Mouse-1} on a line of the source buffer, in the fringe or display
-margin, to set a breakpoint there.  If a breakpoint already exists on
-that line, this action will remove it.
-(@code{gdb-mouse-toggle-breakpoint}).
+With the GDB Graphical Interface, you can click @kbd{Mouse-1} on a
+line of the source buffer, in the fringe or display margin, to set a
+breakpoint there.  If a breakpoint already exists on that line, this
+action will remove it (@code{gdb-mouse-set-clear-breakpoint}). Where
+Emacs uses the margin to display breakpoints, it is also possible to
+enable or disable them when you click @kbd{Mouse-3} there
+(@code{gdb-mouse-toggle--breakpoint}).
 
   These commands interpret a numeric argument as a repeat count, when
 that makes sense.
@@ -659,19 +663,23 @@
 @node GDB Graphical Interface
 @subsection GDB Graphical Interface
 
+By default, the command @code{gdb} starts GDB using a graphical
+interface where you view and control the program's data using Emacs
+windows.  You can still interact with GDB through the GUD buffer, but
+the point of this mode is that you can do it through menus and clicks,
+without needing to know GDB commands.
+
 @findex gdba
-The command @code{gdba} starts GDB using a graphical interface where
-you view and control the program's data using Emacs windows.  You can
-still interact with GDB through the GUD buffer, but the point of this
-mode is that you can do it through menus and clicks, without needing
-to know GDB commands.
+If you have customised @code{gud-gdb-command-name}, then start this
+mode with the command @code{gdba}.
 
 @menu
 * Layout::               Control the number of displayed buffers.
 * Breakpoints Buffer::   A breakpoint control panel.
 * Stack Buffer::         Select a frame from the call stack.
 * Watch Expressions::    Monitor variable values in the speedbar.
-* Other Buffers::        Input/output, locals, registers and assembler buffers.
+* Other Buffers::        Input/output, locals, registers, assembler, threads
+                         and memory buffers.
 @end menu
 
 @node Layout
@@ -720,6 +728,15 @@
 gdb-frame-@var{buffertype}-buffer} respectively, where @var{buffertype}
 is the relevant buffer type e.g breakpoints.
 
+When you finish debugging then kill the GUD buffer with @kbd{C-x k},
+which will also kill all the buffers associated with the session.
+However you need not do this if, after editing and re-compiling your
+source code within Emacs, you wish continue debugging.  When you
+restart execution, GDB will automatically find your new executable.
+Keeping the GUD buffer has the advantage of keeping the shell history
+as well as GDB's breakpoints.  You need to check, however, that the
+breakpoints in the recently edited code are still where you want them.
+
 @node Breakpoints Buffer
 @subsubsection Breakpoints Buffer
 
@@ -825,18 +842,27 @@
 @item Assembler Buffer
 The assembler buffer displays the current frame as machine code.  An
 overlay arrow points to the current instruction and you can set and
-remove breakpoints as with the source buffer.  Breakpoints also
-appear in the margin.
+remove breakpoints as with the source buffer.  Breakpoint icons also
+appear in the fringe or margin.
 
 @item Threads Buffer
 
 The threads buffer displays a summary of all threads currently in your
-program.(@pxref{Threads,,, gdb, The GNU debugger}).  Move point to
+program (@pxref{Threads,,, gdb, The GNU debugger}).  Move point to
 any thread in the list and type @key{RET} to make it become the
 current thread (@code{gdb-threads-select}) and display the associated
 source in the source buffer.  Alternatively, click @kbd{Mouse-2} to
 make the selected thread become the current one.
 
+@item Memory Buffer
+
+The memory buffer allows the user to examine sections of program
+memory (@pxref{Memory,,, gdb, The GNU debugger}).  Click @kbd{Mouse-1}
+on the appropriate part of the header line to change the starting
+address or number of data items that the buffer displays.
+Click @kbd{Mouse-3} on the header line to select the display format
+or unit size for these data items.
+
 @end table
 
 @node Executing Lisp
--- a/man/calc.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/calc.texi	Thu Feb 03 23:28:36 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
@@ -6333,51 +6325,52 @@
 
 @smallexample
 @group
-1:  3                   1:  3           Keyboard Macro Editor.
-    .                       .           Original keys: 1 @key{RET} 2 +
-
-                                        type "1\r"
-                                        type "2"
-                                        calc-plus
+1:  3                   1:  3           Calc Macro Edit Mode.
+    .                       .           Original keys: 1 <return> 2 +
+
+                                        1                          ;; calc digits
+                                        RET                        ;; calc-enter
+                                        2                          ;; calc digits
+                                        +                          ;; calc-plus
 
 C-x ( 1 @key{RET} 2 + C-x )    Z K h @key{RET}      Z E h
 @end group
 @end smallexample
 
 @noindent
-This shows the screen display assuming you have the @file{macedit}
-keyboard macro editing package installed, which is usually the case
-since a copy of @file{macedit} comes bundled with Calc.
-
 A keyboard macro is stored as a pure keystroke sequence.  The
-@file{macedit} package (invoked by @kbd{Z E}) scans along the
+@file{edmacro} package (invoked by @kbd{Z E}) scans along the
 macro and tries to decode it back into human-readable steps.
-If a key or keys are simply shorthand for some command with a
-@kbd{M-x} name, that name is shown.  Anything that doesn't correspond
-to a @kbd{M-x} command is written as a @samp{type} command.
+Descriptions of the keystrokes are given as comments, which begin with
+@samp{;;}, and which are ignored when the edited macro is saved.
+Spaces and line breaks are also ignored when the edited macro is saved.
+To enter a space into the macro, type @code{SPC}.  All the special
+characters @code{RET}, @code{LFD}, @code{TAB}, @code{SPC}, @code{DEL},
+and @code{NUL} must be written in all uppercase, as must the prefixes
+@code{C-} and @code{M-}.
 
 Let's edit in a new definition, for computing harmonic numbers.
-First, erase the three lines of the old definition.  Then, type
+First, erase the four lines of the old definition.  Then, type
 in the new definition (or use Emacs @kbd{M-w} and @kbd{C-y} commands
-to copy it from this page of the Info file; you can skip typing
-the comments that begin with @samp{#}).
-
-@smallexample
-calc-kbd-push         # Save local values (Z `)
-type "0"              # Push a zero
-calc-store-into       # Store it in variable 1
-type "1"
-type "1"              # Initial value for loop
-calc-roll-down        # This is the @key{TAB} key; swap initial & final
-calc-kbd-for          # Begin "for" loop...
-calc-inv              #   Take reciprocal
-calc-store-plus       #   Add to accumulator
-type "1"
-type "1"              #   Loop step is 1
-calc-kbd-end-for      # End "for" loop
-calc-recall           # Now recall final accumulated value
-type "1"
-calc-kbd-pop          # Restore values (Z ')
+to copy it from this page of the Info file; you can of course skip
+typing the comments, which begin with @samp{;;}).
+
+@smallexample
+Z`                      ;; calc-kbd-push     (Save local values)
+0                       ;; calc digits       (Push a zero onto the stack)
+st                      ;; calc-store-into   (Store it in the following variable)
+1                       ;; calc quick variable  (Quick variable q1)
+1                       ;; calc digits       (Initial value for the loop) 
+TAB                     ;; calc-roll-down    (Swap initial and final)
+Z(                      ;; calc-kbd-for      (Begin the "for" loop)
+&                       ;; calc-inv          (Take the reciprocal)
+s+                      ;; calc-store-plus   (Add to the following variable)
+1                       ;; calc quick variable  (Quick variable q1)
+1                       ;; calc digits       (The loop step is 1)
+Z)                      ;; calc-kbd-end-for  (End the "for" loop)
+sr                      ;; calc-recall       (Recall the final accumulated value)
+1                       ;; calc quick variable (Quick variable q1)
+Z'                      ;; calc-kbd-pop      (Restore values)
 @end smallexample
 
 @noindent
@@ -6392,21 +6385,18 @@
 @end group
 @end smallexample
 
-If you don't know how to write a particular command in @file{macedit}
-format, you can always write it as keystrokes in a @code{type} command.
-There is also a @code{keys} command which interprets the rest of the
-line as standard Emacs keystroke names.  In fact, @file{macedit} defines
-a handy @code{read-kbd-macro} command which reads the current region
-of the current buffer as a sequence of keystroke names, and defines that
-sequence on the @kbd{X} (and @kbd{C-x e}) key.  Because this is so
-useful, Calc puts this command on the @kbd{M-# m} key.  Try reading in
-this macro in the following form:  Press @kbd{C-@@} (or @kbd{C-@key{SPC}}) at
+The @file{edmacro} package defines a handy @code{read-kbd-macro} command
+which reads the current region of the current buffer as a sequence of
+keystroke names, and defines that sequence on the @kbd{X} 
+(and @kbd{C-x e}) key.  Because this is so useful, Calc puts this
+command on the @kbd{M-# m} key.  Try reading in this macro in the
+following form:  Press @kbd{C-@@} (or @kbd{C-@key{SPC}}) at 
 one end of the text below, then type @kbd{M-# m} at the other.
 
 @example
 @group
 Z ` 0 t 1
-    1 @key{TAB}
+    1 TAB
     Z (  & s + 1  1 Z )
     r 1
 Z '
@@ -6645,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.
@@ -9096,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:
 
@@ -9210,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
@@ -10031,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
@@ -12231,16 +12186,18 @@
 the stack contains the sole number 5, but after @kbd{2 @key{RET} 3 K +},
 the stack contains the arguments and the result: @samp{2 3 5}.
 
-This works for all commands that take arguments off the stack.  As
-another example, @kbd{K a s} simplifies a formula, pushing the
+With the exception of keyboard macros, this works for all commands that
+take arguments off the stack. (To avoid potentially unpleasant behavior,
+a @kbd{K} prefix before a keyboard macro will be ignored.  A @kbd{K}
+prefix called @emph{within} the keyboard macro will still take effect.)  
+As another example, @kbd{K a s} simplifies a formula, pushing the
 simplified version of the formula onto the stack after the original
-formula (rather than replacing the original formula).
-
-Note that you could get the same effect by typing @kbd{@key{RET} a s},
-copying the formula and then simplifying the copy.  One difference
-is that for a very large formula the time taken to format the
-intermediate copy in @kbd{@key{RET} a s} could be noticeable; @kbd{K a s}
-would avoid this extra work.
+formula (rather than replacing the original formula).  Note that you
+could get the same effect by typing @kbd{@key{RET} a s}, copying the
+formula and then simplifying the copy. One difference is that for a very
+large formula the time taken to format the intermediate copy in
+@kbd{@key{RET} a s} could be noticeable; @kbd{K a s} would avoid this
+extra work. 
 
 Even stack manipulation commands are affected.  @key{TAB} works by
 popping two values and pushing them back in the opposite order,
@@ -12253,13 +12210,6 @@
 @kbd{K ' sin($)}.  @xref{Algebraic Entry}.  Also, the @kbd{s s}
 command is effectively the same as @kbd{K s t}.  @xref{Storing Variables}.
 
-Keyboard macros may interact surprisingly with the @kbd{K} prefix.
-If you have defined a keyboard macro to be, say, @samp{Q +} to add
-one number to the square root of another, then typing @kbd{K X} will
-execute @kbd{K Q +}, probably not what you expected.  The @kbd{K}
-prefix will apply to just the first command in the macro rather than
-the whole macro.
-
 If you execute a command and then decide you really wanted to keep
 the argument, you can press @kbd{M-@key{RET}} (@code{calc-last-args}).
 This command pushes the last arguments that were popped by any command
@@ -12297,16 +12247,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
@@ -12318,22 +12270,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
@@ -15922,7 +15874,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}).
@@ -27809,13 +27761,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
@@ -28200,14 +28153,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
@@ -28226,7 +28180,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
@@ -28413,7 +28367,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
@@ -30468,7 +30422,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
@@ -30484,8 +30439,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}.)
@@ -30723,15 +30678,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
@@ -30827,33 +30783,19 @@
 
 @cindex Keyboard macros, editing
 The @kbd{Z E} (@code{calc-user-define-edit}) command on a key that has
-been defined by a keyboard macro tries to use the @code{edit-kbd-macro}
-command to edit the macro.  This command may be found in the
-@file{macedit} package, a copy of which comes with Calc.  It decomposes
-the macro definition into full Emacs command names, like @code{calc-pop}
-and @code{calc-add}.  Type @kbd{C-c C-c} to finish editing and update
+been defined by a keyboard macro tries to use the @code{edmacro} package
+edit the macro.  Type @kbd{C-c C-c} to finish editing and update 
 the definition stored on the key, or, to cancel the edit, kill the
 buffer with @kbd{C-x k}.
-
-If you give a negative numeric prefix argument to @kbd{Z E}, the keyboard
-macro is edited in spelled-out keystroke form.  For example, the editing
-buffer might contain the nine characters @w{@samp{1 @key{RET} 2 +}}.  When you press
-@kbd{C-c C-c}, the @code{read-kbd-macro} feature of the @file{macedit}
-package is used to reinterpret these key names.  The
-notations @code{RET}, @code{LFD}, @code{TAB}, @code{SPC}, @code{DEL}, and
-@code{NUL} must be written in all uppercase, as must the prefixes @code{C-}
-and @code{M-}.  Spaces and line breaks are ignored.  Other characters are
+The special characters @code{RET}, @code{LFD}, @code{TAB}, @code{SPC},
+@code{DEL}, and @code{NUL} must be entered as these three character
+sequences, written in all uppercase, as must the prefixes @code{C-} and
+@code{M-}.  Spaces and line breaks are ignored.  Other characters are
 copied verbatim into the keyboard macro.  Basically, the notation is the
 same as is used in all of this manual's examples, except that the manual
-takes some liberties with spaces:  When we say @kbd{' [1 2 3] @key{RET}}, we take
-it for granted that it is clear we really mean @kbd{' [1 @key{SPC} 2 @key{SPC} 3] @key{RET}},
-which is what @code{read-kbd-macro} wants to see.
-
-If @file{macedit} is not available, @kbd{Z E} edits the keyboard macro
-in ``raw'' form; the editing buffer simply contains characters like
-@samp{1^M2+} (here @samp{^M} represents the carriage-return character).
-Editing in this mode, you will have to use @kbd{C-q} to enter new
-control characters into the buffer.
+takes some liberties with spaces: When we say @kbd{' [1 2 3] @key{RET}},
+we take it for granted that it is clear we really mean 
+@kbd{' [1 @key{SPC} 2 @key{SPC} 3] @key{RET}}.
 
 @kindex M-# m
 @pindex read-kbd-macro
@@ -30861,7 +30803,6 @@
 of spelled-out keystrokes and defines it as the current keyboard macro.
 It is a convenient way to define a keyboard macro that has been stored
 in a file, or to define a macro without executing it at the same time.
-The @kbd{M-# m} command works only if @file{macedit} is present.
 
 @node Conditionals in Macros, Loops in Macros, Naming Keyboard Macros, Keyboard Macros
 @subsection Conditionals in Keyboard Macros
@@ -31461,12 +31402,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
@@ -34419,7 +34365,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
 
@@ -34562,8 +34508,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.
@@ -35910,7 +35856,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/calendar.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/calendar.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -1540,14 +1540,12 @@
 @vindex timeclock-file
 @findex timeclock-reread-log
   The timeclock functions work by accumulating the data in a file
-called @file{.timelog} in your home directory.  (On MS-DOS, this file
-is called @file{_timelog}, since an initial period is not allowed in
-file names on MS-DOS.)  You can specify a different name for this file
-by customizing the variable @code{timeclock-file}.  If you edit the
-timeclock file manually, or if you change the value of any of
-timeclock's customizable variables, you should run the command
-@kbd{M-x timeclock-reread-log} to update the data in Emacs from the
-file.
+called @file{.timelog} in your home directory.  You can specify a
+different name for this file by customizing the variable
+@code{timeclock-file}.  If you edit the timeclock file manually, or if
+you change the value of any of timeclock's customizable variables, you
+should run the command @kbd{M-x timeclock-reread-log} to update the
+data in Emacs from the file.
 
 @ignore
    arch-tag: 4531ef09-9df3-449d-9c52-2b5a4a337f92
--- a/man/cmdargs.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/cmdargs.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -169,8 +169,9 @@
   Some initial options affect the loading of init files.  The normal
 actions of Emacs are to first load @file{site-start.el} if it exists,
 then your own init file @file{~/.emacs} if it exists, and finally
-@file{default.el} if it exists; certain options prevent loading of some
-of these files or substitute other files for them.
+@file{default.el} if it exists.  @xref{Init File}.  Certain options
+prevent loading of some of these files or substitute other files for
+them.
 
 @table @samp
 @item -t @var{device}
@@ -257,8 +258,8 @@
 @opindex --no-site-file
 @cindex @file{site-start.el} file, not loading
 Do not load @file{site-start.el}.  The options @samp{-q}, @samp{-u}
-and @samp{--batch} have no effect on the loading of this file---this is
-the only option that blocks it.
+and @samp{--batch} have no effect on the loading of this file---this
+option and @samp{-Q} are the only options that block it.
 
 @item -Q
 @opindex -Q
--- a/man/commands.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/commands.texi	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/custom.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -178,10 +178,11 @@
 
 @cindex user option
   Emacs has many @dfn{user options} which have values that you can set
-in order to customize various commands.  Most user options are
-documented in this manual.  Each user option is actually a Lisp
-variable (@pxref{Variables}), so their names appear in the Variable
-Index (@pxref{Variable Index}).
+in order to customize various commands.  Many user options are
+documented in this manual.  Most user options are actually Lisp
+variables (@pxref{Variables}), so their names appear in the Variable
+Index (@pxref{Variable Index}).  The rest are faces and their
+attributes (@pxref{Faces}).
 
 @findex customize
 @cindex customization buffer
@@ -199,11 +200,11 @@
 @menu
 * Groups: Customization Groups.
                              How options are classified in a structure.
-* Changing an Option::       How to edit a value and set an option.
+* Changing a Variable::      How to edit a value and set an option.
 * Saving Customizations::    Details of saving customizations.
 * Face Customization::       How to edit the attributes of a face.
 * Specific Customization::   Making a customization buffer for specific
-                                options, faces, or groups.
+                                variables, faces, or groups.
 @end menu
 
 @node Customization Groups
@@ -266,7 +267,7 @@
 mainly it contains other groups, which contain more groups, which
 contain the user options.  By browsing the hierarchy of groups, you
 will eventually find the feature you are interested in customizing.
-Then you can use the customization buffer to set the options and faces
+Then you can use the customization buffer to set the options
 pertaining to that feature.  You can also go straight to a particular
 group by name, using the command @kbd{M-x customize-group}.
 
@@ -274,45 +275,45 @@
   You can view the structure of customization groups on a larger scale
 with @kbd{M-x customize-browse}.  This command creates a special kind of
 customization buffer which shows only the names of the groups (and
-options and faces), and their structure.
+variables and faces), and their structure.
 
   In this buffer, you can show the contents of a group by invoking
 @samp{[+]}.  When the group contents are visible, this button changes to
 @samp{[-]}; invoking that hides the group contents.
 
-  Each group, option or face name in this buffer has an active field
-which says @samp{[Group]}, @samp{[Option]} or @samp{[Face]}.  Invoking
+  Each group, variable, or face name in this buffer has an active field
+which says @samp{[Group]}, @samp{[Variable]} or @samp{[Face]}.  Invoking
 that active field creates an ordinary customization buffer showing just
-that group and its contents, just that option, or just that face.
+that group and its contents, just that variable, or just that face.
 This is the way to set values in it.
 
-@node Changing an Option
-@subsection Changing an Option
+@node Changing a Variable
+@subsection Changing a Variable
 
-  Here is an example of what a user option looks like in the
+  Here is an example of what a variable looks like in the
 customization buffer:
 
 @smallexample
 Kill Ring Max: [Hide] 60
-   [State]: this option is unchanged from its standard setting.
+   [State]: this variable is unchanged from its standard setting.
 Maximum length of kill ring before oldest elements are thrown away.
 @end smallexample
 
   The text following @samp{[Hide]}, @samp{60} in this case, indicates
-the current value of the option.  If you see @samp{[Show]} instead of
+the current value of the variable.  If you see @samp{[Show]} instead of
 @samp{[Hide]}, it means that the value is hidden; the customization
 buffer initially hides values that take up several lines.  Invoke
 @samp{[Show]} to show the value.
 
   The line after the option name indicates the @dfn{customization state}
-of the option: in the example above, it says you have not changed the
+of the variable: in the example above, it says you have not changed the
 option yet.  The word @samp{[State]} at the beginning of this line is
 active; you can get a menu of various operations by invoking it with
 @kbd{Mouse-1} or @key{RET}.  These operations are essential for
-customizing the user option.
+customizing the variable.
 
   The line after the @samp{[State]} line displays the beginning of the
-option's documentation string.  If there are more lines of
+variable's documentation string.  If there are more lines of
 documentation, this line ends with @samp{[More]}; invoke this to show
 the full documentation string.
 
@@ -324,22 +325,22 @@
 change to say that you have edited the value:
 
 @smallexample
-[State]: you have edited the value as text, but not set the option.
+[State]: you have edited the value as text, but not set the variable.
 @end smallexample
 
 @cindex setting option value
-  Editing the value does not actually set the option.  To do
-that, you must @dfn{set} the option.  To do this, invoke the word
+  Editing the value does not actually set the variable.  To do
+that, you must @dfn{set} it.  To do this, invoke the word
 @samp{[State]} and choose @samp{Set for Current Session}.
 
-  The state of the option changes visibly when you set it:
+  The state of the variable changes visibly when you set it:
 
 @smallexample
-[State]: you have set this option, but not saved it for future sessions.
+[State]: you have set this variable, but not saved it for future sessions.
 @end smallexample
 
    You don't have to worry about specifying a value that is not valid;
-setting the option checks for validity and will not really install an
+setting the variable checks for validity and will not really install an
 unacceptable value.
 
 @kindex M-TAB @r{(customization buffer)}
@@ -348,15 +349,15 @@
 command name, or anything else for which completion is defined, you can
 type @kbd{M-@key{TAB}} (@code{widget-complete}) to do completion.
 
-  Some options have a small fixed set of possible legitimate values.
-These options don't let you edit the value textually.  Instead, an
+  Some variables have a small fixed set of possible legitimate values.
+These variables don't let you edit the value textually.  Instead, an
 active field @samp{[Value Menu]} appears before the value; invoke this
 field to edit the value.  For a boolean ``on or off'' value, the active
 field says @samp{[Toggle]}, and it changes to the other value.
 @samp{[Value Menu]} and @samp{[Toggle]} edit the buffer; the changes
 take effect when you use the @samp{Set for Current Session} operation.
 
-  Some options have values with complex structure.  For example, the
+  Some variables have values with complex structure.  For example, the
 value of @code{file-coding-system-alist} is an association list.  Here
 is how it appears in the customization buffer:
 
@@ -379,7 +380,7 @@
             Decoding: undecided
             Encoding: nil
 [INS]
-   [State]: this option is unchanged from its standard setting.
+   [State]: this variable is unchanged from its standard setting.
 Alist to decide a coding system to use for a file I/O operation. [Hide]
 The format is ((PATTERN . VAL) ...),
 where PATTERN is a regular expression matching a file name,
@@ -415,37 +416,37 @@
 when they are finished editing a field.  To insert a newline within an
 editable field, use @kbd{C-o} or @kbd{C-q C-j}.
 
-@cindex saving option value
-@cindex customized options, saving
-  Setting the option changes its value in the current Emacs session;
+@cindex saving variable value
+@cindex customized variables, saving
+  Setting the variable changes its value in the current Emacs session;
 @dfn{saving} the value changes it for future sessions as well.  To
-save the option, invoke @samp{[State]} and select the @samp{Save for
+save the variable, invoke @samp{[State]} and select the @samp{Save for
 Future Sessions} operation.  This works by writing code so as to set
-the option again, each time you start Emacs (@pxref{Saving
+the variable again, each time you start Emacs (@pxref{Saving
 Customizations}).
 
-  You can also restore the option to its standard value by invoking
+  You can also restore the variable to its standard value by invoking
 @samp{[State]} and selecting the @samp{Erase Customization} operation.
 There are actually three reset operations:
 
 @table @samp
 @item Reset
-If you have made some modifications and not yet set the option,
+If you have made some modifications and not yet set the variable,
 this restores the text in the customization buffer to match
 the actual value.
 
 @item Reset to Saved
-This restores the value of the option to the last saved value,
+This restores the value of the variable to the last saved value,
 and updates the text accordingly.
 
 @item Erase Customization
-This sets the option to its standard value, and updates the text
+This sets the variable to its standard value, and updates the text
 accordingly.  This also eliminates any saved value for the option,
 so that you will get the standard value in future Emacs sessions.
 
 @item Use Backup Value
-This sets the option to a previous value that was set in the
-customization buffer in this session.  If you customize an option
+This sets the variable to a previous value that was set in the
+customization buffer in this session.  If you customize a variable
 and then reset it, which discards the customized value,
 you can get the customized value back again with this operation.
 @end table
@@ -455,7 +456,7 @@
 customization.  Use the @samp{Add Comment} item from the
 @samp{[State]} menu to create a field for entering the comment.  The
 comment you enter will be saved, and displayed again if you again view
-the same option in a customization buffer, even in another session.
+the same variable in a customization buffer, even in another session.
 
   The state of a group indicates whether anything in that group has been
 edited, set or saved.  You can select @samp{Set for Current Session},
@@ -477,8 +478,9 @@
 buffer according to the setting of the option
 @code{custom-buffer-done-function}; the default is to bury the buffer.
 Each of the other fields performs an operation---set, save or
-reset---on each of the items in the buffer that could meaningfully be
-set, saved or reset.
+reset---on each of the options in the buffer that could meaningfully
+be set, saved or reset.  They do not operate on options whose values
+are hidden.
 
 @node Saving Customizations
 @subsection Saving Customizations
@@ -487,21 +489,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
@@ -534,8 +527,8 @@
 @cindex italic font
 @cindex fonts and faces
 
-  In addition to user options, some customization groups also include
-faces.  When you show the contents of a group, both the user options and
+  In addition to variables, some customization groups also include
+faces.  When you show the contents of a group, both the variables and
 the faces in the group appear in the customization buffer.  Here is an
 example of how a face looks:
 
@@ -566,13 +559,18 @@
 attribute by invoking that field.  When the attribute is enabled, you
 can change the attribute value in the usual ways.
 
-  On a black-and-white display, the colors you can use for the
-background are @samp{black}, @samp{white}, @samp{gray}, @samp{gray1},
-and @samp{gray3}.  Emacs supports these shades of gray by using
-background stipple patterns instead of a color.
+  For the colors, you can specify a color name (use @kbd{M-x
+list-colors-display}) for a list of them) or a hexadecimal color
+specification of the form @samp{#@var{rr}@var{gg}@var{bb}}.
+(@samp{#000000} is black, @samp{#ff0000} is red, @samp{#00ff00} is
+green, @samp{#0000ff} is blue, and @samp{#ffffff} is white.)  On a
+black-and-white display, the colors you can use for the background are
+@samp{black}, @samp{white}, @samp{gray}, @samp{gray1}, and
+@samp{gray3}.  Emacs supports these shades of gray by using background
+stipple patterns instead of a color.
 
   Setting, saving and resetting a face work like the same operations for
-options (@pxref{Changing an Option}).
+variables (@pxref{Changing a Variable}).
 
   A face can specify different appearances for different types of
 display.  For example, a face can make text red on a color display, but
@@ -592,37 +590,37 @@
 @subsection Customizing Specific Items
 
   Instead of finding the options you want to change by moving down
-through the structure of groups, you can specify the particular option,
-face or group that you want to customize.
+through the structure of groups, you can specify the particular variable,
+face, or group that you want to customize.
 
 @table @kbd
-@item M-x customize-option @key{RET} @var{option} @key{RET}
-Set up a customization buffer with just one option, @var{option}.
+@item M-x customize-variable @key{RET} @var{variable} @key{RET}
+Set up a customization buffer with just one variable, @var{variable}.
 @item M-x customize-face @key{RET} @var{face} @key{RET}
 Set up a customization buffer with just one face, @var{face}.
 @item M-x customize-group @key{RET} @var{group} @key{RET}
 Set up a customization buffer with just one group, @var{group}.
 @item M-x customize-apropos @key{RET} @var{regexp} @key{RET}
-Set up a customization buffer with all the options, faces and groups
+Set up a customization buffer with all the variables, faces and groups
 that match @var{regexp}.
 @item M-x customize-changed-options @key{RET} @var{version} @key{RET}
-Set up a customization buffer with all the options, faces and groups
+Set up a customization buffer with all the variables, faces and groups
 whose meaning has changed since Emacs version @var{version}.
 @item M-x customize-saved
-Set up a customization buffer containing all options and faces that you
+Set up a customization buffer containing all variables and faces that you
 have saved with customization buffers.
 @item M-x customize-customized
-Set up a customization buffer containing all options and faces that you
+Set up a customization buffer containing all variables and faces that you
 have customized but not saved.
 @end table
 
-@findex customize-option
-  If you want to alter a particular user option with the
-customization buffer, and you know its name, you can use the command
-@kbd{M-x customize-option} and specify the option name.  This sets up
-the customization buffer with just one option---the one that you asked
-for.  Editing, setting and saving the value work as described above, but
-only for the specified option.
+@findex customize-variable
+  If you want to alter a particular variable with the customization
+buffer, and you know its name, you can use the command @kbd{M-x
+customize-variable} and specify the variable name.  This sets up the
+customization buffer with just one variable---the one that you asked
+for.  Editing, setting and saving the value work as described above,
+but only for the specified variable.
 
 @findex customize-face
   Likewise, you can modify a specific face, chosen by name, using
@@ -654,11 +652,11 @@
 
 @findex customize-saved
 @findex customize-customized
-  If you change option values and then decide the change was a mistake,
-you can use two special commands to revisit your previous changes.  Use
-@kbd{M-x customize-saved} to look at the options and faces that you have
-saved.  Use @kbd{M-x customize-customized} to look at the options and
-faces that you have set but not saved.
+  If you change option values and then decide the change was a
+mistake, you can use two special commands to revisit your previous
+changes.  Use @kbd{M-x customize-saved} to look at the options that
+you have saved.  Use @kbd{M-x customize-customized} to look at the
+options that you have set but not saved.
 
 @node Variables
 @section Variables
@@ -683,14 +681,14 @@
 set the variable---is @code{t}.
 
   Emacs uses many Lisp variables for internal record keeping, but the
-most interesting variables for a non-programmer user are the @dfn{user
-options}, the variables that are meant for users to change.  Each user
-option that you can set with the customization buffer is, in fact, a
-Lisp variable.  Emacs does not (usually) change the values of these
-variables; instead, you set the values, and thereby alter and control
-the behavior of certain Emacs commands.  Use of the customization
-buffer is explained above; here we describe other aspects of Emacs
-variables.
+most interesting variables for a non-programmer user are those that
+are also @dfn{user options}, the variables that are meant for users to
+change.  Each user option that you can set with the customization
+buffer is (if it is not a face) in fact a Lisp variable.  Emacs does
+not (usually) change the values of these variables; instead, you set
+the values, and thereby alter and control the behavior of certain
+Emacs commands.  Use of the customization buffer is explained above;
+here we describe other aspects of Emacs variables.
 
 @menu
 * Examining::	        Examining or setting one variable's value.
@@ -738,10 +736,10 @@
 options; it allows any variable name.
 
 @findex set-variable
-  The most convenient way to set a specific user option is with @kbd{M-x
-set-variable}.  This reads the variable name with the minibuffer (with
-completion), and then reads a Lisp expression for the new value using
-the minibuffer a second time.  For example,
+  The most convenient way to set a specific user option variable is
+with @kbd{M-x set-variable}.  This reads the variable name with the
+minibuffer (with completion), and then reads a Lisp expression for the
+new value using the minibuffer a second time.  For example,
 
 @example
 M-x set-variable @key{RET} fill-column @key{RET} 75 @key{RET}
@@ -1096,10 +1094,10 @@
   The @code{eval} ``variable,'' and certain actual variables, create a
 special risk; when you visit someone else's file, local variable
 specifications for these could affect your Emacs in arbitrary ways.
-Therefore, the option @code{enable-local-eval} controls whether Emacs
+Therefore, the variable @code{enable-local-eval} controls whether Emacs
 processes @code{eval} variables, as well variables with names that end
 in @samp{-hook}, @samp{-hooks}, @samp{-function} or @samp{-functions},
-and certain other variables.  The three possibilities for the option's
+and certain other variables.  The three possibilities for the variable's
 value are @code{t}, @code{nil}, and anything else, just as for
 @code{enable-local-variables}.  The default is @code{maybe}, which is
 neither @code{t} nor @code{nil}, so normally Emacs does ask for
--- a/man/dired.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/dired.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -1116,13 +1116,10 @@
 point is on a directory headerline, @kbd{w} gives you the name of that
 directory without looking for marked files.
 
-@vindex dired-marked-files
 The main purpose of the @kbd{w} command is so that you can yank the
 file names into arguments for other Emacs commands.  It also displays
 what was pushed onto the kill ring, so you can use it to display the
-list of currently marked files in the echo area.  It also stores the
-list of names in the variable @code{dired-marked-files}, for use in
-Lisp expressions.
+list of currently marked files in the echo area.
 @end table
 
 @ignore
--- a/man/display.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/display.texi	Thu Feb 03 23:28:36 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).
@@ -219,7 +219,7 @@
 @findex global-font-lock-mode
 @vindex global-font-lock-mode
   To turn on Font Lock mode automatically in all modes which support
-it, customize the user option @code{global-font-lock-mode} or use the
+it, customize the variable @code{global-font-lock-mode} or use the
 function @code{global-font-lock-mode} in your @file{.emacs} file, like
 this:
 
@@ -327,9 +327,9 @@
 that becomes visible is fontified as soon as it is displayed.  The
 parts of the buffer that are not displayed are fontified
 ``stealthily'', in the background, i.e.@: when Emacs is idle.  You can
-control this background fontification, called @dfn{Just-In-Time}, or
-@dfn{JIT} Font Lock, by customizing various options in the
-customization group @samp{jit-lock}.  @xref{Specific Customization}.
+control this background fontification, also called @dfn{Just-In-Time}
+(or @dfn{JIT}) Lock, by customizing variables in the customization
+group @samp{jit-lock}.  @xref{Specific Customization}.
 
 @node Highlight Changes
 @section Highlight Changes Mode
@@ -1087,7 +1087,7 @@
 state, with the same appearance as when the blinking cursor blinks
 ``off''.  For a box cursor, this is a hollow box; for a bar cursor,
 this is a thinner bar.  To turn off cursors in non-selected windows,
-customize the option @code{cursor-in-non-selected-windows} and assign
+customize the variable @code{cursor-in-non-selected-windows} and assign
 it a @code{nil} value.
 
 @vindex x-stretch-cursor
--- a/man/emacs.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/emacs.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -278,13 +278,15 @@
 * Mark Ring::		Previous mark positions saved so you can go back there.
 * Global Mark Ring::	Previous mark positions in various buffers.
 
-Deletion and Killing
+Killing
 
 * Deletion::		Commands for deleting small amounts of text and
 			  blank areas.
 * Killing by Lines::	How to kill entire lines of text at one time.
 * Other Kill Commands:: Commands to kill large regions of text and
 			  syntactic units such as words and sentences.
+* Graphical Kill::      The kill ring on graphical terminals:
+                          yanking between applications.
 
 Yanking
 
--- a/man/faq.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/faq.texi	Thu Feb 03 23:28:36 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
@@ -4000,7 +4000,7 @@
 @email{dak@@gnu.org, David Kastrup}
 
 @item Latest version
-11.52
+11.54
 
 @item Distribution
 @uref{ftp://ftp.gnu.org/pub/gnu/auctex/}
--- a/man/files.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/files.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -120,7 +120,7 @@
 only when done before Emacs is started.
 
 @cindex home directory shorthand
-  You can use the @file{~/} in a file name to mean your home directory,
+  You can use @file{~/} in a file name to mean your home directory,
 or @file{~@var{user-id}/} to mean the home directory of a user whose
 login name is @code{user-id}.  (On DOS and Windows systems, where a user
 doesn't have a home directory, Emacs substitutes @file{~/} with the
@@ -208,11 +208,13 @@
 about this, see @ref{Completion Options}.
 
 @cindex file selection dialog
-  When Emacs is built with a suitable GUI toolkit, it pops up the
-standard File Selection dialog of that toolkit instead of prompting for
-the file name in the minibuffer.  On Unix and GNU/Linux platforms, Emacs
-does that when built with LessTif and Motif toolkits; on MS-Windows, the
-GUI version does that by default.
+  When Emacs is built with a suitable GUI toolkit, commands invoked
+with the mouse or the menu bar use the toolkit's standard File
+Selection dialog instead of prompting for the file name in the
+minibuffer.  On Unix and GNU/Linux platforms, Emacs does that when
+built with GTK, LessTif, and Motif toolkits; on MS-Windows, the GUI
+version does that by default.  @xref{Dialog Boxes}, for info
+on customization of this.
 
   Your confirmation that @kbd{C-x C-f} has completed successfully is the
 appearance of new text on the screen and a new buffer name in the mode
@@ -253,10 +255,10 @@
 @vindex find-file-run-dired
   If the file you specify is actually a directory, @kbd{C-x C-f} invokes
 Dired, the Emacs directory browser, so that you can ``edit'' the contents
-of the directory (@pxref{Dired}).  Dired is a convenient way to delete,
-look at, or operate on the files in the directory.  However, if the
-variable @code{find-file-run-dired} is @code{nil}, then it is an error
-to try to visit a directory.
+of the directory (@pxref{Dired}).  Dired is a convenient way to view, delete,
+or operate on the files in the directory.  However, if the variable
+@code{find-file-run-dired} is @code{nil}, then it is an error to try
+to visit a directory.
 
   Files which are actually collections of other files, or @dfn{file
 archives}, are visited in special modes which invoke a Dired-like
@@ -407,6 +409,9 @@
 View the buffer that you are currently being asked about.  When you exit
 View mode, you get back to @code{save-some-buffers}, which asks the
 question again.
+@item d
+Diff the buffer against its corresponding file, so you can see
+what changes you would be saving.
 @item C-h
 Display a help message about these options.
 @end table
@@ -2979,7 +2984,7 @@
 compressed files when you visit them, and automatically recompress them
 if you alter them and save them.  To enable this feature, type the
 command @kbd{M-x auto-compression-mode}.  You can enable it permanently
-by customizing the option @code{auto-compression-mode}.
+by customizing the variable @code{auto-compression-mode}.
 
   When automatic compression (which implies automatic uncompression as
 well) is enabled, Emacs recognizes compressed files by their file names.
@@ -3085,26 +3090,24 @@
 @end example
 
 @noindent
-When you do this, Emacs may use the FTP program to access files on the
-remote host, or Emacs may use a remote-login program (such as
-@command{ssh}, @command{rlogin}, or @command{telnet}) to do this.
-
-You can always specify in the file name which method should be used to
-access the remote files, for example
+To carry out this request, Emacs uses either the FTP program or a
+remote-login program such as @command{ssh}, @command{rlogin}, or
+@command{telnet}.  You can always specify in the file name which
+method to use---for example,
 @file{/ftp:@var{user}@@@var{host}:@var{filename}} uses FTP, whereas
 @file{/ssh:@var{user}@@@var{host}:@var{filename}} uses @command{ssh}.
-When you don't specify a method in the file name, Emacs determines a
-default method according to the following rules:
+When you don't specify a method in the file name, Emacs chooses
+the method as follows:
 
 @enumerate
 @item
-If the host name starts with @samp{ftp.} (with dot), then Emacs assumes
-the @command{ftp} method.
+If the host name starts with @samp{ftp.} (with dot), then Emacs uses
+FTP.
 @item
-If the user name is @samp{ftp} or @samp{anonymous}, then Emacs assumes
-the @command{ftp} method.
+If the user name is @samp{ftp} or @samp{anonymous}, then Emacs uses
+FTP.
 @item
-Otherwise, Emacs assumes the @command{ssh} method.
+Otherwise, Emacs uses @command{ssh}.
 @end enumerate
 
 @noindent
--- a/man/fixit.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/fixit.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -159,7 +159,7 @@
 @table @kbd
 @item M-x flyspell-mode
 Enable Flyspell mode, which highlights all misspelled words.
-@item M-x flyspell-progmode
+@item M-x flyspell-prog-mode
 Enable Flyspell mode for comments and strings only.
 @item M-$
 Check and correct spelling of the word at point (@code{ispell-word}).
--- a/man/frames.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/frames.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -29,10 +29,6 @@
 so that you can use many of the features described in this chapter.
 @xref{MS-DOS Input}, for more information.
 
-@cindex MS Windows
-  Emacs compiled for MS Windows mostly supports the same features as
-under X.
-
 @menu
 * Mouse Commands::      Moving, cutting, and pasting, with the mouse.
 * Secondary Selection:: Cutting without altering point and mark.
@@ -64,7 +60,9 @@
 
   The mouse commands for selecting and copying a region are mostly
 compatible with the @code{xterm} program.  You can use the same mouse
-commands for copying between Emacs and other X client programs.
+commands for copying between Emacs and other window-based programs.
+Most of these commands also work in Emacs when you run it under an
+@code{xterm} terminal.
 
 @kindex DELETE @r{(and mouse selection)}
   If you select a region with any of these mouse commands, and then
@@ -188,8 +186,6 @@
 system for X selections, use @kbd{C-x @key{RET} x} or @kbd{C-x
 @key{RET} X}.  @xref{Specify Coding}.
 
-  These cutting and pasting commands also work on MS-Windows.
-
 @cindex primary selection
 @cindex cut buffer
 @cindex selection, primary
@@ -270,7 +266,7 @@
 @cindex OpenWindows
 @cindex Gnome
 
-  As well as the primary and secondary selection types, X supports a
+  Apart from the primary and secondary selection types, X supports a
 @dfn{clipboard} selection type which is used by some applications,
 particularly under OpenWindows and Gnome.
 
@@ -278,7 +274,7 @@
 @code{Paste} and @code{Copy} menu items, as well as the keys of the same
 names, all use the clipboard.
 
-  You can customize the option @code{x-select-enable-clipboard} to make
+  You can customize the variable @code{x-select-enable-clipboard} to make
 the Emacs yank functions consult the clipboard before the primary
 selection, and to make the kill functions to store in the clipboard as
 well as the primary selection.  Otherwise they do not access the
@@ -287,28 +283,42 @@
 
 @node Mouse References
 @section Following References with the Mouse
+@kindex Mouse-1 @r{(selection)}
 @kindex Mouse-2 @r{(selection)}
 
-  Some Emacs buffers display lists of various sorts.  These include
-lists of files, of buffers, of possible completions, of matches for
-a pattern, and so on.
+  Some read-only Emacs buffers include references you can follow, or
+commands you can activate.  These include names of files, of buffers,
+of possible completions, of matches for a pattern, as well as the
+buttons in Help buffers and customization buffers.  You can follow the
+reference or activate the command by moving point to it and typing
+@key{RET}.  You can also do this with the mouse, using either
+@kbd{Mouse-1} or @kbd{Mouse-2}.
 
-  Since yanking text into these buffers is not very useful, most of them
-define @kbd{Mouse-2} specially, as a command to use or view the item you
-click on.
+  Since yanking text into a read-only buffer is not allowed, these
+buffers generally define @kbd{Mouse-2} to follow a reference or
+activate a command.  For example, if you click @kbd{Mouse-2} on a file
+name in a Dired buffer, you visit that file.  If you click
+@kbd{Mouse-2} on an error message in the @samp{*Compilation*} buffer,
+you go to the source code for that error message.  If you click
+@kbd{Mouse-2} on a completion in the @samp{*Completions*} buffer, you
+choose that completion.
 
-  For example, if you click @kbd{Mouse-2} on a file name in a Dired
-buffer, you visit that file.  If you click @kbd{Mouse-2} on an error
-message in the @samp{*Compilation*} buffer, you go to the source code
-for that error message.  If you click @kbd{Mouse-2} on a completion in
-the @samp{*Completions*} buffer, you choose that completion.
+@vindex mouse-1-click-follows-link
+  However, most applications use @kbd{Mouse-1} to do this sort of
+thing, so Emacs implements this too.  If you click @kbd{Mouse-1}
+quickly on a reference or button, it follows or activates.  If you
+click slowly, it moves point as usual.  Dragging, meaning moving the
+mouse while it is held down, also has its usual behavior of setting
+the region.  The variable @code{mouse-1-click-follows-link} controls
+whether @kbd{Mouse-1} has this behavior.
 
 @vindex mouse-highlight
-  You can usually tell when @kbd{Mouse-2} has this special sort of
-meaning because the sensitive text highlights when you move the mouse
-over it.  The variable @code{mouse-highlight} controls whether to do
-this highlighting always (even when such text appears where the mouse
-already is), never, or only immediately after you move the mouse.
+  You can usually tell when @kbd{Mouse-1} and @kbd{Mouse-2} have this
+special sort of meaning because the sensitive text highlights when you
+move the mouse over it.  The variable @code{mouse-highlight} controls
+whether to do this highlighting always (even when such text appears
+where the mouse already is), never, or only immediately after you move
+the mouse.
 
 @node Menu Mouse Clicks
 @section Mouse Clicks for Menus
@@ -331,16 +341,17 @@
 
 @item C-Mouse-3
 @kindex C-Mouse-3
-This menu is mode-specific.  For most modes if Menu-bar mode is on, this
-menu has the same items as all the mode-specific menu-bar menus put
-together.  Some modes may specify a different menu for this
+This menu is mode-specific.  For most modes if Menu-bar mode is on,
+this menu has the same items as all the mode-specific menu-bar menus
+put together.  Some modes may specify a different menu for this
 button.@footnote{Some systems use @kbd{Mouse-3} for a mode-specific
 menu.  We took a survey of users, and found they preferred to keep
-@kbd{Mouse-3} for selecting and killing regions.  Hence the decision to
-use @kbd{C-Mouse-3} for this menu.}  If Menu-bar mode is off, this menu
-contains all the items which would be present in the menu bar---not just
-the mode-specific ones---so that you can access them without having to
-display the menu bar.
+@kbd{Mouse-3} for selecting and killing regions.  Hence the decision
+to use @kbd{C-Mouse-3} for this menu.  To use @kbd{Mouse-3} instead,
+do @code{(global-set-key [mouse-3] 'mouse-popup-menubar-stuff)}.}  If
+Menu-bar mode is off, this menu contains all the items which would be
+present in the menu bar---not just the mode-specific ones---so that
+you can access them without having to display the menu bar.
 
 @item S-Mouse-1
 This menu is for specifying the frame's principal font.
@@ -357,9 +368,9 @@
 @table @kbd
 @item Mouse-1
 @kindex Mouse-1 @r{(mode line)}
-@kbd{Mouse-1} on a mode line selects the window above.  By dragging
-@kbd{Mouse-1} on the mode line, you can move it, thus changing the
-height of the windows above and below.
+@kbd{Mouse-1} on a mode line selects the window it belongs to.  By
+dragging @kbd{Mouse-1} on the mode line, you can move it, thus
+changing the height of the windows above and below.
 
 @item Mouse-2
 @kindex Mouse-2 @r{(mode line)}
@@ -367,9 +378,9 @@
 
 @item Mouse-3
 @kindex Mouse-3 @r{(mode line)}
-@kbd{Mouse-3} on a mode line deletes the window above.  If the frame has
-only one window, it buries the current buffer instead and switches to
-another buffer.
+@kbd{Mouse-3} on a mode line deletes the window it belongs to.  If the
+frame has only one window, it buries the current buffer instead, and
+switches to another buffer.
 
 @item C-Mouse-2
 @kindex C-mouse-2 @r{(mode line)}
@@ -758,7 +769,7 @@
 scroll-bar-mode}.  With no argument, it toggles the use of scroll bars.
 With an argument, it turns use of scroll bars on if and only if the
 argument is positive.  This command applies to all frames, including
-frames yet to be created.  Customize the option @code{scroll-bar-mode}
+frames yet to be created.  Customize the variable @code{scroll-bar-mode}
 to control the use of scroll bars at startup.  You can use it to specify
 that they are placed at the right of windows if you prefer that.  You
 have to set this variable through the @samp{Customize} interface
@@ -788,7 +799,7 @@
 @kbd{Mouse-3}, depending on the setup.  You can also use the wheel to
 scroll windows instead of using the scroll bar or keyboard commands.
 To do so, turn on Mouse Wheel global minor mode with the command
-@kbd{M-x mouse-wheel-mode} or by customizing the option
+@kbd{M-x mouse-wheel-mode} or by customizing the variable
 @code{mouse-wheel-mode}.  Support for the wheel depends on the system
 generating appropriate events for Emacs.
 
@@ -798,19 +809,24 @@
 @code{mouse-wheel-scroll-amount} determine where and by how much
 buffers are scrolled.
 
-@node Drag and drop
-@section Drag and drop in Emacs.
-
+@node Drag and Drop
+@section Drag and Drop
 @cindex drag and drop
-  Emacs supports drag and drop so that dropping of files and text is handled.
-Currently supported drag and drop protocols are XDND, Motif and the old
-KDE 1.x protocol.  There is no drag support yet.
-When text is dropped on Emacs, Emacs inserts the text where it is dropped.
-When a file is dragged from a file manager to Emacs, Emacs opens that file.
-As a special case, if a file is dropped on a dired buffer the file is
-copied or moved (depends on exactly how it is dragged and the application
-it was dragged from) to the directory the dired buffer is displaying.
+
+  Emacs supports @cindex{drag and drop} using the mouse.  For
+instance, dropping text onto an Emacs frame inserts the text where it
+is dropped.  Dropping a file onto an Emacs frame visits that file.  As
+a special case, dropping the file on a Dired buffer moves or copies
+the file (according to the conventions of the application it came
+from) into the directory displayed in that buffer.
 
+@vindex x-dnd-open-file-other-window
+  Dropping a file normally visits it in the window you drop it on.  If
+you prefer to visit the file in a new window in such cases, customize
+the variable @code{x-dnd-open-file-other-window}.
+
+@ignore
+@c ??? To Lisp manual
 @vindex x-dnd-test-function
 @vindex x-dnd-known-types
   When a user drags something from another application over Emacs, that other
@@ -822,26 +838,24 @@
 @code{x-dnd-known-types} if you want Emacs to accept or reject drops based
 on some other criteria.
 
-@vindex x-dnd-open-file-other-window
-  A file is normally opened in the window it is dropped on, but if you
-prefer the file to be opened in a new window you can customize the variable
-@code{x-dnd-open-file-other-window}.
-
 @vindex x-dnd-types-alist
   If you want to change the way Emacs handles drop of different types
-or add a new type, you shall customize @code{x-dnd-types-alist}.  This
-requires detailed knowledge of what types other applications use
-for drag and drop.
+or add a new type, customize @code{x-dnd-types-alist}.  This requires
+detailed knowledge of what types other applications use for drag and
+drop.
 
 @vindex x-dnd-protocol-alist
   When an URL is dropped on Emacs it may be a file, but it may also be
 another URL type (ftp, http, etc.).  Emacs first checks
-@code{x-dnd-protocol-alist} to determine what to do with the URL.  If there
-is no match there and if @code{browse-url-browser-function} is an alist,
-Emacs looks for a match there.  If no match is found the text for the URL
-is inserted.  If you want to alter Emacs behaviour you can customize these
-variables.
+@code{x-dnd-protocol-alist} to determine what to do with the URL.  If
+there is no match there and if @code{browse-url-browser-function} is
+an alist, Emacs looks for a match there.  If no match is found the
+text for the URL is inserted.  If you want to alter Emacs behavior,
+you can customize these variables.
+@end ignore
 
+  The drag and drop protocols XDND, Motif and the
+old KDE 1.x protocol are currently supported.
 
 @node Menu Bars
 @section Menu Bars
@@ -849,7 +863,7 @@
 @cindex mode, Menu Bar
 
   You can turn display of menu bars on or off with @kbd{M-x
-menu-bar-mode} or by customizing the option @code{menu-bar-mode}.
+menu-bar-mode} or by customizing the variable @code{menu-bar-mode}.
 With no argument, this command toggles Menu Bar mode, a
 minor mode.  With an argument, the command turns Menu Bar mode on if the
 argument is positive, off if the argument is not positive.  You can use
@@ -873,20 +887,20 @@
 @cindex mode, Tool Bar
 @cindex icons, toolbar
 
-The @dfn{tool bar} is a line (or multiple lines) of icons at the top
-of the Emacs window.  You can click on these icons with the mouse
-to do various jobs.
+  The @dfn{tool bar} is a line (or lines) of icons at the top of the
+Emacs window, just below the menu bar.  You can click on these icons
+with the mouse to do various jobs.
 
-The global tool bar contains general commands.  Some major modes
+  The global tool bar contains general commands.  Some major modes
 define their own tool bars to replace it.  A few ``special'' modes
 that are not designed for ordinary editing remove some items from the
 global tool bar.
 
-Tool bars work only on a graphical display.  The tool bar uses colored
+  Tool bars work only on a graphical display.  The tool bar uses colored
 XPM icons if Emacs was built with XPM support.  Otherwise, the tool
 bar uses monochrome icons (PBM or XBM format).
 
-You can turn display of tool bars on or off with @kbd{M-x
+  You can turn display of tool bars on or off with @kbd{M-x
 tool-bar-mode}.
 
 @node Dialog Boxes
@@ -899,7 +913,7 @@
 dialog box to ask a yes-or-no question, if you used the mouse to
 invoke the command to begin with.
 
-  You can customize the option @code{use-dialog-box} to suppress the
+  You can customize the variable @code{use-dialog-box} to suppress the
 use of dialog boxes.  This also controls whether to use file selection
 windows (but those are not supported on all platforms).
 
@@ -907,10 +921,10 @@
   A file selection window is a special kind of dialog box for asking for
 file names.
 
-  You can customize the option @code{use-file-dialog} to suppress the
+  You can customize the variable @code{use-file-dialog} to suppress the
 use of file selection windows even if you still want other kinds
-of dialogs.  This option has no effect if you have suppressed all dialog
-boxes with the option @code{use-dialog-box}.
+of dialogs.  This variable has no effect if you have suppressed all dialog
+boxes with the variable @code{use-dialog-box}.
 
 @vindex x-use-old-gtk-file-dialog
   For Gtk+ version 2.4 and 2.6, you can make Emacs use the old file dialog
@@ -949,7 +963,7 @@
 @vindex mouse-avoidance-mode
 Mouse Avoidance mode keeps the window system mouse pointer away from
 point, to avoid obscuring text.  Whenever it moves the mouse, it also
-raises the frame.  To use Mouse Avoidance mode, customize the option
+raises the frame.  To use Mouse Avoidance mode, customize the variable
 @code{mouse-avoidance-mode}.  You can set this to various values to
 move the mouse in several ways:
 
--- a/man/glossary.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/glossary.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -434,6 +434,7 @@
 underline and strike-through, background stipple, etc.  Emacs provides
 features to associate specific faces with portions of buffer text, in
 order to display that text as specified by the face attributes.
+@xref{Faces}.
 
 @item File Locking
 Emacs uses file locking to notice when two different users
@@ -1223,8 +1224,9 @@
 @xref{Undo}.
 
 @item User Option
-A user option is a variable (q.v.@:) that exists so that you can customize
-Emacs by setting it to a new value.  @xref{Variables}.
+A user option is a face (q.v.@:) or a variable (q.v.@:) that exists so
+that you can customize Emacs by setting it to a new value.
+@xref{Easy Customization}.
 
 @item Variable
 A variable is an object in Lisp that can store an arbitrary value.
--- a/man/gnus-faq.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/gnus-faq.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 @c Insert  "\input texinfo" at 1st line before texing this file alone.
 @c -*-texinfo-*-
-@c Copyright (C) 1995, 2001, 2003, 2004 Free Software Foundation, Inc.
+@c Copyright (C) 1995, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
 @setfilename gnus-faq.info
 
 @c Frequently Asked Questions, FAQ - Introduction, Emacs for Heathens, Top
@@ -857,7 +857,7 @@
 
  If you enter the group by saying 
  @samp{RET}
- in summary buffer with point over the group, only unread and ticked messages are loaded. Say
+ in group buffer with point over the group, only unread and ticked messages are loaded. Say
  @samp{C-u RET}
  instead to load all available messages. If you want only the e.g. 300 newest say
  @samp{C-u 300 RET}
--- a/man/gnus.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/gnus.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -391,25 +391,25 @@
 @end iftex
 
 @menu
-* Starting Up::                 Finding news can be a pain.
-* Group Buffer::                Selecting, subscribing and killing groups.
-* Summary Buffer::              Reading, saving and posting articles.
-* Article Buffer::              Displaying and handling articles.
-* Composing Messages::          Information on sending mail and news.
-* Select Methods::              Gnus reads all messages from various select methods.
-* Scoring::                     Assigning values to articles.
-* Various::                     General purpose settings.
-* The End::                     Farewell and goodbye.
-* Appendices::                  Terminology, Emacs intro, @acronym{FAQ}, History, Internals.
-* Index::                       Variable, function and concept index.
-* Key Index::                   Key Index.
+* Starting Up::              Finding news can be a pain.
+* Group Buffer::             Selecting, subscribing and killing groups.
+* Summary Buffer::           Reading, saving and posting articles.
+* Article Buffer::           Displaying and handling articles.
+* Composing Messages::       Information on sending mail and news.
+* Select Methods::           Gnus reads all messages from various select methods.
+* Scoring::                  Assigning values to articles.
+* Various::                  General purpose settings.
+* The End::                  Farewell and goodbye.
+* Appendices::               Terminology, Emacs intro, @acronym{FAQ}, History, Internals.
+* Index::                    Variable, function and concept index.
+* Key Index::                Key Index.
 
 Other related manuals
 
-* Message:(message).            Composing messages.
-* Emacs-MIME:(emacs-mime).      Composing messages; @acronym{MIME}-specific parts.
-* Sieve:(sieve).                Managing Sieve scripts in Emacs.
-* PGG:(pgg).                    @acronym{PGP/MIME} with Gnus.
+* Message:(message).         Composing messages.
+* Emacs-MIME:(emacs-mime).   Composing messages; @acronym{MIME}-specific parts.
+* Sieve:(sieve).             Managing Sieve scripts in Emacs.
+* PGG:(pgg).                 @acronym{PGP/MIME} with Gnus.
 
 @detailmenu
  --- The Detailed Node Listing ---
@@ -951,17 +951,16 @@
 terminology section (@pxref{Terminology}).
 
 @menu
-* Finding the News::            Choosing a method for getting news.
-* The First Time::              What does Gnus do the first time you start it?
-* The Server is Down::          How can I read my mail then?
-* Slave Gnusae::                You can have more than one Gnus active at a time.
-* Fetching a Group::            Starting Gnus just to read a group.
-* New Groups::                  What is Gnus supposed to do with new groups?
-* Changing Servers::            You may want to move from one server to another.
-* Startup Files::               Those pesky startup files---@file{.newsrc}.
-* Auto Save::                   Recovering from a crash.
-* The Active File::             Reading the active file over a slow line Takes Time.
-* Startup Variables::           Other variables you might change.
+* Finding the News::      Choosing a method for getting news.
+* The First Time::        What does Gnus do the first time you start it?
+* The Server is Down::    How can I read my mail then?
+* Slave Gnusae::          You can have more than one Gnus active at a time.
+* New Groups::            What is Gnus supposed to do with new groups?
+* Changing Servers::      You may want to move from one server to another.
+* Startup Files::         Those pesky startup files---@file{.newsrc}.
+* Auto Save::             Recovering from a crash.
+* The Active File::       Reading the active file over a slow line Takes Time.
+* Startup Variables::     Other variables you might change.
 @end menu
 
 
@@ -992,7 +991,8 @@
 
 If you can use a local spool, you probably should, as it will almost
 certainly be much faster.  But do not use the local spool if your
-server is running Leafnode; in this case, use @code{(nntp "localhost")}.
+server is running Leafnode (which is a simple, standalone private news
+server); in this case, use @code{(nntp "localhost")}.
 
 @vindex gnus-nntpserver-file
 @cindex NNTPSERVER
@@ -1051,8 +1051,8 @@
 @section The First Time
 @cindex first time usage
 
-If no startup files exist, Gnus will try to determine what groups should
-be subscribed by default.
+If no startup files exist (@pxref{Startup Files}), Gnus will try to
+determine what groups should be subscribed by default.
 
 @vindex gnus-default-subscribed-newsgroups
 If the variable @code{gnus-default-subscribed-newsgroups} is set, Gnus
@@ -1139,16 +1139,6 @@
 incorporated into the slave.  If you answer ``no'', the slave may see some
 messages as unread that have been read in the master.
 
-@node Fetching a Group
-@section Fetching a Group
-@cindex fetching a group
-
-@findex gnus-fetch-group
-It is sometimes convenient to be able to just say ``I want to read this
-group and I don't care whether Gnus has been started or not''.  This is
-perhaps more useful for people who write code than for users, but the
-command @code{gnus-fetch-group} provides this functionality in any case.
-It takes the group name as a parameter.
 
 
 @node New Groups
@@ -1400,8 +1390,10 @@
 @cindex .newsrc.el
 @cindex .newsrc.eld
 
-Now, you all know about the @file{.newsrc} file.  All subscription
-information is traditionally stored in this file.
+Most common Unix news readers use a shared startup file called
+@file{.newsrc}.  This file contains all the information about what
+groups are subscribed, and which articles in these groups have been
+read. 
 
 Things got a bit more complicated with @sc{gnus}.  In addition to
 keeping the @file{.newsrc} file updated, it also used a file called
@@ -1426,8 +1418,10 @@
 However, this will make it impossible to use other newsreaders than
 Gnus.  But hey, who would want to, right?  Similarly, setting
 @code{gnus-read-newsrc-file} to @code{nil} makes Gnus ignore the
-@file{.newsrc} file and any @file{.newsrc-SERVER} files, which is
-convenient if you have a tendency to use Netscape once in a while.
+@file{.newsrc} file and any @file{.newsrc-SERVER} files, which can be
+convenient if you use a different news reader occasionally, and you
+want to read a different subset of the available groups with that
+news reader.
 
 @vindex gnus-save-killed-list
 If @code{gnus-save-killed-list} (default @code{t}) is @code{nil}, Gnus
@@ -15884,7 +15878,7 @@
 will be prompted for the location of the feed.
 
 An easy way to get started with @code{nnrss} is to say something like
-the following in the group buffer: @kbd{B nnrss RET y}, then
+the following in the group buffer: @kbd{B nnrss RET RET y}, then
 subscribe to groups.
 
 The following @code{nnrss} variables can be altered:
@@ -20607,6 +20601,7 @@
 * Undo::                        Some actions can be undone.
 * Predicate Specifiers::        Specifying predicates.
 * Moderation::                  What to do if you're a moderator.
+* Fetching a Group::            Starting Gnus just to read a group.
 * Image Enhancements::          Modern versions of Emacs/XEmacs can display images.
 * Fuzzy Matching::              What's the big fuzz?
 * Thwarting Email Spam::        A how-to on avoiding unsolicited commercial email.
@@ -21878,6 +21873,18 @@
 @end lisp
 
 
+@node Fetching a Group
+@section Fetching a Group
+@cindex fetching a group
+
+@findex gnus-fetch-group
+It is sometimes convenient to be able to just say ``I want to read this
+group and I don't care whether Gnus has been started or not''.  This is
+perhaps more useful for people who write code than for users, but the
+command @code{gnus-fetch-group} provides this functionality in any case.
+It takes the group name as a parameter.
+
+
 @node Image Enhancements
 @section Image Enhancements
 
@@ -26575,6 +26582,12 @@
 number of unread articles is called @dfn{activating the group}.
 Un-activated groups are listed with @samp{*} in the group buffer.
 
+@item spool
+@cindex spool
+News servers store their articles locally in one fashion or other.
+One old-fashioned storage method is to have just one file per
+article.  That's called a ``traditional spool''.
+
 @item server
 @cindex server
 A machine one can connect to and get news (or mail) from.
--- a/man/help.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/help.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -40,7 +40,7 @@
 @cindex looking for a subject in documentation
   If you are looking for a certain feature, but don't know where
 exactly it is documented, and aren't sure of the name of a
-related command or option, we recommend trying these methods.  Usually
+related command or variable, we recommend trying these methods.  Usually
 it is best to start with an apropos command, then try searching the
 manual index, then finally look in the FAQ and the package keywords.
 
@@ -51,9 +51,9 @@
 command displays to find what you are looking for.  @xref{Apropos}.
 
 @item M-x apropos @key{RET} @var{topic} @key{RET}
-This works like @kbd{C-h a}, but it also searches for user options and
-other variables, in case the feature you are looking for is controlled
-by an option, not a command.  @xref{Apropos}.
+This works like @kbd{C-h a}, but it also searches for variables,
+in case the feature you are looking for is controlled by a variable
+rather than a command.  @xref{Apropos}.
 
 @item M-x apropos-documentation @key{RET} @var{topic} @key{RET}
 This searches the @emph{documentation strings} (the built-in short
@@ -302,9 +302,9 @@
 
 @findex apropos-variable
   To list all user variables that match a regexp, use the command
-@kbd{M-x apropos-variable}. This command shows only user variables and
-customization options by default; if you specify a prefix argument, it
-checks all variables.
+@kbd{M-x apropos-variable}.  By default, this command shows only
+variables meant for user customization; if you specify a prefix
+argument, it checks all variables.
 
 @findex apropos
   To list all Lisp symbols that contain a match for a regexp, not just
--- a/man/killing.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/killing.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -2,48 +2,47 @@
 @c Copyright (C) 1985,86,87,93,94,95,97,2000,2001,2004
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@iftex
+
+@node Killing, Yanking, Mark, Top
 @chapter Killing and Moving Text
 
-  @dfn{Killing} means erasing text and copying it into the @dfn{kill
-ring}, from which it can be retrieved by @dfn{yanking} it.  Some systems
-use the terms ``cutting'' and ``pasting'' for these operations.
-
-  The most common way of moving or copying text within Emacs is to kill it
-and later yank it elsewhere in one or more places.  This is very safe
-because Emacs remembers several recent kills, not just the last one.  It
-is versatile, because the many commands for killing syntactic units can
-also be used for moving those units.  But there are other ways of
-copying text for special purposes.
-
-  On terminals that support multiple windows for multiple applications,
-the kill commands also provide a way to select text for other applications
-to copy, and the Emacs yank commands can access selections made by
-other programs.
-
-  Emacs has only one kill ring for all buffers, so you can kill text in
-one buffer and yank it in another buffer.
-
-@end iftex
-
 @ifnottex
 @raisesections
 @end ifnottex
 
-@node Killing, Yanking, Mark, Top
+  @dfn{Killing} means erasing text and copying it into the @dfn{kill
+ring}, from which you can bring it back into the buffer by
+@dfn{yanking} it.  (Some systems use the terms ``cutting'' and
+``pasting'' for these operations.)  This is the most common way of
+moving or copying text within Emacs.  Killing and yanking is very safe
+because Emacs remembers several recent kills, not just the last one.
+It is versatile, because the many commands for killing syntactic units
+can also be used for moving those units.  But there are other ways of
+copying text for special purposes.
+
+@iftex
 @section Deletion and Killing
+@end iftex
 
 @cindex killing text
 @cindex cutting text
 @cindex deletion
-  Most commands which erase text from the buffer save it in the @dfn{kill
-ring} so that you can move or copy it to other parts of the buffer.
-These commands are known as @dfn{kill} commands.  The rest of the
-commands that erase text do not save it in the kill ring; they are known
-as @dfn{delete} commands.  (This distinction is made only for erasure of
-text in the buffer.)  If you do a kill or delete command by mistake, you
-can use the @kbd{C-x u} (@code{undo}) command to undo it
-(@pxref{Undo}).
+  Most commands which erase text from the buffer save it in the kill
+ring.  These commands are known as @dfn{kill} commands.  The commands
+that erase text but do not save it in the kill ring are known as
+@dfn{delete} commands.  The @kbd{C-x u} (@code{undo}) command
+(@pxref{Undo}) can undo both kill and delete commands; the importance
+of the kill ring is that you can also yank the text in a different
+place or places.  Emacs has only one kill ring for all buffers, so you
+can kill text in one buffer and yank it in another buffer.
+
+  The delete commands include @kbd{C-d} (@code{delete-char}) and
+@key{DEL} (@code{delete-backward-char}), which delete only one
+character at a time, and those commands that delete only spaces or
+newlines.  Commands that can erase significant amounts of nontrivial
+data generally do a kill operation instead.  The commands' names and
+individual descriptions use the words @samp{kill} and @samp{delete} to
+say which kind of operation they perform.
 
 @vindex kill-read-only-ok
 @cindex read-only text, killing
@@ -52,34 +51,10 @@
 copy read-only text into the kill ring, without actually changing it.
 Therefore, the kill commands work specially in a read-only buffer:
 they move over text, and copy it to the kill ring, without actually
-deleting it from the buffer.  Normally, Emacs beeps and prints an
-error message when this happens.  But if you set the variable
-@code{kill-read-only-ok} to a non-@code{nil} value, it just prints a
-message in the echo area, telling you what is happening.
-
-  The delete commands include @kbd{C-d} (@code{delete-char}) and
-@key{DEL} (@code{delete-backward-char}), which delete only one
-character at a time, and those commands that delete only spaces or
-newlines.  Commands that can destroy significant amounts of nontrivial
-data generally do a kill operation instead.  The commands' names and
-individual descriptions use the words @samp{kill} and @samp{delete} to
-say which kind of operation they perform.
-
-  On window systems, the most recent kill done in Emacs is also the
-primary selection, if it is more recent than any selection you made in
-another program.  This means that the paste commands of other window
-applications copy the text that you killed in Emacs.
-
-@cindex Delete Selection mode
-@cindex mode, Delete Selection
-@findex delete-selection-mode
-  Many window systems follow the convention that insertion while text
-is selected deletes the selected text.  You can make Emacs behave this
-way by enabling Delete Selection mode, with @kbd{M-x
-delete-selection-mode}, or using Custom.  Another effect of this mode
-is that @key{DEL}, @kbd{C-d} and some other keys, when a selection
-exists, will kill the whole selection.  It also enables Transient Mark
-mode (@pxref{Transient Mark}).
+deleting it from the buffer.  Normally, kill commands beep and display
+an error message when this happens.  But if you set the variable
+@code{kill-read-only-ok} to a non-@code{nil} value, they just print a
+message in the echo area to explain why the text has not been erased.
 
 @menu
 * Deletion::            Commands for deleting small amounts of text and
@@ -87,6 +62,8 @@
 * Killing by Lines::    How to kill entire lines of text at one time.
 * Other Kill Commands:: Commands to kill large regions of text and
                           syntactic units such as words and sentences.
+* Graphical Kill::      The kill ring on graphical terminals:
+                          yanking between applications.
 @end menu
 
 @need 1500
@@ -270,6 +247,27 @@
 they copy in this way, so that successive kill commands build up a
 single kill ring entry as usual.
 
+@node Graphical Kill
+@subsection Killing on Graphical Terminals
+
+  On multi-window terminals, the most recent kill done in Emacs is
+also the primary selection, if it is more recent than any selection
+you made in another program.  This means that the paste commands of
+other applications with separate windows copy the text that you killed
+in Emacs.  In addition, Emacs yank commands treat other applications'
+selections as part of the kill ring, so you can yank them into Emacs.
+
+@cindex Delete Selection mode
+@cindex mode, Delete Selection
+@findex delete-selection-mode
+  Many window systems follow the convention that insertion while text
+is selected deletes the selected text.  You can make Emacs behave this
+way by enabling Delete Selection mode, with @kbd{M-x
+delete-selection-mode}, or using Custom.  Another effect of this mode
+is that @key{DEL}, @kbd{C-d} and some other keys, when a selection
+exists, will kill the whole selection.  It also enables Transient Mark
+mode (@pxref{Transient Mark}).
+
 @node Yanking, Accumulating Text, Killing, Top
 @section Yanking
 @cindex moving text
--- a/man/macos.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/macos.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -101,7 +101,7 @@
 coding system using 12-point Monaco.
 
   To insert characters directly in the @code{mac-roman} coding system,
-type @kbd{C-x @key{RET} k mac-roman @key{RET}}, customize the option
+type @kbd{C-x @key{RET} k mac-roman @key{RET}}, customize the variable
 @code{keyboard-coding-system}, or put this in your init file:
 
 @lisp
--- a/man/maintaining.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/maintaining.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -90,7 +90,7 @@
 changed.
 
 @vindex add-log-keep-changes-together
-  When the option @code{add-log-keep-changes-together} is
+  When the variable @code{add-log-keep-changes-together} is
 non-@code{nil}, @kbd{C-x 4 a} adds to any existing entry for the file
 rather than starting a new entry.
 
--- a/man/major.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/major.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -18,9 +18,10 @@
   The least specialized major mode is called @dfn{Fundamental mode}.
 This mode has no mode-specific redefinitions or variable settings, so
 that each Emacs command behaves in its most general manner, and each
-option is in its default state.  For editing text of a specific type
-that Emacs knows about, such as Lisp code or English text, you should
-switch to the appropriate major mode, such as Lisp mode or Text mode.
+user option variable is in its default state.  For editing text of a
+specific type that Emacs knows about, such as Lisp code or English
+text, you should switch to the appropriate major mode, such as Lisp
+mode or Text mode.
 
   Selecting a major mode changes the meanings of a few keys to become
 more specifically adapted to the language being edited.  The ones that
--- a/man/message.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/message.texi	Thu Feb 03 23:28:36 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/mini.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/mini.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -392,7 +392,7 @@
 complete to @file{/usr/bin/foo}.
 
   To enable this mode, use the command @kbd{M-x
-partial-completion-mode}, or customize the option
+partial-completion-mode}, or customize the variable
 @code{partial-completion-mode}.  This binds the partial completion
 commands to @key{TAB}, @key{SPC}, @key{RET}, and @kbd{?}.  The usual
 completion commands are available on @kbd{M-@key{TAB}},
--- a/man/misc.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/misc.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -2020,8 +2020,8 @@
 @cindex mode, CRiSP
 You can turn on key bindings to emulate the CRiSP/Brief editor with
 @kbd{M-x crisp-mode}.  Note that this rebinds @kbd{M-x} to exit Emacs
-unless you change the user option @code{crisp-override-meta-x}.  You can
-also use the command @kbd{M-x scroll-all-mode} or set the user option
+unless you set the variable @code{crisp-override-meta-x}.  You can
+also use the command @kbd{M-x scroll-all-mode} or set the variable
 @code{crisp-load-scroll-all} to emulate CRiSP's scroll-all feature
 (scrolling all windows together).
 
--- a/man/mule.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/mule.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -996,11 +996,11 @@
 @findex set-keyboard-coding-system
 @vindex keyboard-coding-system
   The command @kbd{C-x @key{RET} k} (@code{set-keyboard-coding-system})
-or the Custom option @code{keyboard-coding-system}
-specifies the coding system for keyboard input.  Character-code
-translation of keyboard input is useful for terminals with keys that
-send non-@acronym{ASCII} graphic characters---for example, some terminals designed
-for ISO Latin-1 or subsets of it.
+or the variable @code{keyboard-coding-system} specifies the coding
+system for keyboard input.  Character-code translation of keyboard
+input is useful for terminals with keys that send non-@acronym{ASCII}
+graphic characters---for example, some terminals designed for ISO
+Latin-1 or subsets of it.
 
   By default, keyboard input is translated based on your system locale
 setting.  If your terminal does not really support the encoding
@@ -1276,7 +1276,7 @@
 @vindex latin1-display
   If your terminal can display Latin-1, you can display characters
 from other European character sets using a mixture of equivalent
-Latin-1 characters and @acronym{ASCII} mnemonics.  Use the Custom option
+Latin-1 characters and @acronym{ASCII} mnemonics.  Customize the variable
 @code{latin1-display} to enable this.  The mnemonic @acronym{ASCII}
 sequences mostly correspond to those of the prefix input methods.
 
@@ -1338,10 +1338,10 @@
 On a windowing terminal, you should not need to do anything special to
 use these keys; they should simply work.  On a text-only terminal, you
 should use the command @code{M-x set-keyboard-coding-system} or the
-Custom option @code{keyboard-coding-system} to specify which coding
+variable @code{keyboard-coding-system} to specify which coding
 system your keyboard uses (@pxref{Specify Coding}).  Enabling this
 feature will probably require you to use @kbd{ESC} to type Meta
-characters; however, on a Linux console or in @code{xterm}, you can
+characters; however, on a console terminal or in @code{xterm}, you can
 arrange for Meta to be converted to @kbd{ESC} and still be able type
 8-bit characters present directly on the keyboard or using
 @kbd{Compose} or @kbd{AltGr} keys.  @xref{User Input}.
--- a/man/org.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/org.texi	Thu Feb 03 23:28:36 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/picture.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/picture.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -44,7 +44,8 @@
 
 @vindex picture-mode-hook
   Turning on Picture mode runs the hook @code{picture-mode-hook}
-(@pxref{Hooks}).
+(@pxref{Hooks}).  Additional extensions to Picture mode can be found
+in @file{artist.el}.
 
 @menu
 * Basic Picture::         Basic concepts and simple commands of Picture Mode.
--- a/man/programs.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/programs.texi	Thu Feb 03 23:28:36 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
@@ -1274,7 +1277,7 @@
 @vindex hs-hide-comments-when-hiding-all
 @vindex hs-isearch-open
 @vindex hs-special-modes-alist
-  These user options exist for customizing Hideshow mode.
+  These variables exist for customizing Hideshow mode.
 
 @table @code
 @item hs-hide-comments-when-hiding-all
@@ -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	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/reftex.texi	Thu Feb 03 23:28:36 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,32 @@
 @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
+Burstall, Alastair Burt, Lars Clausen, Soren Dayton, Stephen Eglen,
+Karl Eichwalder, Erik Frisk, Peter Galbraith, Kai Grossjohann, Frank
+Harrell, Peter Heslin, Stephan Heuel, Alan Ho, Lute Kamstra, Dieter
+Kraft, David Kastrup, Adrian Lanz, Juri Linkov, Rory Molinari, Stefan
+Monnier, Laurent Mugnier, Dan Nicolaescu, 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 +3548,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 +3567,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 +3585,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 +3597,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 +3624,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 +3649,31 @@
 @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-isearch-minor-mode
+Toggle a minor mode which enables incremental search to work globally
+on the entire multifile document.  Files will be searched in th
+sequence they appear in the document.
 @end deffn
 
 @deffn Command reftex-goto-label
@@ -3563,7 +3686,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 +3698,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 +3738,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 +3774,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 +3800,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 +3823,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 +3832,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 +3857,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 +3865,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 +3886,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 +3894,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 +3907,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 +3916,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 +3927,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 +3942,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 +3981,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 +4021,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 +4029,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 +4038,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 +4053,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 +4070,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 +4123,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 +4148,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 +4161,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 +4176,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 +4208,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 +4230,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 +4252,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 +4270,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 +4280,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 +4301,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 +4315,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 +4354,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 +4363,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 +4381,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 +4397,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 +4413,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 +4492,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 +4511,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 +4529,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 +4581,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 +4589,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 +4603,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 +4618,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 +4629,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 +4641,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 +4657,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 +4666,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 +4674,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 +4689,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 +4699,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 +4717,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 +4750,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 +4769,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 +4786,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 +4805,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 +4832,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 +4843,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 +4865,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 +4877,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 +4896,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 +4911,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 +4929,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 +4940,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 +4964,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 +4975,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 +4987,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 +5003,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 +5015,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 +5025,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 +5083,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 +5118,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 +5136,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 +5151,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 +5576,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	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/rmail.texi	Thu Feb 03 23:28:36 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/screen.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/screen.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -97,7 +97,7 @@
 are just hollow.  Thus, the most striking cursor always shows you
 the selected window, on all kinds of terminals.
 
-  @xref{Cursor Display}, for customization options that control display
+  @xref{Cursor Display}, for customizable variables that control display
 of the cursor or cursors.
 
   The term ``point'' comes from the character @samp{.}, which was the
--- a/man/search.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/search.texi	Thu Feb 03 23:28:36 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/sending.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/sending.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -506,9 +506,9 @@
 
   For completion purposes, the valid mailing addresses are taken to be
 the local users' names plus your personal mail aliases.  You can
-specify additional sources of valid addresses; look at the customization
-group @samp{mailalias} to see the options for this
-(@pxref{Customization Groups}).
+specify additional sources of valid addresses; see the customization
+group @samp{mailalias} to see the variables for customizing this
+feature (@pxref{Customization Groups}).
 
   If you type @kbd{M-@key{TAB}} in the body of the message,
 @code{mail-complete} invokes @code{ispell-complete-word}, as in Text
--- a/man/text.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/text.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -185,9 +185,9 @@
   The commands @kbd{M-a} and @kbd{M-e} (@code{backward-sentence} and
 @code{forward-sentence}) move to the beginning and end of the current
 sentence, respectively.  They were chosen to resemble @kbd{C-a} and
-@kbd{C-e}, which move to the beginning and end of a line.  Unlike them,
-@kbd{M-a} and @kbd{M-e} if repeated or given numeric arguments move over
-successive sentences.
+@kbd{C-e}, which move to the beginning and end of a line.  Unlike
+them, @kbd{M-a} and @kbd{M-e} move over successive sentences if
+repeated.
 
   Moving backward over a sentence places point just before the first
 character of the sentence; moving forward places point right after the
@@ -238,11 +238,10 @@
 @end example
 
 @noindent
-You should also set the variable @code{sentence-end-double-space} to
-@code{nil} so that the fill commands expect and leave just one space at
-the end of a sentence.  Note that this makes it impossible to
-distinguish between periods that end sentences and those that indicate
-abbreviations.
+This is what setting the variable @code{sentence-end-double-space} to
+@code{nil} automatically does.  But note that this makes it impossible
+to distinguish between periods that end sentences and those that
+indicate abbreviations.
 
 @node Paragraphs
 @section Paragraphs
@@ -269,8 +268,8 @@
 paragraph.  Blank lines and text-formatter command lines separate
 paragraphs and are not considered part of any paragraph.  In Indented
 Text mode, but not in Text mode, an indented line also starts a new
-paragraph.  (If a paragraph is preceded by a blank line, these
-commands treat that blank line as the beginning of the paragraph.)
+paragraph.  If there is a blank line before the paragraph, @kbd{M-@{}
+moves to the blank line, because that is convenient in practice.
 
   In major modes for programs, paragraphs begin and end only at blank
 lines.  This makes the paragraph commands continue to be useful even
@@ -894,11 +893,11 @@
 outline-mode} to switch to Outline mode as the major mode of the current
 buffer.
 
-  When Outline mode makes a line invisible, the line does not appear on
-the screen.  The screen appears exactly as if the invisible line were
-deleted, except that an ellipsis (three periods in a row) appears at the
-end of the previous visible line (only one ellipsis no matter how many
-invisible lines follow).
+  When Outline mode makes a line invisible, the line does not appear
+on the screen.  The screen appears exactly as if the invisible line
+were deleted, except that an ellipsis (three periods in a row) appears
+at the end of the previous visible line.  (Multiple consecutive
+invisible lines produce just one ellipsis.)
 
   Editing commands that operate on lines, such as @kbd{C-n} and
 @kbd{C-p}, treat the text of the invisible line as part of the previous
@@ -929,7 +928,7 @@
                                      outlines.
 * Visibility: Outline Visibility.  Commands to control what is visible.
 * Views: Outline Views.            Outlines and multiple views.
-* Foldout::                        Folding editing.
+* Foldout::                        Folding means zooming in on outlines.
 @end menu
 
 @node Outline Format
@@ -1900,8 +1899,11 @@
 @cindex soft newline
 @cindex newlines, hard and soft
 
+@cindex use-hard-newlines
   In formatted text, Emacs distinguishes between two different kinds of
-newlines, @dfn{hard} newlines and @dfn{soft} newlines.
+newlines, @dfn{hard} newlines and @dfn{soft} newlines.  (You can enable
+or disable this feature separately in any  buffer with the command
+@code{use-hard-newlines}.)
 
   Hard newlines are used to separate paragraphs, or items in a list, or
 anywhere that there should always be a line break regardless of the
--- a/man/tramp.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/tramp.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -25,8 +25,8 @@
 @end macro
 
 @copying
-Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004 Free Software
-Foundation, Inc.
+Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
+Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -192,6 +192,7 @@
 * Multi-hop filename syntax::   Multi-hop filename conventions.
 * Filename completion::         Filename completion.
 * Dired::                       Dired.
+* Compilation::                 Compile remote files.
 
 The inner workings of remote version control
 
@@ -1690,6 +1691,7 @@
 * Multi-hop filename syntax::   Multi-hop filename conventions.
 * Filename completion::         Filename completion.
 * Dired::                       Dired.
+* Compilation::                 Compile remote files.
 @end menu
 
 
@@ -1885,6 +1887,32 @@
 and will only fetch the directory listing once.
 
 
+@node Compilation
+@section Compile remote files
+@cindex compile
+@cindex recompile
+
+@value{tramp} provides commands for compilation of files on remote
+machines.  In order to get them loaded, you need to require
+@file{tramp-util.el}:
+
+@lisp
+(require 'tramp-util)
+@end lisp
+
+Afterwards, you can use the commands @code{tramp-compile} and
+@code{tramp-recompile} instead of @code{compile} and @code{recompile},
+respectively; @inforef{Compilation, ,@value{emacsdir}}.  This does not
+work for the @option{ftp} and @option{smb} methods.
+
+The corresponding key bindings and menu entries calling these commands
+are redefined automatically for buffers associated with remote files.
+
+After finishing the compilation, you can use the usual commands like
+@code{previous-error}, @code{next-error} and @code{first-error} for
+navigation in the @file{*Compilation*} buffer.
+
+
 @node Bug Reports
 @chapter Reporting Bugs and Problems
 @cindex bug reports
--- a/man/trampver.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/trampver.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -4,7 +4,7 @@
 @c In the Tramp CVS, the version number is auto-frobbed from
 @c configure.ac, so you should edit that file and run
 @c "autoconf && ./configure" to change the version number.
-@set trampver 2.0.46
+@set trampver 2.0.47
 
 @c Other flags from configuration
 @set prefix /usr/local
--- a/man/widget.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/widget.texi	Thu Feb 03 23:28:36 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/man/windows.texi	Thu Feb 03 22:58:27 2005 +0000
+++ b/man/windows.texi	Thu Feb 03 23:28:36 2005 +0000
@@ -60,8 +60,8 @@
 
   Each window has its own mode line, which displays the buffer name,
 modification status and major and minor modes of the buffer that is
-displayed in the window.  @xref{Mode Line}, for full details on the mode
-line.
+displayed in the window.  The selected window's mode line appears in a
+different color.  @xref{Mode Line}, for full details on the mode line.
 
 @iftex
 @break
@@ -322,9 +322,14 @@
 @kbd{Mouse-3}, and delete all the windows in a frame except one window
 by clicking on that window's mode line with @kbd{Mouse-2}.
 
-  The easiest way to adjust window heights is with a mouse.  If you
-press @kbd{Mouse-1} on a mode line, you can drag that mode line up or
-down, changing the heights of the windows above and below it.
+  You can also adjust window heights and widths with the mouse.  If
+you press @kbd{Mouse-1} on a mode line, you can drag that mode line up
+or down, changing the heights of the windows above and below it.  If
+you press it on the divider between two consecutive mode lines, you
+can drag that divider right or left, changing the widths of the
+windows to either side.  Note that changing heights and widths with
+the mouse never deletes windows, it just refuses to make any window
+smaller than it can be.
 
 @kindex C-x ^
 @findex enlarge-window
--- a/src/.gdbinit	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/.gdbinit	Thu Feb 03 23:28:36 2005 +0000
@@ -35,20 +35,23 @@
 # debugging.
 handle SIGALRM ignore
 
-# Set up a mask to use.
-# This should be EMACS_INT, but in some cases that is a macro.
-# long ought to work in all cases right now.
+# $valmask and $tagmask are mask values set up by the xreload macro below.
 
+# Use $bugfix so that the value isn't a constant.
+# Using a constant runs into GDB bugs sometimes.
 define xgetptr
-  set $ptr = (gdb_use_union ? $arg0.u.val : $arg0 & $valmask) | gdb_data_seg_bits
+  set $bugfix = $arg0
+  set $ptr = (gdb_use_union ? $bugfix.u.val : $bugfix & $valmask) | gdb_data_seg_bits
 end
 
 define xgetint
-  set $int = gdb_use_union ? $arg0.s.val : (gdb_use_lsb ? $arg0 : $arg0 << gdb_gctypebits) >> gdb_gctypebits
+  set $bugfix = $arg0
+  set $int = gdb_use_union ? $bugfix.s.val : (gdb_use_lsb ? $bugfix : $bugfix << gdb_gctypebits) >> gdb_gctypebits
 end
 
 define xgettype
-  set $type = gdb_use_union ? $arg0.s.type : (enum Lisp_Type) (gdb_use_lsb ? $arg0 & $tagmask : $arg0 >> gdb_valbits)
+  set $bugfix = $arg0
+  set $type = gdb_use_union ? $bugfix.s.type : (enum Lisp_Type) (gdb_use_lsb ? $bugfix & $tagmask : $bugfix >> gdb_valbits)
 end
 
 # Set up something to print out s-expressions.
--- a/src/ChangeLog	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/ChangeLog	Thu Feb 03 23:28:36 2005 +0000
@@ -1,9 +1,526 @@
+2005-02-03  Richard M. Stallman  <rms@gnu.org>
+
+	* xterm.c (x_error_quitter): On GCC 3 and up, specify noinline.
+
+	* xdisp.c (echo_area_display): Clear echo_message_buffer.
+
+	* buffer.c (Fbury_buffer): Doc fix.
+
+2005-02-02  Steven Tamm  <steventamm@mac.com>
+
+	* macfns.c (unwind_create_frame): Fixing compile error due to
+	xassert being uncondition, but predicate is.
+	* dispnew.c (update_window): Fixing compile error due to
+	xassert being uncondition, but predicate is.
+
+2005-02-02  Miles Bader  <miles@gnu.org>
+
+	* dispextern.h (xassert): Enable unconditionally.
+
+2005-02-02  Kim F. Storm  <storm@cua.dk>
+
+	* undo.c (Fprimitive_undo): Fix dummy apply undo entry.
+
+2005-02-02  Kenichi Handa  <handa@m17n.org>
+
+	* casefiddle.c (casify_object): Enable changing characters of
+	different byte length.
+	(casify_region): Fix loop condition, args to replace_range_2, and
+	update opoint_byte.
+
+	* insdel.c (replace_range_2): Fix bugs in adjusting markers and
+	point.
+
+2005-02-01  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (back_to_previous_visible_line_start): Reset iterator
+	stack before calling handle_display_prop.
+
+2005-01-31  Kim F. Storm  <storm@cua.dk>
+
+	* undo.c (Qapply): New lisp var.
+	(syms_of_undo): Intern and staticpro it.
+	(Fprimitive_undo): Support formats (apply FUNNAME . ARGS) and
+	(apply DELTA BEG END FUNNAME . ARGS) instead of (FUNNAME . ARGS).
+
+	* buffer.c (syms_of_buffer) <buffer-undo-list>: Doc fix.
+
+2005-01-30  Jesper Harder  <harder@phys.au.dk>
+
+	* macterm.c (syms_of_macterm) <mac-reverse-ctrl-meta>
+	<mac-emulate-three-button-mouse>: Fix docstring indentation.
+
+2005-01-29  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* undo.c (syms_of_undo) <undo-outer-limit>: Doc update.
+	Increase value to 3 Meg.
+
+2005-01-29  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* xfns.c (show_hourglass): Use FRAME_X_WINDOW as parent for GTK,
+	button events are not received otherwise.
+
+2005-01-29  Richard M. Stallman  <rms@gnu.org>
+
+	* buffer.c (syms_of_buffer) <buffer-undo-list>: Doc fix.
+
+	* undo.c (Fprimitive_undo): Handle (FUNNAME . ARGS) by calling FUNNAME.
+
+2005-01-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* keymap.c (access_keymap): YAILOM.
+
+2005-01-27  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (get_phys_cursor_geometry): New function to calculate
+	phys cursor position and size for hollow cursor.  Position is
+	aligned with get_glyph_string_clip_rect and ensures that a hollow
+	cursor is shown, even when the actual glyph is not visible.
+
+	* dispextern.h (get_phys_cursor_geometry): Add prototype.
+
+	* xterm.c (x_clip_to_row): Ensure y >= 0.
+	(x_draw_hollow_cursor): Use get_phys_cursor_geometry.
+
+	* w32term.c (x_draw_hollow_cursor): Use get_phys_cursor_geometry.
+
+	* macterm.c (x_draw_hollow_cursor): Use get_phys_cursor_geometry.
+
+2005-01-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* xterm.c (x_error_quitter): Add a prototype.  Make it static again.
+
+2005-01-27  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (get_glyph_string_clip_rect): Always show a cursor
+	glyph, even when row is only partially visible and actual cursor
+	position is not visible.
+
+2005-01-24  Richard M. Stallman  <rms@gnu.org>
+
+	* xterm.c (x_error_quitter): No longer static, and moved after
+	x_error_handler.
+
+2005-01-24  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (move_it_by_lines): If we move forward after going too
+	far back, cancel move if end position is same as start position.
+
+2005-01-24  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* dispextern.h (struct glyph_string): New members clip_head and
+	clip_tail.
+
+	* xdisp.c (get_glyph_string_clip_rect): Restrict horizontal clip
+	region to the area between clip_head and clip_tail.
+	(draw_glyphs): Record the area that need to be actually redrawn to
+	the new variables clip_head and clip_tail when there are
+	overhangs.  Set values of these variables to the corresponding
+	members in struct glyph_string.  Refine x coordinates for
+	notice_overwritten_cursor using clip_head and clip_tail.
+
+	* macgui.h (STORE_XCHARSETSTRUCT): New macro.
+
+	* macterm.c (mac_compute_glyph_string_overhangs): Implement with
+	QDTextBounds.
+	(x_draw_glyph_string): Don't fill the background of the successor
+	of a glyph with a right overhang if the successor will draw a cursor.
+	(XLoadQueryFont): Obtain font metrics using QDTextBounds.
+	(x_redisplay_interface): Add entry for compute_glyph_string_overhangs.
+
+2005-01-24  Kim F. Storm  <storm@cua.dk>
+
+	* window.c (window_scroll_pixel_based): Fix scrolling in the wrong
+	direction if window height was smaller than next-screen-context-lines.
+	Now always scroll at least one line in the requested direction.
+	Ensure that we actually do scroll backwards when requested to do so.
+
+	* xdisp.c (redisplay_window): Only try to make cursor line fully
+	visible once (to avoid redisplay loop).
+
+2005-01-23  Kim F. Storm  <storm@cua.dk>
+
+	* window.c (Fpos_visible_in_window_p): Simplify return value for
+	partially visible rows.
+	(window_scroll_pixel_based): Adapt to that change.
+
+	* window.c (window_scroll_pixel_based): Force moving to next line
+	if scrolling doesn't move start point, e.g. if looking at tall image.
+
+	* xdisp.c (pos_visible_p): Return 0 if non-interactive.
+	Clear last_height before calling line_bottom_y to get real height.
+	Fix calculation of y.
+
+2005-01-22  Steven Tamm  <steventamm@mac.com>
+
+	* s/darwin.h: Removed PTY_ITERATION from here.
+	(DARWIN): Define.
+	* process.c (init_process): Default process-connection-type to
+	nil on darwin 6 or less, t if it is 7 or higher.  This way the
+	broken pty behavior is still allowed on darwin 6 for interactive
+	processes for people that know what they are doing.
+
+2005-01-22  Kim F. Storm  <storm@cua.dk>
+
+	* window.c (auto_window_vscroll_p): New boolean.
+	(syms_of_window): DEFVAR_BOOL it.
+	(Fpos_visible_in_window_p): Extend return value to include RTOP
+	and RBOT values if FULLY is nil.
+	(window_scroll_pixel_based): Adjust vscroll for partially visible
+	rows if auto_window_vscroll_p is set.
+	(Fset_window_vscroll): Do nothing if vscroll is not modified.
+
+	* xdisp.c (pos_visible_p): Replace FULLY arg by RTOP and RBOT args
+	to return number of partially invisible pixels at top and bottom
+	of the dislay row at POS.
+
+	* lisp.h (pos_visible_p): Fix prototype.
+
+2005-01-21  Richard M. Stallman  <rms@gnu.org>
+
+	* fileio.c (Fcopy_file): Doc fix.
+
+2005-01-21  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* gtkutil.c (xg_tool_bar_detach_callback): Remove unused variable bw.
+	(xg_get_file_name): Move declaration ofx_use_old_gtk_file_dialog to
+	start of function for older compilers.
+
+2005-01-20  Richard M. Stallman  <rms@gnu.org>
+
+	* editfns.c (Fmessage): If arg is "", return "" (as before).
+
+	* keymap.c (access_keymap): Protect from bad value of meta_prefix_char.
+
+	* .gdbinit (xgetptr, xgetint, xgettype): Copy $arg0 into a temp
+	variable.
+
+2005-01-20  Steven Tamm  <steventamm@mac.com>
+
+	* editfns.c (Voperating_system_release): Add.
+	(init_editfns): Assign new variable operating-system-release
+	based on call to uname if available.
+	(get_operating_system_release): Add function to
+	allow c-level access to operating system release.
+
+	* config.h: Regenerated.
+
+	* s/darwin.h (PTY_ITERATION): Don't allow PTYs on darwin 6 or less.
+	(MIN_PTY_KERNEL_VERSION): Define minimum kernel version for
+	using ptys as '7'.
+
+2005-01-20  Kim F. Storm  <storm@cua.dk>
+
+	* alloc.c (STRING_MARKED_P, VECTOR_MARKED_P): Return boolean.
+
+	* xterm.c (x_draw_glyph_string_box): Fix last_x for full width rows.
+	Thanks to Chong Yidong <cyd@stupidchicken.com> for debugging this.
+
+	* macterm.c (x_draw_glyph_string_box): Likewise.
+
+	* w32term.c (x_draw_glyph_string_box): Likewise.
+
+	* indent.c (Fvertical_motion): Temporarily disable selective display.
+
+2005-01-19  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (note_mode_line_or_margin_highlight): Fix :pointer
+	image property.
+
+	* fns.c (sweep_weak_table): Advance prev pointer when we keep a pair.
+
+2005-01-18  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (fast_find_position): Backtrack to find first row if
+	charpos is inside a display overlay that spans multiple lines.
+
+2005-01-18  Kenichi Handa  <handa@m17n.org>
+
+	* coding.c (decode_coding_iso2022): Translate invalid codes if
+	translation-table is specified.
+
+2005-01-18  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (back_to_previous_visible_line_start): Undo 2004-12-28
+	change.  If handle_display_prop indicates newline is replaced by
+	image or text, move back to start of relevant overlay or interval
+	and continue scan from there.  Simplify.
+
+2005-01-17  Kim F. Storm  <storm@cua.dk>
+
+	* dispnew.c (mode_line_string, marginal_area_string):
+	Fix off-by-one error in search for glyph.
+
+2005-01-16  Kim F. Storm  <storm@cua.dk>
+
+	* macterm.c (syms_of_macterm) <mac-allow-anti-aliasing>: Doc fix.
+
+2005-01-16  Steven Tamm  <steventamm@mac.com>
+
+	* macterm.c (mac_to_x_fontname): Remove spurious argument.
+
+2005-01-16  Andreas Schwab  <schwab@suse.de>
+
+	* macterm.c (mac_draw_string_common): Fix compilation on OSX 10.1.
+
+2005-01-16  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* fringe.c (Fdefine_fringe_bitmap, init_fringe): When assigning
+	fringe_faces, cast result from xmalloc/xrealloc to Lisp_Object *.
+
+2005-01-16  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* keyboard.c (READABLE_EVENTS_DO_TIMERS_NOW)
+	(READABLE_EVENTS_FILTER_EVENTS, READABLE_EVENTS_IGNORE_SQUEEZABLES):
+	New flags for readable_events.
+	(get_filtered_input_pending, readable_filtered_events): Remove.
+	(tracking_off): Call readable_events and get_input_pending with
+	flag READABLE_EVENTS_DO_TIMERS_NOW.
+	(readable_events): Move code from old readable_filtered_events here,
+	but check new READABLE_EVENTS_* in argument flags instead of previous
+	two boolean arguments do_timers_now and filter_events.
+	If we are doing mouse tracking and the mouse moved, return only if
+	READABLE_EVENTS_IGNORE_SQUEEZABLES is not set in flags.
+	(swallow_events): Call get_input_pending with flag
+	READABLE_EVENTS_DO_TIMERS_NOW.
+	(get_input_pending): Move code from old get_filtered_input_pending
+	here.  Replace boolean arguments do_timers_now, filter_events with
+	flags, and pass flags to readable_events.  Document new
+	READABLE_EVENTS_* flags.
+	(detect_input_pending_ignore_squeezables): New function.
+	(detect_input_pending_run_timers): Call get_input_pending with flag
+	READABLE_EVENTS_DO_TIMERS_NOW.
+	(Finput_pending_p): Call get_input_pending with flags
+	READABLE_EVENTS_DO_TIMERS_NOW and READABLE_EVENTS_FILTER_EVENTS.
+
+	* dispnew.c (update_window, update_frame_1): Replace calls to
+	detect_input_pending with detect_input_pending_ignore_squeezables
+	so that redisplay is not paused if the event queue contains only
+	mouse movements.
+
+	* lisp.h: Declare detect_input_pending_ignore_squeezables.
+
+2005-01-15  Steven Tamm  <steventamm@mac.com>
+
+	* macterm.c (Vmac_use_core_graphics): Declare variable for
+	mac-allow-anti-aliasing.
+	(syms_of_macterm): DEFVAR_LISP and initialize it.
+	(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.
 
 2004-12-31  Richard M. Stallman  <rms@gnu.org>
 
+	* xdisp.c (setup_for_ellipsis, get_next_display_element):
+	Set it->ellipsis_p to 1 or 0.
+	(display_line): Record whether row ends in mid-ellipsis.
+	(set_cursor_from_row): If ends in ellipsis. find start of it.
+	(cursor_row_p): If PT's at the end of the ellipsis the row
+	ends within, don't display cursor on this row.
+
+	* dispextern.h (struct it): New element ellipsis_p.
+	(struct glyph_row): New element ends_in_ellipsis_p.
+
+	* xdisp.c (BUFFER_POS_REACHED_P): We haven't reached the specified
+	position if we're reading from something other than the buffer.
+
 	* window.c (window_scroll_pixel_based): Only look at
 	Vscroll_preserve_screen_position if the old PT can't be kept.
 	(syms_of_window) <scroll-preserve-screen-position>: Doc fix.
@@ -22,8 +539,7 @@
 
 	* fileio.c (Finsert_file_contents): Don't use
 	current_buffer->buffer_file_coding_system even if REPLACE is
-	non-nil.  Call Qafter_insert_file_set_coding with the second arg
-	VISIT.
+	non-nil.  Call Qafter_insert_file_set_coding with the second arg VISIT.
 
 	* fontset.h (struct font_info): New members space_width and
 	average_width.
@@ -35,9 +551,8 @@
 
 	* xterm.c (x_new_font): Set FRAME_COLUMN_WIDTH to
 	fontp->average_width, not FONT_WIDTH.  Set FRAME_SPACE_WIDTH to
-	fontp-?space_width..
-	(x_load_font): Calculate fontp->space_width and
-	fontp->average_width.
+	fontp->space_width.
+	(x_load_font): Calculate fontp->space_width and fontp->average_width.
 	(x_term_init): Initialize dpyinfo->Xatom_AVERAGE_WIDTH.
 
 	* xdisp.c (x_produce_glyphs): Calculate tab width by
@@ -46,8 +561,7 @@
 2004-12-29  Sanghyuk Suh  <han9kin@mac.com>
 
 	* macterm.c (SelectionRange): Add Xcode position apple event struct.
-	(do_ae_open_documents): Handle Xcode-style file position open
-	events.
+	(do_ae_open_documents): Handle Xcode-style file position open events.
 
 2004-12-29  Luc Teirlinck  <teirllm@auburn.edu>
 
@@ -73,11 +587,16 @@
 	init_mac_drag_n_drop.
 	(mac_do_track_drag): New function and declaration.
 	(install_window_handler): Return OSErr value.
-	(install_window_handler) [TARGET_API_MAC_CARBON]: Register
-	handlers for tracking/receiving drag-and-drop items.
+	(install_window_handler) [TARGET_API_MAC_CARBON]:
+	Register handlers for tracking/receiving drag-and-drop items.
 	(do_ae_open_documents): Generate unibyte strings for filenames.
-	(mac_do_receive_drag) [TARGET_API_MAC_CARBON] : Likewise.  Reject
-	only non-filename items.  Set event modifiers.  Set return value.
+<<<<<<< ChangeLog
+	(mac_do_receive_drag) [TARGET_API_MAC_CARBON] : Likewise.
+	Reject only non-filename items.  Set event modifiers and return value.
+=======
+	(mac_do_receive_drag) [TARGET_API_MAC_CARBON] : Likewise.
+	Reject only non-filename items.  Set event modifiers, and return value.
+>>>>>>> 1.4187
 
 2004-12-28  Dan Nicolaescu  <dann@ics.uci.edu>
 
@@ -101,8 +620,8 @@
 	* xmenu.c (popup_get_selection): Only pop down dialogs
 	on C-g and Escape.
 	(popup_get_selection): Remove parameter down_on_keypress.
-	(create_and_show_popup_menu, create_and_show_dialog): Remove
-	parameter down_on_keypress to popup_get_selection.
+	(create_and_show_popup_menu, create_and_show_dialog):
+	Remove parameter down_on_keypress to popup_get_selection.
 
 2004-12-27  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
@@ -119,8 +638,8 @@
 
 	* frame.c (x_set_frame_parameters, x_report_frame_params)
 	(x_set_fullscreen): Remove #ifndef HAVE_CARBON.
-	(x_set_border_width, Vdefault_frame_scroll_bars): Change
-	HAVE_CARBON to MAC_OS.
+	(x_set_border_width, Vdefault_frame_scroll_bars):
+	Change HAVE_CARBON to MAC_OS.
 
 	* image.c [MAC_OS]: Include sys/stat.h.
 	[MAC_OS && !MAC_OSX]: Include sys/param.h, ImageCompression.h, and
@@ -128,8 +647,7 @@
 
 	* mac.c [!MAC_OSX] (mac_wait_next_event): Add extern.
 	[!MAC_OSX] (select): Use mac_wait_next_event.
-	[!MAC_OSX] (run_mac_command): Change EXEC_SUFFIXES to
-	Vexec_suffixes.
+	[!MAC_OSX] (run_mac_command): Change EXEC_SUFFIXES to Vexec_suffixes.
 	[!MAC_OSX] (select, run_mac_command): Change `#ifdef
 	TARGET_API_MAC_CARBON' to `#if TARGET_API_MAC_CARBON'.
 	(mac_clear_font_name_table): Add extern.
@@ -148,21 +666,19 @@
 	* macfns.c (mac_initialized): Remove extern.
 	(stricmp): Put in #if 0.  All callers changed to use xstricmp in
 	xfaces.c.
-	(strnicmp): Decrement `n' at the end of each loop, not the
-	beginning.
-	(check_mac): Use the term "Mac native windows" instead of "Mac
-	OS".
+	(strnicmp): Decrement `n' at the end of each loop, not the beginning.
+	(check_mac): Use the term "Mac native windows" instead of "Mac OS".
 	(check_x_display_info, x_display_info_for_name): Sync with xfns.c.
 	(mac_get_rdb_resource): New function (from w32reg.c).
 	(x_get_string_resource): Use it.
 	(install_window_handler): Add extern.
 	(mac_window): New function.
-	(Fx_create_frame): Use it instead of make_mac_frame.  Set
-	parameter for Qfullscreen.  Call x_wm_set_size_hint.
+	(Fx_create_frame): Use it instead of make_mac_frame.
+	Set parameter for Qfullscreen.  Call x_wm_set_size_hint.
 	(Fx_open_connection, Fx_close_connection): New defuns.
 	(syms_of_macfns): Defsubr them.
-	(x_create_tip_frame) [TARGET_API_MAC_CARBON]: Add
-	kWindowNoUpdatesAttribute to the window attribute.
+	(x_create_tip_frame) [TARGET_API_MAC_CARBON]:
+	Add kWindowNoUpdatesAttribute to the window attribute.
 	(x_create_tip_frame) [!TARGET_API_MAC_CARBON]: Use NewCWindow.
 	(x_create_tip_frame): Don't call ShowWindow.
 	(Fx_show_tip): Call ShowWindow.
@@ -171,8 +687,7 @@
 	(mac_frame_parm_handlers): Set handlers for Qfullscreen.
 	(syms_of_macfns) [MAC_OSX]: Initialize mac_in_use to 0.
 
-	* macgui.h [!MAC_OSX]: Don't include Controls.h.  Include
-	Windows.h.
+	* macgui.h [!MAC_OSX]: Don't include Controls.h.  Include Windows.h.
 	(Window): Typedef to WindowPtr and move outside `#if
 	TARGET_API_MAC_CARBON'.
 	(XSizeHints): New struct.
@@ -191,8 +706,12 @@
 	(x_make_frame_visible) [TARGET_API_MAC_CARBON]: Reposition window
 	if the position is neither user-specified nor program-specified.
 	(x_free_frame_resources): Free size_hints.
-	(x_wm_set_size_hint): Allocate size_hints if needed.  Set
-	size_hints.
+<<<<<<< ChangeLog
+	(x_wm_set_size_hint): Allocate size_hints if needed.
+	Set size_hints.
+=======
+	(x_wm_set_size_hint): Allocate size_hints if needed.  Set size_hints.
+>>>>>>> 1.4187
 	(mac_clear_font_name_table): New function.
 	(mac_do_list_fonts): Initialize font_name_table if needed.
 	(x_list_fonts): Don't initialize font_name_table.  Add BLOCK_INPUT
@@ -206,8 +725,7 @@
 	(do_window_update): Add BeginUpdate/EndUpdate for the tooltip
 	window.  Use UpdateControls.  Get the rectangle that should be
 	updated and restrict the target of expose_frame to it.
-	(do_grow_window): Set minimum height/width according to
-	size_hints.
+	(do_grow_window): Set minimum height/width according to size_hints.
 	(do_grow_window) [TARGET_API_MAC_CARBON]: Use ResizeWindow.
 	(do_zoom_window): Don't use x_set_window_size.
 	[USE_CARBON_EVENTS] (mac_handle_window_event): New function.
@@ -219,10 +737,10 @@
 	(XTread_socket) [!USE_CARBON_EVENTS]: Use mac_wait_next_event.
 	Update mouse_region when mouse is moved.
 	(make_mac_frame): Remove.
-	(make_mac_terminal_frame): Put in #ifdef MAC_OS8.  Initialize
-	mouse pointer shapes.  Change values of f->left_pos and
-	f->top_pos.  Don't use make_mac_frame.  Use NewCWindow.  Don't
-	call ShowWindow.
+	(make_mac_terminal_frame): Put in #ifdef MAC_OS8.
+	Initialize mouse pointer shapes.  Change values of f->left_pos and
+	f->top_pos.  Don't use make_mac_frame.  Use NewCWindow.
+	Don't call ShowWindow.
 	(mac_initialize_display_info) [MAC_OSX]: Create mac_id_name from
 	Vinvocation_name and Vsystem_name.
 	(mac_make_rdb): New function (from w32term.c).
@@ -245,17 +763,21 @@
 
 2004-12-27  Richard M. Stallman  <rms@gnu.org>
 
-	* buffer.c (Fbuffer_disable_undo): Deleted (moved to simple.el).
+<<<<<<< ChangeLog
+	* buffer.c (Fbuffer_disable_undo): Delete (moved to simple.el).
+=======
+	* buffer.c (Fbuffer_disable_undo): Delete (move to simple.el).
+>>>>>>> 1.4187
 	(syms_of_buffer): Don't defsubr it.
 
 	* process.c (list_processes_1): Set undo_list instead
 	of calling Fbuffer_disable_undo.
 
-	* xdisp.c (single_display_spec_string_p): Renamed from
+	* xdisp.c (single_display_spec_string_p): Rename from
 	single_display_prop_string_p.
-	(single_display_spec_intangible_p): Renamed from
+	(single_display_spec_intangible_p): Rename from
 	single_display_prop_intangible_p.
-	(handle_single_display_spec): Renamed from handle_single_display_prop.
+	(handle_single_display_spec): Rename from handle_single_display_prop.
 	Rewritten to be easier to understand.
 
 	Change in load-history format.  Functions now get (defun . NAME),
@@ -285,6 +807,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
@@ -335,7 +861,7 @@
 
 	* alloc.c (Fgarbage_collect): Update call to truncate_undo_list.
 	Call that at the very start.
-	(undo_limit, undo_strong_limit, undo_outer_limit): Moved to undo.c.
+	(undo_limit, undo_strong_limit, undo_outer_limit): Move to undo.c.
 	(syms_of_alloc): Don't define undo-limit,
 	undo-strong-limit and undo-outer-limit here.
 
@@ -370,8 +896,8 @@
 
 2004-12-18  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
-	* macterm.c (endif, x_font_name_to_mac_font_name): Use
-	maccentraleurroman instead of maccentraleuropean
+	* macterm.c (endif, x_font_name_to_mac_font_name):
+	Use maccentraleurroman instead of maccentraleuropean
 	(mac_c_string_match, mac_do_list_fonts): Speed up font search by
 	quickly finding a specific font without needing regexps.
 
@@ -397,8 +923,8 @@
 
 	* sysdep.c (select_alarm): Call SIGNAL_THREAD_CHECK.
 
-	* process.c (send_process_trap, sigchld_handler): Call
-	SIGNAL_THREAD_CHECK.
+	* process.c (send_process_trap, sigchld_handler):
+	Call SIGNAL_THREAD_CHECK.
 
 	* data.c (arith_error): Call SIGNAL_THREAD_CHECK.
 
@@ -488,7 +1014,7 @@
 
 	* alloc.c: Add comment about the reason for (UN)BLOCK_INPUT_ALLOC.
 
-2004-12-07  Stefan  <monnier@iro.umontreal.ca>
+2004-12-07  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* eval.c (init_eval_once): Increase max_specpdl_size to 1000.
 
@@ -1641,7 +2167,7 @@
 
 	* window.c (Fspecial_display_p): Doc fix.
 
-2004-10-15  Stefan  <monnier@iro.umontreal.ca>
+2004-10-15  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* doc.c (Fsubstitute_command_keys): Fix remap-handling.
 	Don't ignore menus, because where-is-internal already does it for us.
--- a/src/alloc.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/alloc.c	Thu Feb 03 23:28:36 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.  */
@@ -143,11 +143,11 @@
 
 #define MARK_STRING(S)		((S)->size |= ARRAY_MARK_FLAG)
 #define UNMARK_STRING(S)	((S)->size &= ~ARRAY_MARK_FLAG)
-#define STRING_MARKED_P(S)	((S)->size & ARRAY_MARK_FLAG)
+#define STRING_MARKED_P(S)	(((S)->size & ARRAY_MARK_FLAG) != 0)
 
 #define VECTOR_MARK(V)		((V)->size |= ARRAY_MARK_FLAG)
 #define VECTOR_UNMARK(V)	((V)->size &= ~ARRAY_MARK_FLAG)
-#define VECTOR_MARKED_P(V)	((V)->size & ARRAY_MARK_FLAG)
+#define VECTOR_MARKED_P(V)	(((V)->size & ARRAY_MARK_FLAG) != 0)
 
 /* Value is the number of bytes/chars of S, a pointer to a struct
    Lisp_String.  This must be used instead of STRING_BYTES (S) or
@@ -310,6 +310,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 */
@@ -705,9 +706,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);
@@ -1114,17 +1120,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));
@@ -1183,20 +1206,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 *
@@ -1348,6 +1357,7 @@
   __realloc_hook = emacs_blocked_realloc;
 }
 
+#endif /* not SYNC_INPUT */
 #endif /* not SYSTEM_MALLOC */
 
 
@@ -4684,7 +4694,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.  */
@@ -4797,6 +4807,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/buffer.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/buffer.c	Thu Feb 03 23:28:36 2005 +0000
@@ -1952,6 +1952,7 @@
        doc: /* Put BUFFER at the end of the list of all buffers.
 There it is the least likely candidate for `other-buffer' to return;
 thus, the least likely buffer for \\[switch-to-buffer] to select by default.
+You can specify a buffer name as BUFFER, or an actual buffer object.
 If BUFFER is nil or omitted, bury the current buffer.
 Also, if BUFFER is nil or omitted, remove the current buffer from the
 selected window if it is displayed there.  */)
@@ -5782,6 +5783,14 @@
 was modified between BEG and END.  PROPERTY is the property name,
 and VALUE is the old value.
 
+An entry (apply FUN-NAME . ARGS) means undo the change with
+\(apply FUN-NAME ARGS).
+
+An entry (apply DELTA BEG END FUN-NAME . ARGS) supports selective undo
+in the active region.  BEG and END is the range affected by this entry
+and DELTA is the number of bytes added or deleted in that range by
+this change.
+
 An entry (MARKER . DISTANCE) indicates that the marker MARKER
 was adjusted in position by the offset DISTANCE (an integer).
 
--- a/src/casefiddle.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/casefiddle.c	Thu Feb 03 23:28:36 2005 +0000
@@ -1,5 +1,5 @@
 /* GNU Emacs case conversion functions.
-   Copyright (C) 1985,94,97,98,99, 2001, 2002, 2004
+   Copyright (C) 1985,94,97,98,99, 2001, 2002, 2004, 2005
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -73,71 +73,38 @@
       if (STRINGP (obj))
 	{
 	  int multibyte = STRING_MULTIBYTE (obj);
+	  int n;
 
 	  obj = Fcopy_sequence (obj);
 	  len = SBYTES (obj);
 
-	  /* Scan all single-byte characters from start of string.  */
-	  for (i = 0; i < len;)
+	  /* I counts bytes, and N counts chars.  */
+	  for (i = n = 0; i < len; n++)
 	    {
+	      int from_len = 1, to_len = 1;
+
 	      c = SREF (obj, i);
 
 	      if (multibyte && c >= 0x80)
-		/* A multibyte character can't be handled in this
-                   simple loop.  */
-		break;
+		c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i, len -i, from_len);
 	      if (inword && flag != CASE_CAPITALIZE_UP)
 		c = DOWNCASE (c);
 	      else if (!UPPERCASEP (c)
 		       && (!inword || flag != CASE_CAPITALIZE_UP))
 		c = UPCASE1 (c);
-	      /* If this char won't fit in a single-byte string.
-		 fall out to the multibyte case.  */
-	      if (multibyte ? ! ASCII_BYTE_P (c)
-		  : ! SINGLE_BYTE_CHAR_P (c))
-		break;
-
-	      SSET (obj, i, c);
+	      if (ASCII_BYTE_P (c) || (! multibyte && SINGLE_BYTE_CHAR_P (c)))
+		SSET (obj, i, c);
+	      else
+		{
+		  to_len = CHAR_BYTES (c);
+		  if (from_len == to_len)
+		    CHAR_STRING (c, SDATA (obj) + i);
+		  else
+		    Faset (obj, make_number (n), make_number (c));
+		}
 	      if ((int) flag >= (int) CASE_CAPITALIZE)
 		inword = SYNTAX (c) == Sword;
-	      i++;
-	    }
-
-	  /* If we didn't do the whole string as single-byte,
-	     scan the rest in a more complex way.  */
-	  if (i < len)
-	    {
-	      /* The work is not yet finished because of a multibyte
-		 character just encountered.  */
-	      int fromlen, j_byte = i;
-	      char *buf;
-	      int bufsize;
-	      USE_SAFE_ALLOCA;
-
-	      bufsize = (len - i) * MAX_MULTIBYTE_LENGTH + i;
-	      SAFE_ALLOCA (buf, char *, bufsize);
-
-	      /* Copy data already handled.  */
-	      bcopy (SDATA (obj), buf, i);
-
-	      /* From now on, I counts bytes.  */
-	      while (i < len)
-		{
-		  c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i,
-					      len - i, fromlen);
-		  if (inword && flag != CASE_CAPITALIZE_UP)
-		    c = DOWNCASE (c);
-		  else if (!UPPERCASEP (c)
-			   && (!inword || flag != CASE_CAPITALIZE_UP))
-		    c = UPCASE1 (c);
-		  i += fromlen;
-		  j_byte += CHAR_STRING (c, buf + j_byte);
-		  if ((int) flag >= (int) CASE_CAPITALIZE)
-		    inword = SYNTAX (c) == Sword;
-		}
-	      obj = make_multibyte_string (buf, SCHARS (obj),
-					   j_byte);
-	      SAFE_FREE ();
+	      i += to_len;
 	    }
 	  return obj;
 	}
@@ -253,7 +220,7 @@
       int opoint_byte = PT_BYTE;
       int c2;
 
-      while (i < end_byte)
+      while (start < end)
 	{
 	  if ((c = FETCH_BYTE (i)) >= 0x80)
 	    c = FETCH_MULTIBYTE_CHAR (i);
@@ -281,12 +248,16 @@
 		    FETCH_BYTE (i + j) = str[j];
 		}
 	      else
-		/* Replace one character with the other,
-		   keeping text properties the same.  */
-		replace_range_2 (start + 1, i + tolen,
-				 start + 2, i + tolen + fromlen,
-				 str, 1, tolen,
-				 0);
+		{
+		  /* Replace one character with the other,
+		     keeping text properties the same.  */
+		  replace_range_2 (start, i,
+				   start + 1, i + fromlen,
+				   str, 1, tolen,
+				   1);
+		  if (opoint > start)
+		    opoint_byte += tolen - fromlen;
+		}
 	    }
 	  if ((int) flag >= (int) CASE_CAPITALIZE)
 	    inword = SYNTAX (c2) == Sword;
--- a/src/casetab.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/casetab.c	Thu Feb 03 23:28:36 2005 +0000
@@ -18,7 +18,7 @@
 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-/* Written by Howard Gayle.  See chartab.c for details. */
+/* Written by Howard Gayle.  */
 
 #include <config.h>
 #include "lisp.h"
--- a/src/coding.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/coding.c	Thu Feb 03 23:28:36 2005 +0000
@@ -2204,6 +2204,8 @@
 	DECODE_COMPOSITION_END ('1');
       src = src_base;
       c = *src++;
+      if (! NILP (translation_table))
+	c = translate_char (translation_table, c, 0, 0, 0);
       EMIT_CHAR (c);
     }
 
--- a/src/config.in	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/config.in	Thu Feb 03 23:28:36 2005 +0000
@@ -598,6 +598,9 @@
 /* Define to 1 if you have the <sys/un.h> header file. */
 #undef HAVE_SYS_UN_H
 
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#undef HAVE_SYS_UTSNAME_H
+
 /* Define to 1 if you have the <sys/vlimit.h> header file. */
 #undef HAVE_SYS_VLIMIT_H
 
--- a/src/dispextern.h	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/dispextern.h	Thu Feb 03 23:28:36 2005 +0000
@@ -1,5 +1,5 @@
 /* Interface definitions for display code.
-   Copyright (C) 1985,93,94,97,98,99, 2000,01,02,03, 2004
+   Copyright (C) 1985,93,94,97,98,99, 2000,01,02,03, 2004, 2005
      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -123,12 +123,13 @@
 
 #if GLYPH_DEBUG
 #define IF_DEBUG(X)	X
-#define xassert(X)	do {if (!(X)) abort ();} while (0)
 #else
 #define IF_DEBUG(X)	(void) 0
-#define xassert(X)	(void) 0
 #endif
 
+/* Maybe move this inside the above `#ifdef GLYPH_DEBUG' for release.  */
+#define xassert(X)	do {if (!(X)) abort ();} while (0)
+
 /* Macro for displaying traces of redisplay.  If Emacs was compiled
    with GLYPH_DEBUG != 0, the variable trace_redisplay_p can be set to
    a non-zero value in debugging sessions to activate traces.  */
@@ -817,6 +818,9 @@
   /* 1 means this row currently shows the cursor in the right fringe.  */
   unsigned cursor_in_fringe_p : 1;
 
+  /* 1 means the last glyph in the row is part of an ellipsis.  */
+  unsigned ends_in_ellipsis_p : 1;
+
   /* Non-zero means display a bitmap on X frames indicating that this
      the first line of the buffer.  */
   unsigned indicate_bob_p : 1;
@@ -1185,6 +1189,11 @@
   /* Slice */
   struct glyph_slice slice;
 
+  /* Non-null means the horizontal clipping region starts from the
+     left edge of *clip_head, and ends with the right edge of
+     *clip_tail, not including their overhangs.  */
+  struct glyph_string *clip_head, *clip_tail;
+
   struct glyph_string *next, *prev;
 };
 
@@ -1820,6 +1829,10 @@
      Don't handle some `display' properties in these strings.  */
   unsigned string_from_display_prop_p : 1;
 
+  /* When METHOD == next_element_from_display_vector,
+     this is 1 if we're doing an ellipsis.  Otherwise meaningless.  */
+  unsigned ellipsis_p : 1;
+
   /* Display table in effect or null for none.  */
   struct Lisp_Char_Table *dp;
 
@@ -1835,6 +1848,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.  */
@@ -2620,6 +2636,8 @@
 extern void draw_phys_cursor_glyph P_ ((struct window *,
 					  struct glyph_row *,
 					  enum draw_glyphs_face));
+extern int get_phys_cursor_geometry P_ ((struct window *, struct glyph_row *,
+					 struct glyph *, int *));
 extern void erase_phys_cursor P_ ((struct window *));
 extern void display_and_set_cursor P_ ((struct window *,
 					  int, int, int, int, int));
@@ -2741,6 +2759,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));
 extern Lisp_Object Qforeground_color, Qbackground_color;
--- a/src/dispnew.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/dispnew.c	Thu Feb 03 23:28:36 2005 +0000
@@ -4064,19 +4064,19 @@
   int preempt_count = baud_rate / 2400 + 1;
   extern int input_pending;
   extern Lisp_Object do_mouse_tracking;
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
 #if GLYPH_DEBUG
   struct frame *f = XFRAME (WINDOW_FRAME (w));
-#endif
-  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
 
   /* Check that W's frame doesn't have glyph matrices.  */
   xassert (FRAME_WINDOW_P (f));
+#endif
 
   /* Check pending input the first time so that we can quickly return.  */
   if (redisplay_dont_pause)
     force_p = 1;
   else
-    detect_input_pending ();
+    detect_input_pending_ignore_squeezables ();
 
   /* If forced to complete the update, or if no input is pending, do
      the update.  */
@@ -4150,7 +4150,7 @@
 	       scrolling large windows with repeated scroll-up
 	       commands will too quickly pause redisplay.  */
 	    if (!force_p && ++n_updated % preempt_count == 0)
-	      detect_input_pending ();
+	      detect_input_pending_ignore_squeezables ();
 
 	    changed_p |= update_window_line (w, vpos,
 					     &mouse_face_overwritten_p);
@@ -5099,7 +5099,7 @@
 
   if (redisplay_dont_pause)
     force_p = 1;
-  else if (!force_p && detect_input_pending ())
+  else if (!force_p && detect_input_pending_ignore_squeezables ())
     {
       pause = 1;
       goto do_pause;
@@ -5155,7 +5155,7 @@
 	    }
 
 	  if ((i - 1) % preempt_count == 0)
-	    detect_input_pending ();
+	    detect_input_pending_ignore_squeezables ();
 
 	  update_frame_line (f, i);
 	}
@@ -5851,7 +5851,7 @@
          it's the one we were looking for.  */
       glyph = row->glyphs[TEXT_AREA];
       end = glyph + row->used[TEXT_AREA];
-      for (x0 = *x; glyph < end && x0 > glyph->pixel_width; ++glyph)
+      for (x0 = *x; glyph < end && x0 >= glyph->pixel_width; ++glyph)
 	x0 -= glyph->pixel_width;
       *x = glyph - row->glyphs[TEXT_AREA];
       if (glyph < end)
@@ -5943,7 +5943,7 @@
 
       glyph = row->glyphs[area];
       end = glyph + row->used[area];
-      for (x0 = *x - x0; glyph < end && x0 > glyph->pixel_width; ++glyph)
+      for (x0 = *x - x0; glyph < end && x0 >= glyph->pixel_width; ++glyph)
 	x0 -= glyph->pixel_width;
       *x = glyph - row->glyphs[area];
       if (glyph < end)
--- a/src/editfns.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/editfns.c	Thu Feb 03 23:28:36 2005 +0000
@@ -34,6 +34,10 @@
 #include <unistd.h>
 #endif
 
+#ifdef HAVE_SYS_UTSNAME_H
+#include <sys/utsname.h>
+#endif
+
 /* systime.h includes <sys/time.h> which, on some systems, is required
    for <sys/resource.h>; thus systime.h must be included before
    <sys/resource.h> */
@@ -106,6 +110,7 @@
 Lisp_Object Vuser_real_login_name;	/* login name of current user ID */
 Lisp_Object Vuser_full_name;		/* full name of current user */
 Lisp_Object Vuser_login_name;		/* user name from LOGNAME or USER */
+Lisp_Object Voperating_system_release;  /* Operating System Release */
 
 /* Symbol for the text property used to mark fields.  */
 
@@ -170,6 +175,16 @@
     Vuser_full_name = build_string (p);
   else if (NILP (Vuser_full_name))
     Vuser_full_name = build_string ("unknown");
+
+#ifdef HAVE_SYS_UTSNAME_H
+  {
+    struct utsname uts;
+    uname (&uts);
+    Voperating_system_release = build_string (uts.release);
+  }
+#else
+  Voperating_system_release = Qnil;
+#endif
 }
 
 DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0,
@@ -1349,6 +1364,15 @@
     return "";
 }
 
+char *
+get_operating_system_release()
+{
+  if (STRINGP (Voperating_system_release))
+    return (char *) SDATA (Voperating_system_release);
+  else
+    return "";
+}
+
 DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0,
        doc: /* Return the process ID of Emacs, as an integer.  */)
      ()
@@ -3111,7 +3135,7 @@
 	  && SBYTES (args[0]) == 0))
     {
       message (0);
-      return Qnil;
+      return args[0];
     }
   else
     {
@@ -4293,6 +4317,9 @@
   DEFVAR_LISP ("user-real-login-name", &Vuser_real_login_name,
 	       doc: /* The user's name, based upon the real uid only.  */);
 
+  DEFVAR_LISP ("operating-system-release", &Voperating_system_release,
+	       doc: /* The release of the operating system Emacs is running on.  */);
+
   defsubr (&Spropertize);
   defsubr (&Schar_equal);
   defsubr (&Sgoto_char);
--- a/src/emacs.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/emacs.c	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 /* Fully extensible Emacs, running on Unix, intended for GNU.
-   Copyright (C) 1985,86,87,93,94,95,97,98,1999,2001,02,03,2004
-      Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2001,
+     2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -2429,7 +2429,16 @@
 Many arguments are deleted from the list as they are processed.  */);
 
   DEFVAR_LISP ("system-type", &Vsystem_type,
-	       doc: /* Value is symbol indicating type of operating system you are using.  */);
++	       doc: /* Value is symbol indicating type of operating system you are using.
++Special values:
++  `gnu/linux'   compiled for a GNU/Linux system.
++  `darwin'      compiled for Darwin (GNU-Darwin, Mac OS X, ...).
++  `macos'       compiled for Mac OS 9.
++  `ms-dos'      compiled as an MS-DOS application.
++  `windows-nt'  compiled as a native W32 application.
++  `cygwin'      compiled using the Cygwin library.
++  `vax-vms' or `axp-vms': compiled for a (Open)VMS system.
++Anything else indicates some sort of Unix system.  */);
   Vsystem_type = intern (SYSTEM_TYPE);
 
   DEFVAR_LISP ("system-configuration", &Vsystem_configuration,
--- a/src/fileio.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/fileio.c	Thu Feb 03 23:28:36 2005 +0000
@@ -2392,10 +2392,10 @@
 unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil.
 A number as third arg means request confirmation if NEWNAME already exists.
 This is what happens in interactive use with M-x.
-Fourth arg KEEP-TIME non-nil means give the new file the same
+Always sets the file modes of the output file to match the input file.
+Fourth arg KEEP-TIME non-nil means give the output file the same
 last-modified time as the old one.  (This works on only some systems.)
-A prefix arg makes KEEP-TIME non-nil.
-Also set the file modes of the target file to match the source file.  */)
+A prefix arg makes KEEP-TIME non-nil.  */)
      (file, newname, ok_if_already_exists, keep_time)
      Lisp_Object file, newname, ok_if_already_exists, keep_time;
 {
--- a/src/fns.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/fns.c	Thu Feb 03 23:28:36 2005 +0000
@@ -3443,6 +3443,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))
@@ -3450,8 +3454,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))
@@ -4834,6 +4836,10 @@
 
 		  h->count = make_number (XFASTINT (h->count) - 1);
 		}
+	      else
+		{
+		  prev = idx;
+		}
 	    }
 	  else
 	    {
--- a/src/fringe.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/fringe.c	Thu Feb 03 23:28:36 2005 +0000
@@ -447,7 +447,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;
@@ -548,7 +548,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)
@@ -575,7 +581,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;
     }
 
@@ -1074,7 +1081,7 @@
 {
   struct fringe_bitmap **fbp;
 
-  fringe_faces[n] = FRINGE_FACE_ID;
+  fringe_faces[n] = Qnil;
 
   fbp = &fringe_bitmaps[n];
   if (*fbp && (*fbp)->dynamic)
@@ -1300,12 +1307,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));
+		= (Lisp_Object *) 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;
 		}
 	    }
 	}
@@ -1363,10 +1370,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;
 }
@@ -1440,6 +1445,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
@@ -1461,12 +1478,12 @@
   fringe_bitmaps
     = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *));
   fringe_faces
-    = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (unsigned));
+    = (Lisp_Object *) 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/gtkutil.c	Thu Feb 03 23:28:36 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
@@ -1312,6 +1312,7 @@
   char *fn = 0;
   int filesel_done = 0;
   xg_get_file_func func;
+  extern int x_use_old_gtk_file_dialog;
 
 #if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN)
   /* I really don't know why this is needed, but without this the GLIBC add on
@@ -1321,7 +1322,6 @@
 #endif /* HAVE_GTK_AND_PTHREAD */
 
 #ifdef HAVE_GTK_FILE_BOTH
-  extern int x_use_old_gtk_file_dialog;
 
   if (x_use_old_gtk_file_dialog)
     w = xg_get_file_with_selection (f, prompt, default_filename,
@@ -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,10 +3156,11 @@
 
   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.  */
-      int bw = gtk_container_get_border_width (GTK_CONTAINER (wbox));
       FRAME_TOOLBAR_HEIGHT (f) = 2;
 
       /* The height has changed, resize outer widget and set columns
@@ -3185,11 +3188,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 +3214,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 +3308,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 +3460,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 +3495,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 +3542,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/indent.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/indent.c	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 /* Indentation functions.
-   Copyright (C) 1985,86,87,88,93,94,95,98,2000,01,02,03,2004
-   Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1998, 2000, 2001,
+     2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -342,7 +342,9 @@
 Ignores finite width of frame, which means that this function may return
 values greater than (frame-width).
 Whether the line is visible (if `selective-display' is t) has no effect;
-however, ^M is treated as end of line when `selective-display' is t.  */)
+however, ^M is treated as end of line when `selective-display' is t.
+Text that has an invisible property is considered as having width 0, unless
+`buffer-invisibility-spec' specifies that it is replaced by an ellipsis.  */)
      ()
 {
   Lisp_Object temp;
@@ -2073,6 +2075,7 @@
   else
     {
       int it_start;
+      int oselective;
 
       SET_TEXT_POS (pt, PT, PT_BYTE);
       start_display (&it, w, pt);
@@ -2086,7 +2089,11 @@
       it_start = IT_CHARPOS (it);
       reseat_at_previous_visible_line_start (&it);
       it.current_x = it.hpos = 0;
+      /* Temporarily disable selective display so we don't move too far */
+      oselective = it.selective;
+      it.selective = 0;
       move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
+      it.selective = oselective;
 
       /* Move back if we got too far.  This may happen if
 	 truncate-lines is on and PT is beyond right margin.  */
--- a/src/insdel.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/insdel.c	Thu Feb 03 23:28:36 2005 +0000
@@ -1,5 +1,5 @@
 /* Buffer insertion/deletion and gap motion for GNU Emacs.
-   Copyright (C) 1985, 86,93,94,95,97,98, 1999, 2000, 01, 2003
+   Copyright (C) 1985, 86,93,94,95,97,98, 1999, 2000, 01, 2003, 2005
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -1745,17 +1745,21 @@
 
   /* Adjust markers for the deletion and the insertion.  */
   if (markers
-      && ! (nchars_del == 1 && inschars == 1))
+      && ! (nchars_del == 1 && inschars == 1 && nbytes_del == insbytes))
     adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
 				inschars, insbytes);
 
   offset_intervals (current_buffer, from, inschars - nchars_del);
 
   /* Relocate point as if it were a marker.  */
-  if (from < PT && nchars_del != inschars)
-    adjust_point ((from + inschars - (PT < to ? PT : to)),
-		  (from_byte + insbytes
-		   - (PT_BYTE < to_byte ? PT_BYTE : to_byte)));
+  if (from < PT && (nchars_del != inschars || nbytes_del != insbytes))
+    {
+      if (PT < to)
+	/* PT was within the deleted text.  Move it to FROM.  */
+	adjust_point (from - PT, from_byte - PT_BYTE);
+      else
+	adjust_point (inschars - nchars_del, insbytes - nbytes_del);
+    }
 
   if (insbytes == 0)
     evaporate_overlays (from);
--- a/src/keyboard.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/keyboard.c	Thu Feb 03 23:28:36 2005 +0000
@@ -634,14 +634,17 @@
 
 /* Global variable declarations.  */
 
+/* Flags for readable_events.  */
+#define READABLE_EVENTS_DO_TIMERS_NOW		(1 << 0)
+#define READABLE_EVENTS_FILTER_EVENTS		(1 << 1)
+#define READABLE_EVENTS_IGNORE_SQUEEZABLES	(1 << 2)
+
 /* Function for init_keyboard to call with no args (if nonzero).  */
 void (*keyboard_init_hook) ();
 
 static int read_avail_input P_ ((int));
 static void get_input_pending P_ ((int *, int));
-static void get_filtered_input_pending P_ ((int *, int, int));
 static int readable_events P_ ((int));
-static int readable_filtered_events P_ ((int, int));
 static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *,
 						Lisp_Object, int *));
 static Lisp_Object read_char_x_menu_prompt ();
@@ -3435,10 +3438,11 @@
 	 input has been processed.  If the only input available was
 	 the sort that we have just disabled, then we need to call
 	 redisplay.  */
-      if (!readable_events (1))
+      if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW))
 	{
 	  redisplay_preserve_echo_area (6);
-	  get_input_pending (&input_pending, 1);
+	  get_input_pending (&input_pending,
+			     READABLE_EVENTS_DO_TIMERS_NOW);
 	}
     }
   return Qnil;
@@ -3490,20 +3494,19 @@
 /* Return true iff there are any events in the queue that read-char
    would return.  If this returns false, a read-char would block.  */
 static int
-readable_filtered_events (do_timers_now, filter_events)
-     int do_timers_now;
-     int filter_events;
-{
-  if (do_timers_now)
-    timer_check (do_timers_now);
-
-  /* If the buffer contains only FOCUS_IN_EVENT events,
-     and FILTER_EVENTS is nonzero, report it as empty.  */
+readable_events (flags)
+     int flags;
+{
+  if (flags & READABLE_EVENTS_DO_TIMERS_NOW)
+    timer_check (1);
+
+  /* If the buffer contains only FOCUS_IN_EVENT events, and
+     READABLE_EVENTS_FILTER_EVENTS is set, report it as empty.  */
   if (kbd_fetch_ptr != kbd_store_ptr)
     {
       int have_live_event = 1;
 
-      if (filter_events)
+      if (flags & READABLE_EVENTS_FILTER_EVENTS)
         {
           struct input_event *event;
 
@@ -3524,7 +3527,8 @@
     }
 
 #ifdef HAVE_MOUSE
-  if (!NILP (do_mouse_tracking) && some_mouse_moved ())
+  if (!(flags & READABLE_EVENTS_IGNORE_SQUEEZABLES)
+      && !NILP (do_mouse_tracking) && some_mouse_moved ())
     return 1;
 #endif
   if (single_kboard)
@@ -3542,15 +3546,6 @@
   return 0;
 }
 
-/* Return true iff there are any events in the queue that read-char
-   would return.  If this returns false, a read-char would block.  */
-static int
-readable_events (do_timers_now)
-     int do_timers_now;
-{
-  return readable_filtered_events (do_timers_now, 0);
-}
-
 /* Set this for debugging, to have a way to get out */
 int stop_character;
 
@@ -4225,7 +4220,7 @@
     }
 
   old_timers_run = timers_run;
-  get_input_pending (&input_pending, 1);
+  get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW);
 
   if (timers_run != old_timers_run && do_display)
     redisplay_preserve_echo_area (7);
@@ -6517,18 +6512,20 @@
    but works even if FIONREAD does not exist.
    (In fact, this may actually read some input.)
 
-   If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe.
-   If FILTER_EVENTS is nonzero, ignore internal events (FOCUS_IN_EVENT). */
+   If READABLE_EVENTS_DO_TIMERS_NOW is set in FLAGS, actually run
+   timer events that are ripe.
+   If READABLE_EVENTS_FILTER_EVENTS is set in FLAGS, ignore internal
+   events (FOCUS_IN_EVENT).
+   If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse
+   movements. */
 
 static void
-get_filtered_input_pending (addr, do_timers_now, filter_events)
+get_input_pending (addr, flags)
      int *addr;
-     int do_timers_now;
-     int filter_events;
+     int flags;
 {
   /* First of all, have we already counted some input?  */
-  *addr = (!NILP (Vquit_flag)
-           || readable_filtered_events (do_timers_now, filter_events));
+  *addr = (!NILP (Vquit_flag) || readable_events (flags));
 
   /* If input is being read as it arrives, and we have none, there is none.  */
   if (*addr > 0 || (interrupt_input && ! interrupts_deferred))
@@ -6536,23 +6533,7 @@
 
   /* Try to read some input and see how much we get.  */
   gobble_input (0);
-  *addr = (!NILP (Vquit_flag)
-           || readable_filtered_events (do_timers_now, filter_events));
-}
-
-/* Store into *addr a value nonzero if terminal input chars are available.
-   Serves the purpose of ioctl (0, FIONREAD, addr)
-   but works even if FIONREAD does not exist.
-   (In fact, this may actually read some input.)
-
-   If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe.  */
-
-static void
-get_input_pending (addr, do_timers_now)
-     int *addr;
-     int do_timers_now;
-{
-  get_filtered_input_pending (addr, do_timers_now, 0);
+  *addr = (!NILP (Vquit_flag) || readable_events (flags));
 }
 
 /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary.  */
@@ -6915,7 +6896,7 @@
 #else
   SIGNAL_THREAD_CHECK (signo);
 #endif
-  
+
   if (input_available_clear_time)
     EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
 
@@ -9940,6 +9921,18 @@
   return input_pending;
 }
 
+/* Return nonzero if input events other than mouse movements are
+   pending.  */
+
+int
+detect_input_pending_ignore_squeezables ()
+{
+  if (!input_pending)
+    get_input_pending (&input_pending, READABLE_EVENTS_IGNORE_SQUEEZABLES);
+
+  return input_pending;
+}
+
 /* Return nonzero if input events are pending, and run any pending timers.  */
 
 int
@@ -9949,7 +9942,7 @@
   int old_timers_run = timers_run;
 
   if (!input_pending)
-    get_input_pending (&input_pending, 1);
+    get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW);
 
   if (old_timers_run != timers_run && do_display)
     {
@@ -10002,7 +9995,9 @@
   if (!NILP (Vunread_command_events) || unread_command_char != -1)
     return (Qt);
 
-  get_filtered_input_pending (&input_pending, 1, 1);
+  get_input_pending (&input_pending,
+		     READABLE_EVENTS_DO_TIMERS_NOW
+		     | READABLE_EVENTS_FILTER_EVENTS);
   return input_pending > 0 ? Qt : Qnil;
 }
 
@@ -10644,17 +10639,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;
@@ -10667,7 +10664,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;
     }
@@ -10695,7 +10695,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;
 }
 
@@ -11401,14 +11401,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	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/keymap.c	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 /* Manipulation of keymaps
-   Copyright (C) 1985, 86,87,88,93,94,95,98,99, 2000, 01, 2004
-   Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1998, 1999, 2000,
+     2001, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -529,6 +529,10 @@
       struct gcpro gcpro1;
       Lisp_Object meta_map;
       GCPRO1 (map);
+      /* A strange value in which Meta is set would cause
+	 infinite recursion.  Protect against that.  */
+      if (XINT (meta_prefix_char) & CHAR_META)
+	meta_prefix_char = make_number (27);
       meta_map = get_keymap (access_keymap (map, meta_prefix_char,
 					    t_ok, noinherit, autoload),
 			     0, autoload);
@@ -1487,10 +1491,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)))
     {
@@ -1498,16 +1505,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/lisp.h	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/lisp.h	Thu Feb 03 23:28:36 2005 +0000
@@ -2464,7 +2464,7 @@
 extern void init_xdisp P_ ((void));
 extern Lisp_Object safe_eval P_ ((Lisp_Object));
 extern int pos_visible_p P_ ((struct window *, int, int *,
-			      int *, int *, int));
+			      int *, int *, int *, int));
 
 /* Defined in vm-limit.c.  */
 extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ()));
@@ -2906,6 +2906,7 @@
 EXFUN (Fread_key_sequence, 5);
 EXFUN (Fset_input_mode, 4);
 extern int detect_input_pending P_ ((void));
+extern int detect_input_pending_ignore_squeezables P_ ((void));
 extern int detect_input_pending_run_timers P_ ((int));
 extern void safe_run_hooks P_ ((Lisp_Object));
 extern void cmd_error_internal P_ ((Lisp_Object, char *));
--- a/src/macfns.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/macfns.c	Thu Feb 03 23:28:36 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
@@ -2490,9 +2527,11 @@
 
       x_free_frame_resources (f);
 
+#if GLYPH_DEBUG
       /* Check that reference counts are indeed correct.  */
       xassert (dpyinfo->reference_count == dpyinfo_refcount);
       xassert (dpyinfo->image_cache->refcount == image_cache_refcount);
+#endif
       return Qt;
     }
 
@@ -3855,6 +3894,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 +4278,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 +4305,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 +4335,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 +4358,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 +4385,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 +4417,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 +4426,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 +4456,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/macgui.h	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/macgui.h	Thu Feb 03 23:28:36 2005 +0000
@@ -92,6 +92,13 @@
   int descent;
 } XCharStruct;
 
+#define STORE_XCHARSTRUCT(xcs, w, bds)			\
+  ((xcs).width = (w),					\
+   (xcs).lbearing = (bds).left,				\
+   (xcs).rbearing = (bds).right,			\
+   (xcs).ascent = -(bds).top,				\
+   (xcs).descent = (bds).bottom)
+
 struct MacFontStruct {
   char *fontname;
 
--- a/src/macterm.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/macterm.c	Thu Feb 03 23:28:36 2005 +0000
@@ -1,5 +1,5 @@
 /* Implementation of GUI terminal on the Mac OS.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -69,6 +69,7 @@
 #include <errno.h>
 #include <setjmp.h>
 #include <sys/stat.h>
+#include <sys/param.h>
 
 #include "keyboard.h"
 #include "frame.h"
@@ -100,6 +101,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.  */
 
@@ -724,6 +729,13 @@
      int nchars, mode, bytes_per_char;
 {
   SetPortWindowPort (w);
+#ifdef MAC_OS_X_VERSION_10_2
+  UInt32 textFlags, savedFlags;
+  if (!NILP(Vmac_use_core_graphics)) {
+    textFlags = kQDUseCGTextRendering;
+    savedFlags = SwapQDTextFlags(textFlags);
+  }
+#endif
 
   mac_set_colors (gc);
 
@@ -734,6 +746,10 @@
 
   MoveTo (x, y);
   DrawText (buf, 0, nchars * bytes_per_char);
+#ifdef MAC_OS_X_VERSION_10_2
+  if (!NILP(Vmac_use_core_graphics))
+    SwapQDTextFlags(savedFlags);
+#endif
 }
 
 
@@ -1090,6 +1106,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
@@ -1919,20 +1991,33 @@
 mac_compute_glyph_string_overhangs (s)
      struct glyph_string *s;
 {
-#if 0
-  /* MAC_TODO: XTextExtents16 does nothing yet... */
-
-  if (s->cmp == NULL
-      && s->first_glyph->type == CHAR_GLYPH)
-    {
-      XCharStruct cs;
-      int direction, font_ascent, font_descent;
-      XTextExtents16 (s->font, s->char2b, s->nchars, &direction,
-		      &font_ascent, &font_descent, &cs);
-      s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0;
-      s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0;
-    }
-#endif
+  Rect r;
+  MacFontStruct *font = s->font;
+
+  TextFont (font->mac_fontnum);
+  TextSize (font->mac_fontsize);
+  TextFace (font->mac_fontface);
+
+  if (s->two_byte_p)
+    QDTextBounds (s->nchars * 2, (char *)s->char2b, &r);
+  else
+    {
+      int i;
+      char *buf = xmalloc (s->nchars);
+
+      if (buf == NULL)
+	SetRect (&r, 0, 0, 0, 0);
+      else
+	{
+	  for (i = 0; i < s->nchars; ++i)
+	    buf[i] = s->char2b[i].byte2;
+	  QDTextBounds (s->nchars, buf, &r);
+	  xfree (buf);
+	}
+    }
+
+  s->right_overhang = r.right > s->width ? r.right - s->width : 0;
+  s->left_overhang = r.left < 0 ? -r.left : 0;
 }
 
 
@@ -2570,15 +2655,9 @@
   struct glyph *last_glyph;
   Rect clip_rect;
 
-  last_x = window_box_right (s->w, s->area);
-  if (s->row->full_width_p
-      && !s->w->pseudo_window_p)
-    {
-      last_x += WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w);
-      if (s->area != RIGHT_MARGIN_AREA
-	  || WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
-	last_x += WINDOW_RIGHT_FRINGE_WIDTH (s->w);
-    }
+  last_x = ((s->row->full_width_p && !s->w->pseudo_window_p)
+	    ? WINDOW_RIGHT_EDGE_X (s->w)
+	    : window_box_right (s->w, s->area));
 
   /* The glyph that may have a right box line.  */
   last_glyph = (s->cmp || s->img
@@ -3006,10 +3085,12 @@
 {
   int relief_drawn_p = 0;
 
-  /* If S draws into the background of its successor, draw the
-     background of the successor first so that S can draw into it.
-     This makes S->next use XDrawString instead of XDrawImageString.  */
-  if (s->next && s->right_overhang && !s->for_overlaps_p)
+  /* If S draws into the background of its successor that does not
+     draw a cursor, draw the background of the successor first so that
+     S can draw into it.  This makes S->next use XDrawString instead
+     of XDrawImageString.  */
+  if (s->next && s->right_overhang && !s->for_overlaps_p
+      && s->next->hl != DRAW_CURSOR)
     {
       xassert (s->next->img == NULL);
       x_set_glyph_string_gc (s->next);
@@ -4650,29 +4731,10 @@
   if (cursor_glyph == NULL)
     return;
 
-  /* Compute the width of the rectangle to draw.  If on a stretch
-     glyph, and `x-stretch-block-cursor' is nil, don't draw a
-     rectangle as wide as the glyph, but use a canonical character
-     width instead.  */
-  wd = cursor_glyph->pixel_width - 1;
-  if (cursor_glyph->type == STRETCH_GLYPH
-      && !x_stretch_cursor_p)
-    wd = min (FRAME_COLUMN_WIDTH (f), wd);
-  w->phys_cursor_width = wd;
-
-  /* Compute frame-relative coordinates from window-relative
-     coordinates.  */
+  /* Compute frame-relative coordinates for phys cursor.  */
   x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
-  y = WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y);
-
-  /* Compute the proper height and ascent of the rectangle, based
-     on the actual glyph.  Using the full height of the row looks
-     bad when there are tall images on that row.  */
-  h = max (min (FRAME_LINE_HEIGHT (f), row->height),
-	   cursor_glyph->ascent + cursor_glyph->descent);
-  if (h < row->height)
-    y += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h;
-  h--;
+  y = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
+  wd = w->phys_cursor_width;
 
   /* The foreground of cursor_gc is typically the same as the normal
      background color, which can cause the cursor box to be invisible.  */
@@ -4952,7 +5014,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);
@@ -5857,7 +5920,7 @@
 
 
 static char *
-mac_to_x_fontname (name, size, style, scriptcode, encoding_base)
+mac_to_x_fontname (name, size, style, scriptcode)
      char *name;
      int size;
      Style style;
@@ -6475,12 +6538,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;
 }
 
 
@@ -6693,29 +6752,66 @@
        returns 15 for 12-point Monaco! */
     char_width = CharWidth ('m');
 
-  font->max_bounds.rbearing = char_width;
-  font->max_bounds.lbearing = 0;
-  font->max_bounds.width = char_width;
-  font->max_bounds.ascent = the_fontinfo.ascent;
-  font->max_bounds.descent = the_fontinfo.descent;
-
-  font->min_bounds = font->max_bounds;
-
-  if (is_two_byte_font || CharWidth ('m') == CharWidth ('i'))
-    font->per_char = NULL;
+  if (is_two_byte_font)
+    {
+      font->per_char = NULL;
+
+      if (fontface & italic)
+	font->max_bounds.rbearing = char_width + 1;
+      else
+	font->max_bounds.rbearing = char_width;
+      font->max_bounds.lbearing = 0;
+      font->max_bounds.width = char_width;
+      font->max_bounds.ascent = the_fontinfo.ascent;
+      font->max_bounds.descent = the_fontinfo.descent;
+
+      font->min_bounds = font->max_bounds;
+    }
   else
     {
       font->per_char = (XCharStruct *)
 	xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1));
       {
-        int c;
-
+	int c, min_width, max_width;
+	Rect char_bounds, min_bounds, max_bounds;
+	char ch;
+
+	min_width = max_width = char_width;
+	SetRect (&min_bounds, -32767, -32767, 32767, 32767);
+	SetRect (&max_bounds, 0, 0, 0, 0);
         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);
-          }
+	    ch = c;
+	    char_width = CharWidth (ch);
+	    QDTextBounds (1, &ch, &char_bounds);
+	    STORE_XCHARSTRUCT (font->per_char[c - 0x20],
+			       char_width, char_bounds);
+	    /* 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);
+	      }
+	    if (!EmptyRect (&char_bounds))
+	      {
+		SetRect (&min_bounds,
+			 max (min_bounds.left, char_bounds.left),
+			 max (min_bounds.top, char_bounds.top),
+			 min (min_bounds.right, char_bounds.right),
+			 min (min_bounds.bottom, char_bounds.bottom));
+		UnionRect (&max_bounds, &char_bounds, &max_bounds);
+	      }
+	  }
+	STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds);
+	STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds);
+	if (min_width == max_width
+	    && max_bounds.left >= 0 && max_bounds.right <= max_width)
+	  {
+	    /* Fixed width and no overhangs.  */
+	    xfree (font->per_char);
+	    font->per_char = NULL;
+	  }
       }
     }
 
@@ -6823,6 +6919,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;
@@ -7835,6 +7960,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)
@@ -7892,7 +8025,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)
@@ -7987,24 +8121,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))
@@ -8040,18 +8178,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;
 	    }
 	}
@@ -8062,7 +8203,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);
@@ -8078,6 +8221,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);
 	}
@@ -8101,9 +8247,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);
@@ -8115,11 +8263,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
@@ -8137,8 +8285,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.  */
@@ -8698,8 +8844,9 @@
 	  if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
 	      != eventNotHandledErr)
 	    break;
-#endif
+#else
 	  do_window_update ((WindowPtr) er.message);
+#endif
 	  break;
 
 	case osEvt:
@@ -9568,7 +9715,7 @@
   0, /* destroy_fringe_bitmap */
   mac_per_char_metric,
   mac_encode_char,
-  NULL, /* mac_compute_glyph_string_overhangs */
+  mac_compute_glyph_string_overhangs,
   x_draw_glyph_string,
   mac_define_frame_cursor,
   mac_clear_frame_area,
@@ -9756,18 +9903,18 @@
 
   DEFVAR_LISP ("mac-reverse-ctrl-meta", &Vmac_reverse_ctrl_meta,
     doc: /* Non-nil means that the control and meta keys are reversed.  This is
-	    useful for non-standard keyboard layouts.  */);
+useful for non-standard keyboard layouts.  */);
   Vmac_reverse_ctrl_meta = Qnil;
 
   DEFVAR_LISP ("mac-emulate-three-button-mouse",
 	       &Vmac_emulate_three_button_mouse,
     doc: /* t means that when the option-key is held down while pressing the
-    mouse button, the click will register as mouse-2 and while the
-    command-key is held down, the click will register as mouse-3.
-    'reverse means that the the option-key will register for mouse-3
-    and the command-key will register for mouse-2.  nil means that
-    not emulation should be done and the modifiers should be placed
-    on the mouse-1 event. */);
+mouse button, the click will register as mouse-2 and while the
+command-key is held down, the click will register as mouse-3.
+'reverse means that the the option-key will register for mouse-3
+and the command-key will register for mouse-2.  nil means that
+no emulation should be done and the modifiers should be placed
+on the mouse-1 event. */);
   Vmac_emulate_three_button_mouse = Qnil;
 
 #if USE_CARBON_EVENTS
@@ -9786,7 +9933,18 @@
    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, allow anti-aliasing.
+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	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/macterm.h	Thu Feb 03 23:28:36 2005 +0000
@@ -599,6 +599,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/process.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/process.c	Thu Feb 03 23:28:36 2005 +0000
@@ -187,6 +187,7 @@
 #include "syswait.h"
 
 extern void set_waiting_for_input P_ ((EMACS_TIME *));
+extern char *get_operating_system_release ();
 
 #ifndef USE_CRT_DLL
 extern int errno;
@@ -6701,6 +6702,19 @@
    Fprovide (intern ("make-network-process"), subfeatures);
  }
 #endif /* HAVE_SOCKETS */
+
+#ifdef DARWIN
+  /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive 
+     processes.  As such, we only change the default value.  */
+ if (initialized)
+  {
+    char *release = get_operating_system_release();
+    if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION
+				    && release[1] == '.')) {
+      Vprocess_connection_type = Qnil;
+    }
+  }
+#endif
 }
 
 void
--- a/src/s/darwin.h	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/s/darwin.h	Thu Feb 03 23:28:36 2005 +0000
@@ -37,6 +37,10 @@
 #define BSD_SYSTEM
 /* #define VMS */
 
+#ifndef	DARWIN
+#define	DARWIN 1
+#endif
+
 /* MAC_OS is used to conditionally compile code common to both MAC_OS8
    and MAC_OSX.  */
 #ifdef MAC_OSX
@@ -103,10 +107,18 @@
 
 /*
  *	Define HAVE_PTYS if the system supports pty devices.
+ *      Note: PTYs are broken on darwin <6.  Use at your own risk.
  */
 
 #define HAVE_PTYS
 
+/**
+ * PTYs only work correctly on Darwin 7 or higher.  So make the
+ * default for process-connection-type dependent on the kernel
+ * version.
+ */
+#define MIN_PTY_KERNEL_VERSION '7' 
+
 /*
  *	Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate
  *      The 4.2 opendir, etc., library functions.
--- a/src/term.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/term.c	Thu Feb 03 23:28:36 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.
@@ -690,7 +690,7 @@
 		  if (! STRING_MULTIBYTE (string))
 		    string = string_to_multibyte (string);
 		  nbytes = buf - encode_terminal_buf;
-		  if (nbytes + SBYTES (string) < encode_terminal_bufsize)
+		  if (encode_terminal_bufsize < nbytes + SBYTES (string))
 		    {
 		      encode_terminal_bufsize = nbytes + SBYTES (string);
 		      encode_terminal_buf = xrealloc (encode_terminal_buf,
--- a/src/undo.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/undo.c	Thu Feb 03 23:28:36 2005 +0000
@@ -40,6 +40,10 @@
 
 Lisp_Object Qinhibit_read_only;
 
+/* Marker for function call undo list elements.  */
+
+Lisp_Object Qapply;
+
 /* The first time a command records something for undo.
    it also allocates the undo-boundary object
    which will be added to the list at the end of the command.
@@ -519,7 +523,7 @@
 		}
 	      else if (EQ (car, Qnil))
 		{
-		  /* Element (nil prop val beg . end) is property change.  */
+		  /* Element (nil PROP VAL BEG . END) is property change.  */
 		  Lisp_Object beg, end, prop, val;
 
 		  prop = Fcar (cdr);
@@ -543,6 +547,27 @@
 		  Fgoto_char (car);
 		  Fdelete_region (car, cdr);
 		}
+	      else if (EQ (car, Qapply))
+		{
+		  Lisp_Object oldlist = current_buffer->undo_list;
+		  /* Element (apply FUNNAME . ARGS) means call FUNNAME to undo.  */
+		  car = Fcar (cdr);
+		  if (INTEGERP (car))
+		    {
+		      /* Long format: (apply DELTA START END FUNNAME . ARGS).  */
+		      cdr = Fcdr (Fcdr (Fcdr (cdr)));
+		      car = Fcar (cdr);
+		    }
+		  cdr = Fcdr (cdr);
+		  apply1 (car, cdr);
+
+		  /* Make sure this produces at least one undo entry,
+		     so the test in `undo' for continuing an undo series
+		     will work right.  */
+		  if (EQ (oldlist, current_buffer->undo_list))
+		    current_buffer->undo_list
+		      = Fcons (list3 (Qapply, Qcdr, Qnil), current_buffer->undo_list);
+		}
 	      else if (STRINGP (car) && INTEGERP (cdr))
 		{
 		  /* Element (STRING . POS) means STRING was deleted.  */
@@ -589,13 +614,16 @@
   UNGCPRO;
   return unbind_to (count, list);
 }
-
+
 void
 syms_of_undo ()
 {
   Qinhibit_read_only = intern ("inhibit-read-only");
   staticpro (&Qinhibit_read_only);
 
+  Qapply = intern ("apply");
+  staticpro (&Qapply);
+
   pending_boundary = Qnil;
   staticpro (&pending_boundary);
 
@@ -627,17 +655,19 @@
   DEFVAR_LISP ("undo-outer-limit", &Vundo_outer_limit,
 	      doc: /* Outer limit on size of undo information for one command.
 At garbage collection time, if the current command has produced
-more than this much undo information, it asks you whether to delete
-the information.  This is a last-ditch limit to prevent memory overflow.
+more than this much undo information, it discards the info and displays
+a warning.  This is a last-ditch limit to prevent memory overflow.
 
-The size is counted as the number of bytes occupied,
-which includes both saved text and other data.
+The size is counted as the number of bytes occupied, which includes
+both saved text and other data.  A value of nil means no limit.  In
+this case, accumulating one huge undo entry could make Emacs crash as
+a result of memory overflow.
 
 In fact, this calls the function which is the value of
 `undo-outer-limit-function' with one argument, the size.
 The text above describes the behavior of the function
 that variable usually specifies.  */);
-  Vundo_outer_limit = make_number (300000);
+  Vundo_outer_limit = make_number (3000000);
 
   DEFVAR_LISP ("undo-outer-limit-function", &Vundo_outer_limit_function,
 	       doc: /* Function to call when an undo list exceeds `undo-outer-limit'.
--- a/src/w32bdf.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/w32bdf.c	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/w32fns.c	Thu Feb 03 23:28:36 2005 +0000
@@ -64,6 +64,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;
 
@@ -4544,7 +4545,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;
@@ -4592,6 +4593,24 @@
     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;
+      }
+
     charset = xlfd_charset_of_font (fontname);
 
   /* Cache the W32 codepage for a font.  This makes w32_encode_char
--- a/src/w32term.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/w32term.c	Thu Feb 03 23:28:36 2005 +0000
@@ -819,8 +819,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 *, int *));
 
 
@@ -957,7 +956,7 @@
 }
 
 
-static XCharStruct *
+XCharStruct *
 w32_per_char_metric (font, char2b, font_type)
      XFontStruct *font;
      wchar_t *char2b;
@@ -1922,15 +1921,9 @@
   struct glyph *last_glyph;
   RECT clip_rect;
 
-  last_x = window_box_right (s->w, s->area);
-  if (s->row->full_width_p
-      && !s->w->pseudo_window_p)
-    {
-      last_x += WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w);
-      if (s->area != RIGHT_MARGIN_AREA
-	  || WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
-	last_x += WINDOW_RIGHT_FRINGE_WIDTH (s->w);
-    }
+  last_x = ((s->row->full_width_p && !s->w->pseudo_window_p)
+	    ? WINDOW_RIGHT_EDGE_X (s->w)
+	    : window_box_right (s->w, s->area));
 
   /* The glyph that may have a right box line.  */
   last_glyph = (s->cmp || s->img
@@ -4944,7 +4937,7 @@
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   HDC hdc;
   RECT rect;
-  int wd, h;
+  int h;
   struct glyph *cursor_glyph;
   HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel);
 
@@ -4954,34 +4947,12 @@
   if (cursor_glyph == NULL)
     return;
 
-  /* Compute frame-relative coordinates from window-relative
-     coordinates.  */
+  /* Compute frame-relative coordinates for phys cursor.  */
   rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
-  rect.top = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y)
-              + row->ascent - w->phys_cursor_ascent);
-
-  /* Compute the proper height and ascent of the rectangle, based
-     on the actual glyph.  Using the full height of the row looks
-     bad when there are tall images on that row.  */
-  h = max (min (FRAME_LINE_HEIGHT (f), row->height),
-	   cursor_glyph->ascent + cursor_glyph->descent);
-  if (h < row->height)
-    rect.top += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h;
-  h--;
-
+  rect.top = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
   rect.bottom = rect.top + h;
-
-  /* Compute the width of the rectangle to draw.  If on a stretch
-     glyph, and `x-stretch-block-cursor' is nil, don't draw a
-     rectangle as wide as the glyph, but use a canonical character
-     width instead.  */
-  wd = cursor_glyph->pixel_width; /* TODO: Why off by one compared with X? */
-  if (cursor_glyph->type == STRETCH_GLYPH
-      && !x_stretch_cursor_p)
-    wd = min (FRAME_COLUMN_WIDTH (f), wd);
-  w->phys_cursor_width = wd;
-
-  rect.right = rect.left + wd;
+  rect.right = rect.left + w->phys_cursor_width;
+
   hdc = get_frame_dc (f);
   /* Set clipping, draw the rectangle, and reset clipping again.  */
   w32_clip_to_row (w, row, TEXT_AREA, hdc);
@@ -5290,7 +5261,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	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/window.c	Thu Feb 03 23:28:36 2005 +0000
@@ -126,6 +126,11 @@
 
 Lisp_Object Vtemp_buffer_show_function;
 
+/* Non-zero means line and page scrolling on tall lines (with images)
+   does partial scrolling by modifying window-vscroll.  */
+
+int auto_window_vscroll_p;
+
 /* Non-zero means to use mode-line-inactive face in all windows but the
    selected-window and the minibuffer-scroll-window when the
    minibuffer is active.  */
@@ -330,9 +335,10 @@
 POS defaults to point in WINDOW; WINDOW defaults to the selected window.
 
 If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
-return value is a list (X Y FULLY) where X and Y are the pixel coordinates
-relative to the top left corner of the window, and FULLY is t if the
-character after POS is fully visible and nil otherwise.  */)
+return value is a list (X Y PARTIAL) where X and Y are the pixel coordinates
+relative to the top left corner of the window. PARTIAL is nil if the character
+after POS is fully visible; otherwise it is a cons (RTOP . RBOT) where RTOP
+and RBOT are the number of pixels invisible at the top and bottom of the row.  */)
      (pos, window, partially)
      Lisp_Object pos, window, partially;
 {
@@ -341,7 +347,7 @@
   register struct buffer *buf;
   struct text_pos top;
   Lisp_Object in_window = Qnil;
-  int fully_p = 1;
+  int rtop, rbot, fully_p = 1;
   int x, y;
 
   w = decode_window (window);
@@ -364,14 +370,17 @@
       && posint <= BUF_ZV (buf)
       && CHARPOS (top) >= BUF_BEGV (buf)
       && CHARPOS (top) <= BUF_ZV (buf)
-      && pos_visible_p (w, posint, &fully_p, &x, &y, NILP (partially))
-      && (!NILP (partially) || fully_p))
+      && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, NILP (partially))
+      && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p)))
     in_window = Qt;
 
   if (!NILP (in_window) && !NILP (partially))
     in_window = Fcons (make_number (x),
 		       Fcons (make_number (y),
-			      Fcons (fully_p ? Qt : Qnil, Qnil)));
+			      Fcons ((fully_p ? Qnil
+				     : Fcons (make_number (rtop),
+					      make_number (rbot))),
+				     Qnil)));
   return in_window;
 }
 
@@ -4566,6 +4575,33 @@
 
       start = it.current.pos;
     }
+  else if (auto_window_vscroll_p)
+    {
+      if (tem = XCAR (XCDR (XCDR (tem))), CONSP (tem))
+	{
+	  int px;
+	  int dy = WINDOW_FRAME_LINE_HEIGHT (w);
+	  if (whole)
+	    dy = max ((window_box_height (w)
+		       - next_screen_context_lines * dy),
+		      dy);
+	  dy *= n;
+
+	  if (n < 0 && (px = XINT (XCAR (tem))) > 0)
+	    {
+	      px = max (0, -w->vscroll - min (px, -dy));
+	      Fset_window_vscroll (window, make_number (px), Qt);
+	      return;
+	    }
+	  if (n > 0 && (px = XINT (XCDR (tem))) > 0)
+	    {
+	      px = max (0, -w->vscroll + min (px, dy));
+	      Fset_window_vscroll (window, make_number (px), Qt);
+	      return;
+	    }
+	}
+      Fset_window_vscroll (window, make_number (0), Qt);
+    }
 
   /* If scroll_preserve_screen_position is non-nil, we try to set
      point in the same window line as it is now, so get that line.  */
@@ -4583,18 +4619,34 @@
   start_display (&it, w, start);
   if (whole)
     {
-      int screen_full = (window_box_height (w)
-			 - next_screen_context_lines * FRAME_LINE_HEIGHT (it.f));
-      int dy = n * screen_full;
+      int start_pos = IT_CHARPOS (it);
+      int dy = WINDOW_FRAME_LINE_HEIGHT (w);
+      dy = max ((window_box_height (w)
+		 - next_screen_context_lines * dy),
+		dy) * n;
 
       /* Note that move_it_vertically always moves the iterator to the
          start of a line.  So, if the last line doesn't have a newline,
 	 we would end up at the start of the line ending at ZV.  */
       if (dy <= 0)
-	move_it_vertically_backward (&it, -dy);
+	{
+	  move_it_vertically_backward (&it, -dy);
+	  /* Ensure we actually does move, e.g. in case we are currently
+	     looking at an image that is taller that the window height.  */
+	  while (start_pos == IT_CHARPOS (it)
+		 && start_pos > BEGV)
+	    move_it_by_lines (&it, -1, 1);
+	}
       else if (dy > 0)
-	move_it_to (&it, ZV, -1, it.current_y + dy, -1,
-		    MOVE_TO_POS | MOVE_TO_Y);
+	{
+	  move_it_to (&it, ZV, -1, it.current_y + dy, -1,
+		      MOVE_TO_POS | MOVE_TO_Y);
+	  /* Ensure we actually does move, e.g. in case we are currently
+	     looking at an image that is taller that the window height.  */
+	  while (start_pos == IT_CHARPOS (it)
+		 && start_pos < ZV)
+	    move_it_by_lines (&it, 1, 1);
+	}
     }
   else
     move_it_by_lines (&it, n, 1);
@@ -4690,7 +4742,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);
 
@@ -4730,9 +4783,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));
@@ -6331,13 +6389,16 @@
 		      : XFLOATINT (vscroll));
       w->vscroll = min (w->vscroll, 0);
 
-      /* Adjust glyph matrix of the frame if the virtual display
-	 area becomes larger than before.  */
-      if (w->vscroll < 0 && w->vscroll < old_dy)
-	adjust_glyphs (f);
-
-      /* Prevent redisplay shortcuts.  */
-      XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
+      if (w->vscroll != old_dy)
+	{
+	  /* Adjust glyph matrix of the frame if the virtual display
+	     area becomes larger than before.  */
+	  if (w->vscroll < 0 && w->vscroll < old_dy)
+	    adjust_glyphs (f);
+
+	  /* Prevent redisplay shortcuts.  */
+	  XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
+	}
     }
 
   return Fwindow_vscroll (window, pixels_p);
@@ -6649,6 +6710,10 @@
 	       doc: /* *Non-nil means `display-buffer' should make a separate frame.  */);
   pop_up_frames = 0;
 
+  DEFVAR_BOOL ("auto-window-vscroll", &auto_window_vscroll_p,
+	       doc: /* *Non-nil means to automatically adjust `window-vscroll' to view tall lines.  */);
+  auto_window_vscroll_p = 1;
+
   DEFVAR_BOOL ("display-buffer-reuse-frames", &display_buffer_reuse_frames,
 	       doc: /* *Non-nil means `display-buffer' should reuse frames.
 If the buffer in question is already displayed in a frame, raise that frame.  */);
--- a/src/xdisp.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/xdisp.c	Thu Feb 03 23:28:36 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.
 
@@ -318,6 +318,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;
 
@@ -345,7 +349,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.  */
@@ -1236,28 +1239,31 @@
 }
 
 
-/* Return 1 if position CHARPOS is visible in window W.  Set *FULLY to
-   1 if POS is visible and the line containing POS is fully visible.
+/* Return 1 if position CHARPOS is visible in window W.
+   If visible, set *X and *Y to pixel coordinates of top left corner.
+   Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS.
    EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line
    and header-lines heights.  */
 
 int
-pos_visible_p (w, charpos, fully, x, y, exact_mode_line_heights_p)
-     struct window *w;
-     int charpos, *fully, *x, *y, exact_mode_line_heights_p;
+pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
+     struct window *w;
+     int charpos, *x, *y, *rtop, *rbot, exact_mode_line_heights_p;
 {
   struct it it;
   struct text_pos top;
-  int visible_p;
+  int visible_p = 0;
   struct buffer *old_buffer = NULL;
 
+  if (noninteractive)
+    return visible_p;
+
   if (XBUFFER (w->buffer) != current_buffer)
     {
       old_buffer = current_buffer;
       set_buffer_internal_1 (XBUFFER (w->buffer));
     }
 
-  *fully = visible_p = 0;
   SET_TEXT_POS_FROM_MARKER (top, w->start);
 
   /* Compute exact mode line heights, if requested.  */
@@ -1282,20 +1288,22 @@
   if (IT_CHARPOS (it) >= charpos)
     {
       int top_y = it.current_y;
-      int bottom_y = line_bottom_y (&it);
+      int bottom_y = (last_height = 0, line_bottom_y (&it));
       int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w);
 
       if (top_y < window_top_y)
 	visible_p = bottom_y > window_top_y;
       else if (top_y < it.last_visible_y)
-	{
 	  visible_p = 1;
-	  *fully = bottom_y <= it.last_visible_y;
-	}
       if (visible_p && x)
 	{
 	  *x = it.current_x;
-	  *y = max (top_y + it.max_ascent - it.ascent, window_top_y);
+	  *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y);
+	  if (rtop)
+	    {
+	      *rtop = max (0, window_top_y - top_y);
+	      *rbot = max (0, bottom_y - it.last_visible_y);
+	    }
 	}
     }
   else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y)
@@ -1312,6 +1320,11 @@
 	      move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS);
 	      *x = it2.current_x;
 	      *y = it2.current_y + it2.max_ascent - it2.ascent;
+	      if (rtop)
+		{
+		  *rtop = 0;
+		  *rbot = max (0, (it2.current_y + it2.max_ascent + it2.max_descent) - it.last_visible_y);
+		}
 	    }
 	}
     }
@@ -1769,6 +1782,24 @@
       r.height = s->row->visible_height;
     }
 
+  if (s->clip_head)
+    if (r.x < s->clip_head->x)
+      {
+	if (r.width >= s->clip_head->x - r.x)
+	  r.width -= s->clip_head->x - r.x;
+	else
+	  r.width = 0;
+	r.x = s->clip_head->x;
+      }
+  if (s->clip_tail)
+    if (r.x + r.width > s->clip_tail->x + s->clip_tail->background_width)
+      {
+	if (s->clip_tail->x + s->clip_tail->background_width >= r.x)
+	  r.width = s->clip_tail->x + s->clip_tail->background_width - r.x;
+	else
+	  r.width = 0;
+      }
+
   /* If S draws overlapping rows, it's sufficient to use the top and
      bottom of the window for clipping because this glyph string
      intentionally draws over other lines.  */
@@ -1802,7 +1833,7 @@
   if (s->hl == DRAW_CURSOR)
     {
       struct glyph *glyph = s->first_glyph;
-      int height;
+      int height, max_y;
 
       if (s->x > r.x)
 	{
@@ -1811,13 +1842,26 @@
 	}
       r.width = min (r.width, glyph->pixel_width);
 
-      /* Don't draw cursor glyph taller than our actual glyph.  */
-      height = max (FRAME_LINE_HEIGHT (s->f), glyph->ascent + glyph->descent);
-      if (height < r.height)
-	{
-	  int max_y = r.y + r.height;
-	  r.y = min (max_y, s->ybase + glyph->descent - height);
-	  r.height = min (max_y - r.y, height);
+      /* If r.y is below window bottom, ensure that we still see a cursor.  */
+      height = min (glyph->ascent + glyph->descent,
+		    min (FRAME_LINE_HEIGHT (s->f), s->row->visible_height));
+      max_y = window_text_bottom_y (s->w) - height;
+      max_y = WINDOW_TO_FRAME_PIXEL_Y (s->w, max_y);
+      if (s->ybase - glyph->ascent > max_y)
+	{
+	  r.y = max_y;
+	  r.height = height;
+	}
+      else
+	{
+	  /* Don't draw cursor glyph taller than our actual glyph.  */
+	  height = max (FRAME_LINE_HEIGHT (s->f), glyph->ascent + glyph->descent);
+	  if (height < r.height)
+	    {
+	      max_y = r.y + r.height;
+	      r.y = min (max_y, max (r.y, s->ybase + glyph->descent - height));
+	      r.height = min (max_y - r.y, height);
+	    }
 	}
     }
 
@@ -1828,6 +1872,64 @@
 #endif
 }
 
+
+/* EXPORT:
+   Return the position and height of the phys cursor in window W.
+   Set w->phys_cursor_width to width of phys cursor.
+*/
+
+int
+get_phys_cursor_geometry (w, row, glyph, heightp)
+     struct window *w;
+     struct glyph_row *row;
+     struct glyph *glyph;
+     int *heightp;
+{
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+  int x, y, wd, h, h0, y0;
+
+  /* Compute the width of the rectangle to draw.  If on a stretch
+     glyph, and `x-stretch-block-cursor' is nil, don't draw a
+     rectangle as wide as the glyph, but use a canonical character
+     width instead.  */
+  wd = glyph->pixel_width - 1;
+#ifdef HAVE_NTGUI
+  wd++; /* Why? */
+#endif
+  if (glyph->type == STRETCH_GLYPH
+      && !x_stretch_cursor_p)
+    wd = min (FRAME_COLUMN_WIDTH (f), wd);
+  w->phys_cursor_width = wd;
+
+  y = w->phys_cursor.y + row->ascent - glyph->ascent;
+
+  /* If y is below window bottom, ensure that we still see a cursor.  */
+  h0 = min (FRAME_LINE_HEIGHT (f), row->visible_height);
+
+  h = max (h0, glyph->ascent + glyph->descent);
+  h0 = min (h0, glyph->ascent + glyph->descent);
+
+  y0 = WINDOW_HEADER_LINE_HEIGHT (w);
+  if (y < y0)
+    {
+      h = max (h - (y0 - y) + 1, h0);
+      y = y0 - 1;
+    }
+  else
+    {
+      y0 = window_text_bottom_y (w) - h0;
+      if (y > y0)
+	{
+	  h += y - y0;
+	  y = y0;
+	}
+    }
+
+  *heightp = h - 1;
+  return WINDOW_TO_FRAME_PIXEL_Y (w, y);
+}
+
+
 #endif /* HAVE_WINDOW_SYSTEM */
 
 
@@ -3261,11 +3363,13 @@
 
   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.  */
   it->saved_face_id = it->face_id;
   it->method = next_element_from_display_vector;
+  it->ellipsis_p = 1;
 }
 
 
@@ -4564,51 +4668,53 @@
 back_to_previous_visible_line_start (it)
      struct it *it;
 {
-  int visible_p = 0;
-
-  /* Go back one newline if not on BEGV already.  */
-  if (IT_CHARPOS (*it) > BEGV)
-    back_to_previous_line_start (it);
-
-  /* Move over lines that are invisible because of selective display
-     or text properties.  */
-  while (IT_CHARPOS (*it) > BEGV
-	 && !visible_p)
-    {
-      visible_p = 1;
+  while (IT_CHARPOS (*it) > BEGV)
+    {
+      back_to_previous_line_start (it);
+      if (IT_CHARPOS (*it) <= BEGV)
+	break;
 
       /* If selective > 0, then lines indented more than that values
 	 are invisible.  */
       if (it->selective > 0
 	  && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it),
 				(double) it->selective)) /* iftc */
-	visible_p = 0;
-      else
-	{
-	  Lisp_Object prop;
-
-	  /* Check the newline before point for invisibility.  */
-	  prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1),
+	continue;
+
+      /* Check the newline before point for invisibility.  */
+      {
+	Lisp_Object prop;
+	prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1),
 				     Qinvisible, it->window);
-	  if (TEXT_PROP_MEANS_INVISIBLE (prop))
-	    visible_p = 0;
-	}
-
-#if 0
-      /* Commenting this out fixes the bug described in
-	 http://www.math.ku.dk/~larsh/emacs/emacs-loops-on-large-images/test-case.txt.  */
-      if (visible_p)
-	{
-	  struct it it2 = *it;
-
-	  if (handle_display_prop (&it2) == HANDLED_RETURN)
-	    visible_p = 0;
-	}
-#endif
-
-      /* Back one more newline if the current one is invisible.  */
-      if (!visible_p)
-	back_to_previous_line_start (it);
+	if (TEXT_PROP_MEANS_INVISIBLE (prop))
+	  continue;
+      }
+
+      /* If newline has a display property that replaces the newline with something
+	 else (image or text), find start of overlay or interval and continue search
+	 from that point.  */
+      {
+	struct it it2 = *it;
+	int pos = IT_CHARPOS (*it);
+	int beg, end;
+	Lisp_Object val, overlay;
+
+	it2.sp = 0;
+	if (handle_display_prop (&it2) == HANDLED_RETURN
+	    && !NILP (val = get_char_property_and_overlay
+		      (make_number (pos), Qdisplay, Qnil, &overlay))
+	    && (OVERLAYP (overlay)
+		? (beg = OVERLAY_POSITION (OVERLAY_START (overlay)))
+		: get_property_and_range (pos, Qdisplay, &val, &beg, &end, Qnil)))
+	  {
+	    if (beg < BEGV)
+	      beg = BEGV;
+	    IT_CHARPOS (*it) = beg;
+	    IT_BYTEPOS (*it) = buf_charpos_to_bytepos (current_buffer, beg);
+	    continue;
+	  }
+      }
+      break;
     }
 
   xassert (IT_CHARPOS (*it) >= BEGV);
@@ -4906,8 +5012,10 @@
 		  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;
 		}
 	      else
 		{
@@ -4939,8 +5047,8 @@
 		       ? ((it->c >= 127
 			   && it->len == 1)
 			  || !CHAR_PRINTABLE_P (it->c)
-			  || it->c == 0x8ad
-			  || it->c == 0x8a0)
+			  || (!NILP (Vshow_nonbreak_escape)
+			      && (it->c == 0x8ad || it->c == 0x8a0)))
 		       : (it->c >= 127
 			  && (!unibyte_display_via_language_environment
 			      || it->c == unibyte_char_to_multibyte (it->c)))))
@@ -4952,21 +5060,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)
 		{
@@ -4974,57 +5069,78 @@
 		  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));
+		    {
+		      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
-		    g = FAST_MAKE_GLYPH ('^', face_id);
+		    {
+		      /* 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 = FAST_MAKE_GLYPH (it->c ^ 0100, face_id);
+		  g = it->c ^ 0100;
 		  XSETINT (it->ctl_chars[1], g);
 		  ctl_len = 2;
-		}
-	      else if (it->c == 0x8a0 || it->c == 0x8ad)
-		{
-		  /* 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 == 0x8ad ? '-' : ' ', face_id);
-		  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
 		{
-		  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 (SINGLE_BYTE_CHAR_P (it->c))
-		    str[0] = it->c, len = 1;
-		  else
-		    {
-		      len = CHAR_STRING_NO_SIGNAL (it->c, str);
-		      if (len < 0)
-			{
-			  /* 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);
+		  escape_glyph = '\\';
+		}
+
+	      if (it->c == 0x8a0 || it->c == 0x8ad)
+		{
+		  XSETINT (it->ctl_chars[0], escape_glyph);
+		  g = it->c == 0x8ad ? '-' : ' ';
+		  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 (SINGLE_BYTE_CHAR_P (it->c))
+		  str[0] = it->c, len = 1;
+		else
+		  {
+		    len = CHAR_STRING_NO_SIGNAL (it->c, str);
+		    if (len < 0)
+		      {
+			/* 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;
@@ -5033,31 +5149,31 @@
 			}
 		    }
 
-		  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;
 	      goto get_next;
 	    }
 	}
@@ -5180,9 +5296,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);
@@ -5191,6 +5304,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)
@@ -5270,7 +5386,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]);
@@ -5280,13 +5395,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
@@ -5699,10 +5815,11 @@
   saved_glyph_row = it->glyph_row;
   it->glyph_row = NULL;
 
-#define BUFFER_POS_REACHED_P()			    \
-  ((op & MOVE_TO_POS) != 0			    \
-   && BUFFERP (it->object)			    \
-   && IT_CHARPOS (*it) >= to_charpos)
+#define BUFFER_POS_REACHED_P()			\
+  ((op & MOVE_TO_POS) != 0			\
+   && BUFFERP (it->object)			\
+   && IT_CHARPOS (*it) >= to_charpos		\
+   && it->method == next_element_from_buffer)
 
   while (1)
     {
@@ -6364,11 +6481,15 @@
       it->current_y -= it2.current_y;
       it->current_x = it->hpos = 0;
 
-      /* If we moved too far, move IT some lines forward.  */
+      /* If we moved too far back, move IT some lines forward.  */
       if (it2.vpos > -dvpos)
 	{
 	  int delta = it2.vpos + dvpos;
+	  it2 = *it;
 	  move_it_to (it, -1, -1, -1, it->vpos + delta, MOVE_TO_VPOS);
+	  /* Move back again if we got too far ahead.  */
+	  if (IT_CHARPOS (*it) >= start_charpos)
+	    *it = it2;
 	}
     }
 }
@@ -7960,6 +8081,8 @@
 
   /* Last displayed message is now the current message.  */
   echo_area_buffer[1] = echo_area_buffer[0];
+  /* Inform read_char that we're not echoing.  */
+  echo_message_buffer = Qnil;
 
   /* Prevent redisplay optimization in redisplay_internal by resetting
      this_line_start_pos.  This is done because the mini-buffer now
@@ -10808,6 +10931,18 @@
       glyph = cursor;
       x = cursor_x;
     }
+  else if (row->ends_in_ellipsis_p && glyph == end)
+    {
+      /* Scan back over the ellipsis glyphs, decrementing positions.  */
+      while (glyph > row->glyphs[TEXT_AREA]
+	     && (glyph - 1)->charpos == last_pos)
+	glyph--, x -= glyph->pixel_width;
+      /* That loop always goes one position too far,
+	 including the glyph before the ellipsis.
+	 So scan forward over that one.  */
+      x += glyph->pixel_width;
+      glyph++;
+    }
   else if (string_start
 	   && (glyph == end || !BUFFERP (glyph->object) || last_pos > pt_old))
     {
@@ -11646,9 +11781,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);
@@ -12193,6 +12325,8 @@
       /* If centering point failed to make the whole line visible,
 	 put point at the top instead.  That has to make the whole line
 	 visible, if it can be done.  */
+      if (centering_position == 0)
+	goto done;
       clear_glyph_matrix (w->desired_matrix);
       centering_position = 0;
       goto point_at_top;
@@ -14614,10 +14748,22 @@
       /* If the row ends with a newline from a string, we don't want
 	 the cursor there (if the row is continued it doesn't end in a
 	 newline).  */
-      if (CHARPOS (row->end.string_pos) >= 0
-	  || MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))
+      if (CHARPOS (row->end.string_pos) >= 0)
 	cursor_row_p = row->continued_p;
-
+      else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))
+	{
+	  /* If the row ends in middle of a real character,
+	     and the line is continued, we want the cursor here.
+	     That's because MATRIX_ROW_END_CHARPOS would equal
+	     PT if PT is before the character.  */
+	  if (!row->ends_in_ellipsis_p)
+	    cursor_row_p = row->continued_p;
+	  else
+	  /* If the row ends in an ellipsis, then
+	     MATRIX_ROW_END_CHARPOS will equal point after the invisible text.
+	     We want that position to be displayed after the ellipsis.  */
+	    cursor_row_p = 0;
+	}
       /* If the row ends at ZV, display the cursor at the end of that
 	 row instead of at the start of the row below.  */
       else if (row->ends_at_zv_p)
@@ -15094,6 +15240,11 @@
   /* Remember the position at which this line ends.  */
   row->end = it->current;
 
+  /* Record whether this row ends inside an ellipsis.  */
+  row->ends_in_ellipsis_p
+    = (it->method == next_element_from_display_vector
+       && it->ellipsis_p);
+
   /* Save fringe bitmaps in this row.  */
   row->left_user_fringe_bitmap = it->left_user_fringe_bitmap;
   row->left_user_fringe_face_id = it->left_user_fringe_face_id;
@@ -15937,22 +16088,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;
@@ -15961,37 +16120,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.
@@ -16014,7 +16173,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);
@@ -18171,6 +18330,7 @@
 {
   struct glyph_string *head, *tail;
   struct glyph_string *s;
+  struct glyph_string *clip_head = NULL, *clip_tail = NULL;
   int last_x, area_width;
   int x_reached;
   int i, j;
@@ -18239,6 +18399,7 @@
 	  start = i;
 	  compute_overhangs_and_x (t, head->x, 1);
 	  prepend_glyph_string_lists (&head, &tail, h, t);
+	  clip_head = head;
 	}
 
       /* Prepend glyph strings for glyphs in front of the first glyph
@@ -18251,6 +18412,7 @@
       i = left_overwriting (head);
       if (i >= 0)
 	{
+	  clip_head = head;
 	  BUILD_GLYPH_STRINGS (i, start, h, t,
 			       DRAW_NORMAL_TEXT, dummy_x, last_x);
 	  for (s = h; s; s = s->next)
@@ -18270,6 +18432,7 @@
 			       DRAW_NORMAL_TEXT, x, last_x);
 	  compute_overhangs_and_x (h, tail->x + tail->width, 0);
 	  append_glyph_string_lists (&head, &tail, h, t);
+	  clip_tail = tail;
 	}
 
       /* Append glyph strings for glyphs following the last glyph
@@ -18280,6 +18443,7 @@
       i = right_overwriting (tail);
       if (i >= 0)
 	{
+	  clip_tail = tail;
 	  BUILD_GLYPH_STRINGS (end, i, h, t,
 			       DRAW_NORMAL_TEXT, x, last_x);
 	  for (s = h; s; s = s->next)
@@ -18287,6 +18451,12 @@
 	  compute_overhangs_and_x (h, tail->x + tail->width, 0);
 	  append_glyph_string_lists (&head, &tail, h, t);
 	}
+      if (clip_head || clip_tail)
+	for (s = head; s; s = s->next)
+	  {
+	    s->clip_head = clip_head;
+	    s->clip_tail = clip_tail;
+	  }
     }
 
   /* Draw all strings.  */
@@ -18300,8 +18470,9 @@
 	 completely. */
       && !overlaps_p)
     {
-      int x0 = head ? head->x : x;
-      int x1 = tail ? tail->x + tail->background_width : x;
+      int x0 = clip_head ? clip_head->x : (head ? head->x : x);
+      int x1 = (clip_tail ? clip_tail->x + clip_tail->background_width
+		: (tail ? tail->x + tail->background_width : x));
 
       int text_left = window_box_left (w, TEXT_AREA);
       x0 -= text_left;
@@ -20553,6 +20724,28 @@
       past_end = 1;
     }
 
+  /* If whole rows or last part of a row came from a display overlay,
+     row_containing_pos will skip over such rows because their end pos
+     equals the start pos of the overlay or interval.  Backtrack if we
+     have a STOP object and previous row's end glyph came from STOP.  */
+  if (!NILP (stop))
+    {
+      struct glyph_row *prev = row-1;
+      while ((prev = row - 1, prev >= first)
+	     && MATRIX_ROW_END_CHARPOS (prev) == charpos
+	     && prev->used[TEXT_AREA] > 0)
+	{
+	  end = prev->glyphs[TEXT_AREA];
+	  glyph = end + prev->used[TEXT_AREA];
+	  while (--glyph >= end
+		 && INTEGERP (glyph->object));
+	  if (glyph >= end
+	      && !EQ (stop, glyph->object))
+	    break;
+	  row = prev;
+	}
+    }
+
   *x = row->x;
   *y = row->y;
   *vpos = MATRIX_ROW_VPOS (row, w->current_matrix);
@@ -21013,9 +21206,9 @@
 		  help_echo_pos = charpos;
 		}
 	    }
-	  if (NILP (pointer))
-	    pointer = Fsafe_plist_get (XCDR (object), QCpointer);
-	}
+	}
+      if (NILP (pointer))
+	pointer = Fsafe_plist_get (XCDR (object), QCpointer);
     }
 
   if (STRINGP (string))
@@ -22319,6 +22512,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	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/xfaces.c	Thu Feb 03 23:28:36 2005 +0000
@@ -7696,6 +7696,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/xfns.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/xfns.c	Thu Feb 03 23:28:36 2005 +0000
@@ -4358,11 +4358,15 @@
 		    {
 		      unsigned long mask = CWCursor;
 		      XSetWindowAttributes attrs;
-
+#ifdef USE_GTK
+                      Window parent = FRAME_X_WINDOW (f);
+#else
+                      Window parent = FRAME_OUTER_WINDOW (f);
+#endif
 		      attrs.cursor = f->output_data.x->hourglass_cursor;
 
 		      f->output_data.x->hourglass_window
-			= XCreateWindow (dpy, FRAME_OUTER_WINDOW (f),
+			= XCreateWindow (dpy, parent,
 					 0, 0, 32000, 32000, 0, 0,
 					 InputOnly,
 					 CopyFromParent,
--- a/src/xmenu.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/xmenu.c	Thu Feb 03 23:28:36 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	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/xselect.c	Thu Feb 03 23:28:36 2005 +0000
@@ -1400,7 +1400,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");
     }
@@ -2500,7 +2500,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.  */
 
@@ -2524,7 +2524,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))
@@ -2629,7 +2629,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
@@ -2761,7 +2761,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.c	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/xterm.c	Thu Feb 03 23:28:36 2005 +0000
@@ -1,6 +1,6 @@
 /* X Communication module for terminals which understand the X protocol.
-   Copyright (C) 1989, 93, 94, 95, 96, 97, 98, 1999, 2000,01,02,03,04
-   Free Software Foundation, Inc.
+   Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+     2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -2129,15 +2129,9 @@
   struct glyph *last_glyph;
   XRectangle clip_rect;
 
-  last_x = window_box_right (s->w, s->area);
-  if (s->row->full_width_p
-      && !s->w->pseudo_window_p)
-    {
-      last_x += WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w);
-      if (s->area != RIGHT_MARGIN_AREA
-	  || WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
-	last_x += WINDOW_RIGHT_FRINGE_WIDTH (s->w);
-    }
+  last_x = ((s->row->full_width_p && !s->w->pseudo_window_p)
+	    ? WINDOW_RIGHT_EDGE_X (s->w)
+	    : window_box_right (s->w, s->area));
 
   /* The glyph that may have a right box line.  */
   last_glyph = (s->cmp || s->img
@@ -4332,7 +4326,7 @@
     }
 
   if (part >= 0)
-    { 
+    {
       window_being_scrolled = bar->window;
       last_scroll_bar_part = part;
       x_send_scroll_bar_event (bar->window, part, portion, whole);
@@ -7159,7 +7153,7 @@
   window_box (w, area, &window_x, &window_y, &window_width, 0);
 
   clip_rect.x = window_x;
-  clip_rect.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
+  clip_rect.y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, row->y));
   clip_rect.y = max (clip_rect.y, window_y);
   clip_rect.width = window_width;
   clip_rect.height = row->visible_height;
@@ -7189,29 +7183,10 @@
   if (cursor_glyph == NULL)
     return;
 
-  /* Compute the width of the rectangle to draw.  If on a stretch
-     glyph, and `x-stretch-block-cursor' is nil, don't draw a
-     rectangle as wide as the glyph, but use a canonical character
-     width instead.  */
-  wd = cursor_glyph->pixel_width - 1;
-  if (cursor_glyph->type == STRETCH_GLYPH
-      && !x_stretch_cursor_p)
-    wd = min (FRAME_COLUMN_WIDTH (f), wd);
-  w->phys_cursor_width = wd;
-
-  /* Compute frame-relative coordinates from window-relative
-     coordinates.  */
+  /* Compute frame-relative coordinates for phys cursor.  */
   x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
-  y = WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y);
-
-  /* Compute the proper height and ascent of the rectangle, based
-     on the actual glyph.  Using the full height of the row looks
-     bad when there are tall images on that row.  */
-  h = max (min (FRAME_LINE_HEIGHT (f), row->height),
-	   cursor_glyph->ascent + cursor_glyph->descent);
-  if (h < row->height)
-    y += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h;
-  h--;
+  y = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
+  wd = w->phys_cursor_width;
 
   /* The foreground of cursor_gc is typically the same as the normal
      background color, which can cause the cursor box to be invisible.  */
@@ -7779,27 +7754,9 @@
   error ("%s", error_msg);
 }
 
-
-/* This is the usual handler for X protocol errors.
-   It kills all frames on the display that we got the error for.
-   If that was the only one, it prints an error message and kills Emacs.  */
-
-static void
-x_error_quitter (display, error)
-     Display *display;
-     XErrorEvent *error;
-{
-  char buf[256], buf1[356];
-
-  /* Note that there is no real way portable across R3/R4 to get the
-     original error handler.  */
-
-  XGetErrorText (display, error->error_code, buf, sizeof (buf));
-  sprintf (buf1, "X protocol error: %s on protocol request %d",
-	   buf, error->request_code);
-  x_connection_closed (display, buf1);
-}
-
+/* We specifically use it before defining it, so that gcc doesn't inline it,
+   otherwise gdb doesn't know how to properly put a breakpoint on it.  */
+static void x_error_quitter (Display *display, XErrorEvent *error);
 
 /* This is the first-level handler for X protocol errors.
    It calls x_error_quitter or x_error_catcher.  */
@@ -7816,6 +7773,38 @@
   return 0;
 }
 
+/* This is the usual handler for X protocol errors.
+   It kills all frames on the display that we got the error for.
+   If that was the only one, it prints an error message and kills Emacs.  */
+
+/* .gdbinit puts a breakpoint here, so make sure it is not inlined.  */
+
+#if __GNUC__ >= 3  /* On GCC 3.0 we might get a warning.  */
+#define NO_INLINE __attribute__((noinline))
+#else
+#define NO_INLINE
+#endif
+
+/* On older GCC versions, just putting x_error_quitter
+   after x_error_handler prevents inlining into the former.  */
+
+static void NO_INLINE
+x_error_quitter (display, error)
+     Display *display;
+     XErrorEvent *error;
+{
+  char buf[256], buf1[356];
+
+  /* Note that there is no real way portable across R3/R4 to get the
+     original error handler.  */
+
+  XGetErrorText (display, error->error_code, buf, sizeof (buf));
+  sprintf (buf1, "X protocol error: %s on protocol request %d",
+	   buf, error->request_code);
+  x_connection_closed (display, buf1);
+}
+
+
 /* This is the handler for X IO errors, always.
    It kills all frames on the display that we lost touch with.
    If that was the only one, it prints an error message and kills Emacs.  */
--- a/src/xterm.h	Thu Feb 03 22:58:27 2005 +0000
+++ b/src/xterm.h	Thu Feb 03 23:28:36 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;